WokerTask/public/admin/assets/edit.5de0b357.js

2 lines
16 KiB
JavaScript

import{_ as oe}from"./index.461f83d2.js";import{U as ne,x as de,a5 as me,y as se,J as re,C as pe,D as ie,P as _e,G as ce,N as Fe,O as be,Q as fe,H as Ve,I as Be,w as Ee,F as ve}from"./element-plus.ff90c99c.js";import{_ as ye}from"./index.vue_vue_type_script_setup_true_lang.a844fe51.js";import{f as S,b as Ae}from"./index.2c97e227.js";import{u as Ce,a as De}from"./vue-router.6d4cf914.js";import{t as ke,g as ge}from"./code.0e3ea14c.js";import{a as Ue}from"./useDictOptions.262f9fba.js";import{a as we}from"./dict.bcf2d1e3.js";import{m as he}from"./menu.e4be35f0.js";import{_ as qe}from"./relations-add.vue_vue_type_script_setup_true_lang.17ec7cfa.js";import{l as j}from"./lodash.2e6f447e.js";import{d as Q,r as z,$ as G,s as H,o as i,c as B,W as e,Q as u,u as o,j as $e,a as d,F as v,a9 as A,P as E,U as c,T as $,n as xe,t as L,w as Re}from"./@vue.f8dfc830.js";import"./lodash-es.a73406b7.js";import"./@vueuse.a2e59ee9.js";import"./@element-plus.0374639c.js";import"./@popperjs.36402333.js";import"./@ctrl.b082b0c1.js";import"./dayjs.7f1be2bc.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./memoize-one.4ee5c96d.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./@floating-ui.34a21088.js";import"./axios.075403c9.js";import"./pinia.4b196199.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.b6f240ee.js";import"./color.35874cfa.js";import"./clone.d8e67888.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.e6aad81b.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.79024f1a.js";import"./index.9321816e.js";import"./index.vue_vue_type_style_index_0_scoped_95d1884e_lang.af59f801.js";const Ie={class:"code-edit"},Te={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),je=d("div",{class:"form-tips"},"\u6307\u5B9A\u6811\u8868\u7684\u7236ID\uFF0C\u6BD4\u5982\uFF1Aparent_id",-1),ze={class:"w-80"},Ge=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),He={class:"w-80"},Le=d("div",{class:"form-tips"},"\u751F\u6210\u6587\u4EF6\u6240\u5728\u6A21\u5757",-1),Qe={class:"w-80"},We=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),Je={class:"w-80"},Ke=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),Me={class:"mt-4"},Xe=Q({name:"tableEdit"}),Ll=Q({...Xe,setup(Ye){const W=Ce(),J=De(),g=z("column"),U=z(!1),x=[{name:"\u4E00\u5BF9\u4E00",value:"has_one"},{name:"\u4E00\u5BF9\u591A",value:"has_many"}],t=G({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 w=0;const R=H(),h=H(),I=G({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"}]}),T=async(p,a,f)=>{var F,_;U.value=!0,await xe(),a&&f!==void 0&&((F=h.value)==null||F.setFormData(a),w=f),(_=h.value)==null||_.open(p)},K=p=>{const a=j.exports.cloneDeep(L(p));t.relations.push(a)},M=async p=>{const a=j.exports.cloneDeep(L(p));console.log(w),t.relations.splice(w,1,a)},X=p=>{t.relations.splice(p,1)},Y=async()=>{const p=await ke({id:W.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}=Ue({dict_type:{api:we},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),J.back()}catch(f){for(const F in f)Object.keys(I).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",Ie,[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(I)},{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",Te,[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"]),je])]),_: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",ze,[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"])]),Ge])]),_: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",He,[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"]),Le])]),_:1}),e(s,{label:"\u7C7B\u76EE\u5F55"},{default:u(()=>[d("div",Qe,[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"])]),We])]),_: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",Je,[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"]),Ke])]),_:1})]),_:1}),e(C,{label:"\u5173\u8054\u914D\u7F6E",name:"relations"},{default:u(()=>[e(k,{type:"primary",onClick:a[18]||(a[18]=l=>T("add"))},{icon:u(()=>[e(le,{name:"el-icon-Plus"})]),default:u(()=>[c(" \u65B0\u589E\u5173\u8054 ")]),_:1}),d("div",Me,[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=>T("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(U)?(i(),E(qe,{key:0,column:o(t).table_column,types:x,ref_key:"editRef",ref:h,onAdd:K,onEdit:M,onClose:a[19]||(a[19]=l=>U.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{Ll as default};