import{_ as oe}from"./index.ae0c2c3e.js";import{P as ne,I as de,B as me,C as se,x as re,L as ie,F as _e,Q as pe,R as ce,M as Fe,G as be,H as fe,Z as Ve,w as Be,y as Ee,D as ve}from"./element-plus.f958bb38.js";import{_ as ye}from"./index.vue_vue_type_script_setup_true_lang.23d19169.js";import{f as S,b as Ae}from"./index.79566453.js";import{u as Ce,a as De}from"./vue-router.12d45bc3.js";import{t as ke,g as ge}from"./code.6b3a94ba.js";import{u as he}from"./useDictOptions.a1641d27.js";import{d as we}from"./dict.7706cbc5.js";import{m as Ue}from"./menu.da03f607.js";import{_ as qe}from"./relations-add.vue_vue_type_script_setup_true_lang.81a6be6f.js";import{l as L}from"./lodash.ec5da75f.js";import{d as K,r as O,$ as j,s as z,o as i,c as V,U as e,L as u,w as $e,a as n,V as E,a7 as y,u as G,K as B,R as U,S as p,n as xe,t as H}from"./@vue.e8706010.js";import"./@vueuse.1e5a6e21.js";import"./@element-plus.196c7323.js";import"./lodash-es.29c53eac.js";import"./dayjs.ff93117e.js";import"./axios.eb055ccc.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./@popperjs.36402333.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./pinia.dfca86b4.js";import"./vue-demi.ebc8116b.js";import"./css-color-function.31dc130b.js";import"./color.b6d632a4.js";import"./clone.7a47b02c.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.3a33898e.js";import"./ms.a9ae1d6d.js";import"./nprogress.fa64f2fc.js";import"./vue-clipboard3.be0dfeee.js";import"./clipboard.824ba320.js";import"./echarts.8d7a50ae.js";import"./zrender.1084fa23.js";import"./tslib.60310f1a.js";import"./highlight.js.4ebdf9a4.js";import"./@highlightjs.2cdc8407.js";import"./index.ace66c08.js";const Re={class:"code-edit"},Ie={class:"w-80"},Te={class:"w-80"},Ne={class:"w-80"},Pe={class:"w-80"},Se=p("\u5355\u8868\uFF08curd\uFF09"),Le=p("\u6811\u8868\uFF08curd\uFF09"),Oe=p("\u7269\u7406\u5220\u9664"),je=p("\u8F6F\u5220\u9664"),ze=n("div",{class:"form-tips"},"\u6307\u5B9A\u6811\u8868\u7684\u4E3B\u8981ID\uFF0C\u4E00\u822C\u4E3A\u4E3B\u952E",-1),Ge=n("div",{class:"form-tips"},"\u6307\u5B9A\u6811\u8868\u7684\u7236ID\uFF0C\u6BD4\u5982\uFF1Aparent_id",-1),He={class:"w-80"},Ke=n("div",{class:"form-tips"},[n("div",null," \u4F8B\uFF1A\u586B\u5199test,\u751F\u6210\u6587\u4EF6\u63CF\u8FF0\u4E3Atest\u63A7\u5236\u5668(test\u903B\u8F91/test\u6A21\u578B) ")],-1),Me=p("\u538B\u7F29\u5305\u4E0B\u8F7D"),Qe=p("\u751F\u6210\u5230\u6A21\u5757"),We={class:"w-80"},Ze=n("div",{class:"form-tips"},"\u751F\u6210\u6587\u4EF6\u6240\u5728\u6A21\u5757",-1),Je={class:"w-80"},Xe=n("div",{class:"form-tips"},[n("div",null," \u4F8B\uFF1A\u586B\u5199test,\u5219\u5728app/\u6A21\u5757\u540D/controller/test\u4E0B\u751F\u6210\u63A7\u5236\u5668 ")],-1),Ye={class:"w-80"},el=p("\u81EA\u52A8\u6784\u5EFA"),ll=p("\u624B\u52A8\u6DFB\u52A0"),ul=n("div",{class:"form-tips"}," \u81EA\u52A8\u6784\u5EFA\uFF1A\u81EA\u52A8\u6267\u884C\u751F\u6210\u83DC\u5355sql\u3002\u624B\u52A8\u6DFB\u52A0\uFF1A\u81EA\u884C\u6DFB\u52A0\u83DC\u5355\u3002 ",-1),al=p(" \u65B0\u589E\u5173\u8054 "),tl={class:"mt-4"},ol=p(" \u7F16\u8F91 "),nl=p(" \u5220\u9664 "),dl=p("\u4FDD\u5B58"),ml=K({name:"tableEdit"}),Xl=K({...ml,setup(sl){const M=Ce(),Q=De(),q=O("column"),k=O(!1),$=[{name:"\u4E00\u5BF9\u4E00",value:"has_one"},{name:"\u4E00\u5BF9\u591A",value:"has_many"}],t=j({id:"",table_name:"",table_comment:"",author:"",remark:"",template_type:0,generate_type:0,module_name:"",class_dir:"",class_comment:"",table_column:[],menu:{pid:0,name:"",type:0},tree:{tree_id:0,tree_pid:0,tree_name:0},delete:{name:"",type:0},relations:[]});let g=0;const x=z(),h=z(),R=j({table_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u8868\u540D\u79F0"}],table_comment:[{required:!0,message:"\u8BF7\u8F93\u5165\u8868\u63CF\u8FF0"}],module_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6A21\u5757\u540D"}],generate_type:[{required:!0,trigger:"change"}],template_type:[{required:!0,trigger:"change"}],["menu.pid"]:[{required:!0,message:"\u8BF7\u9009\u62E9\u7236\u7EA7\u83DC\u5355"}],["menu.name"]:[{required:!0,message:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0"}],["delete.type"]:[{required:!0,trigger:"change"}],["delete.name"]:[{required:!0,message:"\u8BF7\u9009\u62E9\u5220\u9664\u5B57\u6BB5"}]}),I=async(r,a,b)=>{var c,_;k.value=!0,await xe(),a&&b!==void 0&&((c=h.value)==null||c.setFormData(a),g=b),(_=h.value)==null||_.open(r)},W=r=>{const a=L.exports.cloneDeep(H(r));t.relations.push(a)},Z=async r=>{const a=L.exports.cloneDeep(H(r));console.log(g),t.relations.splice(g,1,a)},J=r=>{t.relations.splice(r,1)},X=async()=>{const r=await ke({id:M.query.id});Object.keys(t).forEach(a=>{t[a]=r[a]}),$e(()=>t.generate_type,a=>{a==1&&S.confirm("\u751F\u6210\u5230\u6A21\u5757\u65B9\u5F0F\u5982\u9047\u540C\u540D\u6587\u4EF6\u4F1A\u8986\u76D6\u65E7\u6587\u4EF6\uFF0C\u786E\u5B9A\u8981\u9009\u62E9\u6B64\u65B9\u5F0F\u5417\uFF1F").catch(()=>{t.generate_type=0})})},{optionsData:T}=he({dict_type:{api:we},menu:{api:Ue,transformData(r){const a={id:0,name:"\u9876\u7EA7",children:[]};return a.children=r,[a]}}}),Y=async()=>{var r,a;try{await((r=x.value)==null?void 0:r.validate()),await ge(t),Q.back()}catch(b){for(const c in b)Object.keys(R).includes(c)&&S.msgError((a=b[c][0])==null?void 0:a.message)}};return X(),(r,a)=>{const b=ne,c=de,_=me,m=se,A=re,s=ie,v=_e,d=pe,f=ce,N=Fe,F=be,C=fe,ee=Ve,le=Ae,D=Be,P=ye,ue=Ee,ae=ve,te=oe;return i(),V("div",Re,[e(c,{class:"!border-none",shadow:"never"},{default:u(()=>[e(b,{content:"\u7F16\u8F91\u6570\u636E\u8868",onBack:a[0]||(a[0]=l=>r.$router.back())})]),_:1}),e(c,{class:"mt-4 !border-none",shadow:"never"},{default:u(()=>[e(ae,{ref_key:"formRef",ref:x,class:"ls-form",model:t,"label-width":"100px",rules:R},{default:u(()=>[e(ue,{modelValue:q.value,"onUpdate:modelValue":a[20]||(a[20]=l=>q.value=l)},{default:u(()=>[e(A,{label:"\u57FA\u7840\u4FE1\u606F",name:"base"},{default:u(()=>[e(m,{label:"\u8868\u540D\u79F0",prop:"table_name"},{default:u(()=>[n("div",Ie,[e(_,{modelValue:t.table_name,"onUpdate:modelValue":a[1]||(a[1]=l=>t.table_name=l),placeholder:"\u8BF7\u8F93\u5165\u8868\u540D\u79F0",clearable:""},null,8,["modelValue"])])]),_:1}),e(m,{label:"\u8868\u63CF\u8FF0",prop:"table_comment"},{default:u(()=>[n("div",Te,[e(_,{modelValue:t.table_comment,"onUpdate:modelValue":a[2]||(a[2]=l=>t.table_comment=l),placeholder:"\u8BF7\u8F93\u5165\u8868\u63CF\u8FF0",clearable:""},null,8,["modelValue"])])]),_:1}),e(m,{label:"\u4F5C\u8005"},{default:u(()=>[n("div",Ne,[e(_,{modelValue:t.author,"onUpdate:modelValue":a[3]||(a[3]=l=>t.author=l),clearable:""},null,8,["modelValue"])])]),_:1}),e(m,{label:"\u5907\u6CE8"},{default:u(()=>[n("div",Pe,[e(_,{modelValue:t.remark,"onUpdate:modelValue":a[4]||(a[4]=l=>t.remark=l),class:"w-full",type:"textarea",autosize:{minRows:4,maxRows:4},maxlength:"200","show-word-limit":"",clearable:""},null,8,["modelValue"])])]),_:1})]),_:1}),e(A,{label:"\u5B57\u6BB5\u7BA1\u7406",name:"column"},{default:u(()=>[e(N,{data:t.table_column},{default:u(()=>[e(s,{label:"\u5B57\u6BB5\u5217\u540D",prop:"column_name"}),e(s,{label:"\u5B57\u6BB5\u63CF\u8FF0",prop:"column_comment","min-width":"120"},{default:u(({row:l})=>[e(_,{modelValue:l.column_comment,"onUpdate:modelValue":o=>l.column_comment=o,clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u7269\u7406\u7C7B\u578B",prop:"column_type"}),e(s,{label:"\u5FC5\u586B",width:"80"},{default:u(({row:l})=>[e(v,{modelValue:l.is_required,"onUpdate:modelValue":o=>l.is_required=o,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u63D2\u5165",width:"80"},{default:u(({row:l})=>[e(v,{modelValue:l.is_insert,"onUpdate:modelValue":o=>l.is_insert=o,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u7F16\u8F91",width:"80"},{default:u(({row:l})=>[e(v,{modelValue:l.is_update,"onUpdate:modelValue":o=>l.is_update=o,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u5217\u8868",width:"80"},{default:u(({row:l})=>[e(v,{modelValue:l.is_lists,"onUpdate:modelValue":o=>l.is_lists=o,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u67E5\u8BE2",width:"80"},{default:u(({row:l})=>[e(v,{modelValue:l.is_query,"onUpdate:modelValue":o=>l.is_query=o,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u67E5\u8BE2\u65B9\u5F0F"},{default:u(({row:l})=>[e(f,{modelValue:l.query_type,"onUpdate:modelValue":o=>l.query_type=o},{default:u(()=>[e(d,{label:"=",value:"="}),e(d,{label:"!=",value:"!="}),e(d,{label:">",value:">"}),e(d,{label:">=",value:">="}),e(d,{label:"<",value:"<"}),e(d,{label:"<=",value:"<="}),e(d,{label:"LIKE",value:"like"}),e(d,{label:"BETWEEN",value:"between"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u663E\u793A\u7C7B\u578B","min-width":"120"},{default:u(({row:l})=>[e(f,{modelValue:l.view_type,"onUpdate:modelValue":o=>l.view_type=o},{default:u(()=>[e(d,{label:"\u6587\u672C\u6846",value:"input"}),e(d,{label:"\u6587\u672C\u57DF",value:"textarea"}),e(d,{label:"\u4E0B\u62C9\u6846",value:"select"}),e(d,{label:"\u5355\u9009\u6846",value:"radio"}),e(d,{label:"\u590D\u9009\u6846",value:"checkbox"}),e(d,{label:"\u65E5\u671F\u63A7\u4EF6",value:"datetime"}),e(d,{label:"\u56FE\u7247\u9009\u62E9\u63A7\u4EF6",value:"imageSelect"}),e(d,{label:"\u5BCC\u6587\u672C\u63A7\u4EF6",value:"editor"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u5B57\u5178\u7C7B\u578B","min-width":"120"},{default:u(({row:l})=>[e(f,{modelValue:l.dict_type,"onUpdate:modelValue":o=>l.dict_type=o,clearable:"",disabled:!(l.view_type=="select"||l.view_type=="radio"||l.view_type=="checkbox"),placeholder:"\u5B57\u5178\u7C7B\u578B"},{default:u(()=>[(i(!0),V(E,null,y(G(T).dict_type,(o,w)=>(i(),B(d,{key:w,label:o.name,value:o.type,disabled:!o.status},null,8,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])]),_:1})]),_:1},8,["data"])]),_:1}),e(A,{label:"\u751F\u6210\u914D\u7F6E",name:"config"},{default:u(()=>[e(m,{label:"\u6A21\u677F\u7C7B\u578B",prop:"template_type"},{default:u(()=>[e(C,{modelValue:t.template_type,"onUpdate:modelValue":a[5]||(a[5]=l=>t.template_type=l)},{default:u(()=>[e(F,{label:0},{default:u(()=>[Se]),_:1}),e(F,{label:1},{default:u(()=>[Le]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(m,{label:"\u5220\u9664\u7C7B\u578B",prop:"delete.type"},{default:u(()=>[e(C,{modelValue:t.delete.type,"onUpdate:modelValue":a[6]||(a[6]=l=>t.delete.type=l)},{default:u(()=>[e(F,{label:0},{default:u(()=>[Oe]),_:1}),e(F,{label:1},{default:u(()=>[je]),_:1})]),_:1},8,["modelValue"])]),_:1}),t.delete.type==1?(i(),B(m,{key:0,label:"\u5220\u9664\u5B57\u6BB5",prop:"delete.name"},{default:u(()=>[e(f,{class:"w-80",modelValue:t.delete.name,"onUpdate:modelValue":a[7]||(a[7]=l=>t.delete.name=l),clearable:""},{default:u(()=>[(i(!0),V(E,null,y(t.table_column,l=>(i(),B(d,{key:l.id,value:l.column_name,label:`${l.column_name}\uFF1A${l.column_comment}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})):U("",!0),t.template_type==1?(i(),V(E,{key:1},[e(m,{label:"\u6811\u8868ID",prop:"treePrimary"},{default:u(()=>[n("div",null,[e(f,{class:"w-80",modelValue:t.tree.tree_id,"onUpdate:modelValue":a[8]||(a[8]=l=>t.tree.tree_id=l),clearable:""},{default:u(()=>[(i(!0),V(E,null,y(t.table_column,l=>(i(),B(d,{key:l.id,value:l.column_name,label:`${l.column_name}\uFF1A${l.column_comment}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"]),ze])]),_:1}),e(m,{label:"\u6811\u8868\u7236ID",prop:"treeParent"},{default:u(()=>[n("div",null,[e(f,{class:"w-80",modelValue:t.tree.tree_pid,"onUpdate:modelValue":a[9]||(a[9]=l=>t.tree.tree_pid=l),clearable:""},{default:u(()=>[(i(!0),V(E,null,y(t.table_column,l=>(i(),B(d,{key:l.id,value:l.column_name,label:`${l.column_name}\uFF1A${l.column_comment}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"]),Ge])]),_:1}),e(m,{label:"\u6811\u540D\u79F0",prop:"treeName"},{default:u(()=>[e(f,{class:"w-80",modelValue:t.tree.tree_name,"onUpdate:modelValue":a[10]||(a[10]=l=>t.tree.tree_name=l),clearable:""},{default:u(()=>[(i(!0),V(E,null,y(t.table_column,l=>(i(),B(d,{key:l.id,value:l.column_name,label:`${l.column_name}\uFF1A${l.column_comment}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})],64)):U("",!0),e(m,{label:"\u7C7B\u63CF\u8FF0"},{default:u(()=>[n("div",He,[n("div",null,[e(_,{modelValue:t.class_comment,"onUpdate:modelValue":a[11]||(a[11]=l=>t.class_comment=l),placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u63CF\u8FF0",clearable:""},null,8,["modelValue"])]),Ke])]),_:1}),e(m,{label:"\u751F\u6210\u65B9\u5F0F",prop:"generate_type"},{default:u(()=>[e(C,{modelValue:t.generate_type,"onUpdate:modelValue":a[12]||(a[12]=l=>t.generate_type=l)},{default:u(()=>[e(F,{label:0},{default:u(()=>[Me]),_:1}),e(F,{label:1},{default:u(()=>[Qe]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(m,{label:"\u6A21\u5757\u540D",prop:"module_name"},{default:u(()=>[n("div",We,[e(_,{modelValue:t.module_name,"onUpdate:modelValue":a[13]||(a[13]=l=>t.module_name=l),placeholder:"\u8BF7\u8F93\u5165\u6A21\u5757\u540D",clearable:""},null,8,["modelValue"]),Ze])]),_:1}),e(m,{label:"\u7C7B\u76EE\u5F55"},{default:u(()=>[n("div",Je,[n("div",null,[e(_,{modelValue:t.class_dir,"onUpdate:modelValue":a[14]||(a[14]=l=>t.class_dir=l),placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u6240\u5728\u76EE\u5F55",clearable:""},null,8,["modelValue"])]),Xe])]),_:1}),e(m,{label:"\u7236\u7EA7\u83DC\u5355",prop:"menu.pid"},{default:u(()=>[e(ee,{class:"w-80",modelValue:t.menu.pid,"onUpdate:modelValue":a[15]||(a[15]=l=>t.menu.pid=l),data:G(T).menu,clearable:"","node-key":"id",props:{label:"name"},"default-expand-all":"",placeholder:"\u8BF7\u9009\u62E9\u7236\u7EA7\u83DC\u5355","check-strictly":""},null,8,["modelValue","data"])]),_:1}),e(m,{label:"\u83DC\u5355\u540D\u79F0",prop:"menu.name"},{default:u(()=>[n("div",Ye,[e(_,{modelValue:t.menu.name,"onUpdate:modelValue":a[16]||(a[16]=l=>t.menu.name=l),placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",clearable:""},null,8,["modelValue"])])]),_:1}),e(m,{label:"\u83DC\u5355\u6784\u5EFA",prop:"menu.type",required:""},{default:u(()=>[n("div",null,[e(C,{modelValue:t.menu.type,"onUpdate:modelValue":a[17]||(a[17]=l=>t.menu.type=l)},{default:u(()=>[e(F,{label:1},{default:u(()=>[el]),_:1}),e(F,{label:0},{default:u(()=>[ll]),_:1})]),_:1},8,["modelValue"]),ul])]),_:1})]),_:1}),e(A,{label:"\u5173\u8054\u914D\u7F6E",name:"relations"},{default:u(()=>[e(D,{type:"primary",onClick:a[18]||(a[18]=l=>I("add"))},{icon:u(()=>[e(le,{name:"el-icon-Plus"})]),default:u(()=>[al]),_:1}),n("div",tl,[e(N,{data:t.relations,size:"mini"},{default:u(()=>[e(s,{prop:"type",label:"\u5173\u8054\u7C7B\u578B"},{default:u(({row:l})=>[e(P,{value:l.type,options:$},null,8,["value"])]),_:1}),e(s,{prop:"name",label:"\u5173\u8054\u540D\u79F0"}),e(s,{prop:"model",label:"\u5173\u8054\u6A21\u578B"}),e(s,{prop:"local_key",label:"\u5173\u8054\u952E"},{default:u(({row:l})=>[e(P,{value:l.local_key,options:t.table_column,config:{label:"column_comment",value:"column_name"}},null,8,["value","options"])]),_:1}),e(s,{prop:"foreign_key",label:"\u5916\u952E"}),e(s,{label:"\u64CD\u4F5C"},{default:u(({row:l,$index:o})=>[e(D,{link:"",type:"primary",onClick:w=>I("edit",l,o)},{default:u(()=>[ol]),_:2},1032,["onClick"]),e(D,{link:"",type:"danger",onClick:w=>J(o)},{default:u(()=>[nl]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"]),k.value?(i(),B(qe,{key:0,column:t.table_column,types:$,ref_key:"editRef",ref:h,onAdd:W,onEdit:Z,onClose:a[19]||(a[19]=l=>k.value=!1)},null,8,["column"])):U("",!0)])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["model","rules"])]),_:1}),e(te,null,{default:u(()=>[e(D,{type:"primary",onClick:Y},{default:u(()=>[dl]),_:1})]),_:1})])}}});export{Xl as default};