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