import{_ as S,d as j,n as m,O as G,k as I,d3 as M,aa as V,ct as z,w as y,r as p,aw as L,B as q,i,o as H,A as U,y as s,e as c,h as e,dF as $,dG as J,H as f,G as E,cd as K,cm as P}from"./index.js";import{i as Q,r as W}from"./constants.59c8f8ef.js";import{b as X}from"./index.f78c594b.js";import Y from"./modal.7eae07.js";import"./qr.03c34f.js";import"./cg.325c4e.js";import"./single.291678.js";const Z={flex:"","gap-10":""},ee={class:"w-full"},oe={class:"flex justify-between w-full mb-[10px]"},ue={class:"flex justify-end"},le=j({__name:"form",setup(te){const r=m([]),{currentCompany:v}=G(),u=m({...Q()}),w=m(null),d=m(null),{push:b}=I(),{run:x,loading:h}=M({success:()=>b("/supplierOrder/supplierOrderCollection?tab=supSendOrderRecord_collection")}),B=l=>{const{companyNo:o,company_name:t}=l;return o+" / "+t};function C(){var l;if(!u.value.companyNo||!u.value.supplierNo){P.warning("\u8BF7\u9009\u62E9\u4E70\u65B9\u516C\u53F8\u548C\u5356\u65B9\u516C\u53F8");return}(l=w.value)==null||l.open()}function N(l){var t;const{sids:o}=u.value;l.forEach(n=>{o.includes(n.id)||(u.value.sids.push(n.id),r.value.push(n))}),(t=d.value)==null||t.validateField("sids")}function D(l){var t;const o=r.value.findIndex(n=>n.id===l.id);u.value.sids.splice(o,1),r.value.splice(o,1),(t=d.value)==null||t.validateField("sids")}async function g(){try{await d.value.validate();const{sids:l}=u.value;x(X({cids:l}))}catch{}}const A=V(()=>r.value.reduce((l,o)=>Number(z(l,o.post_fee)).toFixed(2),0));return y(()=>v,()=>{u.value.supplierNo=v.value.companyNo},{immediate:!0,deep:!0}),y(()=>[u.value.supplierNo,u.value.companyNo],()=>{r.value=[],u.value.sids=[]},{immediate:!0,deep:!0}),(l,o)=>{const t=p("ElFormItem"),n=p("el-input"),k=p("ElTag"),F=p("ElButton"),a=p("ElTableColumn"),O=p("el-button"),R=p("ElTable"),T=L("loading");return q((H(),U(i(K),{rules:i(W),model:u.value,ref_key:"formRef",ref:d},{default:s(()=>[c("div",Z,[e(t,{label:"\u4E70\u65B9\u516C\u53F8",prop:"companyNo"},{default:s(()=>[e(i($),{value:u.value.companyNo,"onUpdate:value":o[0]||(o[0]=_=>u.value.companyNo=_),style:{width:"386px"},api:i(J),placeholder:"\u8BF7\u9009\u62E9\u4E70\u65B9\u516C\u53F8","request-prop":"company_name","response-label-prop":"company_name","response-val-prop":"companyNo",getLabel:B},null,8,["value","api"])]),_:1}),e(t,{label:"\u5356\u65B9\u516C\u53F8",prop:"supplierNo"},{default:s(()=>[e(n,{disabled:"",style:{width:"386px"},value:i(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(()=>[c("div",ee,[c("div",oe,[e(k,{type:"warning"},{default:s(()=>[f("\u5171\u8BA1"+E(u.value.sids.length)+"\u4E2A\u8BA2\u5355, \u5171\u8BA1"+E(A.value)+"\u5143",1)]),_:1}),e(F,{type:"primary",onClick:C},{default:s(()=>o[1]||(o[1]=[f("\u6DFB\u52A0\u53D1\u8D27\u8FD0\u5355")])),_:1})]),e(R,{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(O,{type:"text",onClick:ae=>D(_),size:"small"},{default:s(()=>o[2]||(o[2]=[f("\u5220\u9664")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1}),c("div",ue,[e(F,{type:"primary",onClick:g,loading:i(h)},{default:s(()=>o[3]||(o[3]=[f("\u4FDD\u5B58")])),_:1},8,["loading"])]),e(Y,{ref_key:"modalRef",ref:w,onAdd:N,companyNo:u.value.companyNo,supplierNo:u.value.supplierNo},null,8,["companyNo","supplierNo"])]),_:1},8,["rules","model"])),[[T,i(h)]])}}});var ce=S(le,[["__file","D:/work/jiesuan/settle-vue3/src/views/supplierOrder/sendOrderRecord/components/form.vue"]]);export{ce as default};
