import{_ as z,d as M,E as f,D as T,x as m,o as p,N as D,K as h,u as B,a as b,y as g,c as k,M as $,L,W as w,aS as v,ba as O,b4 as W}from"./index.1417328f.js";import{i as H}from"./index.cc00443d.js";import{e as K}from"./execl-upload.2ed330c3.js";import{d as A}from"./status.727086c1.js";import"./xlsx.ed122d16.js";const x=["\u53D1\u7968\u7533\u8BF7\u7F16\u53F7","\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"],Y={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 E=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return x.forEach((F,i)=>{E.push({prop:"value"+i,label:F,minWidth:i===0||i===1?"120px":"90px"})}),E};const G={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},J=w("\u53D6\u6D88"),Q=w("\u4FDD\u5B58"),R=M({__name:"index",emits:["onSuccess"],setup(E,{expose:F,emit:i}){const d=f(!1),o=f(!1),s=f([]),j=q(),{logout:N}=T(),V=A.map(({label:u})=>u),y=f(1),S=u=>`\u5BFC\u5165\u6570\u636E\u7B2C ${u} \u884C \u53D1\u7968\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A${V.join(",")}`,U=({results:u,header:t})=>{if(o.value=!0,u.length===0){v.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),o.value=!1;return}let l=!0;if(t.length!==x.length?l=!1:x.forEach((c,n)=>{c!==t[n]&&(l=!1)}),!l){v.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),o.value=!1;return}s.value=[];for(const c of u){const n=Object.values(c);let e={};n.forEach((a,r)=>{e["value"+r]=a+""}),s.value.push(e)}o.value=!1},I=async()=>{if(o.value)return;o.value=!0;const u=[],t=[],l=[];if(s.value.forEach(e=>{const a={};for(let r in e){const _=Y[r],C=e[r];a[_]=C}u.push(a)}),u.forEach((e,a)=>{const{inv_type:r}=e,_=A.find(({label:C})=>C===r.trim());_?e.inv_type=_.value:t.push(a+1),(e.inv_type==="electronic"||e.inv_type==="normal")&&!e.check_code&&l.push(a+1)}),l.length>0){v.error(`\u7B2C ${l.join(",")} \u884C\u6821\u9A8C\u7801\u4E0D\u80FD\u4E3A\u7A7A`),o.value=!1;return}if(t.length>0){v.error(S(t.join(","))),o.value=!1;return}const{code:c,message:n}=await H({data:u});o.value=!1,O({code:c,message:n,logout:N,handler:()=>{v.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),i("onSuccess"),d.value=!1,y.value=1}})},P=()=>{s.value=[],y.value=1};return F({onDisplay:()=>(d.value=!0,s.value=[])}),(u,t)=>{const l=m("el-table-column"),c=m("el-table"),n=m("el-button"),e=m("el-dialog");return p(),D(e,{modelValue:d.value,"onUpdate:modelValue":t[0]||(t[0]=a=>d.value=a),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?(p(),D(B(K),{key:0,onOnSuccess:U})):b("v-if",!0),g(c,{data:s.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:h(()=>[(p(!0),k(L,null,$(B(j),(a,r)=>(p(),D(l,W(a,{key:r,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),s.value.length!==0?(p(),k("div",G,[g(n,{size:"small",onClick:P},{default:h(()=>[J]),_:1}),g(n,{size:"small",type:"primary",loading:o.value,onClick:I},{default:h(()=>[Q]),_:1},8,["loading"])])):b("v-if",!0)]),_:1},8,["modelValue"])}}});var oe=z(R,[["__scopeId","data-v-1e20f0dd"],["__file","/Users/apple/Desktop/Company Projects/accout-vue3-ui/src/views/InvoiceSales/invoiceApply/components/execl-files-upload/index.vue"]]);export{oe as default};