2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
import{d as ue,O as me,f as fe,r as u,n as he,v as xe,a1 as S,h as m,c as j,e as a,w as e,a as s,t as c,u as n,N as t,i as f,F as ve,G as ge,I as y,y as M,B as be,a8 as q,a4 as ye,R as ke,E as we,al as Ce,am as Ee,aD as Te,as as Fe,aF as Ve,X as De,W as Ne,Y as Se,$ as Pe,ah as Be,aj as Ae,at as $e,aE as je,a2 as Le,aC as Ie,ap as Ge,aa as ze,a0 as Oe,p as Re,g as Ue,_ as Me}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css */import"./el-form-item-4ed993c7.js";/* empty css *//* empty css */import{s as qe,g as Ke,t as We,q as Xe,r as Ye,u as He}from"./tools-123d2a10.js";import{_ as Je}from"./add-table.vue_vue_type_script_setup_true_lang-ff6a0016.js";const h=C=>(Re("data-v-3baec969"),C=C(),Ue(),C),Qe={class:"main-container"},Ze={class:"flex justify-between items-center mb-[10px]"},et={class:"text-[20px]"},tt=h(()=>s("div",{class:"w-[24px] h-[24px] text-[#fff] bg-[#778aa3] text-center leading-[24px] rounded-full"}," 1",-1)),at={class:"text-[14px] text-[#303133] font-[700]"},lt={class:"text-[#999]"},nt={class:"mt-[20px] mb-[40px] h-[32px]"},ot=h(()=>s("div",{class:"w-[24px] h-[24px] text-[#fff] bg-[#778aa3] text-center leading-[24px] rounded-full"}," 2",-1)),st={class:"text-[14px] text-[#303133] font-[700]"},it={class:"text-[#999]"},dt=h(()=>s("div",{class:"mt-[20px] mb-[40px] h-[32px]"},null,-1)),ct=h(()=>s("div",{class:"w-[24px] h-[24px] text-[#fff] bg-[#778aa3] text-center leading-[24px] rounded-full"}," 3",-1)),rt={class:"text-[14px] text-[#303133] font-[700]"},pt={class:"text-[#999]"},_t=h(()=>s("div",{class:"mt-[20px] mb-[40px] h-[32px]"},null,-1)),ut=h(()=>s("div",{class:"w-[24px] h-[24px] text-[#fff] bg-[#778aa3] text-center leading-[24px] rounded-full"}," 4",-1)),mt={class:"text-[14px] text-[#303133] font-[700]"},ft={class:"text-[#999]"},ht=h(()=>s("div",{class:"mt-[20px] mb-[40px] h-[32px]"},null,-1)),xt=h(()=>s("div",{class:"w-[24px] h-[24px] text-[#fff] bg-[#778aa3] text-center leading-[24px] rounded-full"}," 5",-1)),vt={class:"text-[14px] text-[#303133] font-[700]"},gt={class:"text-[#999]"},bt=h(()=>s("div",{class:"mt-[20px] mb-[40px] h-[32px]"},null,-1)),yt={class:"mt-[16px] flex justify-end"},kt={class:"flex h-[50vh]"},wt={class:"flex items-center"},Ct={class:"pl-[5px]"},Et={class:"ml-[20px]",style:{width:"calc(100% - 285px)"}},Tt=ue({__name:"index",setup(C){const K=me().meta.title,W=fe(),P=u("codeGeneration"),i=he({page:1,limit:10,total:0,loading:!0,data:[],searchParam:{table_name:"",table_content:"",addon_name:""}}),L=u(),X=d=>{d&&(d.resetFields(),v())};xe(()=>{window.codeActiveName&&(P.value=window.codeActiveName+"",window.codeActiveName=null),v()});const v=(d=1)=>{i.loading=!0,i.page=d,qe({page:i.page,limit:i.limit,...i.searchParam}).then(l=>{i.loading=!1,i.data=l.data.data,i.total=l.data.total}).catch(()=>{i.loading=!1})},I=u([]),Y=d=>{Ke({search:d}).then(l=>{I.value=l.data})},B=u(null),H=()=>{B.value.setFormData(),B.value.showDialog=!0},J=d=>{q.confirm(t("codeDeleteTips"),t("warning"),{confirmButtonText:t("confirm"),cancelButtonText:t("cancel"),type:"warning"}).then(()=>{We(d).then(()=>{v()}).catch(()=>{})})},Q=d=>{W.push("/tools/code/edit?id="+d.id)},Z=d=>{Xe({id:d}).then(l=>{i.loading=!1,q.confirm(l.msg!="2"?t("saveAndSyncText"):t("saveAndSyncText1"),t("warning"),{confirmButtonText:t("confirm"),cancelButtonText:t("cancel")}).then(()=>{G(d,3)}).catch(()=>{})}).catch(()=>{i.loading=!1})},G=(d,l)=>{i.loading=!0,Ye({id:d,generate_type:l}).then(r=>{ye({type:"success",message:"操作成功"}),l!=3?(i.loading=!1,window.open(ke(r.data.file),"_blank")):v()}).catch(()=>{i.loading=!1})},A=u([]),$=u(!1),E=u([]),T=u(!1),F=u(""),V=u(""),ee=d=>{$.value=!0,T.value=!0,F.value="",E.value=[],V.value="",He(d).then(l=>{A.value=l.data,E.value=ae(l.data.map(r=>r.file_dir+r.name)),F.value=A.value[0].content,T.value=!1}).catch(()=>{T.value=!1})},te=d=>{A.value.forEach(l=>{d.path===l.file_dir+l.name&&(F.value=l.content)})},ae=d=>{const l=[];if(Array.isArray(d))for(let _=0;_<d.length;++_){const D=d[_].split("/");let g=l;for(let x=0;x<D.length;++x){const k=D[x];let p=null;for(var r=0;r<g.length;++r){const N=g[r];if(N.name===k){p=N;break}}p||(p={name:k,path:k.indexOf(".")<0?"":d[_],key:"k"+_+x+r},k.indexOf(".")<0&&(p.children=[]),p.path===d[0]&&(V.value=p.key),g.push(p)),p.children&&(g=p.children)}}return l};return(d,l)=>{const r=we,_=Ce,D=Ee,g=Te,x=Fe,k=Ve,p=De,N=Ne,le=Se,z=Pe,w=Be,ne=Ae,oe=$e,se=je,ie=S("Folder"),de=S("FolderOpened"),O=Le,ce=S("Document"),re=Ie,R=Ge,pe=S("highlightjs"),_e=ze,U=Oe;return m(),j("div",Qe,[a(z,{class:"box-card !border-none",shadow:"never"},{default:e(()=>[s("div",Ze,[s("span",et,c(n(K)),1)]),a(se,{modelValue:P.value,"onUpdate:modelValue":l[7]||(l[7]=o=>P.value=o),class:"demo-tabs"},{default:e(()=>[a(g,{label:n(t)("codeGeneration"),name:"codeGeneration"},{default:e(()=>[a(D,{direction:"vertical"},{default:e(()=>[a(_,null,{icon:e(()=>[tt]),title:e(()=>[s("p",at,c(n(t)("step1")),1)]),description:e(()=>[s("span",lt,c(n(t)("describe1")),1),s("div",nt,[a(r,{type:"primary",class:"w-[100px]",onClick:H},{default:e(()=>[f(c(n(t)("btn1")),1)]),_:1})])]),_:1}),a(_,null,{icon:e(()=>[ot]),title:e(()=>[s("p",st,c(n(t)("step2")),1)]),description:e(()=>[s("span",it,c(n(t)("describe2")),1),dt]),_:1}),a(_,null,{icon:e(()=>[ct]),title:e(()=>[s("p",rt,c(n(t)("step3")),1)]),description:e(()=>[s("span",pt,c(n(t)("describe3")),1),_t]),_:1}),a(_,null,{icon:e(()=>[ut]),title:e(()=>[s("p",mt,c(n(t)("step4")),1)]),description:e(()=>[s("span",ft,c(n(t)("describe4")),1),ht]),_:1}),a(_,null,{icon:e(()=>[xt]),title:e(()=>[s("p",vt,c(n(t)("step5")),1)]),description:e(()=>[s("span",gt,c(n(t)("describe5")),1),bt]),_:1})]),_:1})]),_:1},8,["label"]),a(g,{label:n(t)("codeList"),name:"codeList"},{default:e(()=>[a(z,{class:"box-card !border-none my-[10px] table-search-wrap",shadow:"never"},{default:e(()=>[a(le,{inline:!0,model:i.searchParam,ref_key:"searchFormRef",ref:L},{default:e(()=>[a(p,{label:n(t)("addonName"),prop:"addon_name"},{default:e(()=>[a(k,{modelValue:i.searchParam.addon_name,"onUpdate:modelValue":l[0]||(l[0]=o=>i.searchParam.addon_name=o),placeholder:"Select",filterable:"",remote:"",clearable:"","remote-method":Y},{default:e(()=>[a(x,{label:"全部",value:""}),a(x,{label:"系统",value:"2"}),(m(!0),j(ve,null,ge(I.value,o=>(m(),y(x,{label:o.title,value:o.key,key:o.key},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(p,{label:n(t)("tableName"),prop:"table_name"},{default:e(()=>[a(N,{modelValue:i.searchParam.table_name,"onUpdate:modelValue":l[1]||(l[1]=o=>i.searchParam.table_name=o),placeholder:n(t)("tableNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(p,null,{default:e(()=>[a(r,{type:"primary",onClick:l[2]||(l[2]=o=>v())},{default:e(()=>[f(c(n(t)("search")),1)]),_:1}),a(r,{onClick:l[3]||(l[3]=o=>X(L.value))},{default:e(()=>[f(c(n(t)("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),s("div",null,[M((m(),y(ne,{data:i.data,size:"large"},{empty:e(()=>[s("span",null,c(i.loading?"":n(t)("emptyData")),1)]),default:e(()=>[a(w,{prop:"table_name","show-overflow-tooltip":!0,label:n(t)("tableName"),"min-width":"120"},null,8,["label"]),a(w,{prop:"title","show-overflow-tooltip":!0,label:n(t)("addonName"),"min-width":"120"},null,8,["label"]),a(w,{prop:"table_content","show-overflow-tooltip":!0,label:n(t)("tableContent"),"min-width":"120"},null,8,["label"]),a(w,{prop:"edit_type",label:n(t)("editType"),"min-width":"150",align:"center"},{default:e(({row:o})=>[f(c(o.edit_type==1?n(t)("popup"):n(t)("page")),1)]),_:1},8,["label"]),a(w,{label:n(t)("createTime"),"min-width":"180",align:"center"},{default:e(({row:o})=>[f(c(o.create_time||""),1)]),_:1},8,["label"]),a(w,{label:n(t)("operation"),fixed:"right",align:"right",width:"330"},{default:e(({row:o})=>[a(r,{type:"primary",link:"",onClick:b=>Q(o)},{default:e(()=>[f(c(n(t)("edit")),1)]),_:2},1032,["onClick"]),a(r,{type:"primary",link:"",onClick:b=>ee(o.id)},{default:e(()=>[f(c(n(t)("preview")),1)]),_:2},1032,["onClick"]),a(r,{type:"primary",link:"",onClick:b=>Z(o.id)},{default:e(()=>[f(c(n(t)("saveAndSync")),1)]),_:2},1032,["onClick"]),a(r,{type:"primary",link:"",onClick:b=>G(o.id,2)},{default:e(()=>[f(c(n(t)("download")),1)]),_:2},1032,["onClick"]),a(r,{type:"primary",link:"",onClick:b=>J(o.id)},{default:e(()=>[f(c(n(t)("delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"])),[[U,i.loading]]),s("div",yt,[a(oe,{"current-page":i.page,"onUpdate:current-page":l[4]||(l[4]=o=>i.page=o),"page-size":i.limit,"onUpdate:page-size":l[5]||(l[5]=o=>i.limit=o),layout:"total, sizes, prev, pager, next, jumper",total:i.total,onSizeChange:l[6]||(l[6]=o=>v()),onCurrentChange:v},null,8,["current-page","page-size","total"])])])]),_:1},8,["label"])]),_:1},8,["modelValue"]),a(Je,{ref_key:"addCodeDialog",ref:B},null,512),a(_e,{modelValue:$.value,"onUpdate:modelValue":l[8]||(l[8]=o=>$.value=o),class:"dialog-visible",width:"70%",title:"代码预览"},{default:e(()=>[M((m(),j("div",kt,[a(R,{class:"h-[100%] w-[270px]"},{default:e(()=>[E.value.length&&V.value!=""?(m(),y(re,{key:0,data:E.value,props:{label:"name",value:"key"},"node-key":"key","current-node-key":V.value,"expand-on-click-node":!1,"highlight-current":"","default-expand-all":"",ref:"treeRef",onNodeClick:te},{default:e(({node:o,data:b})=>[s("div",wt,[b.children?(m(),y(O,{key:0},{default:e(()=>[o.expanded?(m(),y(de,{key:1})):(m(),y(ie,{key:0}))]),_:2},1024)):(m(),y(O,{key:1},{default:e(()=>[a(ce)]),_:1})),s("span",Ct,c(b.name),1)])]),_:1},8,["data","current-node-key"])):be("",!0)]),_:1}),s("div",Et,[a(R,{class:"h-[100%] w-[100%]"},{default:e(()=>[a(pe,{autodetect:"",class:"h-[100%]",code:F.value},null,8,["code"])]),_:1})])])),[[U,T.value]])]),_:1},8,["modelValue"])]),_:1})])}}});const Jt=Me(Tt,[["__scopeId","data-v-3baec969"]]);export{Jt as default};
|