import{r,o as _,y as P,q as n,P as b,x as N,v as M,p as a,c as O,F as U,A as j,j as H,k as J,E as A,i as W,m as x,cp as G,cq as K,cv as Q,l as X,bv as Y,D as Z}from"./index.8d733f79.js";import{g as ee}from"./components.b31a8293.js";import{k as ae}from"./deviceTree.170dfbd9.js";const le={class:"dialog-footer"},re={__name:"pullParams",emits:["backParams"],setup(te,{expose:V,emit:k}){const{proxy:h}=Z(),u=r(!1),t=r({componentName:"",paramName:"",deviceId:"",pageNo:1,pageSize:10}),v=r([]),f=r([]),g=r(0),s=r([]),y=r([]);let m=null;function S(e,l){v.value=[],f.value=[],g.value=0,t.value={componentName:"",paramName:"",deviceId:e.deviceInfo.id,pageNo:1,pageSize:10},y.value=l,u.value=!0,s.value=[...e.componentParams||[]],$(),i(1,"init")}function $(){ae({deviceId:t.value.deviceId}).then(e=>{v.value=e.data.components||[]})}async function i(e,l){e&&(t.value.pageNo=1);const p=await ee({...t.value});g.value=p.data.totalElements,f.value=p.data.content,l==="init"&&s.value&&s.value.length&&s.value.forEach(c=>{h.$refs.myTableRef.toggleRowSelection(c,void 0)})}function I(e){t.value.pageNo=e,i()}function T(e){s.value=e}function D(){m&&(clearTimeout(m),m=null),m=setTimeout(()=>{i(1,"init")},500)}function w(){k("backParams",JSON.parse(JSON.stringify(s.value)),y.value),C()}function C(){h.$refs.myTableRef.clearSelection(),s.value=[],setTimeout(()=>{u.value=!1},0)}return V({showModal:S}),(e,l)=>{const p=H,c=J,z=A,B=W,L=x,d=G,F=K,R=Q,E=X,q=Y;return _(),P(q,{modelValue:u.value,"onUpdate:modelValue":l[3]||(l[3]=o=>u.value=o),width:"800","align-center":""},{header:n(()=>[b(N(e.$t("pullParams")),1)]),footer:n(()=>[M("span",le,[a(E,{onClick:C},{default:n(()=>[b(N(e.$t("cancel")),1)]),_:1}),a(E,{type:"primary",onClick:w},{default:n(()=>[b(N(e.$t("confirm")),1)]),_:1})])]),default:n(()=>[a(L,{model:t.value,inline:!0},{default:n(()=>[a(c,{label:e.$t("paramsName")},{default:n(()=>[a(p,{modelValue:t.value.paramName,"onUpdate:modelValue":l[0]||(l[0]=o=>t.value.paramName=o),placeholder:e.paramsNameP,clearable:"",style:{width:"214px"},onInput:D},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(c,{label:e.$t("belongCom")},{default:n(()=>[a(B,{modelValue:t.value.componentName,"onUpdate:modelValue":l[1]||(l[1]=o=>t.value.componentName=o),onChange:l[2]||(l[2]=o=>i(1,"init")),placeholder:e.$t("componentP"),clearable:"",teleported:!1},{default:n(()=>[(_(!0),O(U,null,j(v.value,o=>(_(),P(z,{key:o.componentId,label:o.name,value:o.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model"]),a(F,{ref:"myTableRef",data:f.value,border:!0,onSelectionChange:T,onHeaderDragend:e.changeWidth,"row-key":"componentParamsId"},{default:n(()=>[a(d,{type:"selection",width:"55","reserve-selection":!0}),a(d,{prop:"componentName",label:e.$t("belongCom")},null,8,["label"]),a(d,{prop:"paramsName",label:e.$t("params")},null,8,["label"]),a(d,{prop:"paramsValue",label:e.$t("paramsVal")},null,8,["label"])]),_:1},8,["data","onHeaderDragend"]),a(R,{class:"cardPager",style:{float:"right","margin-top":"16px"},background:"","page-size":t.value.pageSize,layout:"prev, pager, next, jumper",total:g.value,onCurrentChange:I},null,8,["page-size","total"])]),_:1},8,["modelValue"])}}};export{re as default};
