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