ProductForm-ae12a89b.js 6.4 KB

1
  1. import{ar as p,d as $,r as c,e as ee,f as ae,m as le,o as n,x as v,w as u,g as r,q as S,a,y as re,c as V,v as U,F as h,Q as te,i as ue,a_ as se,dX as oe,X as de,B as ie,E as ce,z as ne,A as pe,aW as me,aX as _e,j as ve,G as fe,D as ge,J as be,_ as ye,__tla as we}from"./index-d02d27ca.js";import{_ as Ve,__tla as Ue}from"./Dialog-08baefc8.js";import{a as T,D as F,__tla as he}from"./dict-b0946387.js";import{g as Ie,__tla as Pe}from"./index-2e932cd7.js";import{h as xe,d as ke}from"./tree-0af4953a.js";import{g as qe,__tla as Ce}from"./index-6f4e9084.js";import{u as De,__tla as Re}from"./useMessage-57af7504.js";let I,N,O,z,M,j,P,Se=Promise.all([(()=>{try{return we}catch{}})(),(()=>{try{return Ue}catch{}})(),(()=>{try{return he}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return Ce}catch{}})(),(()=>{try{return Re}catch{}})()]).then(async()=>{O=async o=>await p.get({url:"/crm/product/page",params:o}),P=async o=>await p.get({url:"/crm/product/get?id="+o}),M=async o=>await p.delete({url:"/crm/product/delete?id="+o}),j=async o=>await p.download({url:"/crm/product/export-excel",params:o}),N=async o=>await p.get({url:"/crm/product/operate-log-page",params:o}),I=ye($({name:"CrmProductForm",__name:"ProductForm",emits:["success"],setup(o,{expose:X,emit:A}){const{t:g}=ue(),x=De(),m=c(!1),k=c(""),_=c(!1),q=c(""),B=ee().getUser.id,t=c({id:void 0,name:void 0,no:void 0,unit:void 0,price:NaN,status:void 0,categoryId:void 0,description:void 0,ownerUserId:-1}),E=ae({name:[{required:!0,message:"\u4EA7\u54C1\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],no:[{required:!0,message:"\u4EA7\u54C1\u7F16\u7801\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],status:[{required:!0,message:"\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],categoryId:[{required:!0,message:"\u4EA7\u54C1\u5206\u7C7BID\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],ownerUserId:[{required:!0,message:"\u8D1F\u8D23\u4EBA\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],price:[{required:!0,message:"\u4EF7\u683C\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),f=c();X({open:async(s,l)=>{if(m.value=!0,k.value=g("action."+s),q.value=s,Q(),l){_.value=!0;try{t.value=await P(l),t.value.price=Number(se(t.value.price))}finally{_.value=!1}}else t.value.ownerUserId=B}});const G=A,J=async()=>{if(f&&await f.value.validate()){_.value=!0;try{const s={...t.value,price:oe(t.value.price)};q.value==="create"?(await(async l=>await p.post({url:"/crm/product/create",data:l}))(s),x.success(g("common.createSuccess"))):(await(async l=>await p.put({url:"/crm/product/update",data:l}))(s),x.success(g("common.updateSuccess"))),m.value=!1,G("success")}finally{_.value=!1}}},Q=()=>{var s;t.value={id:void 0,name:void 0,no:void 0,unit:void 0,price:NaN,status:void 0,categoryId:void 0,description:void 0,ownerUserId:-1},(s=f.value)==null||s.resetFields()},C=c([]),D=c([]);return le(async()=>{const s=await Ie({});C.value=xe(s,"id","parentId"),D.value=await qe()}),(s,l)=>{const b=de,d=ie,i=ce,y=ne,w=pe,W=me,H=_e,K=ve,L=fe,R=ge,Y=Ve,Z=be;return n(),v(Y,{title:a(k),modelValue:a(m),"onUpdate:modelValue":l[9]||(l[9]=e=>te(m)?m.value=e:null)},{footer:u(()=>[r(R,{onClick:J,type:"primary",disabled:a(_)},{default:u(()=>[S("\u786E \u5B9A")]),_:1},8,["disabled"]),r(R,{onClick:l[8]||(l[8]=e=>m.value=!1)},{default:u(()=>[S("\u53D6 \u6D88")]),_:1})]),default:u(()=>[re((n(),v(L,{ref_key:"formRef",ref:f,model:a(t),rules:a(E),"label-width":"100px"},{default:u(()=>[r(K,null,{default:u(()=>[r(i,{span:12},{default:u(()=>[r(d,{label:"\u4EA7\u54C1\u540D\u79F0",prop:"name"},{default:u(()=>[r(b,{modelValue:a(t).name,"onUpdate:modelValue":l[0]||(l[0]=e=>a(t).name=e),placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),r(i,{span:12},{default:u(()=>[r(d,{label:"\u8D1F\u8D23\u4EBA",prop:"ownerUserId"},{default:u(()=>[r(w,{modelValue:a(t).ownerUserId,"onUpdate:modelValue":l[1]||(l[1]=e=>a(t).ownerUserId=e),placeholder:"\u8BF7\u9009\u62E9\u8D1F\u8D23\u4EBA",disabled:a(t).id,class:"w-1/1"},{default:u(()=>[(n(!0),V(h,null,U(a(D),e=>(n(),v(y,{key:e.id,label:e.nickname,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),r(i,{span:12},{default:u(()=>[r(d,{label:"\u4EA7\u54C1\u7C7B\u578B",prop:"categoryId"},{default:u(()=>[r(W,{modelValue:a(t).categoryId,"onUpdate:modelValue":l[2]||(l[2]=e=>a(t).categoryId=e),options:a(C),props:a(ke),class:"w-1/1",clearable:"",placeholder:"\u8BF7\u9009\u62E9\u4EA7\u54C1\u7C7B\u578B",filterable:""},null,8,["modelValue","options","props"])]),_:1})]),_:1}),r(i,{span:12},{default:u(()=>[r(d,{label:"\u4EA7\u54C1\u5355\u4F4D",prop:"unit"},{default:u(()=>[r(w,{modelValue:a(t).unit,"onUpdate:modelValue":l[3]||(l[3]=e=>a(t).unit=e),class:"w-1/1",placeholder:"\u8BF7\u9009\u62E9\u5355\u4F4D"},{default:u(()=>[(n(!0),V(h,null,U(a(T)(a(F).CRM_PRODUCT_UNIT),e=>(n(),v(y,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),r(i,{span:12},{default:u(()=>[r(d,{label:"\u4EA7\u54C1\u7F16\u7801",prop:"no"},{default:u(()=>[r(b,{modelValue:a(t).no,"onUpdate:modelValue":l[4]||(l[4]=e=>a(t).no=e),placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u7F16\u7801"},null,8,["modelValue"])]),_:1})]),_:1}),r(i,{span:12},{default:u(()=>[r(d,{label:"\u4EF7\u683C",prop:"price"},{default:u(()=>[r(H,{modelValue:a(t).price,"onUpdate:modelValue":l[5]||(l[5]=e=>a(t).price=e),placeholder:"\u8BF7\u8F93\u5165\u4EF7\u683C",min:0,precision:2,step:.1,class:"w-full!"},null,8,["modelValue"])]),_:1})]),_:1}),r(i,{span:12},{default:u(()=>[r(d,{label:"\u4EA7\u54C1\u63CF\u8FF0",prop:"description"},{default:u(()=>[r(b,{modelValue:a(t).description,"onUpdate:modelValue":l[6]||(l[6]=e=>a(t).description=e),placeholder:"\u8BF7\u8F93\u5165\u4EA7\u54C1\u63CF\u8FF0"},null,8,["modelValue"])]),_:1})]),_:1}),r(i,{span:12},{default:u(()=>[r(d,{label:"\u4E0A\u67B6\u72B6\u6001",prop:"status"},{default:u(()=>[r(w,{modelValue:a(t).status,"onUpdate:modelValue":l[7]||(l[7]=e=>a(t).status=e),placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",class:"w-1/1"},{default:u(()=>[(n(!0),V(h,null,U(a(T)(a(F).CRM_PRODUCT_STATUS),e=>(n(),v(y,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])),[[Z,a(_)]])]),_:1},8,["title","modelValue"])}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/views/crm/product/ProductForm.vue"]]),z=Object.freeze(Object.defineProperty({__proto__:null,default:I},Symbol.toStringTag,{value:"Module"}))});export{I as P,Se as __tla,N as a,O as b,z as c,M as d,j as e,P as g};