1 |
- import{a4 as ue,au as V,a7 as M,_ as le,d as ae,n as oe,w as D,W as te,aY as ne,r as F,at as re,H as de,l as u,o as f,G as E,C as o,j as e,aT as r,aL as d,aP as v,c as w,F as I,D as q,aQ as g,b7 as se,b8 as ie,b9 as x,ba as pe,M as L,L as me,h as N,aR as h,J as T,b0 as P,a as ce,aK as ge,az as fe,aW as j}from"./index.js";import{c as G,t as ve}from"./status.0f771e9a.js";import{b as Ce,c as _e}from"./index.0e8d4646.js";import{c as be,I as K,a as Fe,b as Ee,d as Be}from"./InvoiceTitle.77bebe.js";import ye from"./index.08977e.js";import Ve from"./ChildGoodEditModal.7967d3.js";import De from"./query-category.fa03a8.js";import"./basic-descriptions.898fa2c0.js";import"./use-page-search.c6a73876.js";import"./columns.57fd1333.js";import"./tootip.f8ec1491.js";function he(){const S=ue(),A=V(),B=M(()=>V().companyList),k=M(()=>V().currentCompany||{}),y=p=>V().companyList=p;function i(p,a){const b=({companyCode:U})=>U===p,m=(a||B.value).find(b);return m&&m.companyCode&&(m.companyNo=m.companyCode),S.isSuperUser.value&&(m.companyName=(p==null?void 0:p.name)||"\u6240\u6709\u516C\u53F8",m.companyNo=(p==null?void 0:p.code)||""),A.setCurrentCompany(m),m}return{list:B,setList:y,current:k,setCurrent:i}}const Ae={seller_code:[{required:!0,message:"\u8BF7\u9009\u62E9\u9500\u552E\u65B9\u516C\u53F8",trigger:"change"}],buyer_code:[{required:!0,message:"\u8BF7\u9009\u62E9\u8D2D\u4E70\u65B9\u516C\u53F8",trigger:"change"}],good_source:[{required:!0,message:"\u8BF7\u9009\u62E9\u5546\u54C1\u6765\u6E90",trigger:"change"}],skuCode:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u7F16\u53F7",trigger:"change"}],good_type:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",trigger:"change"}],is_combind:[{required:!0,message:"\u8BF7\u9009\u62E9\u7EC4\u5408\u7C7B\u578B",trigger:"change"}],goodName:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BA2\u5355\u5546\u54C1\u540D\u79F0",trigger:"change"}],inv_good_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u53D1\u7968\u5546\u54C1\u540D\u79F0",trigger:"change"}],unit_price:[{required:!0,message:"\u8BF7\u8F93\u5165\u6210\u672C\u7A0E\u540E\u5355\u4EF7",trigger:"change"}],unit:[{required:!0,message:"\u8BF7\u9009\u62E9\u5355\u4F4D",trigger:"change"}],unit_weight:[{required:!0,message:"\u8BF7\u9009\u62E9\u91CD\u91CF",trigger:"change"}],subunit_price:[{required:!0,message:"\u8BF7\u8F93\u5165\u6210\u672C\u7A0E\u524D\u5355\u4EF7",trigger:"change"}],cat_code:[{required:!0,message:"\u8BF7\u9009\u62E9\u8FDB\u9879\u7C7B\u76EE",trigger:"change"}],inv_type:[{required:!0,message:"\u8BF7\u9009\u62E9\u53D1\u7968\u7C7B\u578B",trigger:"change"}],cat_tax:[{required:!0,message:"\u8BF7\u9009\u62E9\u8FDB\u9879\u7A0E\u7387",trigger:"change"}],basic_status:[{required:!0,message:"\u8BF7\u9009\u62E9\u8FDB\u9879\u6210\u672C\u7C7B\u578B",trigger:"change"}]},ke={class:"w-full flex justify-between"},Ue={class:"w-full flex justify-end"},we=ae({__name:"BaseForm",setup(S){const{current:A}=he(),B=M(()=>({...Ae,skuCode:[{required:a.value.good_source=="1",message:"\u8BF7\u8F93\u5165\u5546\u54C1\u7F16\u53F7",trigger:"change"}]})),k=oe(),y=D(null),i=te({editVisible:!1,visible:!1,companies:[],index:-1,data:{}}),p=ne({success(){k.push("/invoiceInOut/productManager")}}),a=D(be()),b=D({}),m=D({});async function U(){var n;if(a.value.is_combind==="1"&&a.value.childArr.length===0){fe.warning("\u8BF7\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u5B50\u5546\u54C1");return}a.value.is_combind==="0"&&(a.value.childArr=[]);try{await((n=y.value)==null?void 0:n.validate()),p.run(_e({...a.value,skuCode:a.value.good_source=="1"?a.value.skuCode:W(),childArr:a.value.childArr.map(({child_id:l,child_num:s})=>({child_id:l,child_num:s}))}))}catch{}}function R(n,l){if(n?a.value.seller_name=l.name:(l=i.companies.find(s=>s.company_license===a.value.buyer_code),a.value.buyer_name=l.company_name),!l)return n?b.value={}:m.value={};n?b.value=Fe(Be(l)):m.value=Ee(l)}const H=R.bind(null,!0),z=R.bind(null,!1);function O(n){const l=a.value.childArr.map(({id:c})=>c),s=[];for(const c of n)l.includes(c.id)||s.push(c);a.value.childArr=[...a.value.childArr,...s]}function Y(n){i.index=n,i.editVisible=!0,i.data={...a.value.childArr[n]}}(async function(){const l=await Ce({size:1e4});if(l.code==0){i.companies=[...l.data.list];const s=i.companies.find(c=>c.companyNo===A.value.companyNo);a.value.buyer_code=s.company_license,z(s)}})();function Q(n,l){return n=Math.ceil(n),l=Math.floor(l),Math.floor(Math.random()*(l-n+1))+n}function W(){let n=j(new Date).format("YY-MM-DD HH:mm:ss");n=n.replace(/-/g,""),n=n.replace(/:/g,""),n=n.replace(/ /g,"");let l=String(j().get("millisecond"));l.length===2&&(l="0"+l),l.length===1&&(l="00"+l);let s=a.value.is_combind=="0"?"PKU":"PSU";const c=Q(10,99);return s+n+l+c}function $(n){n=="2"&&(a.value.skuCode="")}return(n,l)=>{const s=F("ElInput"),c=F("ElRow"),C=F("ElTableColumn"),J=F("ElTag"),X=F("ElTable"),Z=re("loading");return de((f(),E(u(ge),{ref_key:"formRef",ref:y,rules:B.value,model:a.value},{default:o(()=>[e(c,{gutter:10},{default:o(()=>[e(u(r),{span:12},{default:o(()=>[e(u(d),{label:"\u8D2D\u4E70\u65B9\u516C\u53F8",prop:"buyer_code"},{default:o(()=>[e(u(v),{style:{width:"100%"},placeholder:"\u8D2D\u4E70\u65B9\u516C\u53F8",modelValue:a.value.buyer_code,"onUpdate:modelValue":l[0]||(l[0]=t=>a.value.buyer_code=t),onChange:u(z),disabled:""},{default:o(()=>[(f(!0),w(I,null,q(i.companies,t=>(f(),E(u(g),{label:t.company_name,value:t.company_license},null,8,["label","value"]))),256))]),_:1},8,["modelValue","onChange"])]),_:1}),e(K,{detail:m.value},null,8,["detail"])]),_:1}),e(u(r),{span:12},{default:o(()=>[e(u(d),{label:"\u9500\u552E\u65B9\u516C\u53F8",prop:"seller_code"},{default:o(()=>[e(u(se),{style:{width:"100%"},"request-prop":"name",api:u(ie),"response-val-prop":"registercode",placeholder:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934",value:a.value.seller_code,"onUpdate:value":l[1]||(l[1]=t=>a.value.seller_code=t),"response-label-prop":"name",onItemChange:u(H)},null,8,["api","value","onItemChange"])]),_:1}),e(K,{detail:b.value},null,8,["detail"])]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u5546\u54C1\u6765\u6E90",prop:"good_source"},{default:o(()=>[e(u(v),{onChange:$,modelValue:a.value.good_source,"onUpdate:modelValue":l[2]||(l[2]=t=>a.value.good_source=t),placeholder:"\u5546\u54C1\u6765\u6E90",style:{width:"100%"}},{default:o(()=>[e(u(g),{label:"\u91C7\u9500\u5546\u54C1",value:"1"}),e(u(g),{label:"\u975E\u91C7\u9500\u5546\u54C1",value:"2"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u7EC4\u5408\u7C7B\u578B",prop:"is_combind"},{default:o(()=>[e(u(v),{style:{width:"100%"},modelValue:a.value.is_combind,"onUpdate:modelValue":l[3]||(l[3]=t=>a.value.is_combind=t)},{default:o(()=>[e(u(g),{label:"\u975E\u7EC4\u5408\u5546\u54C1",value:"0"}),e(u(g),{label:"\u7EC4\u5408\u5546\u54C1",value:"1"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",prop:"good_type"},{default:o(()=>[e(u(v),{modelValue:a.value.good_type,"onUpdate:modelValue":l[4]||(l[4]=t=>a.value.good_type=t),placeholder:"\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",style:{width:"100%"}},{default:o(()=>[(f(!0),w(I,null,q(u(G),t=>(f(),E(u(g),{value:t.value,label:t.label},null,8,["value","label"]))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u8FDB\u9879\u6210\u672C\u72B6\u6001",prop:"basic_status"},{default:o(()=>[e(u(v),{modelValue:a.value.basic_status,"onUpdate:modelValue":l[5]||(l[5]=t=>a.value.basic_status=t),placeholder:"\u8FDB\u9879\u6210\u672C\u72B6\u6001"},{default:o(()=>[e(u(g),{label:"\u771F\u5B9E\u6210\u672C\u4FE1\u606F",value:"1"}),e(u(g),{label:"\u9884\u4F30\u6210\u672C\u4FE1\u606F",value:"2"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:12},{default:o(()=>[e(u(d),{label:"\u53D1\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name"},{default:o(()=>[e(s,{modelValue:a.value.inv_good_name,"onUpdate:modelValue":l[6]||(l[6]=t=>a.value.inv_good_name=t),placeholder:"\u53D1\u7968\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:12},{default:o(()=>[e(u(d),{label:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0",prop:"goodName"},{default:o(()=>[e(s,{modelValue:a.value.goodName,"onUpdate:modelValue":l[7]||(l[7]=t=>a.value.goodName=t),placeholder:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode"},{default:o(()=>[e(s,{placeholder:"\u5546\u54C1\u7F16\u53F7",modelValue:a.value.skuCode,"onUpdate:modelValue":l[8]||(l[8]=t=>a.value.skuCode=t),disabled:a.value.good_source=="2"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u5355\u4F4D",prop:"unit"},{default:o(()=>[e(s,{modelValue:a.value.unit,"onUpdate:modelValue":l[9]||(l[9]=t=>a.value.unit=t),placeholder:"\u5355\u4F4D"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u89C4\u683C",prop:"spec"},{default:o(()=>[e(s,{modelValue:a.value.spec,"onUpdate:modelValue":l[10]||(l[10]=t=>a.value.spec=t),placeholder:"\u89C4\u683C"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u91CD\u91CF",prop:"unit_weight"},{default:o(()=>[e(u(x),{unit:"g",modelValue:a.value.unit_weight,"onUpdate:modelValue":l[11]||(l[11]=t=>a.value.unit_weight=t),placeholder:"\u91CD\u91CF",KeepDecimals:3},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u53D1\u7968\u7C7B\u578B",prop:"inv_type"},{default:o(()=>[e(u(v),{modelValue:a.value.inv_type,"onUpdate:modelValue":l[12]||(l[12]=t=>a.value.inv_type=t),placeholder:"\u53D1\u7968\u7C7B\u578B",style:{width:"100%"}},{default:o(()=>[e(u(g),{label:"\u666E\u7968",value:"0"}),e(u(g),{label:"\u4E13\u7968",value:"1"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u6210\u672C\u7A0E\u524D\u5355\u4EF7",prop:"subunit_price"},{default:o(()=>[e(u(x),{unit:"\u5143",modelValue:a.value.subunit_price,"onUpdate:modelValue":l[13]||(l[13]=t=>a.value.subunit_price=t),placeholder:"\u6210\u672C\u7A0E\u524D\u5355\u4EF7",KeepDecimals:8},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u6210\u672C\u7A0E\u540E\u5355\u4EF7",prop:"unit_price"},{default:o(()=>[e(u(x),{unit:"\u5143",modelValue:a.value.unit_price,"onUpdate:modelValue":l[14]||(l[14]=t=>a.value.unit_price=t),placeholder:"\u6210\u672C\u7A0E\u540E\u5355\u4EF7",KeepDecimals:8},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u5546\u54C1\u4EE3\u7801",prop:"good_code"},{default:o(()=>[e(s,{modelValue:a.value.good_code,"onUpdate:modelValue":l[15]||(l[15]=t=>a.value.good_code=t),placeholder:"\u5546\u54C1\u4EE3\u7801"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:12},{default:o(()=>[e(u(d),{label:"\u8FDB\u9879\u7A0E\u76EE",prop:"cat_code"},{default:o(()=>[e(De,{modelValue:a.value.cat_code,"onUpdate:modelValue":l[16]||(l[16]=t=>a.value.cat_code=t)},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u8FDB\u9879\u7A0E\u7387",prop:"cat_tax"},{default:o(()=>[e(u(v),{modelValue:a.value.cat_tax,"onUpdate:modelValue":l[17]||(l[17]=t=>a.value.cat_tax=t),placeholder:"\u8FDB\u9879\u7A0E\u7387"},{default:o(()=>[(f(!0),w(I,null,q(u(ve),t=>(f(),E(u(g),pe({ref_for:!0},t),null,16))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:o(()=>[e(u(d),{label:"\u5206\u5149",prop:"spectral"},{default:o(()=>[e(s,{modelValue:a.value.spectral,"onUpdate:modelValue":l[18]||(l[18]=t=>a.value.spectral=t),placeholder:"\u5206\u5149",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),a.value.is_combind=="1"?(f(),E(c,{key:0},{default:o(()=>[e(u(r),{span:24},{default:o(()=>[e(u(d),{label:"\u5B50\u5546\u54C1"},{default:o(()=>[e(X,{border:"",size:"small",data:a.value.childArr},{default:o(()=>[e(C,{label:"\u6BD4\u4F8B",prop:"child_num",width:"60px"}),e(C,{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode"}),e(C,{label:"\u5546\u54C1\u7C7B\u578B",prop:"good_type"},{default:o(({row:t})=>[e(J,{size:"small"},{default:o(()=>{var _;return[L(me((_=u(G).find(ee=>ee.value==t.good_type))==null?void 0:_.label),1)]}),_:2},1024)]),_:1}),e(C,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName"}),e(C,{width:"80px"},{header:o(()=>[N("div",ke,[l[23]||(l[23]=N("p",null,"\u64CD\u4F5C",-1)),e(u(h),{link:"",size:"small",type:"primary",icon:u(T)("add"),onClick:l[19]||(l[19]=t=>i.visible=!0)},null,8,["icon"])])]),default:o(({$index:t})=>[e(u(P),{content:"\u5220\u9664",placement:"top"},{default:o(()=>[e(u(h),{link:"",size:"small",type:"danger",icon:u(T)("delete"),onClick:_=>a.value.childArr.splice(t,1)},null,8,["icon","onClick"])]),_:2},1024),e(u(P),{content:"\u7F16\u8F91",placement:"top"},{default:o(()=>[e(u(h),{link:"",size:"small",type:"primary",icon:u(T)("edits"),onClick:_=>Y(t)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1})]),_:1})]),_:1})):ce("v-if",!0),N("div",Ue,[e(u(h),{type:"primary",onClick:U},{default:o(()=>l[24]||(l[24]=[L("\u4FDD\u5B58")])),_:1})]),e(ye,{visible:i.visible,"onUpdate:visible":l[20]||(l[20]=t=>i.visible=t),onSubmit:O},null,8,["visible"]),e(Ve,{visible:i.editVisible,"onUpdate:visible":l[21]||(l[21]=t=>i.editVisible=t),index:i.index,data:i.data,onSubmit:l[22]||(l[22]=(t,_)=>a.value.childArr[t]={..._})},null,8,["visible","index","data"])]),_:1},8,["rules","model"])),[[Z,u(p).loading]])}}});var je=le(we,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/productManager/components/BaseForm.vue"]]);export{je as default};
|