import{_ as W,d as j,O as I,n as v,m as O,r as f,o as r,A as B,y as p,i as m,a as C,h as _,c as F,F as q,z as G,G as y,e as L,H as E,cm as c,dk as D,cW as M}from"./index.js";import{f as P}from"./index.afe5f4bc.js";import{e as T}from"./execl-upload.d28cb458.js";import"./xlsx.ed122d16.js";const h=["\u6536\u6B3E\u65B9\u516C\u53F8\u7F16\u7801","\u6536\u6B3E\u65B9\u516C\u53F8\u540D\u79F0","\u8D44\u91D1\u7F16\u7801","\u8BA2\u5355\u7F16\u7801","\u8BA4\u9886\u8D44\u91D1"],J=["\u6536\u6B3E\u65B9\u516C\u53F8\u7F16\u7801","\u8D44\u91D1\u7F16\u7801","\u8BA2\u5355\u7F16\u7801","\u8BA4\u9886\u8D44\u91D1"],K=["companyNo","tradNo","orderCode","trad_fee"],Q=()=>[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"},{prop:"companyNo",label:"\u6536\u6B3E\u65B9\u516C\u53F8\u7F16\u7801"},{prop:"companyName",label:"\u6536\u6B3E\u65B9\u516C\u53F8\u540D\u79F0"},{prop:"tradNo",label:"\u8D44\u91D1\u7F16\u7801"},{prop:"orderCode",label:"\u8BA2\u5355\u7F16\u7801"},{prop:"trad_fee",label:"\u8BA4\u9886\u8D44\u91D1"}];const R={key:0},X={key:1},Y={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},Z=j({__name:"index",emits:["onSuccess"],setup(x,{expose:g,emit:b}){const{currentCompany:A}=I(),d=v(!1),l=v(!1),u=v([]),N=Q(),{logout:k}=O(),w=b,S=()=>{},V=({results:i,header:e})=>{if(l.value=!0,i.length===0){c.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),l.value=!1;return}let s=!0;if(e.length!==h.length?s=!1:h.forEach((o,t)=>{o!==e[t]&&(s=!1)}),!s){c.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),l.value=!1;return}u.value=[];try{i.forEach(t=>{const n=Object.values(t);let a={companyNo:n[0],companyName:n[1],tradNo:n[2],orderCode:n[3],trad_fee:n[4]};u.value.push(a)});const o=[...new Set(u.value.map(({companyNo:t})=>t))];if(o.length!==1){c.warning("\u4E0A\u4F20\u6570\u636E\u7684\u6536\u6B3E\u65B9\u516C\u53F8\u5FC5\u987B\u4E3A\u540C\u4E00\u5BB6\u516C\u53F8"),u.value=[];return}if(o[0]!==A.value.companyNo){c.warning("\u4E0A\u4F20\u6570\u636E\u7684\u6536\u6B3E\u65B9\u516C\u53F8\u4E0E\u5F53\u524D\u9009\u4E2D\u7684\u4E1A\u52A1\u516C\u53F8\u4E0D\u4E00\u81F4"),u.value=[];return}l.value=!1}catch{c.error("\u5BFC\u5165\u6570\u636E\u62FC\u63A5\u6709\u8BEF\uFF01"),l.value=!1}},z=async()=>{if(l.value)return;l.value=!0;let i=!0;if(u.value.forEach(o=>{for(let t in o)K.includes(t)&&!o[t]&&(i=!1)}),!i){D({title:"\u5FC5\u586B\u5B57\u6BB5\u7F3A\u5931\uFF01",type:"error"}),l.value=!1;return}const{code:e,message:s}=await P({list:m(u)});M({code:e,message:s,logout:k,handler:()=>{l.value=!1,c.success("\u8BA2\u5355\u8BA4\u6B3E\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),w("onSuccess"),d.value=!1},error:()=>{l.value=!1,D({title:s,type:"error"})}})},U=()=>{u.value=[]};return g({onDisplay:()=>(d.value=!0,u.value=[])}),(i,e)=>{const s=f("el-table-column"),o=f("el-table"),t=f("el-button"),n=f("el-dialog");return r(),B(n,{"close-on-click-modal":!1,"close-on-press-escape":!1,modelValue:d.value,"onUpdate:modelValue":e[0]||(e[0]=a=>d.value=a),title:"\u5BFC\u5165\u8BA2\u5355\u8BA4\u6B3E\u6570\u636E",width:"1040px",top:"8vh",center:"",onClose:S},{default:p(()=>[u.value.length===0?(r(),B(m(T),{key:0,onOnSuccess:V})):C("v-if",!0),_(o,{data:u.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:p(()=>[(r(!0),F(q,null,G(m(N),(a,H)=>(r(),B(s,{type:a.type,minWidth:a.minWidth,fixed:a.fixed,key:H,prop:a.prop,"show-overflow-tooltip":""},{header:p(()=>[!m(J).includes(a.label)||a.label==="\u5E8F\u53F7"?(r(),F("span",R,y(a.label),1)):(r(),F("p",X,[e[1]||(e[1]=L("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),E(" "+y(a.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),u.value.length!==0?(r(),F("div",Y,[_(t,{size:"small",onClick:U},{default:p(()=>e[2]||(e[2]=[E("\u53D6\u6D88")])),_:1}),_(t,{size:"small",type:"primary",loading:l.value,onClick:z},{default:p(()=>e[3]||(e[3]=[E("\u4FDD\u5B58")])),_:1},8,["loading"])])):C("v-if",!0)]),_:1},8,["modelValue"])}}});var le=W(Z,[["__scopeId","data-v-5c64c5e9"],["__file","D:/work/jiesuan/settle-vue3/src/views/InvoiceSales/capitalPool/components/execl-capital-files-upload/index.vue"]]);export{le as default};
