BaseForm.dc901e.js 12 KB

1
  1. import{_ as J,d as Q,n as X,w as b,ab as Y,aO as Z,r as C,aj as K,H as W,l as u,o as p,G as g,C as t,j as e,aL as d,aD as n,aX as ee,aY as ue,aH as c,c as E,F,D as B,aI as m,aZ as U,a as x,a_ as le,M as q,L as ae,h,aJ as V,J as A,a$ as T,aC as te,aq as oe}from"./index.js";import{c as N,x as de,t as ne}from"./status.21dece30.js";import{b as re,c as se}from"./index.0935e0b4.js";import{c as ie,I as R,a as pe,b as me,d as ve}from"./InvoiceTitle.250697.js";import ce from"./index.91c8b9.js";import{C as _e}from"./ChildGoodEditModal.266623.js";import ge from"./query-category.7a496a.js";import"./basic-descriptions.d643872c.js";import"./use-page-search.89126f99.js";const fe={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\u524D\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\u540E\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"}]},Ce={class:"w-full flex justify-between"},be={class:"w-full flex justify-end"},Ee=Q({__name:"BaseForm",setup(Fe){const z=X(),w=b(null),s=Y({editVisible:!1,visible:!1,companies:[],index:-1,data:{}}),I=Z({success(){z.push("/invoiceInOut/productManager")}}),o=b(ie()),D=b({}),y=b({});async function M(){var i;if(o.value.is_combind==="1"&&o.value.childArr.length===0){oe.warning("\u8BF7\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u5B50\u5546\u54C1");return}o.value.is_combind==="0"&&(o.value.childArr=[]);try{await((i=w.value)==null?void 0:i.validate()),I.run(se({...o.value,childArr:o.value.childArr.map(({child_id:l,child_num:r})=>({child_id:l,child_num:r}))}))}catch{}}function k(i,l){if(i?o.value.seller_name=l.name:(l=s.companies.find(r=>r.company_license===o.value.buyer_code),o.value.buyer_name=l.company_name),!l)return i?D.value={}:y.value={};i?D.value=pe(ve(l)):y.value=me(l)}const j=k.bind(null,!0),S=k.bind(null,!1);function G(i){const l=o.value.childArr.map(({id:v})=>v),r=[];for(const v of i)l.includes(v.id)||r.push(v);o.value.childArr=[...o.value.childArr,...r]}function L(i){s.index=i,s.editVisible=!0,s.data={...o.value.childArr[i]}}return async function(){const l=await re({size:1e4});l.code==0&&(s.companies=[...l.data.list])}(),(i,l)=>{const r=C("ElInput"),v=C("ElRow"),f=C("ElTableColumn"),O=C("ElTag"),$=C("ElTable"),P=K("loading");return W((p(),g(u(te),{ref_key:"formRef",ref:w,rules:u(fe),model:o.value},{default:t(()=>[e(v,{gutter:10},{default:t(()=>[e(u(d),{span:12},{default:t(()=>[e(u(n),{label:"\u9500\u552E\u65B9\u516C\u53F8",prop:"seller_code"},{default:t(()=>[e(u(ee),{style:{width:"100%"},"request-prop":"name",api:u(ue),"response-val-prop":"registercode",placeholder:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934",value:o.value.seller_code,"onUpdate:value":l[0]||(l[0]=a=>o.value.seller_code=a),"response-label-prop":"name",onItemChange:u(j)},null,8,["api","value","onItemChange"])]),_:1}),e(R,{detail:D.value},null,8,["detail"])]),_:1}),e(u(d),{span:12},{default:t(()=>[e(u(n),{label:"\u8D2D\u4E70\u65B9\u516C\u53F8",prop:"buyer_code"},{default:t(()=>[e(u(c),{style:{width:"100%"},placeholder:"\u8D2D\u4E70\u65B9\u516C\u53F8",modelValue:o.value.buyer_code,"onUpdate:modelValue":l[1]||(l[1]=a=>o.value.buyer_code=a),onChange:u(S)},{default:t(()=>[(p(!0),E(F,null,B(s.companies,a=>(p(),g(u(m),{label:a.company_name,value:a.company_license},null,8,["label","value"]))),256))]),_:1},8,["modelValue","onChange"])]),_:1}),e(R,{detail:y.value},null,8,["detail"])]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u5546\u54C1\u6765\u6E90",prop:"good_source"},{default:t(()=>[e(u(c),{onChange:l[2]||(l[2]=a=>o.value.good_code=""),modelValue:o.value.good_source,"onUpdate:modelValue":l[3]||(l[3]=a=>o.value.good_source=a),placeholder:"\u5546\u54C1\u6765\u6E90",style:{width:"100%"}},{default:t(()=>[e(u(m),{label:"\u91C7\u9500\u5546\u54C1",value:"1"}),e(u(m),{label:"\u975E\u91C7\u9500\u5546\u54C1",value:"2"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u7EC4\u5408\u7C7B\u578B",prop:"is_combind"},{default:t(()=>[e(u(c),{style:{width:"100%"},modelValue:o.value.is_combind,"onUpdate:modelValue":l[4]||(l[4]=a=>o.value.is_combind=a)},{default:t(()=>[e(u(m),{label:"\u975E\u7EC4\u5408\u5546\u54C1",value:"0"}),e(u(m),{label:"\u7EC4\u5408\u5546\u54C1",value:"1"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",prop:"good_type"},{default:t(()=>[e(u(c),{modelValue:o.value.good_type,"onUpdate:modelValue":l[5]||(l[5]=a=>o.value.good_type=a),placeholder:"\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",style:{width:"100%"}},{default:t(()=>[(p(!0),E(F,null,B(u(N),a=>(p(),g(u(m),{value:a.value,label:a.label},null,8,["value","label"]))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u8FDB\u9879\u6210\u672C\u72B6\u6001",prop:"basic_status"},{default:t(()=>[e(u(c),{modelValue:o.value.basic_status,"onUpdate:modelValue":l[6]||(l[6]=a=>o.value.basic_status=a),placeholder:"\u8FDB\u9879\u6210\u672C\u72B6\u6001"},{default:t(()=>[e(u(m),{label:"\u771F\u5B9E\u6210\u672C\u4FE1\u606F",value:"1"}),e(u(m),{label:"\u9884\u4F30\u6210\u672C\u4FE1\u606F",value:"2"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:12},{default:t(()=>[e(u(n),{label:"\u53D1\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name"},{default:t(()=>[e(r,{modelValue:o.value.inv_good_name,"onUpdate:modelValue":l[7]||(l[7]=a=>o.value.inv_good_name=a),placeholder:"\u53D1\u7968\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:12},{default:t(()=>[e(u(n),{label:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0",prop:"goodName"},{default:t(()=>[e(r,{modelValue:o.value.goodName,"onUpdate:modelValue":l[8]||(l[8]=a=>o.value.goodName=a),placeholder:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode"},{default:t(()=>[e(r,{modelValue:o.value.skuCode,"onUpdate:modelValue":l[9]||(l[9]=a=>o.value.skuCode=a),placeholder:"\u5546\u54C1\u7F16\u53F7"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u5355\u4F4D",prop:"unit"},{default:t(()=>[e(r,{modelValue:o.value.unit,"onUpdate:modelValue":l[10]||(l[10]=a=>o.value.unit=a),placeholder:"\u5355\u4F4D"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u89C4\u683C",prop:"spec"},{default:t(()=>[e(r,{modelValue:o.value.spec,"onUpdate:modelValue":l[11]||(l[11]=a=>o.value.spec=a),placeholder:"\u89C4\u683C"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u91CD\u91CF",prop:"unit_weight"},{default:t(()=>[e(r,{modelValue:o.value.unit_weight,"onUpdate:modelValue":l[12]||(l[12]=a=>o.value.unit_weight=a),placeholder:"\u91CD\u91CF"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u53D1\u7968\u7C7B\u578B",prop:"inv_type"},{default:t(()=>[e(u(c),{modelValue:o.value.inv_type,"onUpdate:modelValue":l[13]||(l[13]=a=>o.value.inv_type=a),placeholder:"\u53D1\u7968\u7C7B\u578B",style:{width:"100%"}},{default:t(()=>[(p(!0),E(F,null,B(u(de),a=>(p(),g(u(m),{value:a.value,label:a.label},null,8,["value","label"]))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u6210\u672C\u7A0E\u524D\u5355\u4EF7",prop:"unit_price"},{default:t(()=>[e(u(U),{unit:"\u5143",modelValue:o.value.unit_price,"onUpdate:modelValue":l[14]||(l[14]=a=>o.value.unit_price=a),placeholder:"\u6210\u672C\u7A0E\u524D\u5355\u4EF7"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u6210\u672C\u7A0E\u540E\u5355\u4EF7",prop:"subunit_price"},{default:t(()=>[e(u(U),{unit:"\u5143",modelValue:o.value.subunit_price,"onUpdate:modelValue":l[15]||(l[15]=a=>o.value.subunit_price=a),placeholder:"\u6210\u672C\u7A0E\u540E\u5355\u4EF7"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u5546\u54C1\u4EE3\u7801",prop:"good_code"},{default:t(()=>[e(r,{modelValue:o.value.good_code,"onUpdate:modelValue":l[16]||(l[16]=a=>o.value.good_code=a),placeholder:"\u5546\u54C1\u4EE3\u7801"},null,8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:12},{default:t(()=>[e(u(n),{label:"\u8FDB\u9879\u7A0E\u76EE",prop:"cat_code"},{default:t(()=>[e(ge,{modelValue:o.value.cat_code,"onUpdate:modelValue":l[17]||(l[17]=a=>o.value.cat_code=a)},null,8,["modelValue"]),x(' <ElInput v-model="formData.cat_code" placeholder="\u8FDB\u9879\u7A0E\u76EE" /> ')]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u8FDB\u9879\u7A0E\u7387",prop:"cat_tax"},{default:t(()=>[e(u(c),{modelValue:o.value.cat_tax,"onUpdate:modelValue":l[18]||(l[18]=a=>o.value.cat_tax=a),placeholder:"\u8FDB\u9879\u7A0E\u7387"},{default:t(()=>[(p(!0),E(F,null,B(u(ne),a=>(p(),g(u(m),le({ref_for:!0},a),null,16))),256))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(u(d),{span:6},{default:t(()=>[e(u(n),{label:"\u5206\u5149",prop:"spectral"},{default:t(()=>[e(r,{modelValue:o.value.spectral,"onUpdate:modelValue":l[19]||(l[19]=a=>o.value.spectral=a),placeholder:"\u5206\u5149",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),o.value.is_combind=="1"?(p(),g(v,{key:0},{default:t(()=>[e(u(d),{span:24},{default:t(()=>[e(u(n),{label:"\u5B50\u5546\u54C1"},{default:t(()=>[e($,{border:"",size:"small",data:o.value.childArr},{default:t(()=>[e(f,{label:"\u6BD4\u4F8B",prop:"child_num",width:"60px"}),e(f,{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode"}),e(f,{label:"\u5546\u54C1\u7C7B\u578B",prop:"good_type"},{default:t(({row:a})=>[e(O,{size:"small"},{default:t(()=>{var _;return[q(ae((_=u(N).find(H=>H.value==a.good_type))==null?void 0:_.label),1)]}),_:2},1024)]),_:1}),e(f,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName"}),e(f,{width:"80px"},{header:t(()=>[h("div",Ce,[l[24]||(l[24]=h("p",null,"\u64CD\u4F5C",-1)),e(u(V),{link:"",size:"small",type:"primary",icon:u(A)("add"),onClick:l[20]||(l[20]=a=>s.visible=!0)},null,8,["icon"])])]),default:t(({$index:a})=>[e(u(T),{content:"\u5220\u9664",placement:"top"},{default:t(()=>[e(u(V),{link:"",size:"small",type:"danger",icon:u(A)("delete"),onClick:_=>o.value.childArr.splice(a,1)},null,8,["icon","onClick"])]),_:2},1024),e(u(T),{content:"\u7F16\u8F91",placement:"top"},{default:t(()=>[e(u(V),{link:"",size:"small",type:"primary",icon:u(A)("edits"),onClick:_=>L(a)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1})]),_:1})]),_:1})):x("v-if",!0),h("div",be,[e(u(V),{type:"primary",onClick:M},{default:t(()=>l[25]||(l[25]=[q("\u4FDD\u5B58")])),_:1})]),e(ce,{visible:s.visible,"onUpdate:visible":l[21]||(l[21]=a=>s.visible=a),onSubmit:G},null,8,["visible"]),e(_e,{visible:s.editVisible,"onUpdate:visible":l[22]||(l[22]=a=>s.editVisible=a),index:s.index,data:s.data,onSubmit:l[23]||(l[23]=(a,_)=>o.value.childArr[a]={..._})},null,8,["visible","index","data"])]),_:1},8,["rules","model"])),[[P,u(I).loading]])}}});var Ue=J(Ee,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/productManager/components/BaseForm.vue"]]);export{Ue as default};