1 |
- import{_ as R,d as q,w as _,W as G,aL as I,r as F,o as i,G as x,C as v,u as E,a as S,l as k,c as y,F as P,D as J,L as j,M as N,b as K,aW as p}from"./index.0bc83371.js";import{e as Q}from"./execl-upload.cc28de33.js";import{g as X}from"./index.2fe221b2.js";import{v as V}from"./status.d6b2a53d.js";import"./xlsx.ed122d16.js";const w=["\u5356\u65B9\u516C\u53F8\u7F16\u7801","\u5BF9\u8D26\u7F16\u7801","\u53D1\u7968\u7C7B\u578B","\u53D1\u7968\u4EE3\u7801","\u53D1\u7968\u53F7\u7801","\u53D1\u7968\u7A0E\u524D\u91D1\u989D","\u5F00\u7968\u65E5\u671F","\u6821\u9A8C\u7801(\u7535\u5B50\u7968\u5FC5\u586B,\u5168\u7535\u7968\u4E0D\u9700\u8981)"],W={value0:"supplierNo",value1:"payNo",value2:"invoiceType",value3:"invoiceCode",value4:"invoiceNumber",value5:"inv_subtotal_amount",value6:"open_time",value7:"checkNumber"},Y=[],Z=()=>{const C=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return w.forEach((g,f)=>{C.push({prop:"value"+f,label:g,minWidth:f===0||f===1?"120px":"90px"})}),C},ee={key:0},ue={key:1},ae=K("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1),oe={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},te=q({__name:"index",emits:["onSuccess"],setup(C,{expose:g,emit:f}){const m=_(!1),o=_(!1),n=_([]),T=Z(),U=V.map(({label:a})=>a),A=_(1),z=a=>`\u5BFC\u5165\u6570\u636E\u7B2C ${a} \u884C \u53D1\u7968\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A${U.join(",")}`,{currentCompany:D}=G(),M=I(),H=({results:a,header:t})=>{if(o.value=!0,a.length===0){p.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),o.value=!1;return}let l=!0;if(t.length!==w.length?l=!1:w.forEach((r,s)=>{r!==t[s]&&(l=!1)}),!l){p.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),o.value=!1;return}n.value=[];for(const r of a){const s=Object.values(r);let d={};s.forEach((e,u)=>{d["value"+u]=e+""}),n.value.push(d),A.value=A.value+1}o.value=!1},L=async()=>{if(o.value)return;o.value=!0;const a=[];n.value.forEach((u,B)=>{const h={};for(let c in u){const b=W[c],O=u[c];h[b]=O}a.push(h)});const t=[],l=[];if(a.forEach((u,B)=>{const h=u.invoiceType.trim(),c=V.find(({label:b})=>b===h);c?(u.invoiceType=c.value,(c.value==="normal"||c.value==="electronic")&&!u.checkNumber&&l.push(String(B+1))):t.push(String(B+1))}),t.length>0){p({type:"error",message:z(t.join(","))}),o.value=!1;return}if(l.length>0){p({type:"error",message:`\u7B2C ${l.join(",")} \u884C,\u6821\u9A8C\u7801\u4E0D\u80FD\u4E3A\u7A7A\u3002`}),o.value=!1;return}const r=a.map(({supplierNo:u})=>u),s=[...new Set(r)];if(s.length>1){p.error("\u5356\u65B9\u516C\u53F8\u7F16\u7801\u4E0D\u4E00\u81F4"),o.value=!1;return}if(s[0]!==D.value.companyNo){p.error("\u5356\u65B9\u516C\u53F8\u7F16\u7801\u4E0E\u5F53\u524D\u9009\u62E9\u7684\u516C\u53F8\u4E0D\u4E00\u81F4"),o.value=!1;return}a.forEach(u=>{delete u.supplierNo});const{code:d,message:e}=await X({list:a,companyNo:D.value.companyNo,relaComNo:D.value.companyNo});o.value=!1,M({code:d,message:e,noMessage:!1,handler:()=>{p.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),f("onSuccess"),m.value=!1}})},$=()=>{n.value=[]};return g({onDisplay:()=>(m.value=!0,n.value=[])}),(a,t)=>{const l=F("el-table-column"),r=F("el-table"),s=F("el-button"),d=F("el-dialog");return i(),x(d,{"close-on-click-modal":!1,modelValue:m.value,"onUpdate:modelValue":t[0]||(t[0]=e=>m.value=e),title:"\u5BFC\u5165\u6279\u91CF\u5F00\u7968\u6570\u636E",width:"1040px",top:"8vh",center:""},{default:v(()=>[n.value.length===0?(i(),x(E(Q),{key:0,onOnSuccess:H})):S("v-if",!0),k(r,{data:n.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:v(()=>[(i(!0),y(P,null,J(E(T),(e,u)=>(i(),x(l,{type:e.type,minWidth:e.minWidth,fixed:e.fixed,key:u,prop:e.prop,"show-overflow-tooltip":""},{header:v(()=>[!E(Y).includes(E(W)[e.prop])||e.label==="\u5E8F\u53F7"?(i(),y("span",ee,j(e.label),1)):(i(),y("p",ue,[ae,N(" "+j(e.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),n.value.length!==0?(i(),y("div",oe,[k(s,{size:"small",onClick:$},{default:v(()=>[N("\u53D6\u6D88")]),_:1}),k(s,{size:"small",type:"primary",loading:o.value,onClick:L},{default:v(()=>[N("\u4FDD\u5B58")]),_:1},8,["loading"])])):S("v-if",!0)]),_:1},8,["modelValue"])}}});var ie=R(te,[["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/supply/ticketReturn/components/execl-files-upload/index.vue"]]);export{ie as default};
|