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