Bläddra i källkod

断路器修改点

Signed-off-by: hsshuxian <3049816743@qq.com>
hsshuxian 5 månader sedan
förälder
incheckning
68fa75fd09

+ 10 - 0
ems-ui-cloud/src/api/basecfg/objAbility.js

@@ -51,3 +51,13 @@ export function delAbility(id) {
     method: 'delete'
   })
 }
+/**
+ * 查询能源对象能力列表
+ */
+export function listcallAbility(data) {
+  return request({
+    url: '/ems/object/ability/call',
+    method: 'post',
+    data: data
+  })
+}

+ 34 - 63
ems-ui-cloud/src/views/basecfg/device/index.vue

@@ -337,9 +337,9 @@
             <!-- 分页导航 -->
             <el-tabs v-model="activeTab">
               <el-tab-pane label="设备基本信息" name="basic"></el-tab-pane>
-              <el-tab-pane label="属性定义" name="attr"></el-tab-pane>
-              <el-tab-pane label="能力定义" name="ability"></el-tab-pane>
-              <el-tab-pane label="事件定义" name="event"></el-tab-pane>
+              <el-tab-pane label="设备参数" name="attr"></el-tab-pane>
+              <el-tab-pane label="设备事件" name="event"></el-tab-pane>
+              <el-tab-pane label="设备能力" name="ability"></el-tab-pane>
             </el-tabs>
 
             <!-- 设备基本信息 -->
@@ -363,13 +363,14 @@
             <div v-if="activeTab === 'attr'">
               <el-card class="box-card">
                 <div slot="header" class="clearfix">
-                  <span class="section-title">属性定义</span>
+                  <span class="section-title">设备参数</span>
                 </div>
                 <el-table :data="attrData" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
                   <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
                   <el-table-column label="属性名称" prop="attrName"></el-table-column>
+                  <el-table-column label="属性标识" prop="attrKey"></el-table-column>
                   <el-table-column label="属性值" prop="attrValue"></el-table-column>
-                  <el-table-column label="属性单位" prop="attrUnit"></el-table-column>
+                  <el-table-column label="属性值描述" prop="attrValueName"></el-table-column>
                 </el-table>
               </el-card>
             </div>
@@ -378,7 +379,7 @@
             <div v-if="activeTab === 'ability'">
               <el-card class="box-card">
                 <div slot="header" class="clearfix">
-                  <span class="section-title">能力定义</span>
+                  <span class="section-title">设备能力</span>
                 </div>
                 <el-table :data="abilityData" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
                   <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
@@ -394,7 +395,7 @@
             <div v-if="activeTab === 'event'">
               <el-card class="box-card">
                 <div slot="header" class="clearfix">
-                  <span class="section-title">事件定义</span>
+                  <span class="section-title">设备事件</span>
                 </div>
                 <el-table :data="eventData" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
                   <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
@@ -471,7 +472,6 @@ export default {
       subCategoryOptions: undefined,
       subsystemOptions: undefined,
       devOptions: undefined,
-
       defaultProps: {
         children: 'children',
         label: 'label'
@@ -510,7 +510,7 @@ export default {
 
       // 表单参数
       form: {
-        customAttrs: [] // 自定义属性数组
+        customAttrs: []
       },
       // 表单校验
       rules: {
@@ -664,10 +664,10 @@ export default {
         psCode: null,
         createTime: null,
         updateTime: null,
-        customAttrs: [] // 确保自定义属性列表也被初始化
+        customAttrs: []
       }
-      this.attrList = []; // 重置属性模板列表
-      this.attrValuesMap = {}; // 重置属性值映射
+      this.attrList = [];
+      this.attrValuesMap = {};
       this.resetForm('form')
     },
     componentReset() {
@@ -708,9 +708,9 @@ export default {
       this.reset()
       this.open = true
       this.title = '添加能源设备'
-      this.attrList = []; // 重置属性模板列表
-      this.form.customAttrs = []; // 重置自定义属性列表
-      this.attrValuesMap = {}; // 重置属性值映射
+      this.attrList = [];
+      this.form.customAttrs = [];
+      this.attrValuesMap = {};
     },
     /**设备器件按钮*/
     handleDevProcess(row) {
@@ -731,28 +731,17 @@ export default {
     handleDetail(row) {
       this.showDrawer = true
       this.curRow = row
+      console.log("设备详情", this.curRow)
       this.subKey = this.$options.data().subKey
-      getModelByCode(this.curRow.facsModel).then(response => {
-        const code = response.data
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
-
+      getModelByCode(this.curRow.deviceModel).then(response => {
+        this.eventData = response.data?.eventList || [];
+        this.abilityData = response.data?.abilityList || [];
       })
       getObjAttr(2, this.curRow.deviceCode).then(response => {
-        const attrs = response.data.attrs
-        const attrValues = response.data.attrValues
+        this.attrData = response.data.attrs
 
-        // 合并 attrs 和 attrValues 数组
-        const mergedData = attrValues.map(attrValue => {
-          const attr = attrs.find(a => a.attrKey === attrValue.attrKey)
-          return {
-            ...attrValue,
-            attrName: attr ? attr.attrName : attrValue.attrName,
-            attrUnit: attr ? attr.attrUnit : ''
-          }
-        })
-        this.attrData = mergedData
       })
+      this.activeTab = 'basic';
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -762,10 +751,10 @@ export default {
         this.form = response.data
         this.open = true
         this.title = '修改能源设备'
-        this.attrList = []; // 重置属性模板列表
-        this.form.customAttrs = []; // 重置自定义属性列表
-        this.attrValuesMap = {}; // 重置属性值映射
-        this.getObjAttr(2, this.form.deviceCode); // 获取设备的属性定义和属性值
+        this.attrList = [];
+        this.form.customAttrs = [];
+        this.attrValuesMap = {};
+        this.getObjAttr(2, this.form.deviceCode);
       })
       const recursion = true
       const areaCode = '0'
@@ -775,7 +764,6 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      // 重置 attrList 和 form.customAttrs
       if (!this.attrList) {
         this.attrList = []
       }
@@ -784,7 +772,6 @@ export default {
       }
       // 准备要发送的数据
       let dataToSubmit = []
-      // 添加模型属性数据
       this.attrList.forEach(attr => {
         const attrName = attr.attrName
         const attrKey = attr.attrKey
@@ -793,9 +780,9 @@ export default {
         if (existingIndex === -1) {
           // 如果attrKey不存在于dataToSubmit中,则添加
           dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
+            modelCode: this.form.deviceModel,
+            objCode: this.form.deviceCode,
+            objType: 2,
             attrKey: attrKey,
             attrValue: attrValue,
             attrName: attrName
@@ -812,9 +799,9 @@ export default {
         if (existingIndex === -1) {
           // 如果attrKey不存在于dataToSubmit中,则添加
           dataToSubmit.push({
-            modelCode: '', // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
+            modelCode: '',
+            objCode: this.form.deviceCode,
+            objType: 2,
             attrKey: attrKey,
             attrValue: attrValue,
             attrName: attrName
@@ -829,9 +816,6 @@ export default {
               this.$modal.msgSuccess('修改成功')
               this.open = false
               this.getList()
-            }).catch(error => {
-              console.error('修改失败:', error)
-              this.$message.error('修改失败')
             })
 
             if (dataToSubmit.length > 0) {
@@ -842,19 +826,13 @@ export default {
                   } else {
                     this.$message.error('属性添加失败')
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
-              })
+                })
             }
           } else {
             addDevice(this.form).then(response => {
               this.$modal.msgSuccess('新增成功')
               this.open = false
               this.getList()
-            }).catch(error => {
-              console.error('新增失败:', error)
-              this.$message.error('新增失败')
             })
 
             if (dataToSubmit.length > 0) {
@@ -865,10 +843,7 @@ export default {
                   } else {
                     this.$message.error('属性添加失败')
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
-              })
+                })
             } else {
               // this.$message.info('没有属性需要添加');
             }
@@ -970,12 +945,12 @@ export default {
     },
     getModelByCode(modelCode) {
       getModelByCode(modelCode).then(response => {
-        // this.attrList = response.data.attrList;
         const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
         this.attrList = filteredAttrList
 
       })
     },
+    /**  getObjAttr存在问题 */
     getObjAttr(objType, deviceCode) {
       getObjAttr(objType, deviceCode).then(response => {
         // const attrs = response.data.attrs;
@@ -984,16 +959,13 @@ export default {
 
         // 创建一个映射对象,用于存储 attrKey 与对应的 attrValue
         const attrValuesMap = {}
-
         // 遍历 attrs 数组
         attrs.forEach(attr => {
           // 查找 attrValues 数组中是否有匹配的 attrKey
           const attrValueObj = attrValues.find(value => value.attrKey === attr.attrKey)
-          // 如果找到匹配的 attrValue,更新 attrValuesMap
           if (attrValueObj) {
             attrValuesMap[attr.attrKey] = attrValueObj.attrValue
           } else {
-            // 如果没有找到匹配的 attrValue,则设置为 '暂无数据'
             attrValuesMap[attr.attrKey] = ''
           }
         })
@@ -1051,7 +1023,6 @@ export default {
   min-width: 100px;
   flex: 1;
 }
-
 .status-online {
   color: #00FF00; /* 在线状态颜色 */
   background-color: #DDFFDD;

+ 49 - 80
ems-ui-cloud/src/views/basecfg/device/model.vue

@@ -65,7 +65,6 @@
         >删除
         </el-button>
       </el-col>
-
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -125,6 +124,12 @@
         <el-form-item label="模型名称" prop="modelName">
           <el-input v-model="form.modelName" placeholder="请输入模型名称"/>
         </el-form-item>
+        <el-form-item label="能力接口" prop="abilityHandle">
+        <el-input v-model="form.abilityHandle" placeholder="请输入能力接口"/>
+        </el-form-item>
+        <el-form-item label="事件接口" prop="eventHandle">
+          <el-input v-model="form.eventHandle" placeholder="请输入事件接口"/>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -132,7 +137,6 @@
       </div>
     </el-dialog>
 
-
     <!-- ”特性“对话框   -->
     <el-drawer :title=curRow.modelName size="80%" :visible.sync="showDrawer" direction="rtl">
       <div class="drawer-content" style="padding-left:50px">
@@ -195,18 +199,8 @@
                 </el-form-item>
 
               <!--属性值表格-->
-                <el-form-item label="枚举类型值" prop="customAttrs" v-if="attrForm.attrValueType === 'String'">
+                <el-form-item label="枚举类型值" prop="customAttrs" v-if="attrForm.attrValueType === 'Enum'">
                   <el-table class="attr-table" v-loading="loading" :data="customAttrs" max-height="280px" key="'customAttrs'">
-                    <el-table-column label="模型代码" align="center" prop="modelCode">
-                      <template slot-scope="scope">
-                        <el-input size="mini" v-model="scope.row.modelCode" placeholder="请输入模型代码"  />
-                      </template>
-                    </el-table-column>
-                    <el-table-column label="属性标识" align="center" prop="attrKey">
-                      <template slot-scope="scope">
-                        <el-input size="mini" v-model="scope.row.attrKey" placeholder="请输入属性标识" />
-                      </template>
-                    </el-table-column>
                     <el-table-column label="枚举值" align="center" prop="attrValue">
                       <template slot-scope="scope">
                         <el-input size="mini" v-model="scope.row.attrValue" placeholder="请输入枚举值" />
@@ -323,7 +317,7 @@
               </el-table-column>
             </el-table>
 
-            <!-- 添加或修改能力对话框 -->
+            <!--添加或修改能力对话框 -->
             <el-dialog :title="title" :visible.sync="abilityOpen" width="500px" append-to-body>
               <el-form ref="abilityForm" :model="abilityForm" :rules="abilityRules" label-width="80px">
                 <el-form-item label="能力键" prop="abilityKey">
@@ -338,6 +332,12 @@
                 <el-form-item label="能力参数" prop="abilityParam">
                   <el-input v-model="abilityForm.abilityParam" type="textarea" placeholder="请输入内容"/>
                 </el-form-item>
+                <el-form-item label="隐藏标记" prop="hiddenFlag">
+                  <el-radio-group v-model="abilityForm.hiddenFlag">
+                    <el-radio :label="0">隐藏</el-radio>
+                    <el-radio :label="1">展示</el-radio>
+                  </el-radio-group>
+                </el-form-item>
               </el-form>
               <div slot="footer" class="dialog-footer">
                 <el-button type="primary" @click="submitAbilityForm">确 定</el-button>
@@ -357,13 +357,13 @@ import { listModel, getModel, delModel, addModel, updateModel, getModelByCode }
 import { getEvent, delEvent, addEvent, updateEvent } from '@/api/basecfg/objEvent'
 import { getAttr, delAttr, addAttr, updateAttr } from '@/api/basecfg/objAttribute'
 import { getAbility, delAbility, addAbility, updateAbility } from '@/api/basecfg/objAbility'
-import {getAttrList,delAttrEnum,addAttrEnums} from '@/api/basecfg/emum'
+import {getAttrList,delAttrEnum} from '@/api/basecfg/emum'
 
 export default {
   name: 'Model',
   data() {
     return {
-      // 用于存储表格数据
+      // 用于存储属性表格
       customAttrs: [],
       // 遮罩层
       loading: true,
@@ -380,7 +380,7 @@ export default {
       // 能源对象属性表格数据
       modelList: [],
       filteredModelList:[],
-      activeObjType: '1', // 当前激活的 objType
+      activeObjType: '1',
       // 弹出层标题
       title: '',
       // 是否显示弹出层
@@ -434,7 +434,9 @@ export default {
         modelCode: null,
         modelName: null,
         // 这里将由标签页控制
-        objType: null
+        objType: null,
+        abilityHandle: null,
+        eventHandle: null
       },
       eventForm: {},
       attrForm: {},
@@ -487,16 +489,14 @@ export default {
           { required: true, message: '能力名称不能为空', trigger: 'blur' }
         ]
       },
-
-      // 能源对象事件表格数据
+      // 能源对象事件
       eventList: [],
-      // 能源对象属性表格数据
+      // 能源对象属性
       attrList: [],
-      // 能源对象能力表格数据
+      // 能源对象能力
       abilityList: [],
       showDrawer: false,
       subDialogShow: false,
-      // subTitle: '',
       subKey: 'attr'
     }
   },
@@ -520,8 +520,6 @@ export default {
     // 添加自定义属性的方法
     addCustomAttr() {
       this.customAttrs.push({
-        modelCode:this.attrForm.modelCode,
-        attrKey:  null,
         attrValue: null,
         attrValueName: null,
       });
@@ -591,7 +589,6 @@ export default {
       this.loading = true
       getModelByCode(modelcode).then(response => {
         const data = response.data
-        console.log('data', data)
         this.attrList = data.attrList
         this.eventList = data.eventList
         this.abilityList = data.abilityList
@@ -604,28 +601,23 @@ export default {
       this.loading = true
       getModelByCode(modelcode).then(response => {
         const data = response.data
-        console.log('data', data)
         this.attrList = data.attrList
         this.eventList = data.eventList
         this.abilityList = data.abilityList
-
       })
       this.loading = false
     },
     /** 查询能源对象能力列表 */
     getAbilityList(modelcode) {
       this.loading = true
-      console.log('对象能力!!!!')
       getModelByCode(modelcode).then(response => {
         const data = response.data
-        console.log('data', data)
         this.attrList = data.attrList
         this.eventList = data.eventList
         this.abilityList = data.abilityList
 
       })
       this.loading = false
-
     },
 
     // 表单重置
@@ -662,7 +654,8 @@ export default {
         abilityKey: null,
         abilityName: null,
         abilityDesc: null,
-        abilityParam: null
+        abilityParam: null,
+        hiddenFlag:null,
       }
       this.resetForm('abilityForm')
     },
@@ -673,7 +666,6 @@ export default {
       const id = row.id || this.ids
       getAttr(id).then(response => {
         this.attrForm = response.data
-        console.log("this.attrForm",this.attrForm)
         this.attrOpen = true
         this.title = '修改能源对象属性'
         this.attrForm.modelCode= this.curRow.modelCode
@@ -710,7 +702,6 @@ export default {
       this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function() {
         return delAttr(ids)
       }).then(() => {
-        console.log('删除row', row.modelCode)
         this.getAttrList(row.modelCode)
         this.$modal.msgSuccess('删除成功')
       }).catch(() => {
@@ -721,7 +712,6 @@ export default {
       this.$modal.confirm('是否确认删除能源对象事件编号为"' + ids + '"的数据项?').then(function() {
         return delEvent(ids)
       }).then(() => {
-        console.log('删除row', row.modelCode)
         this.getEventList(row.modelCode)
         this.$modal.msgSuccess('删除成功')
       }).catch(() => {
@@ -732,62 +722,42 @@ export default {
       this.$modal.confirm('是否确认删除能源对象能力编号为"' + ids + '"的数据项?').then(function() {
         return delAbility(ids)
       }).then(() => {
-        console.log('删除row', row.modelCode)
         this.getAbilityList(row.modelCode)
         this.$modal.msgSuccess('删除成功')
       }).catch(() => {
       })
     },
 
-    /** 获取数据库中已存在的枚举值*/
-    async getExistingEnums() {
-      try {
-        this.loading = true;
-        const response = await getAttrList(this.attrForm.modelCode, this.attrForm.attrKey);
-        this.existingEnums = response.data || [];
-        this.loading = false;
-      } catch (error) {
-        this.$modal.msgError("获取枚举值失败:" + error.message);
-        this.loading = false;
-        throw error;
-      }
-    },
     /** 提交按钮 */
     submitAttrForm() {
-      this.$refs["attrForm"].validate(async (valid) => {
+      this.$refs['attrForm'].validate(valid => {
         if (valid) {
-          try {
-            await this.getExistingEnums();
-            const newCustomAttrs = this.customAttrs.filter(attr => {
-              return !this.existingEnums.some(existingAttr =>
-                existingAttr.attrKey === attr.attrKey &&
-                existingAttr.attrValue === attr.attrValue
-              );
+          const formData = {
+            ...this.attrForm,
+            valueEnums: this.customAttrs.map(item => ({
+              modelCode: this.attrForm.modelCode,
+              attrKey: this.attrForm.attrKey,
+              attrValue: item.attrValue,
+              attrValueName: item.attrValueName
+            }))
+          };
+
+          if (this.attrForm.id != null) {
+            updateAttr(formData).then(response => {
+              this.$modal.msgSuccess('修改成功');
+              this.attrOpen = false;
+              this.getAttrList(this.attrForm.modelCode);  // 刷新属性列表
+            });
+          } else {
+            addAttr(formData).then(response => {
+              this.$modal.msgSuccess('新增成功');
+              this.attrOpen = false;
+              this.getAttrList(this.attrForm.modelCode);
             });
-            if (newCustomAttrs.length > 0) {
-              await addAttrEnums(newCustomAttrs); // 调用接口添加枚举值
-              this.$modal.msgSuccess("枚举值添加成功");
-            } else {
-              this.$modal.msgSuccess("没有新的枚举值需要添加");
-            }
-
-            if (this.attrForm.id != null) {
-              await updateAttr(this.attrForm);
-              this.$modal.msgSuccess("修改成功");
-            } else {
-              await addAttr(this.attrForm);
-              this.$modal.msgSuccess("新增成功");
-            }
-
-            this.attrOpen = false;
-            this.getAttrList(this.attrForm.modelCode);
-          } catch (error) {
-            this.$modal.msgError("操作失败:" + error.message);
           }
         }
       });
     },
-
     submitEventForm() {
       this.$refs['eventForm'].validate(valid => {
         if (valid) {
@@ -795,14 +765,12 @@ export default {
             updateEvent(this.eventForm).then(response => {
               this.$modal.msgSuccess('修改成功')
               this.eventOpen = false
-              console.log('id', this.eventForm)
               this.getEventList(this.eventForm.modelCode)
             })
           } else {
             addEvent(this.eventForm).then(response => {
               this.$modal.msgSuccess('新增成功')
               this.eventOpen = false
-              console.log('id', this.eventForm)
               this.getEventList(this.eventForm.modelCode)
             })
           }
@@ -854,7 +822,8 @@ export default {
         id: null,
         modelCode: null,
         modelName: null,
-        objType: null
+        objType: null,
+
       }
       this.resetForm('form')
     },

+ 75 - 13
ems-ui-cloud/src/views/devmgr/attr/index.vue

@@ -71,7 +71,8 @@
           </el-table-column>
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
-              <el-button size="mini" type="text" @click="handleDetail(scope.row)">详情</el-button>
+              <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)">详情</el-button>
+
             </template>
           </el-table-column>
         </el-table>
@@ -84,9 +85,9 @@
             <!--分页导航 @tab-click="handleTabClick"-->
             <el-tabs v-model="activeTab"  >
               <el-tab-pane label="设备基本信息" name="basic"></el-tab-pane>
-              <el-tab-pane label="属性定义" name="attr"></el-tab-pane>
-              <el-tab-pane label="能力定义" name="ability"></el-tab-pane>
-              <el-tab-pane label="事件定义" name="event"></el-tab-pane>
+              <el-tab-pane label="设备参数" name="attr"></el-tab-pane>
+              <el-tab-pane label="设备事件" name="event"></el-tab-pane>
+              <el-tab-pane label="设备能力" name="ability"></el-tab-pane>
             </el-tabs>
 
             <!--  设备基本信息 -->
@@ -114,22 +115,22 @@
             <div v-if="activeTab === 'attr'">
               <el-card class="box-card">
                 <div slot="header" class="clearfix">
-                  <span class="section-title">属性定义</span>
+                  <span class="section-title">设备参数</span>
                 </div>
                 <el-table :data="attrData" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
                   <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
                   <el-table-column label="属性名称" prop="attrName"></el-table-column>
                   <el-table-column label="属性标识" prop="attrKey"></el-table-column>
                   <el-table-column label="属性值" prop="attrValue"></el-table-column>
-                  <el-table-column label="属性单位" prop="attrUnit"></el-table-column>
+                  <el-table-column label="属性值描述" prop="attrValueName"></el-table-column>
                 </el-table>
               </el-card>
             </div>
-            <!--能力定义-->
+            <!--能力-->
             <div v-if="activeTab === 'ability'">
               <el-card class="box-card">
                 <div slot="header" class="clearfix">
-                  <span class="section-title">能力定义</span>
+                  <span class="section-title">设备能力</span>
                 </div>
                 <el-table :data="abilityData" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
                   <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
@@ -137,14 +138,32 @@
                   <el-table-column label="能力键" prop="abilityKey"></el-table-column>
                   <el-table-column label="能力参数" prop="abilityParam"></el-table-column>
                   <el-table-column label="能力描述" prop="abilityDesc"></el-table-column>
+                  <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+
+
+                      <template slot-scope="scope">
+<!--                       <el-button size="mini" type="text" icon="el-icon-info" @click="handleOpenOperate(scope.row)">开启</el-button>
+                           <el-button size="mini" type="text" icon="el-icon-info" @click="handleColseOperate(scope.row)">关闭</el-button> -->
+                        <el-dropdown size="mini" split-button type="primary" icon="el-icon-info" @command="handleCommand">
+                          操作
+                          <el-dropdown-menu slot="dropdown">
+                            <el-dropdown-item icon="el-icon-plus" command="open" :data="scope.row">执行</el-dropdown-item>
+                            <el-dropdown-item icon="el-icon-circle-plus" command="close" :data="scope.row">关闭</el-dropdown-item>
+                            <el-dropdown-item icon="el-icon-circle-plus-outline">锁定</el-dropdown-item>
+                            <el-dropdown-item icon="el-icon-check">开启</el-dropdown-item>
+                            <el-dropdown-item icon="el-icon-circle-check">执行日志</el-dropdown-item>
+                          </el-dropdown-menu>
+                        </el-dropdown>
+                    </template>
+                  </el-table-column>
                 </el-table>
               </el-card>
             </div>
-          <!--事件定义-->
+          <!--事件-->
             <div v-if="activeTab === 'event'">
               <el-card class="box-card">
                 <div slot="header" class="clearfix">
-                  <span class="section-title">事件定义</span>
+                  <span class="section-title">设备事件</span>
                 </div>
                 <el-table :data="eventData" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
                   <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
@@ -170,6 +189,8 @@ import {listSubsystemAll} from '@/api/adapter/subsystem'
 import {getModelByCode} from '@/api/basecfg/objModel'
 import Treeselect from '@riophae/vue-treeselect'
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import {listcallAbility} from '@/api/basecfg/objAbility'
+import { getObjAttr } from '@/api/basecfg/objAttribute'
 
 export default {
   name: 'Device',
@@ -234,6 +255,43 @@ export default {
     this.getSubCategorygetByCode()
   },
   methods: {
+    handleCommand(command, row) {
+      if (command === 'open') {
+        this.handleOpenOperate(row);
+      } else if (command === 'close') {
+        this.handleCloseOperate(row);
+      }
+    },
+    /**设备能力-操作按钮*/
+    handleOpenOperate(row) {
+        // 调用接口
+        listcallAbility({
+          abilityKey: 'event-1',
+          objCode: this.curRow.deviceCode,
+          objType:'2',
+          modeCode:this.curRow.modeCode,
+          abilityParam:'{\"type\":\"event\",\"key\":1}',
+        }).then(response => {
+          // 处理成功逻辑
+          this.$message({ message: '设备能力执行成功', type: 'success' });
+          // 如果需要,可以刷新数据
+          this.handleDetail(this.curRow);
+        })
+      },
+    handleCloseOperate(row) {
+      // 调用接口
+      listcallAbility({
+        abilityKey: 'event-0',
+        objCode: this.curRow.deviceCode,
+        objType:'2',
+        modeCode:this.curRow.modeCode,
+        abilityParam:'{\"type\":\"event\",\"key\":0}',
+      }).then(response => {
+        // 处理成功逻辑
+        this.$message({ message: '设备能力执行成功', type: 'success' });
+
+      })
+    },
     getDeviceStatus(status) {
       return status === 1 ? "在线" : "离线";
     },
@@ -317,9 +375,12 @@ export default {
         this.open = true
         const code = response.data
         console.log('code', code)
-        this.attrData = response.data.attrList
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
+        this.eventData = response.data?.eventList || [];
+        // 过滤
+        this.abilityData = response.data.abilityList.filter(item => item.hiddenFlag === 1)||[]
+      })
+      getObjAttr(2, this.curRow.deviceCode).then(response => {
+        this.attrData = response.data.attrs
       })
       this.activeTab = 'basic';
     },
@@ -360,6 +421,7 @@ export default {
       this.queryParams.deviceSubCategory = ''
       this.queryParams.refFacs = null
       this.queryParams.subsystemCode = null
+
     }
   }
 }