import{_ as L,d as M,w as b,W as Q,aO as R,r as C,o as f,G as N,C as F,u as y,a as V,l as k,c as B,F as q,D as G,L as j,M as A,aY as r,Q as P,R as T,b as Y}from"./index.1d1a5ecb.js";import{e as J}from"./execl-upload.e6fd115e.js";import{a as K}from"./index.48d04e86.js";import"./xlsx.ed122d16.js";const w=["\u4E70\u65B9\u516C\u53F8\u7F16\u7801","\u56DE\u7968\u7533\u8BF7\u7F16\u7801","\u5BF9\u8D26\u7F16\u7801","\u5BA1\u6838\u72B6\u6001","\u5BA1\u6838\u5907\u6CE8"],z={value0:"companyNo",value1:"hpNo",value2:"payNo",value3:"status",value4:"remark"},X=["payNo","companyNo","hpNo","status"],Z=()=>{const c=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return w.forEach((D,m)=>{c.push({prop:"value"+m,label:D,minWidth:m===0||m===1?"120px":"90px"})}),c};const ee=c=>(P("data-v-56311783"),c=c(),T(),c),ue={key:0},te={key:1},ae=ee(()=>Y("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),oe={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},le=M({__name:"index",emits:["onSuccess"],setup(c,{expose:D,emit:m}){const E=b(!1),u=b(!1),l=b([]),I=Z(),{currentCompany:U}=Q(),W=R(),H=({results:s,header:a})=>{if(u.value=!0,s.length===0){r.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),u.value=!1;return}let o=!0;if(a.length!==w.length?o=!1:w.forEach((t,n)=>{t!==a[n]&&(o=!1)}),!o){r.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),u.value=!1;return}l.value=[];try{for(const t of s){const n=Object.values(t);let p={};n.forEach((e,_)=>{p["value"+_]=e+""}),l.value.push(p)}u.value=!1}catch(t){return t}},O=async()=>{if(u.value)return;u.value=!0;const s=[],a=[],o=[],t=[];l.value.forEach((i,g)=>{const h={};for(let S in i){const d=z[S],v=i[S];if(d==="status"){const x=v.trim();x!=="\u901A\u8FC7"&&x!=="\u9A73\u56DE"?a.push(g+1):h[d]=x==="\u901A\u8FC7"?"4":"7"}else d==="hpNo"?(v||o.push(g+1),h[d]=v):(d==="payNo"&&(v||t.push(g+1)),h[d]=v)}s.push(h)});const n=s.map(({companyNo:i})=>i),p=[...new Set(n)];if(a.length>0){r.error(`\u7B2C ${a.join(",")} \u884C\u5BA1\u6838\u72B6\u6001\u683C\u5F0F\u4E0D\u6B63\u786E,\u5E94\u8BE5\u4E3A'\u901A\u8FC7',\u6216'\u9A73\u56DE'`),u.value=!1;return}if(o.length>0){r.error(`\u7B2C ${o.join(",")} \u884C\u683C\u5F0F\u4E0D\u6B63\u786E,\u56DE\u7968\u7533\u8BF7\u7F16\u7801\u4E3A\u5FC5\u586B\u9879`),u.value=!1;return}if(t.length>0){r.error(`\u7B2C ${t.join(",")} \u884C\u683C\u5F0F\u4E0D\u6B63\u786E,\u5BF9\u8D26\u7F16\u7801\u4E3A\u5FC5\u586B\u9879`),u.value=!1;return}if(p.length>1){r.error("\u4E70\u65B9\u516C\u53F8\u7F16\u7801\u4E0D\u4E00\u81F4"),u.value=!1;return}if(p[0]!==U.value.companyNo){r.error("\u4E70\u65B9\u516C\u53F8\u7F16\u7801\u4E0E\u5F53\u524D\u9009\u62E9\u7684\u516C\u53F8\u4E0D\u4E00\u81F4"),u.value=!1;return}s.forEach(i=>{delete i.payNo,delete i.companyNo});const{code:e,message:_}=await K({list:s});u.value=!1,W({code:e,message:_,handler:()=>{r.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),m("onSuccess"),E.value=!1}})},$=()=>{l.value=[]};return D({onDisplay:()=>(E.value=!0,l.value=[])}),(s,a)=>{const o=C("el-table-column"),t=C("el-table"),n=C("el-button"),p=C("el-dialog");return f(),N(p,{"close-on-click-modal":!1,modelValue:E.value,"onUpdate:modelValue":a[0]||(a[0]=e=>E.value=e),title:"\u6279\u91CF\u5BFC\u5165\u8BA4\u8BC1\u7ED3\u679C",width:"1040px",top:"8vh",center:""},{default:F(()=>[l.value.length===0?(f(),N(y(J),{key:0,onOnSuccess:H})):V("v-if",!0),k(t,{data:l.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:F(()=>[(f(!0),B(q,null,G(y(I),(e,_)=>(f(),N(o,{type:e.type,minWidth:e.minWidth,fixed:e.fixed,key:_,prop:e.prop,"show-overflow-tooltip":""},{header:F(()=>[!y(X).includes(y(z)[e.prop])||e.label==="\u5E8F\u53F7"?(f(),B("span",ue,j(e.label),1)):(f(),B("p",te,[ae,A(" "+j(e.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),l.value.length!==0?(f(),B("div",oe,[k(n,{size:"small",onClick:$},{default:F(()=>[A("\u53D6\u6D88")]),_:1}),k(n,{size:"small",type:"primary",loading:u.value,onClick:O},{default:F(()=>[A("\u4FDD\u5B58")]),_:1},8,["loading"])])):V("v-if",!0)]),_:1},8,["modelValue"])}}});var pe=L(le,[["__scopeId","data-v-56311783"],["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/purchase/buyInvoiceQuery/components/execl-files-upload/index.vue"]]);export{pe as default};
