index.3bf35e.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 B,a as j,l as k,c as y,F as G,E as P,L as V,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{j as K}from"./index.26d6ac45.js";import"./xlsx.ed122d16.js";const w=["\u4E70\u65B9\u516C\u53F8\u7F16\u7801","\u56DE\u7968\u7533\u8BF7\u7F16\u7801","\u5BA1\u6838\u72B6\u6001","\u5BA1\u6838\u5907\u6CE8"],z={value0:"companyNo",value1:"hpNo",value2:"status",value3:"remark"},X=["payNo","companyNo","hpNo","status"],Y=()=>{const c=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return w.forEach((x,v)=>{c.push({label:x,prop:"value"+v,minWidth:v===0||v===1?"120px":"90px"})}),c};const ee=c=>(Q("data-v-021dc625"),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:x,emit:v}){const E=b(!1),u=b(!1),l=b([]),I=Y(),{currentCompany:U}=M(),W=q(),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,h)=>{p["value"+h]=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,D)=>{const _={};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(D+1):_[d]=g==="\u901A\u8FC7"?"4":"7"}else d==="hpNo"?(m||o.push(D+1),_[d]=m):(d==="payNo"&&(m||t.push(D+1)),_[d]=m)}s.push(_)});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:h}=await K({list:s});u.value=!1,W({code:e,message:h,handler:()=>{r.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),v("onSuccess"),E.value=!1}})},R=()=>{l.value=[]};return x({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(B(J),{key:0,onOnSuccess:H})):j("v-if",!0),k(t,{data:l.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:F(()=>[(f(!0),y(G,null,P(B(I),(e,h)=>(f(),N(o,{type:e.type,minWidth:e.minWidth,fixed:e.fixed,key:h,prop:e.prop,"show-overflow-tooltip":""},{header:F(()=>[!B(X).includes(B(z)[e.prop])||e.label==="\u5E8F\u53F7"?(f(),y("span",ue,V(e.label),1)):(f(),y("p",te,[ae,A(" "+V(e.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),l.value.length!==0?(f(),y("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"])])):j("v-if",!0)]),_:1},8,["modelValue"])}}});var pe=$(le,[["__scopeId","data-v-021dc625"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/purchaseNew/invoiceRelation/components/execl-files-upload/index.vue"]]);export{pe as default};