1 |
- import{by as R,a7 as A,_ as L,d as U,m as _,O as P,bs as G,bz as H,r as q,o as C,A as g,x as y,h,a as w,f as E,c as F,F as J,y as K,G as V,e as Q,H as x,bm as j,ac as X,bt as Y,az as D}from"./index.js";import{e as Z}from"./execl-upload.8692a4ce.js";import{m as N,t as M}from"./shared.f80a8b25.js";import{f as $}from"./index.004a0bb2.js";import{I as ee}from"./index.e25db4d1.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:A("div",{style:"display: flex, flex-direction: column"},{default:()=>Object.keys(u).reduce((e,a)=>[...e,A("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"+M.map(({label:r})=>r).join("\u3001"))):a&&(e[o]="\u76D8\u70B9\u7C7B\u578B\u5FC5\u987B\u4E3A"+M.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"),O=H(),m=_({visible:!1,importColumns:[],columns:[]}),S=({results:f,header:t})=>{if(l.value=!0,f.length===0){D.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,B)=>{i.label,t[B]}),!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 B={};Object.keys(i).forEach(k=>{const I=ue[k];B[I]=i[k]}),c.push(B)}const s=r(),n=[...new Set(c.map(({buyer_code:i})=>i))];if(n.length!==1){D.warning("\u5BFC\u5165\u6570\u636E\u7684\u8D2D\u4E70\u65B9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4");return}if(n[0]!==s){D.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},T=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){D.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 $({list:f});l.value=!1,O({code:v,message:c,noMessage:!1,handler:()=>{D.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),b("refresh"),p.value=!1}})}catch{}},z=()=>{a.value=[]};return(f,t)=>{const v=q("el-table-column"),c=q("el-table");return C(),g(h(Y),{modelValue:h(p),"onUpdate:modelValue":t[1]||(t[1]=s=>X(p)?p.value=s:null),"close-on-click-modal":!1,title:"\u76D8\u70B9\u5BFC\u5165",width:"1040px",top:"8vh",center:""},{default:y(()=>[a.value.length===0?(C(),g(h(Z),{key:0,style:{"margin-bottom":"10px"},onOnSuccess:S})):w("v-if",!0),E(c,{data:a.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:y(()=>[(C(!0),F(J,null,K(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:y(()=>[s.required?(C(),F("p",re,[t[2]||(t[2]=Q("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),x(" "+V(s.label),1)])):(C(),F("span",se,V(s.label),1))]),_:2},1032,["minWidth","fixed","prop","type"]))),128))]),_:1},8,["data"]),a.value.length!==0?(C(),F("div",ne,[E(h(j),{size:"small",onClick:z},{default:y(()=>t[3]||(t[3]=[x("\u53D6\u6D88")])),_:1}),E(h(j),{size:"small",type:"primary",loading:l.value,onClick:T},{default:y(()=>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};
|