index.35528b06.js 4.2 KB

1
  1. import{_ as M,d as O,E as b,a5 as P,aC as R,x as C,o as f,N,K as F,u as y,a as V,y as k,c as B,M as T,L as q,W as S,aS as r,T as j,$ as K,a0 as G,b as J}from"./index.1417328f.js";import{e as Q}from"./execl-upload.2ed330c3.js";import{e as X}from"./index.28d5e629.js";import"./xlsx.ed122d16.js";const A=["\u4E70\u65B9\u516C\u53F8\u7F16\u7801","\u56DE\u7968\u7533\u8BF7\u7F16\u7801","\u5BF9\u8D26\u7F16\u53F7","\u5BA1\u6838\u72B6\u6001","\u5BA1\u6838\u5907\u6CE8"],z={value0:"companyNo",value1:"hpNo",value2:"payNo",value3:"status",value4:"remark"},Y=["payNo","companyNo","hpNo","status"],Z=()=>{const c=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return A.forEach((x,m)=>{c.push({prop:"value"+m,label:x,minWidth:m===0||m===1?"120px":"90px"})}),c};const ee=c=>(K("data-v-beccd394"),c=c(),G(),c),ue={key:0},te={key:1},ae=ee(()=>J("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),oe={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},se=S("\u53D6\u6D88"),le=S("\u4FDD\u5B58"),ne=O({__name:"index",emits:["onSuccess"],setup(c,{expose:x,emit:m}){const E=b(!1),u=b(!1),s=b([]),U=Z(),{currentCompany:W}=P(),H=R(),I=({results:l,header:a})=>{if(u.value=!0,l.length===0){r.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),u.value=!1;return}let o=!0;if(a.length!==A.length?o=!1:A.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}s.value=[];try{for(const t of l){const n=Object.values(t);let p={};n.forEach((e,v)=>{p["value"+v]=e+""}),s.value.push(p)}u.value=!1}catch(t){return t}},$=async()=>{if(u.value)return;u.value=!0;const l=[],a=[],o=[],t=[];s.value.forEach((i,D)=>{const h={};for(let w in i){const d=z[w],_=i[w];if(d==="status"){const g=_.trim();g!=="\u901A\u8FC7"&&g!=="\u9A73\u56DE"?a.push(D+1):h[d]=g==="\u901A\u8FC7"?"4":"7"}else d==="hpNo"?(_||o.push(D+1),h[d]=_):(d==="payNo"&&(_||t.push(D+1)),h[d]=_)}l.push(h)});const n=l.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\u53F7\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\u53F7\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}l.forEach(i=>{delete i.payNo,delete i.companyNo});const{code:e,message:v}=await X({list:l});u.value=!1,H({code:e,message:v,handler:()=>{r.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),m("onSuccess"),E.value=!1}})},L=()=>{s.value=[]};return x({onDisplay:()=>(E.value=!0,s.value=[])}),(l,a)=>{const o=C("el-table-column"),t=C("el-table"),n=C("el-button"),p=C("el-dialog");return f(),N(p,{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(()=>[s.value.length===0?(f(),N(y(Q),{key:0,onOnSuccess:I})):V("v-if",!0),k(t,{data:s.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:F(()=>[(f(!0),B(q,null,T(y(U),(e,v)=>(f(),N(o,{type:e.type,minWidth:e.minWidth,fixed:e.fixed,key:v,prop:e.prop,"show-overflow-tooltip":""},{header:F(()=>[!y(Y).includes(y(z)[e.prop])||e.label==="\u5E8F\u53F7"?(f(),B("span",ue,j(e.label),1)):(f(),B("p",te,[ae,S(" "+j(e.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),s.value.length!==0?(f(),B("div",oe,[k(n,{size:"small",onClick:L},{default:F(()=>[se]),_:1}),k(n,{size:"small",type:"primary",loading:u.value,onClick:$},{default:F(()=>[le]),_:1},8,["loading"])])):V("v-if",!0)]),_:1},8,["modelValue"])}}});var de=M(ne,[["__scopeId","data-v-beccd394"],["__file","/Users/apple/Desktop/Company Projects/accout-vue3-ui/src/views/purchase/ticketReturn/components/execl-files-upload/index.vue"]]);export{de as default};