SourceForm-b0f1bfb5.js 2.6 KB

1
  1. import{ar as o,d as q,i as B,r as c,f as G,o as g,x as b,w as i,g as m,a as r,n as x,y as J,P as R,W as T,B as W,G as A,D as E,J as H,_ as I,__tla as K}from"./index-b362e1d5.js";import{_ as L,__tla as N}from"./Dialog-71bebaff.js";import{u as Q,__tla as X}from"./useMessage-7c1dd10e.js";let v,d,V,Y=Promise.all([(()=>{try{return K}catch{}})(),(()=>{try{return N}catch{}})(),(()=>{try{return X}catch{}})()]).then(async()=>{d={getSourcePage:async e=>await o.get({url:"/distri/source/page",params:e}),getSource:async e=>await o.get({url:"/distri/source/get?id="+e}),createSource:async e=>await o.post({url:"/distri/source/create",data:e}),updateSource:async e=>await o.put({url:"/distri/source/update",data:e}),deleteSource:async e=>await o.delete({url:"/distri/source/delete?id="+e}),exportSource:async e=>await o.download({url:"/distri/source/export-excel",params:e})},v=I(q({name:"SourceForm",__name:"SourceForm",emits:["success"],setup(e,{expose:h,emit:F}){const{t:_}=B(),f=Q(),l=c(!1),y=c(""),s=c(!1),S=c(""),u=c({id:void 0,name:void 0}),P=G({name:[{required:!0,message:"\u6765\u6E90\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),p=c();h({open:async(a,t)=>{if(l.value=!0,y.value=_("action."+a),S.value=a,j(),t){s.value=!0;try{u.value=await d.getSource(t)}finally{s.value=!1}}}});const k=F,z=async()=>{await p.value.validate(),s.value=!0;try{const a=u.value;S.value==="create"?(await d.createSource(a),f.success(_("common.createSuccess"))):(await d.updateSource(a),f.success(_("common.updateSuccess"))),l.value=!1,k("success")}finally{s.value=!1}},j=()=>{var a;u.value={id:void 0,name:void 0},(a=p.value)==null||a.resetFields()};return(a,t)=>{const C=T,D=W,O=A,w=E,M=L,U=H;return g(),b(M,{title:r(y),modelValue:r(l),"onUpdate:modelValue":t[2]||(t[2]=n=>R(l)?l.value=n:null)},{footer:i(()=>[m(w,{onClick:z,type:"primary",disabled:r(s)},{default:i(()=>[x("\u786E \u5B9A")]),_:1},8,["disabled"]),m(w,{onClick:t[1]||(t[1]=n=>l.value=!1)},{default:i(()=>[x("\u53D6 \u6D88")]),_:1})]),default:i(()=>[J((g(),b(O,{ref_key:"formRef",ref:p,model:r(u),rules:r(P),"label-width":"100px"},{default:i(()=>[m(D,{label:"\u6765\u6E90\u540D\u79F0",prop:"name"},{default:i(()=>[m(C,{modelValue:r(u).name,"onUpdate:modelValue":t[0]||(t[0]=n=>r(u).name=n),placeholder:"\u8BF7\u8F93\u5165\u6765\u6E90\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[U,r(s)]])]),_:1},8,["title","modelValue"])}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/system/distri/source/SourceForm.vue"]]),V=Object.freeze(Object.defineProperty({__proto__:null,default:v},Symbol.toStringTag,{value:"Module"}))});export{v as S,Y as __tla,d as a,V as b};