1 |
- import{_ as Q,d as X,x as N,df as $,W as w,aO as uu,r as A,o as d,G as z,D as B,m as x,a as O,l as M,c as S,F as eu,E as tu,L as I,M as V,h as au,aZ as n,ae as g,be as lu,am as U}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 Y=["\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"],W={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 j=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return Y.forEach((k,y)=>{j.push({prop:"value"+y,label:k,minWidth:y===0||y===1?"120px":"90px"})}),j},iu={key:0},cu={key:1},pu=au("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(j,{expose:k,emit:y}){const b=N(!1),t=N(!1),l=N([]),L=ru(),P=$.map(({label:o})=>o),H=N(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:T}=w(),q=uu(),G=({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 F=!0;if(f.length!==Y.length?F=!1:Y.forEach((u,s)=>{u!==f[s]&&(F=!1)}),!F){n.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),t.value=!1;return}l.value=[];for(const u of o){const s=Object.values(u);let m={};s.forEach((i,E)=>{m["value"+E]=i+""}),l.value.push(m),H.value=H.value+1}const C=[];l.value.forEach((u,s)=>{const m={};for(let i in u){const E=W[i],h=u[i];m[E]=h}C.push(m)});const r=[],c=[],a=[],e=[],_=[],p=[],v=[],D=g(new Date).format("YYYY-MM-DD");if(C.forEach((u,s)=>{const m=u.invoiceType.trim(),i=$.find(({label:K})=>K===m);i?(u.invoiceType=i.value,(i.value==="normal"||i.value==="electronic")&&!u.checkNumber&&c.push(String(s+1))):r.push(String(s+1));const E=u.invoiceType==="fully_digitalized_special_electronic"||u.invoiceType==="fully_digitalized_normal_electronic";(!u.open_time||u.open_time&&!g(u.open_time).isSame(g(D))&&!g(u.open_time).isBefore(g(D)))&&v.push(String(s+1));const h=/^\d+(\.\d+)?$/;!h.test(u.invoiceCode)&&!E&&a.push(String(s+1)),h.test(u.invoiceNumber)||e.push(String(s+1)),(!h.test(u.inv_subtotal_amount)||Number(u.inv_subtotal_amount)<0)&&!E&&_.push(String(s+1)),(!h.test(u.inv_total)||Number(u.inv_total)<0)&&E&&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,l.value=[];return}if(a.length>0){n({type:"error",message:`\u7B2C ${a.join(",")} \u884C,\u53D1\u7968\u4EE3\u7801\u5FC5\u987B\u4E3A\u6570\u5B57\u3002`}),t.value=!1,l.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,l.value=[];return}if(_.length>0){n({type:"error",message:`\u7B2C ${_.join(",")} \u884C,\u53D1\u7968\u7A0E\u524D\u91D1\u989D\u5FC5\u987B\u4E3A\u6570\u5B57\u4E14\u4E0D\u80FD\u662F\u8D1F\u6570`}),t.value=!1,l.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,l.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,l.value=[];return}t.value=!1},Z=async()=>{try{if(t.value)return;t.value=!0;const o=[];l.value.forEach((e,_)=>{const p={};for(let v in e){const D=W[v],u=e[v];p[D]=u}o.push(p)}),o.forEach((e,_)=>{const p=e.invoiceType.trim(),v=$.find(({label:D})=>D===p);e.invoiceType=v.value});const f=o.map(({companyNo:e})=>e);if([...new Set(f)].length>1){n.error("\u4E70\u65B9\u516C\u53F8\u7F16\u7801\u4E0D\u4E00\u81F4"),t.value=!1;return}if(o[0].companyNo!=T.value.companyNo){n.error("\u4E70\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:a}=await nu({list:o,is_comon:"0",companyNo:T.value.companyNo,relaComNo:T.value.companyNo});t.value=!1,q({code:r,message:c,noMessage:!1,handler:()=>{n.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),y("onSuccess"),b.value=!1},onError(){Number(r)===10004?lu({title:"\u4EE5\u4E0B\u5BF9\u8D26\u5355\u4E0D\u7B26\u5408\u8981\u6C42",message:U("div",null,[U("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"),U("p",null,a.join("\u3001"))])}):n.warning(c)}})}catch{}},J=()=>{l.value=[]};return k({onDisplay:()=>(b.value=!0,l.value=[])}),(o,f)=>{const F=A("el-table-column"),C=A("el-table"),r=A("el-button"),c=A("el-dialog");return d(),z(c,{"close-on-click-modal":!1,modelValue:b.value,"onUpdate:modelValue":f[0]||(f[0]=a=>b.value=a),title:"\u6279\u91CF\u5BFC\u5165\u5F00\u7968\u6570\u636E",width:"1040px",top:"8vh",center:""},{default:B(()=>[l.value.length===0?(d(),z(x(ou),{key:0,onOnSuccess:G})):O("v-if",!0),M(C,{data:l.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:B(()=>[(d(!0),S(eu,null,tu(x(L),(a,e)=>(d(),z(F,{type:a.type,minWidth:a.minWidth,fixed:a.fixed,key:e,prop:a.prop,"show-overflow-tooltip":""},{header:B(()=>[!x(su).includes(x(W)[a.prop])||a.label==="\u5E8F\u53F7"?(d(),S("span",iu,I(a.label),1)):(d(),S("p",cu,[pu,V(" "+I(a.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),l.value.length!==0?(d(),S("div",vu,[M(r,{size:"small",onClick:J},{default:B(()=>[V("\u53D6\u6D88")]),_:1}),M(r,{size:"small",type:"primary",loading:t.value,onClick:Z},{default:B(()=>[V("\u4FDD\u5B58")]),_:1},8,["loading"])])):O("v-if",!0)]),_:1},8,["modelValue"])}}});var _u=Q(fu,[["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/purchase/ticketReturn/components/execl-files-upload-inv/index.vue"]]);export{_u as default};
|