1 |
- import{a4 as le,au as V,a7 as M,_ as ae,d as te,n as oe,w as D,W as ne,aY as re,r as E,at as de,H as se,l as u,o as f,G as F,C as t,j as e,aT as r,aL as d,aP as v,c as w,F as I,D as q,aQ as g,b8 as ie,b9 as pe,ba as x,bb as me,M as L,L as ce,h as N,aR as h,J as T,b0 as P,a as ge,aK as fe,az as j,aW as G}from"./index.js";import{c as K,t as ve}from"./status.0f771e9a.js";import{b as Ce,c as _e}from"./index.3e4a56da.js";import{c as be,I as H,a as Ee,b as Fe,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.17783a41.js";import"./use-page-search.496e3eda.js";import"./columns.eaa2d03d.js";import"./tootip.c29898b9.js";function he(){const S=le(),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=te({__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=ne({editVisible:!1,visible:!1,companies:[],index:-1,data:{}}),p=re({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){j.warning("\u8BF7\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u5B50\u5546\u54C1");return}if(a.value.is_combind==="0"&&(a.value.childArr=[]),a.value.subunit_price>a.value.unit_price){j.warning("\u6210\u672C\u7A0E\u540E\u5355\u4EF7\u5FC5\u987B\u5927\u4E8E\u6216\u7B49\u4E8E\u6210\u672C\u7A0E\u524D\u5355\u4EF7");return}try{await((n=y.value)==null?void 0:n.validate()),p.run(_e({...a.value,skuCode:a.value.good_source=="1"?a.value.skuCode:$(),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=Ee(Be(l)):m.value=Fe(l)}const O=R.bind(null,!0),z=R.bind(null,!1);function Y(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 Q(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 W(n,l){return n=Math.ceil(n),l=Math.floor(l),Math.floor(Math.random()*(l-n+1))+n}function $(){let n=G(new Date).format("YY-MM-DD HH:mm:ss");n=n.replace(/-/g,""),n=n.replace(/:/g,""),n=n.replace(/ /g,"");let l=String(G().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=W(10,99);return s+n+l+c}function J(n){n=="2"&&(a.value.skuCode="")}return(n,l)=>{const s=E("ElInput"),c=E("ElRow"),C=E("ElTableColumn"),X=E("ElTag"),Z=E("ElTable"),ee=de("loading");return se((f(),F(u(fe),{ref_key:"formRef",ref:y,rules:B.value,model:a.value},{default:t(()=>[e(c,{gutter:10},{default:t(()=>[e(u(r),{span:12},{default:t(()=>[e(u(d),{label:"\u8D2D\u4E70\u65B9\u516C\u53F8",prop:"buyer_code"},{default:t(()=>[e(u(v),{style:{width:"100%"},placeholder:"\u8D2D\u4E70\u65B9\u516C\u53F8",modelValue:a.value.buyer_code,"onUpdate:modelValue":l[0]||(l[0]=o=>a.value.buyer_code=o),onChange:u(z),disabled:""},{default:t(()=>[(f(!0),w(I,null,q(i.companies,o=>(f(),F(u(g),{label:o.company_name,value:o.company_license},null,8,["label","value"]))),256))]),_:1},8,["modelValue","onChange"])]),_:1}),e(H,{detail:m.value},null,8,["detail"])]),_:1}),e(u(r),{span:12},{default:t(()=>[e(u(d),{label:"\u9500\u552E\u65B9\u516C\u53F8",prop:"seller_code"},{default:t(()=>[e(u(ie),{style:{width:"100%"},"request-prop":"name",api:u(pe),"response-val-prop":"registercode",placeholder:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934",value:a.value.seller_code,"onUpdate:value":l[1]||(l[1]=o=>a.value.seller_code=o),"response-label-prop":"name",onItemChange:u(O)},null,8,["api","value","onItemChange"])]),_:1}),e(H,{detail:b.value},null,8,["detail"])]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u5546\u54C1\u6765\u6E90",prop:"good_source"},{default:t(()=>[e(u(v),{onChange:J,modelValue:a.value.good_source,"onUpdate:modelValue":l[2]||(l[2]=o=>a.value.good_source=o),placeholder:"\u5546\u54C1\u6765\u6E90",style:{width:"100%"}},{default:t(()=>[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:t(()=>[e(u(d),{label:"\u7EC4\u5408\u7C7B\u578B",prop:"is_combind"},{default:t(()=>[e(u(v),{style:{width:"100%"},modelValue:a.value.is_combind,"onUpdate:modelValue":l[3]||(l[3]=o=>a.value.is_combind=o)},{default:t(()=>[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:t(()=>[e(u(d),{label:"\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",prop:"good_type"},{default:t(()=>[e(u(v),{modelValue:a.value.good_type,"onUpdate:modelValue":l[4]||(l[4]=o=>a.value.good_type=o),placeholder:"\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",style:{width:"100%"}},{default:t(()=>[(f(!0),w(I,null,q(u(K),o=>(f(),F(u(g),{value:o.value,label:o.label},null,8,["value","label"]))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u8FDB\u9879\u6210\u672C\u72B6\u6001",prop:"basic_status"},{default:t(()=>[e(u(v),{modelValue:a.value.basic_status,"onUpdate:modelValue":l[5]||(l[5]=o=>a.value.basic_status=o),placeholder:"\u8FDB\u9879\u6210\u672C\u72B6\u6001"},{default:t(()=>[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:t(()=>[e(u(d),{label:"\u53D1\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name"},{default:t(()=>[e(s,{modelValue:a.value.inv_good_name,"onUpdate:modelValue":l[6]||(l[6]=o=>a.value.inv_good_name=o),placeholder:"\u53D1\u7968\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:12},{default:t(()=>[e(u(d),{label:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0",prop:"goodName"},{default:t(()=>[e(s,{modelValue:a.value.goodName,"onUpdate:modelValue":l[7]||(l[7]=o=>a.value.goodName=o),placeholder:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode"},{default:t(()=>[e(s,{placeholder:"\u5546\u54C1\u7F16\u53F7",modelValue:a.value.skuCode,"onUpdate:modelValue":l[8]||(l[8]=o=>a.value.skuCode=o),disabled:a.value.good_source=="2"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u5355\u4F4D",prop:"unit"},{default:t(()=>[e(s,{modelValue:a.value.unit,"onUpdate:modelValue":l[9]||(l[9]=o=>a.value.unit=o),placeholder:"\u5355\u4F4D"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u89C4\u683C",prop:"spec"},{default:t(()=>[e(s,{modelValue:a.value.spec,"onUpdate:modelValue":l[10]||(l[10]=o=>a.value.spec=o),placeholder:"\u89C4\u683C"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u91CD\u91CF",prop:"unit_weight"},{default:t(()=>[e(u(x),{unit:"g",modelValue:a.value.unit_weight,"onUpdate:modelValue":l[11]||(l[11]=o=>a.value.unit_weight=o),placeholder:"\u91CD\u91CF",KeepDecimals:3},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u53D1\u7968\u7C7B\u578B",prop:"inv_type"},{default:t(()=>[e(u(v),{modelValue:a.value.inv_type,"onUpdate:modelValue":l[12]||(l[12]=o=>a.value.inv_type=o),placeholder:"\u53D1\u7968\u7C7B\u578B",style:{width:"100%"}},{default:t(()=>[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:t(()=>[e(u(d),{label:"\u6210\u672C\u7A0E\u524D\u5355\u4EF7",prop:"subunit_price"},{default:t(()=>[e(u(x),{unit:"\u5143",modelValue:a.value.subunit_price,"onUpdate:modelValue":l[13]||(l[13]=o=>a.value.subunit_price=o),placeholder:"\u6210\u672C\u7A0E\u524D\u5355\u4EF7",KeepDecimals:8},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u6210\u672C\u7A0E\u540E\u5355\u4EF7",prop:"unit_price"},{default:t(()=>[e(u(x),{unit:"\u5143",modelValue:a.value.unit_price,"onUpdate:modelValue":l[14]||(l[14]=o=>a.value.unit_price=o),placeholder:"\u6210\u672C\u7A0E\u540E\u5355\u4EF7",KeepDecimals:8},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u5546\u54C1\u4EE3\u7801",prop:"good_code"},{default:t(()=>[e(s,{modelValue:a.value.good_code,"onUpdate:modelValue":l[15]||(l[15]=o=>a.value.good_code=o),placeholder:"\u5546\u54C1\u4EE3\u7801"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:12},{default:t(()=>[e(u(d),{label:"\u8FDB\u9879\u7A0E\u76EE",prop:"cat_code"},{default:t(()=>[e(De,{modelValue:a.value.cat_code,"onUpdate:modelValue":l[16]||(l[16]=o=>a.value.cat_code=o)},null,8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u8FDB\u9879\u7A0E\u7387",prop:"cat_tax"},{default:t(()=>[e(u(v),{modelValue:a.value.cat_tax,"onUpdate:modelValue":l[17]||(l[17]=o=>a.value.cat_tax=o),placeholder:"\u8FDB\u9879\u7A0E\u7387"},{default:t(()=>[(f(!0),w(I,null,q(u(ve),o=>(f(),F(u(g),me({ref_for:!0},o),null,16))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(r),{span:6},{default:t(()=>[e(u(d),{label:"\u5206\u5149",prop:"spectral"},{default:t(()=>[e(s,{modelValue:a.value.spectral,"onUpdate:modelValue":l[18]||(l[18]=o=>a.value.spectral=o),placeholder:"\u5206\u5149",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),a.value.is_combind=="1"?(f(),F(c,{key:0},{default:t(()=>[e(u(r),{span:24},{default:t(()=>[e(u(d),{label:"\u5B50\u5546\u54C1"},{default:t(()=>[e(Z,{border:"",size:"small",data:a.value.childArr},{default:t(()=>[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:t(({row:o})=>[e(X,{size:"small"},{default:t(()=>{var _;return[L(ce((_=u(K).find(ue=>ue.value==o.good_type))==null?void 0:_.label),1)]}),_:2},1024)]),_:1}),e(C,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName"}),e(C,{width:"80px"},{header:t(()=>[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]=o=>i.visible=!0)},null,8,["icon"])])]),default:t(({$index:o})=>[e(u(P),{content:"\u5220\u9664",placement:"top"},{default:t(()=>[e(u(h),{link:"",size:"small",type:"danger",icon:u(T)("delete"),onClick:_=>a.value.childArr.splice(o,1)},null,8,["icon","onClick"])]),_:2},1024),e(u(P),{content:"\u7F16\u8F91",placement:"top"},{default:t(()=>[e(u(h),{link:"",size:"small",type:"primary",icon:u(T)("edits"),onClick:_=>Q(o)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1})]),_:1})]),_:1})):ge("v-if",!0),N("div",Ue,[e(u(h),{type:"primary",onClick:U},{default:t(()=>l[24]||(l[24]=[L("\u4FDD\u5B58")])),_:1})]),e(ye,{visible:i.visible,"onUpdate:visible":l[20]||(l[20]=o=>i.visible=o),onSubmit:Y},null,8,["visible"]),e(Ve,{visible:i.editVisible,"onUpdate:visible":l[21]||(l[21]=o=>i.editVisible=o),index:i.index,data:i.data,onSubmit:l[22]||(l[22]=(o,_)=>a.value.childArr[o]={..._})},null,8,["visible","index","data"])]),_:1},8,["rules","model"])),[[ee,u(p).loading]])}}});var je=ae(we,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/productManager/components/BaseForm.vue"]]);export{je as default};
|