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