import{a as N,r as l,w as x,aj as i,J as P,o as S,K as s,b as M,S as a,a7 as R,P as f}from"./vue.YrNK8sx4.js";import{G as U}from"./api.BlfGKqFh.js";import{G as j}from"./api.EJ6EzJuI.js";const E={style:{"margin-bottom":"12px"}},T=N({__name:"index",props:{visible:{type:Boolean}},emits:["update:visible","confirm"],setup(V,{emit:k}){const b=V,c=k,u=l(b.visible);x(()=>b.visible,t=>u.value=t);const v=l(""),p=l(1),_=l(10),g=l(0),y=l([]),w=l([]),h=l({});function $(){j().then(t=>{const e={};t.data.forEach(n=>{e[n.id]=n.name}),h.value=e})}async function d(t=!1){t&&(p.value=1),await $(),U({page:p.value,limit:_.value,code:v.value,status:1}).then(e=>{const n=e.data.filter(o=>o.available_quantity>0).map(o=>({...o,warehouse:`${h.value[o.warehouse]||`ID:${o.warehouse}`} (${o.available_quantity})`}));y.value=n,g.value=e.total})}function B(t){w.value=t}function G(t){p.value=t,d()}function q(){c("confirm",w.value),c("update:visible",!1)}function C(){c("update:visible",!1)}return x([u,p],t=>{u.value&&d()}),(t,e)=>{const n=i("el-input"),o=i("el-button"),r=i("el-table-column"),z=i("el-table"),D=i("el-pagination"),K=i("el-dialog");return S(),P(K,{modelValue:u.value,"onUpdate:modelValue":e[3]||(e[3]=m=>u.value=m),title:"选择设备",width:"800px","close-on-click-modal":!1,onClose:C},{footer:s(()=>[a(o,{onClick:C},{default:s(()=>e[5]||(e[5]=[f("取消")])),_:1}),a(o,{type:"primary",onClick:q},{default:s(()=>e[6]||(e[6]=[f("确定")])),_:1})]),default:s(()=>[M("div",E,[a(n,{modelValue:v.value,"onUpdate:modelValue":e[0]||(e[0]=m=>v.value=m),placeholder:"输入关键字搜索",style:{width:"240px","margin-right":"8px"},onKeyup:e[1]||(e[1]=R(m=>d(!0),["enter"]))},null,8,["modelValue"]),a(o,{type:"primary",onClick:e[2]||(e[2]=m=>d(!0))},{default:s(()=>e[4]||(e[4]=[f("搜索")])),_:1})]),a(z,{data:y.value,border:"",style:{width:"100%"},onSelectionChange:B,ref:"tableRef"},{default:s(()=>[a(r,{type:"selection",width:"50"}),a(r,{type:"index",label:"序号",width:"60"}),a(r,{prop:"name",label:"设备名称"}),a(r,{prop:"inventory.available_quantity",label:"可用数量"}),a(r,{prop:"warehouse",label:"存放仓库"})]),_:1},8,["data"]),a(D,{style:{"margin-top":"12px","text-align":"right"},"current-page":p.value,"page-size":_.value,total:g.value,onCurrentChange:G},null,8,["current-page","page-size","total"])]),_:1},8,["modelValue"])}}});export{T as _};
