import{aY as p,b4 as O,al as B,_ as I,d as P,w as V,n as $,bv as T,W as L,r as _,aC as M,H as q,u as D,o as E,c as C,l as F,C as v,G as w,a as x,F as j,D as z,bw as G,M as y}from"./index.88f7d256.js";import{e as H}from"./execl-upload.b7ac7feb.js";import{c}from"./template.f1513dc2.js";import{h as R}from"./index.3d048da1.js";import"./xlsx.ed122d16.js";function U(e,u){if(e.length!==u.length)return p.warning("\u5BFC\u5165\u7684\u6A21\u677F\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;for(const t in e)if(e[t].label!==u[t])return p.warning("\u5BFC\u5165\u7684\u6A21\u677F\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;return!0}const W=c.reduce((e,u)=>({...e,[u.label]:u.prop}),{});function Y(e){const u=[];for(const t of e){const n={};for(const s in t)n[W[s]]=t[s];u.push(n)}return u}const A=c.reduce((e,u)=>({...e,[u.prop]:u.label}),{}),J=c.filter(e=>e.required).map(e=>e.prop),K=c.filter(e=>e.number).map(e=>e.prop),Q=e=>e===""||e.trim()==="",X=/^\d+(\.\d+)?$/;function S(e){let u=[];for(const t in e){let n=[];const s=e[t];for(const r in s){const b=String(s[r]);J.includes(r)&&Q(b)&&n.push(`${A[r]}\u4E0D\u80FD\u4E3A\u7A7A`),K.includes(r)&&X.test(b)===!1&&n.push(`${A[r]}\u5FC5\u987B\u4E3A\u6570\u5B57`)}n.length!==0&&u.push({index:Number(t)+1,error:n.join(",")})}return{errorSet:u,isValid:u.length===0}}function k(e){const u=e.map(t=>`\u7B2C ${t.index} \u884C\uFF1A${t.error}`);O({title:"\u6570\u636E\u6821\u9A8C\u5931\u8D25",type:"warning",message:B("div",null,u.map(t=>B("p",null,t)))})}const Z={class:"padding-container bg-white"},ee={key:1,class:"flex my-[10px]"},ue=P({__name:"batchImportSendOrder",setup(e){const u=V([]),{push:t}=$(),{run:n,loading:s}=T({success:()=>t("/supplierOrder/supSendOrder")}),{currentCompany:r}=L();function b({results:m,header:l}){if(!U(c,l))return;const a=Y(m),i=[...new Set(a.map(f=>f.supplierNo))];if(i.length>1){p.warning("\u4E0A\u4F20\u591A\u6761\u6570\u636E\u4F9B\u5E94\u5546\u5FC5\u987B\u4E00\u81F4");return}if(i[0]!==r.value.companyNo){p.warning("\u4E0A\u4F20\u6570\u636E\u7684\u4F9B\u5E94\u5546\u4E0E\u9009\u4E2D\u7684\u4F9B\u5E94\u5546\u4E0D\u4E00\u81F4");return}const{errorSet:o,isValid:d}=S(a);d||k(o),u.value=a}function N(){const m=[...new Set(u.value.map(o=>o.supplierNo))];if(m.length>1){p.warning("\u4E0A\u4F20\u591A\u6761\u6570\u636E\u4F9B\u5E94\u5546\u5FC5\u987B\u4E00\u81F4");return}if(m[0]!==r.value.companyNo){p.warning("\u4E0A\u4F20\u6570\u636E\u7684\u4F9B\u5E94\u5546\u4E0E\u9009\u4E2D\u7684\u4F9B\u5E94\u5546\u4E0D\u4E00\u81F4");return}const{errorSet:l,isValid:a}=S(u.value);if(!a){k(l);return}const i=u.value.map(({outChildCode:o,supplierNo:d,companyNo:f,post_fee:g})=>({outChildCode:o,supplierNo:d,companyNo:f,post_fee:Number(g).toFixed(2)}));n(R({list:i}))}return(m,l)=>{const a=_("el-table-column"),i=_("el-table"),o=_("el-button"),d=_("el-tab-pane"),f=_("el-tabs"),g=M("loading");return q((E(),C("div",Z,[F(f,{class:"px-[10px]"},{default:v(()=>[F(d,{label:"\u6279\u91CF\u5BFC\u5165\u53D1\u8D27\u8FD0\u5355"},{default:v(()=>[u.value.length===0?(E(),w(D(H),{key:0,style:{width:"100%"},onOnSuccess:b})):x("v-if",!0),F(i,{border:"",size:"mini",class:"my-[10px]",data:u.value},{default:v(()=>[(E(!0),C(j,null,z(D(c),h=>(E(),w(a,G(h,{key:h.prop,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),u.value.length!==0?(E(),C("div",ee,[F(o,{class:"ml-auto",onClick:l[0]||(l[0]=h=>u.value=[])},{default:v(()=>[y("\u53D6\u6D88")]),_:1}),F(o,{type:"primary",class:"ml-auto",onClick:N},{default:v(()=>[y("\u4FDD\u5B58")]),_:1})])):x("v-if",!0)]),_:1})]),_:1})])),[[g,D(s)]])}}});var ae=I(ue,[["__file","D:/work/accout-vue3-ui2/settle-vue3/src/views/supplierOrder/sendOrder/batchImportSendOrder.vue"]]);export{ae as default};