1 |
- import{_ as H,d as O,w as y,W as R,aP as q,r as h,o as d,G as D,C as f,l as F,a as I,j as g,c as x,F as G,D as L,L as w,M as b,aZ as E,b6 as M,Q as P,R as Q,h as T}from"./index.js";import{e as Z}from"./execl-upload.343222a6.js";import{h as J}from"./index.c75071f3.js";import"./xlsx.ed122d16.js";const k=["\u53D1\u7968\u660E\u7EC6ID","\u8BA2\u5355\u7F16\u53F7","\u8BA2\u5355\u4E3B\u7F16\u53F7","\u5546\u54C1\u540D\u79F0","\u5F00\u7968\u5546\u54C1\u540D\u79F0","\u5546\u54C1\u7C7B\u76EE\u7F16\u53F7","\u7A0E\u7387","\u672C\u6B21\u5F00\u7968\u91D1\u989D","\u672C\u6B21\u5F00\u7968\u6570\u91CF"],B={value0:"itemId",value1:"code",value2:"code_2",value3:"goodName",value4:"openGoodName",value5:"cat_code",value6:"tax",value7:"total_amount",value8:"num"},K={value0:"100px",value1:"160px",value2:"160px",value3:"160px",value4:"160px",value5:"120px",value6:"140px",value7:"140px",value8:"220px",value9:"140px"},A=["itemId","code","num","total_amount","good_price","companyNo"],X=()=>{const i=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return k.forEach((C,m)=>{i.push({minWidth:K["value"+m],prop:"value"+m,label:C})}),i};const Y=i=>(P("data-v-8476c384"),i=i(),Q(),i),$={key:0},ee={key:1},ue=Y(()=>T("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),oe={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},ae=O({__name:"index",emits:["onSuccess"],setup(i,{expose:C,emit:m}){const _=y(!1),v=y(!1),s=y([]),S=X();R();const j=q();function N(r){let a=!1;const t=[];return r.forEach((n,l)=>{Object.keys(n).forEach(e=>{if(A.includes(e)){const u=n[e];(!u||String(u).trim()==="")&&!t.includes(l+1)&&(a=!0,t.push(l+1))}})}),a&&E.error("\u7B2C "+t.join(",")+" \u884C\u53D1\u7968\u660E\u7EC6ID,\u8BA2\u5355\u7F16\u53F7,\u672C\u6B21\u5F00\u7968\u91D1\u989D,\u672C\u6B21\u5F00\u7968\u6570\u91CF\u4E0D\u80FD\u4E3A\u7A7A"),a}const V=({results:r,header:a})=>{if(v.value=!0,r.length===0){E.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),v.value=!1;return}let t=!0;if(a.length!==k.length?t=!1:k.forEach((o,e)=>{o!==a[e]&&(t=!1)}),!t){E.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),v.value=!1;return}s.value=[];try{for(const o of r){const e=Object.values(o);let u={};e.forEach((c,p)=>{u["value"+p]=c+""}),s.value.push(u)}v.value=!1}catch(o){return o}const n=[];s.value.forEach((o,e)=>{const u={};for(let c in o){const p=B[c],z=o[c];u[p]=z}n.push(u)}),N(n)&&(s.value=[])},W=async()=>{if(v.value)return;let r=[];const a=[];s.value.forEach((l,o)=>{const e={};for(let u in l){const c=B[u],p=l[u];e[c]=p}a.push(e)}),a.forEach(l=>{const{itemId:o,code:e,num:u,total_amount:c}=l,p=Number(M(c,u)).toFixed(2);r.push({itemId:o,code:e,num:u,good_price:p,total_amount:c,remark:""})});const{code:t,message:n}=await J({order_type:"1",list:r});j({code:t,message:n,handler:()=>{E.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),m("onSuccess"),_.value=!1}})},U=()=>{s.value=[]};return C({onDisplay:()=>(_.value=!0,s.value=[])}),(r,a)=>{const t=h("el-table-column"),n=h("el-table"),l=h("el-button"),o=h("el-dialog");return d(),D(o,{"close-on-click-modal":!1,modelValue:_.value,"onUpdate:modelValue":a[0]||(a[0]=e=>_.value=e),title:"\u6279\u91CF\u5BFC\u5165\u53D1\u7968\u4E0E\u8BA2\u5355\u5173\u8054\u7ED3\u679C",width:"1040px",top:"8vh",center:""},{default:f(()=>[s.value.length===0?(d(),D(F(Z),{key:0,onOnSuccess:V})):I("v-if",!0),g(n,{data:s.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:f(()=>[(d(!0),x(G,null,L(F(S),(e,u)=>(d(),D(t,{type:e.type,minWidth:e.minWidth,fixed:e.fixed,key:u,prop:e.prop,"show-overflow-tooltip":""},{header:f(()=>[!F(A).includes(F(B)[e.prop])||e.label==="\u5E8F\u53F7"?(d(),x("span",$,w(e.label),1)):(d(),x("p",ee,[ue,b(" "+w(e.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),s.value.length!==0?(d(),x("div",oe,[g(l,{size:"small",onClick:U},{default:f(()=>[b("\u53D6\u6D88")]),_:1}),g(l,{size:"small",type:"primary",loading:v.value,onClick:W},{default:f(()=>[b("\u4FDD\u5B58")]),_:1},8,["loading"])])):I("v-if",!0)]),_:1},8,["modelValue"])}}});var ce=H(ae,[["__scopeId","data-v-8476c384"],["__file","C:/Users/63107/Desktop/projects/settle-vue3/src/views/InvoiceSales/invoiceApply/components/excel-files-upload-relation/index.vue"]]);export{ce as default};
|