moreShopAdmin/build/admin/assets/edit.25e7ff94.js

2 lines
16 KiB
JavaScript
Raw Normal View History

2024-11-15 19:58:31 +08:00
import{_ as fe}from"./index.b9ee2930.js";import{m as H,_ as ce,af as Ve,r as L,aT as W,s as j,d as C,bb as Ee,ag as Be,aZ as ye,a_ as ve,bc as Ce,ah as Ae,p,q as B,t as l,v as a,u as o,i as De,x as d,V as v,W as A,y,a2 as b,A as I,n as ke,ba as z,w as ge,b5 as Ue,aW as we,aX as qe,b6 as xe,aU as $e,b3 as Ie,b4 as Re,b7 as Te,ae as he,aY as Ne}from"./.pnpm.1b0299fb.js";import{_ as Pe}from"./index.vue_vue_type_script_setup_true_lang.bbc9e61d.js";import{f as Q,b as Oe}from"./index.689cfa31.js";import{t as Se,g as Le}from"./code.575733be.js";import{a as We}from"./useDictOptions.e9843f63.js";import{d as je}from"./dict.91e59095.js";import{m as ze}from"./menu.f68ea208.js";import{_ as Qe}from"./relations-add.vue_vue_type_script_setup_true_lang.40d8764e.js";import{l as G}from"./lodash.c3b66c05.js";import"./@vueuse.72d44d91.js";import"./@vue.9d708d7c.js";import"./index.6c48d0ba.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.abac7546.js";const Ge={class:"code-edit"},He={class:"w-80"},Ke={class:"w-80"},Xe={class:"w-80"},Ye={class:"w-80"},Ze={class:"w-80"},Je={class:"w-80"},Me={class:"w-80"},el={class:"w-80"},ll={class:"mt-4"},ul=H({name:"tableEdit"}),Vl=H({...ul,setup(al){const K=ce(),X=Ve(),U=L("column"),w=L(!1),R=[{name:"\u4E00\u5BF9\u4E00",value:"has_one"},{name:"\u4E00\u5BF9\u591A",value:"has_many"}],t=W({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 q=0;const T=j(),x=j(),h=W({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"}]}),N=async(n,e,V)=>{var f,_;w.value=!0,await ke(),e&&V!==void 0&&((f=x.value)==null||f.setFormData(e),q=V),(_=x.value)==null||_.open(n)},Y=n=>{const e=G.exports.cloneDeep(z(n));t.relations.push(e)},Z=async n=>{const e=G.exports.cloneDeep(z(n));console.log(q),t.relations.splice(q,1,e)},J=n=>{t.relations.splice(n,1)},M=async()=>{const n=await Se({id:K.query.id});Object.keys(t).forEach(e=>{t[e]=n[e]}),ge(()=>t.generate_type,e=>{e==1&&Q.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:P}=We({dict_type:{api:je},menu:{api:ze,transformData(n){const e={id:0,name:"\u9876\u7EA7",children:[]};return e.children=n,[e]}}}),ee=async()=>{var n,e;try{await((n=T.value)==null?void 0:n.validate()),await Le(t),X.back()}catch(V){for(const f in V)Object.keys(h).includes(f)&&Q.msgError((e=V[f][0])==null?void 0:e.message)}};M();const le=C(()=>!t.table_column.findIndex(n=>n.is_required==0)),ue=n=>{t.table_column.forEach(e=>{e.is_required=n})},ae=C(()=>!t.table_column.findIndex(n=>n.is_insert==0)),te=n=>{t.table_column.forEach(e=>{e.is_insert=n})},oe=C(()=>!t.table_column.findIndex(n=>n.is_update==0)),ne=n=>{t.table_column.forEach(e=>{e.is_update=n})},de=C(()=>!t.table_column.findIndex(n=>n.is_lists==0)),se=n=>{t.table_column.forEach(e=>{e.is_lists=n})},me=C(()=>!t.table_column.findIndex(n=>n.is_query==0)),re=n=>{t.table_column.forEach(e=>{e.is_query=n})};return(n,e)=>{const V=Ee,f=Ue,_=we,r=qe,D=Be,i=xe,F=$e,m=Ie,E=Re,O=Te,c=ye,k=ve,ie=Ce,pe=Oe,g=he,S=Pe,_e=Ae,be=Ne,Fe=fe;return p(),B("div",Ge,[l(f,{class:"!border-none",shadow:"never"},{default:a(()=>[l(V,{content:"\u7F16\u8F91\u6570\u636E\u8868",onBack:e[0]||(e[0]=u=>n.$router.back())})]),_:1}),l(f,{class:"