2025-03-20 10:46:42 +08:00

2 lines
6.5 KiB
JavaScript

import{L as O,M as Q,N as Z,O as H,B as J,C as W,w as X,D as Y,p as ee,q as te,r as oe}from"./element-plus.2acb577d.js";import{_ as ne}from"./index.vue_vue_type_script_setup_true_lang.a280d02d.js";import{k as ae,f as k,b as le}from"./index.81df6f20.js";import{d as $,Z as h,r as ue,ah as re,am as se,o as u,c as C,U as t,L as o,u as n,aa as P,R as s,M as i,K as d,a as b,i as ie,Q as me}from"./@vue.821a47ec.js";import{b as de,c as pe,d as _e,e as ce,s as fe}from"./code.330bf478.js";import{u as Fe}from"./usePaging.23706826.js";import{_ as ge}from"./data-table.vue_vue_type_script_setup_true_lang.a8cf5d65.js";import{_ as Ce}from"./code-preview.vue_vue_type_script_setup_true_lang.3026666b.js";import"./lodash-es.df44a280.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.81e2759c.js";import"./@element-plus.dabbc398.js";import"./dayjs.d2a77ee0.js";import"./axios.9e996410.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./lodash.6bfd3540.js";import"./vue-router.4c04f9b6.js";import"./pinia.fefed778.js";import"./css-color-function.8ff67959.js";import"./color.bfa08e9a.js";import"./clone.660f80c4.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./ms.564e106c.js";import"./nprogress.dcb32030.js";import"./vue-clipboard3.e681583f.js";import"./clipboard.3ad9b20b.js";import"./echarts.42bea269.js";import"./tslib.60310f1a.js";import"./zrender.2cb48b70.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.8864a4be.js";import"./index.f292cd50.js";const be={class:"code-generation"},we={class:"flex"},ye={class:"mt-4"},Ee={class:"flex items-center"},ve={class:"flex justify-end mt-4"},ke=$({name:"codeGenerate"}),it=$({...ke,setup(Be){const p=h({table_name:"",table_comment:""}),_=h({show:!1,loading:!1,code:[]}),{pager:f,getLists:g,resetParams:K,resetPage:w}=Fe({fetchFun:ce,params:p}),F=ue([]),S=a=>{F.value=a.map(({id:e})=>e)},T=async a=>{await k.confirm("\u786E\u5B9A\u8981\u540C\u6B65\u8868\u7ED3\u6784\uFF1F"),await fe({id:a})},B=async a=>{await k.confirm("\u786E\u5B9A\u8981\u5220\u9664\uFF1F"),await de({id:a}),g()},N=async a=>{const e=await pe({id:a});_.code=e,_.show=!0},U=a=>a.some(e=>e.generate_type==1),D=async a=>{if(U(a))return k.msgError("\u751F\u6210\u65B9\u5F0F\u4E3A\u751F\u6210\u5230\u6A21\u5757\uFF0C\u8BF7\u5728\u524D\u7AEF\u5F00\u53D1\u6A21\u5F0F\u4E0B\u4F7F\u7528\uFF0C\u8BE6\u7EC6\u53C2\u8003\u6587\u6863");const e=await _e({id:a});e.file&&window.open(e.file,"_blank")},I=(a,e)=>{switch(a){case"generate":D([e.id]);break;case"sync":T(e.id);break;case"delete":B(e.id)}};return g(),(a,e)=>{const V=J,y=W,r=X,L=Y,x=O,E=le,c=Q,M=re("router-link"),v=ee,G=te,R=oe,q=Z,z=ne,m=se("perms"),j=H;return u(),C("div",be,[t(x,{class:"!border-none",shadow:"never"},{default:o(()=>[t(L,{class:"mb-[-16px]",model:n(p),inline:""},{default:o(()=>[t(y,{label:"\u8868\u540D\u79F0"},{default:o(()=>[t(V,{class:"w-[280px]",modelValue:n(p).table_name,"onUpdate:modelValue":e[0]||(e[0]=l=>n(p).table_name=l),clearable:"",onKeyup:P(n(w),["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),t(y,{label:"\u8868\u63CF\u8FF0"},{default:o(()=>[t(V,{class:"w-[280px]",modelValue:n(p).table_comment,"onUpdate:modelValue":e[1]||(e[1]=l=>n(p).table_comment=l),clearable:"",onKeyup:P(n(w),["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),t(y,null,{default:o(()=>[t(r,{type:"primary",onClick:n(w)},{default:o(()=>e[6]||(e[6]=[s("\u67E5\u8BE2")])),_:1},8,["onClick"]),t(r,{onClick:n(K)},{default:o(()=>e[7]||(e[7]=[s("\u91CD\u7F6E")])),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"])]),_:1}),i((u(),d(x,{class:"!border-none mt-4",shadow:"never"},{default:o(()=>[b("div",we,[i((u(),d(ge,{class:"inline-block mr-[10px]",onSuccess:n(g)},{default:o(()=>[t(r,{type:"primary"},{icon:o(()=>[t(E,{name:"el-icon-Plus"})]),default:o(()=>[e[8]||(e[8]=s(" \u5BFC\u5165\u6570\u636E\u8868 "))]),_:1})]),_:1},8,["onSuccess"])),[[m,["tools.generator/selectTable"]]]),i((u(),d(r,{disabled:!n(F).length,onClick:e[2]||(e[2]=l=>B(n(F))),type:"danger"},{icon:o(()=>[t(E,{name:"el-icon-Delete"})]),default:o(()=>[e[9]||(e[9]=s(" \u5220\u9664 "))]),_:1},8,["disabled"])),[[m,["tools.generator/delete"]]]),i((u(),d(r,{disabled:!n(F).length,onClick:e[3]||(e[3]=l=>D(n(F)))},{default:o(()=>e[10]||(e[10]=[s(" \u751F\u6210\u4EE3\u7801 ")])),_:1},8,["disabled"])),[[m,["tools.generator/generate"]]])]),b("div",ye,[t(q,{data:n(f).lists,size:"large",onSelectionChange:S},{default:o(()=>[t(c,{type:"selection",width:"55"}),t(c,{label:"\u8868\u540D\u79F0",prop:"table_name","min-width":"180"}),t(c,{label:"\u8868\u63CF\u8FF0",prop:"table_comment","min-width":"180"}),t(c,{label:"\u521B\u5EFA\u65F6\u95F4",prop:"create_time","min-width":"180"}),t(c,{label:"\u66F4\u65B0\u65F6\u95F4",prop:"update_time","min-width":"180"}),t(c,{label:"\u64CD\u4F5C",width:"160",fixed:"right"},{default:o(({row:l})=>[b("div",Ee,[i((u(),d(r,{type:"primary",link:"",onClick:A=>N(l.id)},{default:o(()=>e[11]||(e[11]=[s(" \u9884\u89C8 ")])),_:2},1032,["onClick"])),[[m,["tools.generator/preview"]]]),t(r,{type:"primary",link:""},{default:o(()=>[i((u(),d(M,{to:{path:n(ae)("tools.generator/edit"),query:{id:l.id}}},{default:o(()=>e[12]||(e[12]=[s(" \u7F16\u8F91 ")])),_:2},1032,["to"])),[[m,["tools.generator/edit"]]])]),_:2},1024),i((u(),d(R,{class:"ml-2",onCommand:A=>I(A,l)},{dropdown:o(()=>[t(G,null,{default:o(()=>[i((u(),C("div",null,[t(v,{command:"generate"},{default:o(()=>[t(r,{type:"primary",link:""},{default:o(()=>e[14]||(e[14]=[s(" \u751F\u6210\u4EE3\u7801 ")])),_:1})]),_:1})])),[[m,["tools.generator/generate"]]]),i((u(),C("div",null,[t(v,{command:"sync"},{default:o(()=>[t(r,{type:"primary",link:""},{default:o(()=>e[15]||(e[15]=[s(" \u540C\u6B65 ")])),_:1})]),_:1})])),[[m,["tools.generator/syncColumn"]]]),i((u(),C("div",null,[t(v,{command:"delete"},{default:o(()=>[t(r,{type:"danger",link:""},{default:o(()=>e[16]||(e[16]=[s(" \u5220\u9664 ")])),_:1})]),_:1})])),[[m,["tools.generator/delete"]]])]),_:1})]),default:o(()=>[t(r,{type:"primary",link:""},{default:o(()=>[e[13]||(e[13]=s(" \u66F4\u591A ")),t(E,{name:"el-icon-ArrowDown",size:14})]),_:1})]),_:2},1032,["onCommand"])),[[m,["tools.generator/generate","tools.generator/syncColumn","tools.generator/delete"]]])])]),_:1})]),_:1},8,["data"])]),b("div",ve,[t(z,{modelValue:n(f),"onUpdate:modelValue":e[4]||(e[4]=l=>ie(f)?f.value=l:null),onChange:n(g)},null,8,["modelValue","onChange"])])]),_:1})),[[j,n(f).loading]]),n(_).show?(u(),d(Ce,{key:0,modelValue:n(_).show,"onUpdate:modelValue":e[5]||(e[5]=l=>n(_).show=l),code:n(_).code},null,8,["modelValue","code"])):me("",!0)])}}});export{it as default};