1 |
- import{as as n,d as P,B as T,r,g as Y,o as I,k as x,w as s,i as c,a as e,l as k,D as A,R as G,Y as H,I as K,J as L,s as N,M as Q,_ as W,__tla as X}from"./index-2f799233.js";import{_ as Z,__tla as $}from"./Dialog-6fd39e06.js";import{E as aa,__tla as ea}from"./el-tree-select-ef4257fc.js";import{d as ta,h as la}from"./tree-0af4953a.js";import{u as ra,__tla as sa}from"./useMessage-e567ad40.js";let y,D,z,C,v,oa=Promise.all([(()=>{try{return X}catch{}})(),(()=>{try{return $}catch{}})(),(()=>{try{return ea}catch{}})(),(()=>{try{return sa}catch{}})()]).then(async()=>{v=async o=>await n.get({url:"/infra/demo02-category/list",params:o}),z=async o=>await n.delete({url:"/infra/demo02-category/delete?id="+o}),C=async o=>await n.download({url:"/infra/demo02-category/export-excel",params:o}),y=W(P({__name:"Demo02CategoryForm",emits:["success"],setup(o,{expose:S,emit:F}){const{t:m}=T(),g=ra(),d=r(!1),w=r(""),u=r(!1),h=r(""),l=r({id:void 0,name:void 0,parentId:void 0}),U=Y({name:[{required:!0,message:"\u540D\u5B57\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],parentId:[{required:!0,message:"\u7236\u7EA7\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),p=r(),_=r();S({open:async(t,a)=>{if(d.value=!0,w.value=m("action."+t),h.value=t,M(),a){u.value=!0;try{l.value=await(async f=>await n.get({url:"/infra/demo02-category/get?id="+f}))(a)}finally{u.value=!1}}await O()}});const j=F,q=async()=>{await p.value.validate(),u.value=!0;try{const t=l.value;h.value==="create"?(await(async a=>await n.post({url:"/infra/demo02-category/create",data:a}))(t),g.success(m("common.createSuccess"))):(await(async a=>await n.put({url:"/infra/demo02-category/update",data:a}))(t),g.success(m("common.updateSuccess"))),d.value=!1,j("success")}finally{u.value=!1}},M=()=>{var t;l.value={id:void 0,name:void 0,parentId:void 0},(t=p.value)==null||t.resetFields()},O=async()=>{_.value=[];const t=await v(),a={id:0,name:"\u9876\u7EA7\u793A\u4F8B\u5206\u7C7B",children:[]};a.children=la(t,"id","parentId"),_.value.push(a)};return(t,a)=>{const f=H,b=K,R=aa,B=L,V=N,E=Z,J=Q;return I(),x(E,{title:e(w),modelValue:e(d),"onUpdate:modelValue":a[3]||(a[3]=i=>G(d)?d.value=i:null)},{footer:s(()=>[c(V,{onClick:q,type:"primary",disabled:e(u)},{default:s(()=>[k("\u786E \u5B9A")]),_:1},8,["disabled"]),c(V,{onClick:a[2]||(a[2]=i=>d.value=!1)},{default:s(()=>[k("\u53D6 \u6D88")]),_:1})]),default:s(()=>[A((I(),x(B,{ref_key:"formRef",ref:p,model:e(l),rules:e(U),"label-width":"100px"},{default:s(()=>[c(b,{label:"\u540D\u5B57",prop:"name"},{default:s(()=>[c(f,{modelValue:e(l).name,"onUpdate:modelValue":a[0]||(a[0]=i=>e(l).name=i),placeholder:"\u8BF7\u8F93\u5165\u540D\u5B57"},null,8,["modelValue"])]),_:1}),c(b,{label:"\u7236\u7EA7\u7F16\u53F7",prop:"parentId"},{default:s(()=>[c(R,{modelValue:e(l).parentId,"onUpdate:modelValue":a[1]||(a[1]=i=>e(l).parentId=i),data:e(_),props:e(ta),"check-strictly":"","default-expand-all":"",placeholder:"\u8BF7\u9009\u62E9\u7236\u7EA7\u7F16\u53F7"},null,8,["modelValue","data","props"])]),_:1})]),_:1},8,["model","rules"])),[[J,e(u)]])]),_:1},8,["title","modelValue"])}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/views/infra/demo/demo02/Demo02CategoryForm.vue"]]),D=Object.freeze(Object.defineProperty({__proto__:null,default:y},Symbol.toStringTag,{value:"Module"}))});export{y as D,oa as __tla,D as a,z as d,C as e,v as g};
|