index.a7b2dd.js 5.3 KB

1
  1. import{_ as H,d as j,x as _,w as P,W as T,r as B,o as r,G as b,D as d,m as g,a as k,l as m,c as E,F as N,E as q,L as S,M as w,aZ as f,bW as W,bx as M,Q as G,R as K,h as Q}from"./index.js";import{e as R}from"./index.4e61d38f.js";import{e as Z}from"./execl-upload.7c83427b.js";import"./xlsx.ed122d16.js";const F=[{label:"\u6536\u6B3E\u65B9\u516C\u53F8\u7F16\u7801",width:"160px",prop:"trade_in_code",required:!0},{label:"\u6536\u6B3E\u65B9\u516C\u53F8\u540D\u79F0",width:"160px",prop:"trade_in",required:!0},{label:"\u6536\u6B3E\u65B9\u8D26\u6237",width:"140px",prop:"trade_in_account",required:!0},{label:"\u4EA4\u6613\u65F6\u95F4",width:"120px",prop:"tradeTime",required:!0},{label:"\u5BA2\u6237\u673A\u6784\u540D\u79F0",width:"140px",prop:"customerName"},{label:"\u5BA2\u6237\u4ED8\u6B3E\u94F6\u884C\u6237\u540D",width:"160px",prop:"trade_out",required:!0},{label:"\u5BA2\u6237\u4ED8\u6B3E\u884C\u540D",width:"160px",prop:"trade_bank",required:!0},{label:"\u5BA2\u6237\u4ED8\u6B3E\u94F6\u884C\u8D26\u53F7",width:"160px",prop:"trade_account",required:!0},{label:"\u5BA2\u6237PO",width:"140px",prop:"poCode"},{label:"\u5BA2\u6237DN",width:"120px",prop:"NdCode"},{label:"\u4E1A\u52A1\u516C\u53F8\u6536\u5165\u603B\u4EF7",prop:"com_total",width:"160px",required:!0},{label:"\u4EA4\u6613\u7528\u9014",width:"120px",prop:"trade_used"}],J=()=>[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"},...F],X=n=>{var v;return(v=F.find(C=>C.label===n))==null?void 0:v.prop};const Y=n=>(G("data-v-b450d560"),n=n(),K(),n),$={key:0},ee={key:1},ue=Y(()=>Q("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),te={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},ae=j({__name:"index",emits:["onSuccess"],setup(n,{expose:v,emit:C}){const h=_(!1),o=_(!1),a=_([]),{logout:O}=P(),V=J(),{currentCompany:U}=T(),y=_(!1),D=_([]),z=({results:p,header:l})=>{if(o.value=!0,p.length===0){f.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),o.value=!1;return}let s=!0;const c=F.map(({label:u})=>u);if(l.length!==F.length?s=!1:c.forEach((u,e)=>{let t=l[e];t.indexOf("*")!==-1&&(t=t.split("*")[1]),u!==t&&(s=!1)}),!s){y.value=!0,D.value=[...l],o.value=!1;return}a.value=[];let i=!1;try{p.forEach(e=>{const t={};Object.keys(e).forEach(x=>{let A=x;x.indexOf("*")!==-1&&(A=x.split("*")[1]),t[X(A)]=e[x]}),t.tradeTime.indexOf("-")===-1&&(i=!0),a.value.push(t)});const u=[...new Set(a.value.map(({trade_in_code:e})=>e))];if(u.length!==1){f.warning("\u4E0A\u4F20\u6570\u636E\u7684\u6536\u6B3E\u65B9\u516C\u53F8\u5FC5\u987B\u4E3A\u540C\u4E00\u5BB6\u516C\u53F8"),a.value=[];return}if(u[0].trim()!==U.value.companyNo.trim()){f.warning("\u4E0A\u4F20\u6570\u636E\u7684\u6536\u6B3E\u65B9\u516C\u53F8\u4E0E\u5F53\u524D\u9009\u4E2D\u7684\u4E1A\u52A1\u516C\u53F8\u4E0D\u4E00\u81F4"),a.value=[];return}if(o.value=!1,i){a.value=[],f.error("\u4EA4\u6613\u65F6\u95F4\u683C\u5F0F\u9519\u8BEF,\u5E94\u4E3A:2020-01-01");return}a.value=a.value.map(e=>({...e,companyNo:e.trade_in_code,companyName:e.trade_in}))}catch{f.error("\u5BFC\u5165\u6570\u636E\u62FC\u63A5\u6709\u8BEF\uFF01"),o.value=!1}},I=async()=>{if(o.value)return;o.value=!0;let p=!0,l=[];const s=F.filter(u=>!!u.required).map(({prop:u})=>u);if(a.value.forEach(u=>{let e={};for(let t in u)e[t]=u[t],s.includes(t)&&!u[t]&&(p=!1);l.push({...e,trade_fee:e.com_total,trade_type:"0",trade_remark:""})}),!p){W({title:"\u5FC5\u586B\u5B57\u6BB5\u7F3A\u5931\uFF01",type:"error"}),o.value=!1;return}const{code:c,message:i}=await R({data:l});o.value=!1,M({code:c,message:i,logout:O,handler:()=>{h.value=!1,f.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),C("onSuccess")}})},L=()=>{a.value=[]};return v({onDisplay:()=>{h.value=!0,a.value=[]}}),(p,l)=>{const s=B("el-table-column"),c=B("el-table"),i=B("el-button"),u=B("el-dialog");return r(),b(u,{"close-on-click-modal":!1,"close-on-press-escape":!1,modelValue:h.value,"onUpdate:modelValue":l[1]||(l[1]=e=>h.value=e),title:"\u5BFC\u5165\u81EA\u8425\u8BA2\u5355\u56DE\u6B3E\u6570\u636E",width:"1040px",top:"8vh",center:""},{default:d(()=>[a.value.length===0?(r(),b(g(Z),{key:0,onOnSuccess:z})):k("v-if",!0),m(c,{stripe:"",border:"",size:"small",data:a.value,"max-height":"500px",style:{width:"100%"}},{default:d(()=>[(r(!0),E(N,null,q(g(V),(e,t)=>(r(),b(s,{width:e.width,fixed:e.fixed,type:e.type,prop:e.prop,key:t,"show-overflow-tooltip":""},{header:d(()=>[e.required?(r(),E("p",ee,[ue,w(" "+S(e.label),1)])):(r(),E("span",$,S(e.label),1))]),_:2},1032,["width","fixed","type","prop"]))),128))]),_:1},8,["data"]),a.value.length!==0?(r(),E("div",te,[m(i,{size:"small",onClick:L},{default:d(()=>[w("\u53D6\u6D88")]),_:1}),m(i,{size:"small",type:"primary",loading:o.value,onClick:I},{default:d(()=>[w("\u4FDD\u5B58")]),_:1},8,["loading"])])):k("v-if",!0),m(u,{modelValue:y.value,"onUpdate:modelValue":l[0]||(l[0]=e=>y.value=e),title:"\u5BFC\u5165\u6587\u4EF6\u8868\u5934\u4E0E\u6A21\u677F\u8868\u5934\u4E0D\u4E00\u81F4,\u5F53\u524D\u5BFC\u5165\u6587\u4EF6\u8868\u5934\u4E3A:","close-on-click-modal":!1,"close-on-press-escape":!1},{default:d(()=>[m(c,{border:"",size:"small"},{default:d(()=>[(r(!0),E(N,null,q(D.value,e=>(r(),b(s,{fit:"",label:e.indexOf("UNKNOWN")!==-1?"":e},null,8,["label"]))),256))]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])}}});var ne=H(ae,[["__scopeId","data-v-b450d560"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSales/capitalClaim/components/execl-files-upload/index.vue"]]);export{ne as default};