import{_ as M,d as P,w as f,v as T,r as m,o as v,G as D,C as h,u as y,a as b,l as g,c as k,F as $,D as O,bw as Y,M as A,aY as p,bn as G}from"./index.1d1a5ecb.js";import{j as H}from"./index.5fa131c7.js";import{e as L}from"./execl-upload.e6fd115e.js";import{c as w}from"./status.d6b2a53d.js";import"./xlsx.ed122d16.js";const x=["\u53D1\u7968\u7533\u8BF7\u7F16\u7801","\u53D1\u7968\u7C7B\u578B","\u53D1\u7968\u4EE3\u7801","\u53D1\u7968\u53F7\u7801","\u4EF7\u7A0E\u5408\u8BA1","\u53D1\u7968\u91D1\u989D","\u6821\u9A8C\u7801","\u5F00\u7968\u65E5\u671F"],W={value0:"invNo",value1:"inv_type",value2:"inv_code",value3:"inv_number",value4:"inv_total",value5:"inv_subtotal",value6:"check_code",value7:"open_date"},q=()=>{const F=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return x.forEach((E,i)=>{F.push({prop:"value"+i,label:E,minWidth:i===0||i===1?"120px":"90px"})}),F};const J={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},K=P({__name:"index",emits:["onSuccess"],setup(F,{expose:E,emit:i}){const d=f(!1),a=f(!1),s=f([]),j=q(),{logout:V}=T(),N=w.map(({label:u})=>u),B=f(1),U=u=>`\u5BFC\u5165\u6570\u636E\u7B2C ${u} \u884C \u53D1\u7968\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A${N.join(",")}`,S=({results:u,header:o})=>{if(a.value=!0,u.length===0){p.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),a.value=!1;return}let t=!0;if(o.length!==x.length?t=!1:x.forEach((c,n)=>{c!==o[n]&&(t=!1)}),!t){p.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),a.value=!1;return}s.value=[];for(const c of u){const n=Object.values(c);let e={};n.forEach((l,r)=>{e["value"+r]=l+""}),s.value.push(e)}a.value=!1},I=async()=>{if(a.value)return;a.value=!0;const u=[],o=[],t=[];if(s.value.forEach(e=>{const l={};for(let r in e){const _=W[r],C=e[r];l[_]=C}u.push(l)}),u.forEach((e,l)=>{const{inv_type:r}=e,_=w.find(({label:C})=>C===r.trim());_?e.inv_type=_.value:o.push(l+1),(e.inv_type==="electronic"||e.inv_type==="normal")&&!e.check_code&&t.push(l+1)}),t.length>0){p.error(`\u7B2C ${t.join(",")} \u884C\u6821\u9A8C\u7801\u4E0D\u80FD\u4E3A\u7A7A`),a.value=!1;return}if(o.length>0){p.error(U(o.join(","))),a.value=!1;return}const{code:c,message:n}=await H({data:u});a.value=!1,G({code:c,message:n,logout:V,handler:()=>{p.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),i("onSuccess"),d.value=!1,B.value=1}})},z=()=>{s.value=[],B.value=1};return E({onDisplay:()=>(d.value=!0,s.value=[])}),(u,o)=>{const t=m("el-table-column"),c=m("el-table"),n=m("el-button"),e=m("el-dialog");return v(),D(e,{"close-on-click-modal":!1,modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=l=>d.value=l),title:"\u6279\u91CF\u5BFC\u5165\u8D22\u52A1\u5F00\u7968\u7ED3\u679C(\u53D1\u7968\u7533\u8BF7\uFF09",width:"1040px",top:"8vh",center:""},{default:h(()=>[s.value.length===0?(v(),D(y(L),{key:0,onOnSuccess:S})):b("v-if",!0),g(c,{data:s.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:h(()=>[(v(!0),k($,null,O(y(j),(l,r)=>(v(),D(t,Y(l,{key:r,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),s.value.length!==0?(v(),k("div",J,[g(n,{size:"small",onClick:z},{default:h(()=>[A("\u53D6\u6D88")]),_:1}),g(n,{size:"small",type:"primary",loading:a.value,onClick:I},{default:h(()=>[A("\u4FDD\u5B58")]),_:1},8,["loading"])])):b("v-if",!0)]),_:1},8,["modelValue"])}}});var ue=M(K,[["__scopeId","data-v-1e20f0dd"],["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/InvoiceSales/invoiceApply/components/execl-files-upload/index.vue"]]);export{ue as default};
