index.76ffe1.js 5.8 KB

1
  1. import{b2 as L,ac as g,_ as N,d as P,w as A,aZ as R,b3 as U,r as q,o as c,G as _,C as h,l as F,a as k,j as v,c as x,F as H,D as G,L as W,h as Z,M as B,aR as j,ah as J,a_ as K,az as D}from"./index.js";import{a as Q}from"./index.00d6e041.js";import{e as X}from"./execl-upload.0e9ffc49.js";import{b as M,c as Y,t as O,s as T}from"./shared.e62a6d9e.js";import{m as S,x as w}from"./status.4e0ebdbc.js";const m=[{type:"index",fixed:"left",label:"\u5E8F\u53F7",width:"50"},{label:"\u786E\u8BA4\u5355\u7F16\u53F7",prop:"orderCode",minWidth:"100px",required:!0,defaultData:""},{label:"\u9500\u552E\u4E3B\u5355\u53F7",prop:"cxCode",minWidth:"100px",required:!0,defaultData:""},{label:"\u4E1A\u52A1\u7C7B\u578B",prop:"type",minWidth:"100px",required:!0,defaultData:""},{label:"\u5E73\u53F0\u8BA2\u5355\u53F7",prop:"poCode",minWidth:"120px",required:!0,defaultData:""},{label:"\u5356\u51FA\u65B9\u516C\u53F8\u7F16\u7801",prop:"seller_code",minWidth:"120px",required:!0,defaultData:""},{label:"\u5356\u51FA\u65B9\u516C\u53F8\u540D\u79F0",prop:"seller_name",minWidth:"120px",required:!0,defaultData:""},{label:"\u5BA2\u6237\u516C\u53F8\u7F16\u53F7",prop:"buyer_code",minWidth:"120px",required:!0,defaultData:""},{label:"\u5BA2\u6237\u516C\u53F8\u540D\u79F0",prop:"buyer_name",minWidth:"100px",required:!0,defaultData:""},{label:"\u5546\u54C1\u7F16\u53F7",prop:"goodNo",minWidth:"100px",required:!0,defaultData:""},{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName",minWidth:"100px",required:!0,defaultData:""},{label:"\u4E0B\u5355\u6570\u91CF",prop:"num",minWidth:"110px",required:!0,defaultData:""},{label:"\u9500\u552E\u5355\u4EF7",prop:"goodPrice",minWidth:"110px",required:!0,defaultData:""},{label:"\u9500\u552E\u5408\u8BA1",prop:"totalPrice",minWidth:"110px",required:!0,defaultData:""},{label:"\u51FA\u5E93\u6708\u4EFD",prop:"fz_date",minWidth:"80px",required:!0,defaultData:""}],me=[m.slice(1).reduce((t,e)=>({...t,[e.label]:e.defaultData?e.defaultData:""}),{})],$=m.reduce((t,e)=>({...t,[e.label]:e.prop}),{}),V=m.reduce((t,e)=>({...t,[e.prop]:e.label}),{}),ee=m.filter(t=>!!t.required).map(t=>t.prop);function ue(t){L({type:"warning",title:"\u6570\u636E\u6821\u9A8C\u5931\u8D25",message:g("div",{style:"display: flex, flex-direction: column"},{default:()=>Object.keys(t).reduce((e,i)=>[...e,g("p",{},"\u7B2C"+i+"\u884C,"+t[i])],[])})})}function te(t){const e={};let i=!1,E=!1,o=!1;for(const s in t){const n=t[s],r=Number(s)+1;for(const u in n){const p=String(n[u]).trim();ee.includes(u)&&(!p||!String(p).trim())?e[r]?e[r]=e[r]+="\u3001"+V[u]:e[r]=V[u]:u==="type"&&!M[p]?i=!0:u==="source"&&!Y[p]?E=!0:u==="inv_type"&&!S[p]&&(o=!0)}e[r]?(e[r]+="\u4E0D\u80FD\u4E3A\u7A7A",i&&(e[r]+=" , \u7C7B\u578B\u5FC5\u987B\u4E3A"+O.map(({label:u})=>u).join("\u3001")),E&&(e[r]+=" ,\u8BA2\u5355\u6765\u6E90\u5FC5\u987B\u4E3A"+T.map(({label:u})=>u).join("\u3001")),o&&(e[r]+=" ,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A"+w.map(({label:u})=>u).join("\u3001"))):(i&&(e[r]="\u7C7B\u578B\u5FC5\u987B\u4E3A"+O.map(({label:u})=>u).join("\u3001")),E&&(e[r]=" \u8BA2\u5355\u6765\u6E90\u5FC5\u987B\u4E3A"+T.map(({label:u})=>u).join("\u3001")),o&&(e[r]=" \u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A"+w.map(({label:u})=>u).join("\u3001")))}return Object.keys(e).length===0?!0:(ue(e),!1)}function ae(t){return!!te(t)}const re={key:0},le={key:1},oe={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},se=P({__name:"index",props:{visible:{type:Boolean,required:!0}},emits:["refresh"],setup(t,{emit:e}){const i=t,E=e,o=A([]),s=A(!1),n=R(i,"visible"),r=U(),u=({results:d,header:l})=>{if(s.value=!0,d.length===0){D.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),s.value=!1;return}let f=!0;if(l.length!==m.length-1?f=!1:m.slice(1).forEach((a,y)=>{a.label!==l[y]&&(f=!1)}),!f){D.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),s.value=!1;return}o.value=[];const b=[];for(const a of d){const y={};Object.keys(a).forEach(C=>{const z=$[C];y[z]=a[C]}),b.push(y)}ae(b)&&(o.value=b),s.value=!1},p=async()=>{try{if(s.value)return;s.value=!0;const d=[];o.value.forEach(a=>{d.push({...a,inv_type:S[a.inv_type],relaArr:[{id:1,num:a.num}],type:M[a.type],platform_type:"2",goodType:"1",cat_code:"0",cat_name:"0",channel:"3",source:"1",unit:"0",tax:"0"})});const{code:l,message:f,data:b}=await Q({list:d});s.value=!1,r({code:l,message:f,noMessage:!1,handler:()=>{D.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),E("refresh"),n.value=!1}})}catch{}},I=()=>{o.value=[]};return(d,l)=>{const f=q("el-table-column"),b=q("el-table");return c(),_(F(K),{modelValue:F(n),"onUpdate:modelValue":l[0]||(l[0]=a=>J(n)?n.value=a:null),"close-on-click-modal":!1,title:"C\u7AEF\u65E0\u53D1\u7968\u8BA2\u5355\u51FA\u5E93",width:"1040px",top:"8vh",center:""},{default:h(()=>[o.value.length===0?(c(),_(F(X),{key:0,style:{"margin-bottom":"10px"},onOnSuccess:u})):k("v-if",!0),v(b,{data:o.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:h(()=>[(c(!0),x(H,null,G(F(m),(a,y)=>(c(),_(f,{minWidth:a.minWidth,"show-overflow-tooltip":"",fixed:a.fixed,prop:a.prop,type:a.type,key:y},{header:h(()=>[a.required?(c(),x("p",le,[l[1]||(l[1]=Z("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),B(" "+W(a.label),1)])):(c(),x("span",re,W(a.label),1))]),_:2},1032,["minWidth","fixed","prop","type"]))),128))]),_:1},8,["data"]),o.value.length!==0?(c(),x("div",oe,[v(F(j),{size:"small",onClick:I},{default:h(()=>l[2]||(l[2]=[B("\u53D6\u6D88")])),_:1}),v(F(j),{size:"small",type:"primary",loading:s.value,onClick:p},{default:h(()=>l[3]||(l[3]=[B("\u4FDD\u5B58")])),_:1},8,["loading"])])):k("v-if",!0)]),_:1},8,["modelValue"])}}});var ie=N(se,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/clientC/components/OrderImportModal/index.vue"]]),be=Object.freeze(Object.defineProperty({__proto__:null,default:ie},Symbol.toStringTag,{value:"Module"}));export{ie as O,be as i,me as o};