SourceForm-655f89a7.js 2.6 KB

1
  1. import{aA as o,d as U,P as q,r as c,x as J,o as g,C as b,A as i,f as m,a as l,D as x,k as R,a2 as T,a9 as W,V as Z,W as B,J as E,Z as G,_ as H,__tla as I}from"./index-286756b9.js";import{_ as K,__tla as L}from"./Dialog-4c2de357.js";import{u as N,__tla as Q}from"./useMessage-084b1e70.js";let v,d,V,X=Promise.all([(()=>{try{return I}catch{}})(),(()=>{try{return L}catch{}})(),(()=>{try{return Q}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=H(U({name:"SourceForm",__name:"SourceForm",emits:["success"],setup(e,{expose:h,emit:k}){const{t:_}=q(),f=N(),r=c(!1),y=c(""),s=c(!1),S=c(""),u=c({id:void 0,name:void 0}),F=J({name:[{required:!0,message:"\u6765\u6E90\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),p=c();h({open:async(a,t)=>{if(r.value=!0,y.value=_("action."+a),S.value=a,C(),t){s.value=!0;try{u.value=await d.getSource(t)}finally{s.value=!1}}}});const P=k,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"))),r.value=!1,P("success")}finally{s.value=!1}},C=()=>{var a;u.value={id:void 0,name:void 0},(a=p.value)==null||a.resetFields()};return(a,t)=>{const j=W,A=Z,D=B,w=E,M=K,O=G;return g(),b(M,{title:l(y),modelValue:l(r),"onUpdate:modelValue":t[2]||(t[2]=n=>T(r)?r.value=n:null)},{footer:i(()=>[m(w,{onClick:z,type:"primary",disabled:l(s)},{default:i(()=>[x("\u786E \u5B9A")]),_:1},8,["disabled"]),m(w,{onClick:t[1]||(t[1]=n=>r.value=!1)},{default:i(()=>[x("\u53D6 \u6D88")]),_:1})]),default:i(()=>[R((g(),b(D,{ref_key:"formRef",ref:p,model:l(u),rules:l(F),"label-width":"100px"},{default:i(()=>[m(A,{label:"\u6765\u6E90\u540D\u79F0",prop:"name"},{default:i(()=>[m(j,{modelValue:l(u).name,"onUpdate:modelValue":t[0]||(t[0]=n=>l(u).name=n),placeholder:"\u8BF7\u8F93\u5165\u6765\u6E90\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[O,l(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,X as __tla,d as a,V as b};