1 |
- import{aY as c,b4 as O,al as D,_ 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 g,o as E,c as h,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 as p}from"./template.5f221cfb.js";import{h as R}from"./index.3d048da1.js";import"./xlsx.ed122d16.js";function U(e,u){if(e.length!==u.length)return c.warning("\u5BFC\u5165\u7684\u6A21\u677F\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;for(const t in e)if(e[t].label!==u[t])return c.warning("\u5BFC\u5165\u7684\u6A21\u677F\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;return!0}const W=p.reduce((e,u)=>({...e,[u.label]:u.prop}),{});function Y(e){const u=[];for(const t of e){const n={};for(const a in t)n[W[a]]=t[a];u.push(n)}return u}const B=p.reduce((e,u)=>({...e,[u.prop]:u.label}),{}),J=p.filter(e=>e.required).map(e=>e.prop),K=p.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 a=e[t];for(const o in a){const b=String(a[o]);J.includes(o)&&Q(b)&&n.push(`${B[o]}\u4E0D\u80FD\u4E3A\u7A7A`),K.includes(o)&&X.test(b)===!1&&n.push(`${B[o]}\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:D("div",null,u.map(t=>D("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:a}=T({success:()=>t("/postSupplierOrder/sendOrder")}),{currentCompany:o}=L();function b({results:m,header:l}){if(!U(p,l))return;const s=Y(m),i=[...new Set(s.map(f=>f.companyNo))];if(i.length>1){c.warning("\u4E0A\u4F20\u591A\u6761\u6570\u636E\u4E1A\u52A1\u516C\u53F8\u5FC5\u987B\u4E00\u81F4");return}if(i[0]!==o.value.companyNo){c.warning("\u4E0A\u4F20\u6570\u636E\u7684\u4E1A\u52A1\u516C\u53F8\u4E0E\u9009\u4E2D\u7684\u4E1A\u52A1\u516C\u53F8\u4E0D\u4E00\u81F4");return}const{errorSet:r,isValid:d}=S(s);d||k(r),u.value=s}function N(){const m=[...new Set(u.value.map(r=>r.companyNo))];if(m.length>1){c.warning("\u4E0A\u4F20\u591A\u6761\u6570\u636E\u4E1A\u52A1\u516C\u53F8\u5FC5\u987B\u4E00\u81F4");return}if(m[0]!==o.value.companyNo){c.warning("\u4E0A\u4F20\u6570\u636E\u7684\u4E1A\u52A1\u516C\u53F8\u4E0E\u9009\u4E2D\u7684\u4E1A\u52A1\u516C\u53F8\u4E0D\u4E00\u81F4");return}const{errorSet:l,isValid:s}=S(u.value);if(!s){k(l);return}const i=u.value.map(({outChildCode:r,supplierNo:d,companyNo:f,post_fee:A})=>({outChildCode:r,supplierNo:d,companyNo:f,post_fee:Number(A).toFixed(2)}));n(R({list:i}))}return(m,l)=>{const s=_("el-table-column"),i=_("el-table"),r=_("el-button"),d=_("el-tab-pane"),f=_("el-tabs"),A=M("loading");return q((E(),h("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(g(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),h(j,null,z(g(p),C=>(E(),w(s,G(C,{key:C.prop,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),u.value.length!==0?(E(),h("div",ee,[F(r,{class:"ml-auto",onClick:l[0]||(l[0]=C=>u.value=[])},{default:v(()=>[y("\u53D6\u6D88")]),_:1}),F(r,{type:"primary",class:"ml-auto",onClick:N},{default:v(()=>[y("\u4FDD\u5B58")]),_:1})])):x("v-if",!0)]),_:1})]),_:1})])),[[A,g(a)]])}}});var se=I(ue,[["__file","D:/work/accout-vue3-ui2/settle-vue3/src/views/postSupplierOrder/sendOrder/batchImportSendOrder.vue"]]);export{se as default};
|