import{_ as S,d as M,x as c,W as j,p as G,bG as I,ah as L,b4 as V,A as y,r as i,aD as z,H as U,m as n,o as q,G as H,D as s,h as m,l as e,cg as Q,ch as W,M as f,L as b,aQ as Z,aZ as $}from"./index.js";import{i as J,r as K}from"./constants.59c8f8ef.js";import{b as P}from"./index.a7de6b05.js";import X from"./modal.29820a.js";import"./qr.a30b70.js";import"./cg.cff78a.js";import"./single.9958a5.js";const Y={flex:"","gap-10":""},ee={class:"w-full"},oe={class:"flex justify-between w-full mb-[10px]"},ue={class:"flex justify-end"},le=M({__name:"form",setup(te){const r=c([]),{currentCompany:v}=j(),o=c({...J()}),h=c(null),d=c(null),{push:E}=G(),{run:x,loading:w}=I({success:()=>E("/supplierOrder/supplierOrderCollection?tab=supSendOrderRecord_collection")}),C=u=>{const{companyNo:l,company_name:t}=u;return l+" / "+t};function B(){var u;if(!o.value.companyNo||!o.value.supplierNo){$.warning("\u8BF7\u9009\u62E9\u4E70\u65B9\u516C\u53F8\u548C\u5356\u65B9\u516C\u53F8");return}(u=h.value)==null||u.open()}function D(u){var t;const{sids:l}=o.value;u.forEach(p=>{l.includes(p.id)||(o.value.sids.push(p.id),r.value.push(p))}),(t=d.value)==null||t.validateField("sids")}function N(u){var t;const l=r.value.findIndex(p=>p.id===u.id);o.value.sids.splice(l,1),r.value.splice(l,1),(t=d.value)==null||t.validateField("sids")}async function g(){try{await d.value.validate();const{sids:u}=o.value;x(P({cids:u}))}catch{}}const A=L(()=>r.value.reduce((u,l)=>Number(V(u,l.post_fee)).toFixed(2),0));return y(()=>v,()=>{o.value.supplierNo=v.value.companyNo},{immediate:!0,deep:!0}),y(()=>[o.value.supplierNo,o.value.companyNo],()=>{r.value=[],o.value.sids=[]},{immediate:!0,deep:!0}),(u,l)=>{const t=i("ElFormItem"),p=i("el-input"),k=i("ElTag"),F=i("ElButton"),a=i("ElTableColumn"),R=i("el-button"),T=i("ElTable"),O=z("loading");return U((q(),H(n(Z),{rules:n(K),model:o.value,ref_key:"formRef",ref:d},{default:s(()=>[m("div",Y,[e(t,{label:"\u4E70\u65B9\u516C\u53F8",prop:"companyNo"},{default:s(()=>[e(n(Q),{value:o.value.companyNo,"onUpdate:value":l[0]||(l[0]=_=>o.value.companyNo=_),style:{width:"386px"},api:n(W),placeholder:"\u8BF7\u9009\u62E9\u4E70\u65B9\u516C\u53F8","request-prop":"company_name","response-label-prop":"company_name","response-val-prop":"companyNo",getLabel:C},null,8,["value","api"])]),_:1}),e(t,{label:"\u5356\u65B9\u516C\u53F8",prop:"supplierNo"},{default:s(()=>[e(p,{disabled:"",style:{width:"386px"},value:n(v).companyName,placeholder:"\u8BF7\u9009\u62E9\u4E70\u65B9\u516C\u53F8"},null,8,["value"])]),_:1})]),e(t,{prop:"sids",label:"\u53D1\u8D27\u8FD0\u5355\u4FE1\u606F"},{default:s(()=>[m("div",ee,[m("div",oe,[e(k,{type:"warning"},{default:s(()=>[f("\u5171\u8BA1"+b(o.value.sids.length)+"\u4E2A\u8BA2\u5355, \u5171\u8BA1"+b(n(A))+"\u5143",1)]),_:1}),e(F,{type:"primary",onClick:B},{default:s(()=>[f("\u6DFB\u52A0\u53D1\u8D27\u8FD0\u5355")]),_:1})]),e(T,{size:"small",border:"",data:r.value,"max-height":"450px"},{default:s(()=>[e(a,{type:"index",label:"\u5E8F\u53F7","min-width":"55","show-overflow-tooltip":""}),e(a,{prop:"TrackCode",label:"\u53D1\u8D27\u8FD0\u5355\u7F16\u53F7","min-width":"150px","show-overflow-tooltip":""}),e(a,{prop:"outChildCode",label:"\u53D1\u8D27\u5DE5\u5355\u7F16\u53F7","min-width":"160px","show-overflow-tooltip":""}),e(a,{prop:"orderCode",label:"\u9500\u552E\u8BA2\u5355\u7F16\u53F7","min-width":"150px","show-overflow-tooltip":""}),e(a,{prop:"companyName",label:"\u4E1A\u52A1\u516C\u53F8","min-width":"180px","show-overflow-tooltip":""}),e(a,{prop:"supplierName",label:"\u7269\u6D41\u4F9B\u5E94\u5546","min-width":"180px","show-overflow-tooltip":""}),e(a,{label:"\u7269\u6D41\u8D39\u7528","min-width":"100px",prop:"post_fee","show-overflow-tooltip":""}),e(a,{label:"\u5907\u6CE8",prop:"remark","min-width":"140px","show-overflow-tooltip":""}),e(a,{label:"\u521B\u5EFA\u4EBA",prop:"apply_name","min-width":"120px","show-overflow-tooltip":""}),e(a,{label:"\u521B\u5EFA\u65F6\u95F4",prop:"create_time","min-width":"140px","show-overflow-tooltip":""}),e(a,{label:"\u64CD\u4F5C",width:"65px",align:"center",fixed:"right","show-overflow-tooltip":""},{default:s(({row:_})=>[e(R,{type:"text",onClick:ae=>N(_),size:"small"},{default:s(()=>[f("\u5220\u9664")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1}),m("div",ue,[e(F,{type:"primary",onClick:g,loading:n(w)},{default:s(()=>[f("\u4FDD\u5B58")]),_:1},8,["loading"])]),e(X,{ref_key:"modalRef",ref:h,onAdd:D,companyNo:o.value.companyNo,supplierNo:o.value.supplierNo},null,8,["companyNo","supplierNo"])]),_:1},8,["rules","model"])),[[O,n(w)]])}}});var me=S(le,[["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/supplierOrder/sendOrderRecord/components/form.vue"]]);export{me as default};
