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