import{b2 as z,ac as E,_ as S,d as I,w as k,a_ as L,b3 as N,r as F,o as p,G as B,C as b,l as m,a as j,j as _,c as y,F as P,D as R,L as q,h as U,M as C,aR as V,ah as H,a$ as G,az as D}from"./index.js";import{e as $}from"./execl-upload.765cd18b.js";import{d as J}from"./index.81d51bb0.js";const c=[{label:"\u5546\u54C1ID",prop:"product_id",minWidth:"100px",defaultData:"",required:!0},{label:"\u76D8\u70B9\u7C7B\u578B",prop:"check_type",minWidth:"100px",defaultData:"",required:!0},{label:"\u76D8\u70B9\u6570\u91CF",prop:"check_num",minWidth:"100px",defaultData:"",required:!0},{label:"\u5E93\u5B58\u6570\u91CF",prop:"balance_num",minWidth:"100px",defaultData:"",required:!0},{label:"\u8C03\u6574\u5355\u5165\u8D26\u6708\u4EFD",prop:"fz_date",minWidth:"160px",defaultData:"",required:!0}],ie=[c.reduce((t,e)=>({...t,[e.label]:e.defaultData?e.defaultData:""}),{})],K=c.reduce((t,e)=>({...t,[e.label]:e.prop}),{}),w=c.reduce((t,e)=>({...t,[e.prop]:e.label}),{}),Q=c.filter(t=>!!t.required).map(t=>t.prop),x=[{value:"1",label:"\u524D\u671F\u6570\u636E\u5BFC\u5165"},{value:"2",label:"\u8C03\u6574\u5355"}],A=x.reduce((t,e)=>({...t,[e.label]:e.value}),{}),X=[{value:"1",label:"\u91C7\u9500\u7ED3\u7B97"},{value:"2",label:"\u7EBF\u4E0B\u8BA2\u5355"}];X.reduce((t,e)=>({...t,[e.label]:e.value}),{});function Y(t){z({type:"warning",title:"\u6570\u636E\u6821\u9A8C\u5931\u8D25",message:E("div",{style:"display: flex, flex-direction: column"},{default:()=>Object.keys(t).reduce((e,a)=>[...e,E("p",{},"\u7B2C"+a+"\u884C,"+t[a])],[])})})}function Z(t){const e={};let a=!1;for(const s in t){const v=t[s],r=Number(s)+1;for(const l in v){const h=String(v[l]).trim();Q.includes(l)&&(!h||!String(h).trim())?e[r]?e[r]=e[r]+="\u3001"+w[l]:e[r]=w[l]:l==="check_type"&&!A[h]&&(a=!0)}e[r]?(e[r]+="\u4E0D\u80FD\u4E3A\u7A7A",a&&(e[r]+=" , \u76D8\u70B9\u7C7B\u578B\u5FC5\u987B\u4E3A"+x.map(({label:l})=>l).join("\u3001"))):a&&(e[r]="\u76D8\u70B9\u7C7B\u578B\u5FC5\u987B\u4E3A"+x.map(({label:l})=>l).join("\u3001"))}return Object.keys(e).length===0?!0:(Y(e),!1)}function ee(t){return!!Z(t)}const te={key:0},ue={key:1},ae={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},le=I({__name:"index",props:{visible:{type:Boolean,required:!0}},emits:["refresh"],setup(t,{emit:e}){const a=k([]),s=k(!1),v=e,l=L(t,"visible"),h=N(),M=({results:n,header:o})=>{if(s.value=!0,n.length===0){D.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),s.value=!1;return}let i=!0;if(o.length!==c.length?i=!1:c.forEach((u,f)=>{u.label!==o[f]&&(i=!1)}),!i){D.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),s.value=!1;return}a.value=[];const d=[];for(const u of n){const f={};Object.keys(u).forEach(g=>{const W=K[g];f[W]=u[g]}),d.push(f)}ee(d)&&(a.value=d),s.value=!1},O=async()=>{try{if(s.value)return;s.value=!0;const n=[];a.value.forEach(u=>{n.push({...u,check_type:A[u.check_type]})});const{code:o,message:i,data:d}=await J({list:n});s.value=!1,h({code:o,message:i,noMessage:!1,handler:()=>{D.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),v("refresh"),l.value=!1}})}catch{}},T=()=>{a.value=[]};return(n,o)=>{const i=F("el-table-column"),d=F("el-table");return p(),B(m(G),{modelValue:m(l),"onUpdate:modelValue":o[0]||(o[0]=u=>H(l)?l.value=u:null),"close-on-click-modal":!1,title:"\u8BA2\u5355\u5546\u54C1\u5BFC\u5165",width:"1040px",top:"8vh",center:""},{default:b(()=>[a.value.length===0?(p(),B(m($),{key:0,style:{"margin-bottom":"10px"},onOnSuccess:M})):j("v-if",!0),_(d,{data:a.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:b(()=>[(p(!0),y(P,null,R(m(c),(u,f)=>(p(),B(i,{minWidth:u.minWidth,"show-overflow-tooltip":"",fixed:u.fixed,prop:u.prop,type:u.type,key:f},{header:b(()=>[u.required?(p(),y("p",ue,[o[1]||(o[1]=U("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),C(" "+q(u.label),1)])):(p(),y("span",te,q(u.label),1))]),_:2},1032,["minWidth","fixed","prop","type"]))),128))]),_:1},8,["data"]),a.value.length!==0?(p(),y("div",ae,[_(m(V),{size:"small",onClick:T},{default:b(()=>o[2]||(o[2]=[C("\u53D6\u6D88")])),_:1}),_(m(V),{size:"small",type:"primary",loading:s.value,onClick:O},{default:b(()=>o[3]||(o[3]=[C("\u4FDD\u5B58")])),_:1},8,["loading"])])):j("v-if",!0)]),_:1},8,["modelValue"])}}});var oe=S(le,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/inventoryCheck/components/BatchCreateModal/index.vue"]]),pe=Object.freeze(Object.defineProperty({__proto__:null,default:oe},Symbol.toStringTag,{value:"Module"}));export{oe as B,pe as i,ie as o};