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