index.a21012.js 4.2 KB

1
  1. import{_ as $,d as L,x as b,W as M,aO as q,r as C,o as f,G as N,D as F,m as y,a as V,l as k,c as B,F as G,E as P,L as j,M as A,aZ as r,Q,R as T,h as Z}from"./index.js";import{e as J}from"./execl-upload.7c83427b.js";import{b as K}from"./index.26d6ac45.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 c=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return w.forEach((D,v)=>{c.push({prop:"value"+v,label:D,minWidth:v===0||v===1?"120px":"90px"})}),c};const ee=c=>(Q("data-v-d6db8a0e"),c=c(),T(),c),ue={key:0},te={key:1},ae=ee(()=>Z("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),oe={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},le=L({__name:"index",emits:["onSuccess"],setup(c,{expose:D,emit:v}){const E=b(!1),u=b(!1),l=b([]),U=Y(),{currentCompany:W}=M(),H=q(),I=({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,x)=>{const h={};for(let S in i){const d=z[S],m=i[S];if(d==="status"){const g=m.trim();g!=="\u901A\u8FC7"&&g!=="\u9A73\u56DE"?a.push(x+1):h[d]=g==="\u901A\u8FC7"?"4":"7"}else d==="hpNo"?(m||o.push(x+1),h[d]=m):(d==="payNo"&&(m||t.push(x+1)),h[d]=m)}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]!==W.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,H({code:e,message:_,handler:()=>{r.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),v("onSuccess"),E.value=!1}})},R=()=>{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:I})):V("v-if",!0),k(t,{data:l.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:F(()=>[(f(!0),B(G,null,P(y(U),(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:R},{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=$(le,[["__scopeId","data-v-d6db8a0e"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/supply/invoiceRelation/components/execl-files-upload/index.vue"]]);export{pe as default};