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