index.da99fc3c.js 6.9 KB

1
  1. import{_ as J,d as K,w as y,W as Q,aO as X,r as b,o as F,G as S,C as g,u as A,a as O,l as $,c as N,F as Z,D as uu,L,M as T,b as eu,aY as o,b4 as tu,al as V}from"./index.88f7d256.js";import{e as au}from"./execl-upload.b7ac7feb.js";import{c as ou}from"./index.3ab8ac20.js";import{C as M}from"./status.2df4810d.js";import"./xlsx.ed122d16.js";const z=["\u4E70\u65B9\u516C\u53F8\u7F16\u7801","\u4E70\u65B9\u516C\u53F8\u540D\u79F0","\u5356\u65B9\u516C\u53F8\u7F16\u7801","\u5356\u65B9\u516C\u53F8\u540D\u79F0","\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"],W={value0:"companyNo",value1:"companyName",value2:"supplierNo",value3:"supplierName",value4:"payNo",value5:"invoiceType",value6:"invoiceCode",value7:"invoiceNumber",value8:"inv_subtotal_amount",value9:"open_time",value10:"checkNumber"},su=[],lu=()=>{const x=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return z.forEach((k,B)=>{x.push({prop:"value"+B,label:k,minWidth:B===0||B===1?"120px":"90px"})}),x},nu={key:0},ru={key:1},cu=eu("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1),iu={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},pu=K({__name:"index",emits:["onSuccess"],setup(x,{expose:k,emit:B}){const _=y(!1),e=y(!1),n=y([]),R=lu(),q=M.map(({label:s})=>s),U=y(1),H=s=>`\u5BFC\u5165\u6570\u636E\u7B2C ${s} \u884C \u53D1\u7968\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A${q.join(",")}`,{currentCompany:w}=Q(),G=X(),I=({results:s,header:i})=>{if(e.value=!0,s.length===0){o.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),e.value=!1;return}let p=!0;if(i.length!==z.length?p=!1:z.forEach((t,r)=>{t!==i[r]&&(p=!1)}),!p){o.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),e.value=!1;return}n.value=[];for(const t of s){const r=Object.values(t);let v={};r.forEach((u,l)=>{v["value"+l]=u+""}),n.value.push(v),U.value=U.value+1}const m=[];n.value.forEach((t,r)=>{const v={};for(let u in t){const l=W[u],E=t[u];v[l]=E}m.push(v)});const c=[],f=[],a=[],h=[],C=[];if(m.forEach((t,r)=>{const v=t.invoiceType.trim(),u=M.find(({label:E})=>E===v);u?(t.invoiceType=u.value,(u.value==="normal"||u.value==="electronic")&&!t.checkNumber&&f.push(String(r+1))):c.push(String(r+1));const l=/^\d+(\.\d+)?$/;l.test(t.invoiceCode)||a.push(String(r+1)),l.test(t.invoiceNumber)||h.push(String(r+1)),(!l.test(t.inv_subtotal_amount)||Number(t.inv_subtotal_amount)<0)&&C.push(String(r+1))}),c.length>0){o({type:"error",message:H(c.join(","))}),e.value=!1;return}if(f.length>0){o({type:"error",message:`\u7B2C ${f.join(",")} \u884C,\u6821\u9A8C\u7801\u4E0D\u80FD\u4E3A\u7A7A\u3002`}),e.value=!1,n.value=[];return}if(a.length>0){o({type:"error",message:`\u7B2C ${a.join(",")} \u884C,\u53D1\u7968\u4EE3\u7801\u5FC5\u987B\u4E3A\u6570\u5B57\u3002`}),e.value=!1,n.value=[];return}if(h.length>0){o({type:"error",message:`\u7B2C ${h.join(",")} \u884C,\u53D1\u7968\u53F7\u7801\u5FC5\u987B\u4E3A\u6570\u5B57\u3002`}),e.value=!1,n.value=[];return}if(C.length>0){o({type:"error",message:`\u7B2C ${C.join(",")} \u884C,\u53D1\u7968\u7A0E\u524D\u91D1\u989D\u5FC5\u987B\u4E3A\u6570\u5B57\u4E14\u4E0D\u80FD\u662F\u8D1F\u6570`}),e.value=!1,n.value=[];return}e.value=!1},P=async()=>{try{if(e.value)return;e.value=!0;const s=[];n.value.forEach((u,l)=>{const E={};for(let d in u){const D=W[d],j=u[d];E[D]=j}s.push(E)});const i=[],p=[],m=[],c=[],f=[];if(s.forEach((u,l)=>{const E=u.invoiceType.trim(),d=M.find(({label:j})=>j===E);d?(u.invoiceType=d.value,(d.value==="normal"||d.value==="electronic")&&!u.checkNumber&&p.push(String(l+1))):i.push(String(l+1));const D=/^\d+(\.\d+)?$/;D.test(u.invoiceCode)||m.push(String(l+1)),D.test(u.invoiceNumber)||c.push(String(l+1)),(!D.test(u.inv_subtotal_amount)||Number(u.inv_subtotal_amount)<0)&&f.push(String(l+1))}),i.length>0){o({type:"error",message:H(i.join(","))}),e.value=!1;return}if(p.length>0){o({type:"error",message:`\u7B2C ${p.join(",")} \u884C,\u6821\u9A8C\u7801\u4E0D\u80FD\u4E3A\u7A7A\u3002`}),e.value=!1;return}if(m.length>0){o({type:"error",message:`\u7B2C ${m.join(",")} \u884C,\u53D1\u7968\u4EE3\u7801\u5FC5\u987B\u4E3A\u6570\u5B57\u3002`}),e.value=!1;return}if(c.length>0){o({type:"error",message:`\u7B2C ${c.join(",")} \u884C,\u53D1\u7968\u53F7\u7801\u5FC5\u987B\u4E3A\u6570\u5B57\u3002`}),e.value=!1;return}if(f.length>0){o({type:"error",message:`\u7B2C ${f.join(",")} \u884C,\u53D1\u7968\u7A0E\u524D\u91D1\u989D\u5FC5\u987B\u4E3A\u6570\u5B57\u4E14\u4E0D\u80FD\u662F\u8D1F\u6570`}),e.value=!1;return}const a=s.map(({supplierNo:u})=>u);if([...new Set(a)].length>1){o.error("\u5356\u65B9\u516C\u53F8\u7F16\u7801\u4E0D\u4E00\u81F4"),e.value=!1;return}const C=s[0].supplierNo;if(C!=w.value.companyNo){o.error("\u5356\u65B9\u516C\u53F8\u7F16\u7801\u4E0E\u5F53\u524D\u9009\u4E2D\u7684\u516C\u53F8\u4E0D\u4E00\u81F4"),e.value=!1;return}s.forEach(u=>{delete u.supplierNo,delete u.supplierName,delete u.companyName,delete u.companyNo});const{code:t,message:r,data:v}=await ou({list:s,companyNo:C,is_comon:"0"});e.value=!1,G({code:t,message:r,noMessage:!1,handler:()=>{o.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),B("onSuccess"),_.value=!1},onError(){Number(t)===10004?tu({title:"\u4EE5\u4E0B\u5BF9\u8D26\u5355\u4E0D\u7B26\u5408\u8981\u6C42",message:V("div",null,[V("p",null,"\u5F53\u524D\u529F\u80FD\u4EC5\u652F\u6301\u4E1A\u52A1\u7C7B\u578B\u4E3A\u91C7\u8D2D\u8BA2\u5355\u7684\u5BF9\u8D26\u5355,\u4EE5\u4E0B\u901A\u7528\u8BA2\u5355\u7C7B\u578B\u7684\u5BF9\u8D26\u5355\u4E0D\u652F\u6301\u8BE5\u529F\u80FD\uFF1A"),V("p",null,v.join("\u3001"))])}):o.warning(r)}})}catch{}},Y=()=>{n.value=[]};return k({onDisplay:()=>(_.value=!0,n.value=[])}),(s,i)=>{const p=b("el-table-column"),m=b("el-table"),c=b("el-button"),f=b("el-dialog");return F(),S(f,{"close-on-click-modal":!1,modelValue:_.value,"onUpdate:modelValue":i[0]||(i[0]=a=>_.value=a),title:"\u6279\u91CF\u5BFC\u5165\u5F00\u7968\u6570\u636E",width:"1040px",top:"8vh",center:""},{default:g(()=>[n.value.length===0?(F(),S(A(au),{key:0,onOnSuccess:I})):O("v-if",!0),$(m,{data:n.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:g(()=>[(F(!0),N(Z,null,uu(A(R),(a,h)=>(F(),S(p,{type:a.type,minWidth:a.minWidth,fixed:a.fixed,key:h,prop:a.prop,"show-overflow-tooltip":""},{header:g(()=>[!A(su).includes(A(W)[a.prop])||a.label==="\u5E8F\u53F7"?(F(),N("span",nu,L(a.label),1)):(F(),N("p",ru,[cu,T(" "+L(a.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),n.value.length!==0?(F(),N("div",iu,[$(c,{size:"small",onClick:Y},{default:g(()=>[T("\u53D6\u6D88")]),_:1}),$(c,{size:"small",type:"primary",loading:e.value,onClick:P},{default:g(()=>[T("\u4FDD\u5B58")]),_:1},8,["loading"])])):O("v-if",!0)]),_:1},8,["modelValue"])}}});var Fu=J(pu,[["__file","D:/work/accout-vue3-ui2/settle-vue3/src/views/supply/ticketReturn/components/execl-files-upload/index.vue"]]);export{Fu as default};