import{b as S,J as _,ah as b,e as $,cE as w,o as p,c as C,n as a,aH as u,y as f,q as c,P as g,x as y,t as x,p as h,aj as z,l as I,D as V}from"./index.8d733f79.js";import{s as B,t as E}from"./components.b31a8293.js";import R from"./addParamDialog.df86d81d.js";import"./el-input-number.60463ef8.js";import"./index.28f6da25.js";const J={style:{height:"100%",display:"flex","flex-direction":"column"}},H={__name:"parameterTab",setup(L){const{t:D}=S(),{proxy:l}=V(),r=_.session.getJSON("userInfo"),v=_.session.getJSON("enums").dataType,o=b({total:0,tableData:[],columns:[{prop:"name",label:"paramsName"},{prop:"identifier",label:"identifier"},{prop:"dataType",label:"dataType",formatter:e=>{var t;return(t=v.find(i=>+i.key===e.dataType))==null?void 0:t.desc}},{prop:"unit",label:"unit"},{prop:"defaultValue",label:"defaultValue"},{label:"action",type:"action",width:250,fixed:"right"}]}),s=b({pageNo:1,pageSize:10});$(()=>{r.userLevel===0&&r.superType===1||o.columns.pop(),d()});async function d(){const e=await B(s);o.total=e.data.total,o.tableData=e.data.records}const k=()=>{l.$refs.addDialogRef.showModal("add")},N=e=>{l.$refs.addDialogRef.showModal("edit",e.id)},T=e=>{l.$modal.confirm(D("confirmDelete")).then(()=>{E({id:e.id}).then(t=>{l.$modal.msgSuccess(t.msg),d()})}).catch(()=>{})};return(e,t)=>{const i=I,m=w("hasPermi");return p(),C("div",J,[a(r).userLevel===0&&a(r).superType===1?u((p(),f(i,{key:0,type:"primary",onClick:k,style:{"margin-bottom":"16px",width:"fit-content"}},{default:c(()=>[g(y(e.$t("addParams")),1)]),_:1})),[[m,["device_components_add"]]]):x("",!0),h(a(z),{tableWrapId:"parameterTab",class:"f-h",columns:a(o).columns,tableData:a(o).tableData,total:a(o).total,pageNum:a(s).pageNo,"onUpdate:pageNum":t[0]||(t[0]=n=>a(s).pageNo=n),pageSize:a(s).pageSize,"onUpdate:pageSize":t[1]||(t[1]=n=>a(s).pageSize=n),onPagination:d},{action:c(({scope:n})=>[u((p(),f(i,{link:"",type:"primary",onClick:P=>N(n.row)},{default:c(()=>[g(y(e.$t("edit")),1)]),_:2},1032,["onClick"])),[[m,["device_components_edit"]]]),u((p(),f(i,{link:"",type:"danger",onClick:P=>T(n.row)},{default:c(()=>[g(y(e.$t("delete")),1)]),_:2},1032,["onClick"])),[[m,["device_components_delete"]]])]),_:1},8,["columns","tableData","total","pageNum","pageSize"]),h(a(R),{ref:"addDialogRef",onRefresh:d},null,512)])}}};export{H as default};
