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