WokerTask/public/admin/assets/edit.2486509f.js

2 lines
16 KiB
JavaScript

import{_ as oe}from"./index.1e16e898.js";import{T as ne,x as de,a3 as me,y as se,I as re,B as pe,C as ie,O as _e,F as ce,M as Fe,N as be,P as fe,G as Ve,H as Be,w as Ee,D as ve}from"./element-plus.10e48c93.js";import{_ as ye}from"./index.vue_vue_type_script_setup_true_lang.17266fa4.js";import{f as S,b as Ae}from"./index.8604d989.js";import{u as Ce,a as De}from"./vue-router.9f65afb1.js";import{t as ke,g as ge}from"./code.ab06ceec.js";import{a as we}from"./useDictOptions.0cd6f35c.js";import{a as Ue}from"./dict.f873732c.js";import{m as he}from"./menu.4009a065.js";import{_ as qe}from"./relations-add.vue_vue_type_script_setup_true_lang.6d80232b.js";import{l as L}from"./lodash.08438971.js";import{d as K,r as j,$ as z,s as G,o as i,c as B,U as e,L as u,u as o,k as $e,a as d,T as v,a7 as A,K as E,R as c,Q as $,n as xe,t as H,w as Re}from"./@vue.51d7f2d8.js";import"./@vueuse.ec90c285.js";import"./@element-plus.c80b8015.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";import"./index.49a85b68.js";import"./index.vue_vue_type_style_index_0_scoped_95d1884e_lang.0fc4c9f8.js";const Te={class:"code-edit"},Ie={class:"w-80"},Ne={class:"w-80"},Pe={class:"w-80"},Oe={class:"w-80"},Se=d("div",{class:"form-tips"},"\u6307\u5B9A\u6811\u8868\u7684\u4E3B\u8981ID\uFF0C\u4E00\u822C\u4E3A\u4E3B\u952E",-1),Le=d("div",{class:"form-tips"},"\u6307\u5B9A\u6811\u8868\u7684\u7236ID\uFF0C\u6BD4\u5982\uFF1Aparent_id",-1),je={class:"w-80"},ze=d("div",{class:"form-tips"},[d("div",null," \u4F8B\uFF1A\u586B\u5199test,\u751F\u6210\u6587\u4EF6\u63CF\u8FF0\u4E3Atest\u63A7\u5236\u5668(test\u903B\u8F91/test\u6A21\u578B) ")],-1),Ge={class:"w-80"},He=d("div",{class:"form-tips"},"\u751F\u6210\u6587\u4EF6\u6240\u5728\u6A21\u5757",-1),Ke={class:"w-80"},Me=d("div",{class:"form-tips"},[d("div",null," \u4F8B\uFF1A\u586B\u5199test,\u5219\u5728app/\u6A21\u5757\u540D/controller/test\u4E0B\u751F\u6210\u63A7\u5236\u5668 ")],-1),Qe={class:"w-80"},We=d("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),Je={class:"mt-4"},Xe=K({name:"tableEdit"}),jl=K({...Xe,setup(Ye){const M=Ce(),Q=De(),g=j("column"),w=j(!1),x=[{name:"\u4E00\u5BF9\u4E00",value:"has_one"},{name:"\u4E00\u5BF9\u591A",value:"has_many"}],t=z({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 U=0;const R=G(),h=G(),T=z({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(p,a,f)=>{var F,_;w.value=!0,await xe(),a&&f!==void 0&&((F=h.value)==null||F.setFormData(a),U=f),(_=h.value)==null||_.open(p)},W=p=>{const a=L.exports.cloneDeep(H(p));t.relations.push(a)},J=async p=>{const a=L.exports.cloneDeep(H(p));console.log(U),t.relations.splice(U,1,a)},X=p=>{t.relations.splice(p,1)},Y=async()=>{const p=await ke({id:M.query.id});Object.keys(t).forEach(a=>{t[a]=p[a]}),Re(()=>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:N}=we({dict_type:{api:Ue},menu:{api:he,transformData(p){const a={id:0,name:"\u9876\u7EA7",children:[]};return a.children=p,[a]}}}),Z=async()=>{var p,a;try{await((p=R.value)==null?void 0:p.validate()),await ge(t),Q.back()}catch(f){for(const F in f)Object.keys(T).includes(F)&&S.msgError((a=f[F][0])==null?void 0:a.message)}};return Y(),(p,a)=>{const f=ne,F=re,_=pe,s=ie,C=de,r=_e,y=ce,m=Fe,V=be,P=fe,b=Ve,D=Be,ee=me,le=Ae,k=Ee,O=ye,ue=se,ae=ve,te=oe;return i(),B("div",Te,[e(F,{class:"!border-none",shadow:"never"},{default:u(()=>[e(f,{content:"\u7F16\u8F91\u6570\u636E\u8868",onBack:a[0]||(a[0]=l=>p.$router.back())})]),_:1}),e(F,{class:"mt-4 !border-none",shadow:"never"},{default:u(()=>[e(ae,{ref_key:"formRef",ref:R,class:"ls-form",model:o(t),"label-width":"100px",rules:o(T)},{default:u(()=>[e(ue,{modelValue:o(g),"onUpdate:modelValue":a[20]||(a[20]=l=>$e(g)?g.value=l:null)},{default:u(()=>[e(C,{label:"\u57FA\u7840\u4FE1\u606F",name:"base"},{default:u(()=>[e(s,{label:"\u8868\u540D\u79F0",prop:"table_name"},{default:u(()=>[d("div",Ie,[e(_,{modelValue:o(t).table_name,"onUpdate:modelValue":a[1]||(a[1]=l=>o(t).table_name=l),placeholder:"\u8BF7\u8F93\u5165\u8868\u540D\u79F0",clearable:""},null,8,["modelValue"])])]),_:1}),e(s,{label:"\u8868\u63CF\u8FF0",prop:"table_comment"},{default:u(()=>[d("div",Ne,[e(_,{modelValue:o(t).table_comment,"onUpdate:modelValue":a[2]||(a[2]=l=>o(t).table_comment=l),placeholder:"\u8BF7\u8F93\u5165\u8868\u63CF\u8FF0",clearable:""},null,8,["modelValue"])])]),_:1}),e(s,{label:"\u4F5C\u8005"},{default:u(()=>[d("div",Pe,[e(_,{modelValue:o(t).author,"onUpdate:modelValue":a[3]||(a[3]=l=>o(t).author=l),clearable:""},null,8,["modelValue"])])]),_:1}),e(s,{label:"\u5907\u6CE8"},{default:u(()=>[d("div",Oe,[e(_,{modelValue:o(t).remark,"onUpdate:modelValue":a[4]||(a[4]=l=>o(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(C,{label:"\u5B57\u6BB5\u7BA1\u7406",name:"column"},{default:u(()=>[e(P,{data:o(t).table_column},{default:u(()=>[e(r,{label:"\u5B57\u6BB5\u5217\u540D",prop:"column_name"}),e(r,{label:"\u5B57\u6BB5\u63CF\u8FF0",prop:"column_comment","min-width":"120"},{default:u(({row:l})=>[e(_,{modelValue:l.column_comment,"onUpdate:modelValue":n=>l.column_comment=n,clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u7269\u7406\u7C7B\u578B",prop:"column_type"}),e(r,{label:"\u5FC5\u586B",width:"80"},{default:u(({row:l})=>[e(y,{modelValue:l.is_required,"onUpdate:modelValue":n=>l.is_required=n,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u63D2\u5165",width:"80"},{default:u(({row:l})=>[e(y,{modelValue:l.is_insert,"onUpdate:modelValue":n=>l.is_insert=n,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u7F16\u8F91",width:"80"},{default:u(({row:l})=>[e(y,{modelValue:l.is_update,"onUpdate:modelValue":n=>l.is_update=n,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u5217\u8868",width:"80"},{default:u(({row:l})=>[e(y,{modelValue:l.is_lists,"onUpdate:modelValue":n=>l.is_lists=n,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u67E5\u8BE2",width:"80"},{default:u(({row:l})=>[e(y,{modelValue:l.is_query,"onUpdate:modelValue":n=>l.is_query=n,"true-label":1,"false-label":0},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u67E5\u8BE2\u65B9\u5F0F"},{default:u(({row:l})=>[e(V,{modelValue:l.query_type,"onUpdate:modelValue":n=>l.query_type=n},{default:u(()=>[e(m,{label:"=",value:"="}),e(m,{label:"!=",value:"!="}),e(m,{label:">",value:">"}),e(m,{label:">=",value:">="}),e(m,{label:"<",value:"<"}),e(m,{label:"<=",value:"<="}),e(m,{label:"LIKE",value:"like"}),e(m,{label:"BETWEEN",value:"between"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u663E\u793A\u7C7B\u578B","min-width":"120"},{default:u(({row:l})=>[e(V,{modelValue:l.view_type,"onUpdate:modelValue":n=>l.view_type=n},{default:u(()=>[e(m,{label:"\u6587\u672C\u6846",value:"input"}),e(m,{label:"\u6587\u672C\u57DF",value:"textarea"}),e(m,{label:"\u4E0B\u62C9\u6846",value:"select"}),e(m,{label:"\u5355\u9009\u6846",value:"radio"}),e(m,{label:"\u590D\u9009\u6846",value:"checkbox"}),e(m,{label:"\u65E5\u671F\u63A7\u4EF6",value:"datetime"}),e(m,{label:"\u56FE\u7247\u9009\u62E9\u63A7\u4EF6",value:"imageSelect"}),e(m,{label:"\u5BCC\u6587\u672C\u63A7\u4EF6",value:"editor"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1}),e(r,{label:"\u5B57\u5178\u7C7B\u578B","min-width":"120"},{default:u(({row:l})=>[e(V,{modelValue:l.dict_type,"onUpdate:modelValue":n=>l.dict_type=n,clearable:"",disabled:!(l.view_type=="select"||l.view_type=="radio"||l.view_type=="checkbox"),placeholder:"\u5B57\u5178\u7C7B\u578B"},{default:u(()=>[(i(!0),B(v,null,A(o(N).dict_type,(n,q)=>(i(),E(m,{key:q,label:n.name,value:n.type,disabled:!n.status},null,8,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])]),_:1})]),_:1},8,["data"])]),_:1}),e(C,{label:"\u751F\u6210\u914D\u7F6E",name:"config"},{default:u(()=>[e(s,{label:"\u6A21\u677F\u7C7B\u578B",prop:"template_type"},{default:u(()=>[e(D,{modelValue:o(t).template_type,"onUpdate:modelValue":a[5]||(a[5]=l=>o(t).template_type=l)},{default:u(()=>[e(b,{label:0},{default:u(()=>[c("\u5355\u8868\uFF08curd\uFF09")]),_:1}),e(b,{label:1},{default:u(()=>[c("\u6811\u8868\uFF08curd\uFF09")]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(s,{label:"\u5220\u9664\u7C7B\u578B",prop:"delete.type"},{default:u(()=>[e(D,{modelValue:o(t).delete.type,"onUpdate:modelValue":a[6]||(a[6]=l=>o(t).delete.type=l)},{default:u(()=>[e(b,{label:0},{default:u(()=>[c("\u7269\u7406\u5220\u9664")]),_:1}),e(b,{label:1},{default:u(()=>[c("\u8F6F\u5220\u9664")]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(t).delete.type==1?(i(),E(s,{key:0,label:"\u5220\u9664\u5B57\u6BB5",prop:"delete.name"},{default:u(()=>[e(V,{class:"w-80",modelValue:o(t).delete.name,"onUpdate:modelValue":a[7]||(a[7]=l=>o(t).delete.name=l),clearable:""},{default:u(()=>[(i(!0),B(v,null,A(o(t).table_column,l=>(i(),E(m,{key:l.id,value:l.column_name,label:`${l.column_name}\uFF1A${l.column_comment}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})):$("",!0),o(t).template_type==1?(i(),B(v,{key:1},[e(s,{label:"\u6811\u8868ID",prop:"treePrimary"},{default:u(()=>[d("div",null,[e(V,{class:"w-80",modelValue:o(t).tree.tree_id,"onUpdate:modelValue":a[8]||(a[8]=l=>o(t).tree.tree_id=l),clearable:""},{default:u(()=>[(i(!0),B(v,null,A(o(t).table_column,l=>(i(),E(m,{key:l.id,value:l.column_name,label:`${l.column_name}\uFF1A${l.column_comment}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"]),Se])]),_:1}),e(s,{label:"\u6811\u8868\u7236ID",prop:"treeParent"},{default:u(()=>[d("div",null,[e(V,{class:"w-80",modelValue:o(t).tree.tree_pid,"onUpdate:modelValue":a[9]||(a[9]=l=>o(t).tree.tree_pid=l),clearable:""},{default:u(()=>[(i(!0),B(v,null,A(o(t).table_column,l=>(i(),E(m,{key:l.id,value:l.column_name,label:`${l.column_name}\uFF1A${l.column_comment}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"]),Le])]),_:1}),e(s,{label:"\u6811\u540D\u79F0",prop:"treeName"},{default:u(()=>[e(V,{class:"w-80",modelValue:o(t).tree.tree_name,"onUpdate:modelValue":a[10]||(a[10]=l=>o(t).tree.tree_name=l),clearable:""},{default:u(()=>[(i(!0),B(v,null,A(o(t).table_column,l=>(i(),E(m,{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)):$("",!0),e(s,{label:"\u7C7B\u63CF\u8FF0"},{default:u(()=>[d("div",je,[d("div",null,[e(_,{modelValue:o(t).class_comment,"onUpdate:modelValue":a[11]||(a[11]=l=>o(t).class_comment=l),placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u63CF\u8FF0",clearable:""},null,8,["modelValue"])]),ze])]),_:1}),e(s,{label:"\u751F\u6210\u65B9\u5F0F",prop:"generate_type"},{default:u(()=>[e(D,{modelValue:o(t).generate_type,"onUpdate:modelValue":a[12]||(a[12]=l=>o(t).generate_type=l)},{default:u(()=>[e(b,{label:0},{default:u(()=>[c("\u538B\u7F29\u5305\u4E0B\u8F7D")]),_:1}),e(b,{label:1},{default:u(()=>[c("\u751F\u6210\u5230\u6A21\u5757")]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(s,{label:"\u6A21\u5757\u540D",prop:"module_name"},{default:u(()=>[d("div",Ge,[e(_,{modelValue:o(t).module_name,"onUpdate:modelValue":a[13]||(a[13]=l=>o(t).module_name=l),placeholder:"\u8BF7\u8F93\u5165\u6A21\u5757\u540D",clearable:""},null,8,["modelValue"]),He])]),_:1}),e(s,{label:"\u7C7B\u76EE\u5F55"},{default:u(()=>[d("div",Ke,[d("div",null,[e(_,{modelValue:o(t).class_dir,"onUpdate:modelValue":a[14]||(a[14]=l=>o(t).class_dir=l),placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u6240\u5728\u76EE\u5F55",clearable:""},null,8,["modelValue"])]),Me])]),_:1}),e(s,{label:"\u7236\u7EA7\u83DC\u5355",prop:"menu.pid"},{default:u(()=>[e(ee,{class:"w-80",modelValue:o(t).menu.pid,"onUpdate:modelValue":a[15]||(a[15]=l=>o(t).menu.pid=l),data:o(N).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(s,{label:"\u83DC\u5355\u540D\u79F0",prop:"menu.name"},{default:u(()=>[d("div",Qe,[e(_,{modelValue:o(t).menu.name,"onUpdate:modelValue":a[16]||(a[16]=l=>o(t).menu.name=l),placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",clearable:""},null,8,["modelValue"])])]),_:1}),e(s,{label:"\u83DC\u5355\u6784\u5EFA",prop:"menu.type",required:""},{default:u(()=>[d("div",null,[e(D,{modelValue:o(t).menu.type,"onUpdate:modelValue":a[17]||(a[17]=l=>o(t).menu.type=l)},{default:u(()=>[e(b,{label:1},{default:u(()=>[c("\u81EA\u52A8\u6784\u5EFA")]),_:1}),e(b,{label:0},{default:u(()=>[c("\u624B\u52A8\u6DFB\u52A0")]),_:1})]),_:1},8,["modelValue"]),We])]),_:1})]),_:1}),e(C,{label:"\u5173\u8054\u914D\u7F6E",name:"relations"},{default:u(()=>[e(k,{type:"primary",onClick:a[18]||(a[18]=l=>I("add"))},{icon:u(()=>[e(le,{name:"el-icon-Plus"})]),default:u(()=>[c(" \u65B0\u589E\u5173\u8054 ")]),_:1}),d("div",Je,[e(P,{data:o(t).relations,size:"mini"},{default:u(()=>[e(r,{prop:"type",label:"\u5173\u8054\u7C7B\u578B"},{default:u(({row:l})=>[e(O,{value:l.type,options:x},null,8,["value"])]),_:1}),e(r,{prop:"name",label:"\u5173\u8054\u540D\u79F0"}),e(r,{prop:"model",label:"\u5173\u8054\u6A21\u578B"}),e(r,{prop:"local_key",label:"\u5173\u8054\u952E"},{default:u(({row:l})=>[e(O,{value:l.local_key,options:o(t).table_column,config:{label:"column_comment",value:"column_name"}},null,8,["value","options"])]),_:1}),e(r,{prop:"foreign_key",label:"\u5916\u952E"}),e(r,{label:"\u64CD\u4F5C"},{default:u(({row:l,$index:n})=>[e(k,{link:"",type:"primary",onClick:q=>I("edit",l,n)},{default:u(()=>[c(" \u7F16\u8F91 ")]),_:2},1032,["onClick"]),e(k,{link:"",type:"danger",onClick:q=>X(n)},{default:u(()=>[c(" \u5220\u9664 ")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"]),o(w)?(i(),E(qe,{key:0,column:o(t).table_column,types:x,ref_key:"editRef",ref:h,onAdd:W,onEdit:J,onClose:a[19]||(a[19]=l=>w.value=!1)},null,8,["column"])):$("",!0)])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["model","rules"])]),_:1}),e(te,null,{default:u(()=>[e(k,{type:"primary",onClick:Z},{default:u(()=>[c("\u4FDD\u5B58")]),_:1})]),_:1})])}}});export{jl as default};