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