1 |
- import{b3 as R,ac as q,_ as L,d as U,w as _,U as P,a$ as G,b4 as H,r as A,o as C,G as g,C as D,l as h,a as w,j as E,c as F,F as $,D as J,L as j,h as K,M as x,aR as M,ah as Q,b0 as X,az as B}from"./index.js";import{e as Y}from"./execl-upload.59283836.js";import{m as N,t as V}from"./shared.f80a8b25.js";import{e as Z}from"./index.0b63e24d.js";import{I as ee}from"./index.46232daf.js";const d=[{label:"\u5546\u54C1ID",prop:"product_id",minWidth:"100px",required:!0,defaultData:["10","12"]},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u7EB3\u7A0E\u53F7",prop:"buyer_code",minWidth:"100px",required:!0,defaultData:["91110118MACEA1R94G","91110118MACEA1R94G"]},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u540D\u79F0",prop:"buyer_name",minWidth:"100px",required:!0,defaultData:["\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8","\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8"]},{label:"\u76D8\u70B9\u7C7B\u578B",prop:"check_type",minWidth:"100px",required:!0,defaultData:["\u8C03\u6574\u5355","\u524D\u671F\u6570\u636E\u5BFC\u5165"]},{label:"\u76D8\u70B9\u6570\u91CF",prop:"check_num",minWidth:"100px",required:!0,defaultData:["100","120"]},{label:"\u5E93\u5B58\u6570\u91CF",prop:"balance_num",minWidth:"100px",required:!0,defaultData:["110","120"]},{label:"\u8C03\u6574\u5355\u5165\u8D26\u6708\u4EFD",prop:"fz_date",minWidth:"160px",required:!0,defaultData:["2024-11","2024-11"]}],be=new Array(3).fill(1).map((u,e)=>d.reduce((a,l)=>{const b=e===0;let o="";return b?o=l.required?"\u5FC5\u586B":"":o=l.defaultData[e-1],{...a,[l.label]:o}},{})),ue=d.reduce((u,e)=>({...u,[e.label]:e.prop}),{}),W=d.reduce((u,e)=>({...u,[e.prop]:e.label}),{}),te=d.filter(u=>!!u.required).map(u=>u.prop);function ae(u){R({type:"warning",title:"\u6570\u636E\u6821\u9A8C\u5931\u8D25",message:q("div",{style:"display: flex, flex-direction: column"},{default:()=>Object.keys(u).reduce((e,a)=>[...e,q("p",{},"\u7B2C"+a+"\u884C,"+u[a])],[])})})}function le(u){const e={};let a=!1;for(const l in u){const b=u[l],o=Number(l)+1;for(const r in b){const p=String(b[r]).trim();te.includes(r)&&(!p||!String(p).trim())?e[o]?e[o]=e[o]+="\u3001"+W[r]:e[o]=W[r]:r==="check_type"&&!N[p]&&(a=!0)}e[o]?(e[o]+="\u4E0D\u80FD\u4E3A\u7A7A",a&&(e[o]+=" , \u76D8\u70B9\u7C7B\u578B\u5FC5\u987B\u4E3A"+V.map(({label:r})=>r).join("\u3001"))):a&&(e[o]="\u76D8\u70B9\u7C7B\u578B\u5FC5\u987B\u4E3A"+V.map(({label:r})=>r).join("\u3001"))}return Object.keys(e).length===0?!0:(ae(e),!1)}function oe(u){return!!le(u)}const se={key:0},re={key:1},ne={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},ie=U({__name:"index",props:{visible:{type:Boolean,required:!0}},emits:["refresh"],setup(u,{emit:e}){const a=_([]),l=_(!1),b=e,o=u,{getCurrentLicense:r}=P(),p=G(o,"visible"),S=H(),m=_({visible:!1,importColumns:[],columns:[]}),T=({results:f,header:t})=>{if(l.value=!0,f.length===0){B.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),l.value=!1;return}let v=!0;if(t.length!==d.length?v=!1:d.forEach((i,y)=>{i.label,t[y]}),!v){m.value.visible=!0,m.value.importColumns=[...t],m.value.columns=d.slice(1).map(({label:i})=>i),l.value=!1;return}a.value=[];const c=[];for(const i of f){const y={};Object.keys(i).forEach(k=>{const I=ue[k];y[I]=i[k]}),c.push(y)}const s=r(),n=[...new Set(c.map(({buyer_code:i})=>i))];if(n.length!==1){B.warning("\u5BFC\u5165\u6570\u636E\u7684\u8D2D\u4E70\u65B9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4");return}if(n[0]!==s){B.warning("\u5BFC\u5165\u6570\u636E\u8D2D\u4E70\u65B9\u516C\u53F8\u4E0E\u5F53\u524D\u9009\u62E9\u516C\u53F8\u4E0D\u4E00\u81F4");return}oe(c)&&(a.value=c),l.value=!1},O=async()=>{try{if(l.value)return;l.value=!0;const f=[];a.value.forEach(n=>{f.push({...n,check_type:N[n.check_type]})});const t=[];if(a.value.forEach((n,i)=>{Number(n.balance_num)===Number(n.check_num)&&t.push(i+1)}),t.length!==0){B.warning("\u7B2C"+t.join("\u3001")+"\u884C,\u76D8\u70B9\u6570\u91CF\u548C\u5E93\u5B58\u4E00\u81F4\u4E0D\u5141\u8BB8\u5BFC\u5165"),l.value=!1;return}const{code:v,message:c,data:s}=await Z({list:f});l.value=!1,S({code:v,message:c,noMessage:!1,handler:()=>{B.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),b("refresh"),p.value=!1}})}catch{}},z=()=>{a.value=[]};return(f,t)=>{const v=A("el-table-column"),c=A("el-table");return C(),g(h(X),{modelValue:h(p),"onUpdate:modelValue":t[1]||(t[1]=s=>Q(p)?p.value=s:null),"close-on-click-modal":!1,title:"\u76D8\u70B9\u5BFC\u5165",width:"1040px",top:"8vh",center:""},{default:D(()=>[a.value.length===0?(C(),g(h(Y),{key:0,style:{"margin-bottom":"10px"},onOnSuccess:T})):w("v-if",!0),E(c,{data:a.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:D(()=>[(C(!0),F($,null,J(h(d),(s,n)=>(C(),g(v,{minWidth:s.minWidth,"show-overflow-tooltip":"",fixed:s.fixed,prop:s.prop,type:s.type,key:n},{header:D(()=>[s.required?(C(),F("p",re,[t[2]||(t[2]=K("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),x(" "+j(s.label),1)])):(C(),F("span",se,j(s.label),1))]),_:2},1032,["minWidth","fixed","prop","type"]))),128))]),_:1},8,["data"]),a.value.length!==0?(C(),F("div",ne,[E(h(M),{size:"small",onClick:z},{default:D(()=>t[3]||(t[3]=[x("\u53D6\u6D88")])),_:1}),E(h(M),{size:"small",type:"primary",loading:l.value,onClick:O},{default:D(()=>t[4]||(t[4]=[x("\u4FDD\u5B58")])),_:1},8,["loading"])])):w("v-if",!0),E(ee,{visible:m.value.visible,"onUpdate:visible":t[0]||(t[0]=s=>m.value.visible=s),"import-columns":m.value.importColumns,columns:m.value.columns},null,8,["visible","import-columns","columns"])]),_:1},8,["modelValue"])}}});var pe=L(ie,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/inventoryCheck/components/BatchCreateModal/index.vue"]]),ve=Object.freeze(Object.defineProperty({__proto__:null,default:pe},Symbol.toStringTag,{value:"Module"}));export{pe as B,ve as i,be as o};
|