Browse Source

系统对接界面统一样式

learshaw 2 weeks ago
parent
commit
30f0fa6bf1

+ 1392 - 1112
ems-ui-cloud/src/views/adapter/cdz/index.vue

@@ -1,1261 +1,1541 @@
 <template>
   <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="4" :xs="24">
-        <div class="head-container">
-          <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-                    style="margin-bottom: 20px"
-          />
-        </div>
-        <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
-          <el-tree :data="treeAreaOptions" :props="defaultProps" :expand-on-click-node="false"
-                   :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-                   @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"
-          />
-        </div>
-      </el-col>
-      <el-col :span="20" :xs="24">
-        <div class="contents">
-          <div class="other-content">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
-                     label-width="68px"
-            >
-              <el-form-item label="设备分类" prop="deviceSubCategory">
-                <el-select v-model="queryParams.deviceSubCategory">
-                  <el-option v-for="item in subCategoryOptions" placeholder="设备分类" :label="item.name"
-                             :value="item.code"
-                             :key="item.code"
-                  />
-                </el-select>
+    <!-- 系统基础信息卡片 - 添加编辑按钮 -->
+    <el-card class="system-info-card">
+      <div slot="header" class="card-header">
+        <span class="title">
+          <i class="el-icon-s-platform"></i>
+          充电桩监测
+        </span>
+        <el-tag :type="systemStatus === '1' ? 'success' : 'danger'" effect="dark">
+          {{ systemStatus === '1' ? '正常' : '异常' }}
+        </el-tag>
+      </div>
+
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">系统信息</div>
+            <div class="info-item">
+              <label>系统代码:</label>
+              <span class="code">{{ systemInfo.systemCode }}</span>
+            </div>
+            <div class="info-item">
+              <label>系统名称:</label>
+              <span>{{ systemInfo.systemName }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">厂商信息</div>
+            <div class="info-item">
+              <label>对接厂商:</label>
+              <span>{{ systemInfo.manFacturer || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系人:</label>
+              <span>{{ systemInfo.contactPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系电话:</label>
+              <span>{{ systemInfo.contactNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">维护信息</div>
+            <div class="info-item">
+              <label>维护人:</label>
+              <span>{{ systemInfo.maintainerPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>维护电话:</label>
+              <span>{{ systemInfo.maintainerNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">设备统计</div>
+            <div class="info-item">
+              <label>设备总数:</label>
+              <span class="stat-number">{{ deviceStats.total }}</span>
+            </div>
+            <div class="info-item">
+              <label>在线设备:</label>
+              <span class="stat-number">{{ deviceStats.online }}</span>
+            </div>
+            <div class="info-item">
+              <label>测点总数:</label>
+              <span class="stat-number">{{ deviceStats.points }}</span>
+            </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEdit"
+                v-hasPermi="['ems:subsystem:edit']">
+                编辑
+              </el-button>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <!-- 系统详情标签页 -->
+    <el-card class="detail-card">
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+        <!-- 系统属性标签页 -->
+        <el-tab-pane label="系统属性" name="attributes">
+          <div class="tab-content">
+            <!-- 协议属性 -->
+            <div class="attr-section" v-if="protocolAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-connection"></i>
+                协议信息
+              </h4>
+              <el-table :data="protocolAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.attrKey === 'url'" class="url-text">
+                      {{ scope.row.attrValue }}
+                    </span>
+                    <span v-else>{{ scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+
+            <!-- 状态属性 -->
+            <div class="attr-section" v-if="stateAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-info"></i>
+                状态信息
+              </h4>
+              <el-table :data="stateAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <el-tag v-if="scope.row.attrKey === 'interfaceStatus'"
+                            :type="scope.row.attrValue === '1' ? 'success' : 'danger'">
+                      {{ scope.row.attrValueName }}
+                    </el-tag>
+                    <span v-else>{{ scope.row.attrValueName || scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="updateTime" label="更新时间" width="180"></el-table-column>
+              </el-table>
+            </div>
+          </div>
+        </el-tab-pane>
+
+        <!-- 系统能力标签页 -->
+        <el-tab-pane label="系统能力" name="abilities">
+          <div class="tab-content">
+            <el-table :data="systemAbilities" border stripe v-loading="abilityLoading">
+              <el-table-column prop="abilityName" label="能力名称" width="200"></el-table-column>
+              <el-table-column prop="abilityKey" label="能力标识" width="180"></el-table-column>
+              <el-table-column prop="abilityDesc" label="能力描述"></el-table-column>
+              <el-table-column label="操作" width="200" align="center">
+                <template slot-scope="scope">
+                  <div v-if="getParamType(scope.row.paramDefinition) === 'Options'" style="display: inline-block;">
+                    <el-button-group>
+                      <el-button
+                        v-for="option in parseOptions(scope.row.paramDefinition)"
+                        :key="option.value"
+                        size="mini"
+                        type="primary"
+                        @click="executeSystemAbilityWithParam(scope.row, option.value)"
+                        :loading="scope.row.executing && scope.row.executingValue === option.value">
+                        {{ option.key }}
+                      </el-button>
+                    </el-button-group>
+                  </div>
+                  <el-button
+                    v-else
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-caret-right"
+                    @click="handleSystemAbilityClick(scope.row)"
+                    :loading="scope.row.executing">
+                    执行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 关联设备标签页 -->
+        <el-tab-pane label="关联设备" name="devices">
+          <div class="tab-content">
+            <!-- 设备统计 -->
+            <div class="device-stats">
+              <el-row :gutter="20">
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.total }}</div>
+                    <div class="stat-label">设备总数</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item online">
+                    <div class="stat-value">{{ deviceStats.online }}</div>
+                    <div class="stat-label">在线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item offline">
+                    <div class="stat-value">{{ deviceStats.offline }}</div>
+                    <div class="stat-label">离线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.points }}</div>
+                    <div class="stat-label">测点总数</div>
+                  </div>
+                </el-col>
+              </el-row>
+            </div>
+
+            <!-- 设备列表 -->
+            <el-table
+              :data="deviceList"
+              border
+              stripe
+              v-loading="deviceLoading"
+              @row-click="handleDeviceClick"
+              ref="deviceTable">
+              <el-table-column type="expand">
+                <template slot-scope="props">
+                  <div class="device-detail">
+                    <el-tabs v-model="props.row.detailTab">
+                      <el-tab-pane label="设备属性" name="attrs">
+                        <el-descriptions :column="2" border size="small">
+                          <el-descriptions-item label="IP地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'ip') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="网关地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'gateway') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="子网掩码">
+                            {{ getDeviceAttr(props.row.deviceCode, 'subnetMask') }}
+                          </el-descriptions-item>
+                        </el-descriptions>
+                      </el-tab-pane>
+                      <el-tab-pane label="测点信息" name="points">
+                        <div v-for="(channel, idx) in getDeviceChannels(props.row.deviceCode)" :key="idx">
+                          <h5>{{ channel.name }} ({{ channel.points.length }}个测点)</h5>
+                          <el-table :data="channel.points" size="mini" max-height="200">
+                            <el-table-column prop="name" label="测点名称"></el-table-column>
+                            <el-table-column prop="key" label="测点标识"></el-table-column>
+                            <el-table-column prop="value" label="当前值">
+                              <template slot-scope="scope">
+                                {{ scope.row.value || '-' }}
+                              </template>
+                            </el-table-column>
+                            <el-table-column prop="updateTime" label="更新时间"></el-table-column>
+                          </el-table>
+                        </div>
+                      </el-tab-pane>
+                    </el-tabs>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="deviceCode" label="设备代码" width="150"></el-table-column>
+              <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+              <el-table-column prop="location" label="安装位置"></el-table-column>
+              <el-table-column prop="areaCode" label="区域" width="150">
+                <template slot-scope="scope">
+                  {{ scope.row.areaCode.includes('3001') ? '北区' : '南区' }}
+                </template>
+              </el-table-column>
+              <el-table-column label="设备状态" width="100" align="center">
+                <template slot-scope="scope">
+                  <el-tag :type="scope.row.deviceStatus === 1 ? 'success' : 'info'">
+                    {{ scope.row.deviceStatus === 1 ? '在线' : '离线' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="120" align="center">
+                <template slot-scope="scope">
+                  <el-dropdown
+                    trigger="click"
+                    @command="handleDeviceCommand"
+                    @visible-change="(visible) => handleAbilityLoad(visible, scope.row)">
+                    <el-button type="text" size="mini">
+                      操作<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                      <template v-if="deviceAbilities[scope.row.deviceCode] && deviceAbilities[scope.row.deviceCode].length > 0">
+                        <template v-for="ability in deviceAbilities[scope.row.deviceCode]">
+                          <el-submenu
+                            v-if="getParamType(ability.paramDefinition) === 'Options'"
+                            :key="ability.abilityKey"
+                            :index="ability.abilityKey">
+                            <template slot="title">
+                              {{ ability.abilityName }}
+                              <i class="el-icon-arrow-right" style="float: right;"></i>
+                            </template>
+                            <el-dropdown-item
+                              v-for="option in parseOptions(ability.paramDefinition)"
+                              :key="option.value"
+                              :command="{device: scope.row, ability: ability, paramValue: option.value}">
+                              {{ option.key }}
+                            </el-dropdown-item>
+                          </el-submenu>
+                          <el-dropdown-item
+                            v-else
+                            :key="ability.abilityKey"
+                            :command="{device: scope.row, ability: ability}">
+                            {{ ability.abilityName }}
+                          </el-dropdown-item>
+                        </template>
+                      </template>
+                      <el-dropdown-item v-else disabled>
+                        无可用操作
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 调用日志标签页 -->
+        <el-tab-pane label="调用日志" name="callLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="callLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="callLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
               </el-form-item>
-              <el-form-item label="归属设施" prop="refFacs">
-                <el-select v-model="queryParams.refFacs">
-                  <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                             :key="item.facsCode"
-                  />
-                </el-select>
+              <el-form-item label="能力标识">
+                <el-input v-model="callLogQuery.abilityKey" placeholder="请输入能力标识" clearable></el-input>
               </el-form-item>
-              <el-form-item label="子系统" prop="subsystemCode">
-                <el-select v-model="queryParams.subsystemCode">
-                  <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                             :key="item.systemCode"
-                  />
+              <el-form-item label="调用状态">
+                <el-select v-model="callLogQuery.callStatus" placeholder="全部" clearable>
+                  <el-option label="成功" :value="0"></el-option>
+                  <el-option label="进行中" :value="1"></el-option>
+                  <el-option label="失败" :value="2"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item>
-                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                <el-button type="primary" @click="queryCallLogs">查询</el-button>
+                <el-button @click="resetCallLogQuery">重置</el-button>
               </el-form-item>
             </el-form>
 
-            <el-row :gutter="10" class="mb8">
-              <el-col :span="1.5">
-                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-                           v-hasPermi="['ems:device:add']"
-                >新增
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-                           v-hasPermi="['ems:device:edit']"
-                >修改
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
-                           @click="handleDelete"
-                           v-hasPermi="['ems:device:remove']"
-                >删除
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-                           v-hasPermi="['ems:device:export']"
-                >导出
-                </el-button>
-              </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-            </el-row>
-          </div>
-
-          <div class="table-content">
-            <!--分页-->
-            <div class="button-group-container">
-              <el-button-group>
-                <el-button :type="primary1" icon="el-icon-s-fold" @click="switchData(1)"/>
-                <el-button :type="primary2" icon="el-icon-menu" @click="switchData(2)"/>
-              </el-button-group>
-            </div>
-
-            <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"
-                      v-if="istable === 1">
-              <el-table-column type="selection" width="55" align="center"/>
-              <el-table-column label="设备名称" align="left" prop="deviceName"/>
-              <el-table-column label="安装位置" align="left" prop="areaPath" width="220px"/>
-              <el-table-column label="归属设施" align="center" prop="refFacsName"/>
-              <el-table-column label="设备分类" align="center" prop="deviceCategoryName"/>
-              <el-table-column label="子系统" align="center" prop="subsystemName"/>
-              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <el-table :data="callLogList" border stripe v-loading="logLoading">
+              <el-table-column prop="objCode" label="对象代码" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="abilityName" label="能力名称" min-width="150"></el-table-column>
+              <el-table-column prop="callTime" label="调用时间" width="180"></el-table-column>
+              <el-table-column label="调用状态" width="100" align="center">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDevProcess(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']" v-if="shouldShowDevProcessButton(scope.row)"
-                  >
-                    器件
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    详情
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    修改
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                             @click="handleDelete(scope.row)" v-hasPermi="['basecfg:device:remove']"
-                  >
-                    删除
-                  </el-button>
-
+                  <el-tag size="small" :type="getCallStatusType(scope.row.callStatus)">
+                    {{ formatCallStatus(scope.row.callStatus) }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleCallLogDetail(scope.row)">详情</el-button>
                 </template>
               </el-table-column>
             </el-table>
 
-            <div v-else-if="istable === 2">
-              <el-row :gutter="20" class="device-list">
-                <el-col v-for="device in deviceList" :key="device.id" :span="6">
-                  <div :class="`device-card ${backStyle(device.areaPath)}`">
-                    <div class="device-header">
-                      <i class="el-icon-s-operation" style="margin-right: 8px;"></i>
-                      {{ device.deviceName }}
-                    </div>
-                    <div class="device-body">
-                      <p>设备代码:<span class="device-code">{{ device.deviceCode }}</span></p>
-                      <p>安装位置:<span class="deviceOthers">{{ device.areaPath }}</span></p>
-                      <p>归属设施:<span class="deviceOthers">{{ device.refFacsName }}</span></p>
-                      <p>设备分类:<span class="deviceOthers">{{ device.deviceCategoryName }}</span></p>
-                      <p>子系统:<span class="deviceOthers">{{ device.subsystemName }}</span></p>
-                    </div>
-                    <div class="device-footer">
-                      <el-button size="mini" plain icon=" el-icon-document" @click="handleDetail(device)">详情
-                      </el-button>
-                      <el-button size="mini" plain icon="el-icon-edit" @click="handleUpdate(device)">修改</el-button>
-                      <el-button size="mini" plain icon="el-icon-delete" type="danger" @click="handleDelete(device)">
-                        删除
-                      </el-button>
-                    </div>
-                  </div>
-                </el-col>
-              </el-row>
-            </div>
+            <pagination
+              v-show="callLogTotal > 0"
+              :total="callLogTotal"
+              :page.sync="callLogQuery.pageNum"
+              :limit.sync="callLogQuery.pageSize"
+              @pagination="queryCallLogs"
+            />
+          </div>
+        </el-tab-pane>
+
+        <!-- 事件日志标签页 -->
+        <el-tab-pane label="事件日志" name="eventLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="eventLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="eventLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
+              </el-form-item>
+              <el-form-item label="事件标识">
+                <el-input v-model="eventLogQuery.eventKey" placeholder="请输入事件标识" clearable></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="queryEventLogs">查询</el-button>
+                <el-button @click="resetEventLogQuery">重置</el-button>
+              </el-form-item>
+            </el-form>
 
+            <el-table :data="eventLogList" border stripe v-loading="eventLogLoading">
+              <el-table-column prop="objCode" label="对象编号" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventName" label="事件名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventTime" label="事件时间" width="180"></el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleEventLogDetail(scope.row)">详情</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
 
-            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-                        :limit.sync="queryParams.pageSize"
-                        @pagination="getList"
+            <pagination
+              v-show="eventLogTotal > 0"
+              :total="eventLogTotal"
+              :page.sync="eventLogQuery.pageNum"
+              :limit.sync="eventLogQuery.pageSize"
+              @pagination="queryEventLogs"
             />
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </el-card>
+
+    <!-- 修改系统信息对话框 -->
+    <el-dialog title="修改系统信息" :visible.sync="editDialogVisible" width="500px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="厂商" prop="manFacturer">
+          <el-input v-model="editForm.manFacturer" placeholder="请输入厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editForm.descr" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelEdit">取 消</el-button>
+        <el-button type="primary" @click="submitEdit" :loading="editLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 执行结果对话框 -->
+    <el-dialog
+      :title="executeDialog.title"
+      :visible.sync="executeDialog.visible"
+      width="600px">
+      <div class="execute-result">
+        <el-alert
+          :title="executeDialog.status"
+          :type="executeDialog.type"
+          :description="executeDialog.message"
+          show-icon>
+        </el-alert>
+        <div v-if="executeDialog.data" class="result-data">
+          <pre>{{ JSON.stringify(executeDialog.data, null, 2) }}</pre>
+        </div>
+      </div>
+      <span slot="footer">
+        <el-button @click="executeDialog.visible = false">关闭</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 调用日志详情弹窗 -->
+    <el-dialog :visible.sync="callLogDetailDialog" title="调用日志详情" width="60%">
+      <div v-if="callLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象代码">{{ callLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="模型代码">{{ callLogDetailData.modelCode }}</el-descriptions-item>
+          <el-descriptions-item label="能力标识">{{ callLogDetailData.abilityKey }}</el-descriptions-item>
+          <el-descriptions-item label="调用时间">{{ callLogDetailData.callTime }}</el-descriptions-item>
+          <el-descriptions-item label="响应时间">{{ callLogDetailData.resTime }}</el-descriptions-item>
+          <el-descriptions-item label="调用结果">
+            <el-tag :type="getCallStatusType(callLogDetailData.callStatus)">
+              {{ formatCallStatus(callLogDetailData.callStatus) }}
+            </el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>调用载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.callPayload }}</pre>
+        </div>
 
-            <!-- 添加或修改能源设备对话框 -->
-            <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-              <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-                <el-form-item label="归属设施" prop="refFacs">
-                  <el-select v-model="form.refFacs">
-                    <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                               :key="item.facsCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备代码" prop="deviceCode">
-                  <el-input v-model="form.deviceCode" placeholder="请输入设备代码"/>
-                </el-form-item>
-                <el-form-item label="设备名称" prop="deviceName">
-                  <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
-                </el-form-item>
-
-
-                <el-form-item label="功能类型" prop="psCode" v-if="queryParams.deviceCategory === 'W'">
-                  <el-select v-model="form.psCode">
-                    <el-option v-for="item in devOptions" :label="item.psName" :value="item.psCode"
-                               :key="item.psCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备类型" prop="deviceType">
-                  <el-select v-model="form.deviceCategory">
-                    <el-option v-for="item in subCategoryOptions" :label="item.name" :value="item.code"
-                               :key="item.code"
-                    />
-                  </el-select>
-                </el-form-item>
-                <el-form-item label="设备模型" prop="deviceModel">
-                  <el-select v-model="form.deviceModel" style="width:100%" @change="handleModelChange">
-                    <el-option
-                      v-for="item in modelList"
-                      :label="item.modelName"
-                      :value="item.modelCode"
-                      :key="item.modelCode"
-                    />
-                  </el-select>
-                </el-form-item>
-                <!-- 这里可以展示属性名称和属性值 -->
-                <div v-if="attrList.length > 0" class="attr-list-container">
-                  <h3>模型属性:</h3>
-                  <ul>
-                    <li v-for="attr in attrList" :key="attr.attrKey" class="attr-item">
-                      <span class="attr-name">{{ attr.attrName }} ({{ attr.attrUnit }}):</span>
-                      <!-- 使用 el-input 组件允许用户编辑属性值 -->
-                      <el-input
-                        v-model="attrValuesMap[attr.attrKey]"
-                        placeholder="点击编辑"
-                        size="small"
-                        @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])"
-                      >
-                      </el-input>
-                    </li>
-                  </ul>
-                </div>
-                <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
-                  <el-form-item label="" prop="attrList">
-                    <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px"
-                              key="'customAttrs'"
-                    >
-                      <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="attrName">
-                        <template slot-scope="scope">
-                          <el-input size="mini" v-model="scope.row.attrName" 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="请输入属性值"/>
-                        </template>
-                      </el-table-column>
-                      <el-table-column align="center" label="操作">
-                        <template slot="header">
-                          <div class="operateBtns" @click="addCustomAttr">
-                            <span>添加</span><i class="el-icon-circle-plus-outline"></i>
-                          </div>
-                        </template>
-                        <template slot-scope="scope">
-                          <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
-                        </template>
-                      </el-table-column>
-                    </el-table>
-                  </el-form-item>
-                </h3>
-                <el-form-item label="子系统" prop="subsystemCode">
-                  <el-select v-model="form.subsystemCode">
-                    <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                               :key="item.systemCode"
-                    />
-                  </el-select>
-                </el-form-item>
-              </el-form>
-              <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="submitForm">确 定</el-button>
-                <el-button @click="cancel">取 消</el-button>
+        <div style="margin-top: 20px;">
+          <h4>响应载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.resPayload }}</pre>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 事件日志详情弹窗 -->
+    <el-dialog :visible.sync="eventLogDetailDialog" title="事件日志详情" width="60%">
+      <div v-if="eventLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象编号">{{ eventLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="对象名称">{{ eventLogDetailData.objName }}</el-descriptions-item>
+          <el-descriptions-item label="事件名称">{{ eventLogDetailData.eventName }}</el-descriptions-item>
+          <el-descriptions-item label="事件标识">{{ eventLogDetailData.eventKey }}</el-descriptions-item>
+          <el-descriptions-item label="事件时间" :span="2">{{ eventLogDetailData.eventTime }}</el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>事件描述</h4>
+          <div style="background-color: #f5f5f5; padding: 10px; border-radius: 4px;">
+            {{ eventLogDetailData.eventDetail || '无' }}
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 能力执行弹窗(支持Slider和Input类型) -->
+    <el-dialog :title="abilityDialogTitle" :visible.sync="abilityDialogVisible" width="500px" append-to-body :close-on-click-modal="false">
+      <el-form ref="abilityForm" :model="abilityForm" label-width="100px">
+        <el-form-item label="能力名称">
+          <el-input v-model="abilityForm.abilityName" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="能力描述">
+          <el-input type="textarea" v-model="abilityForm.abilityDesc" disabled :rows="2"></el-input>
+        </el-form-item>
+
+        <el-form-item label="参数设置" v-if="abilityParamType">
+          <template v-if="abilityParamType === 'Slider'">
+            <div style="width: 100%;">
+              <div style="padding: 0 10px;">
+                <el-slider
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :show-tooltip="true"
+                  :format-tooltip="formatTooltip">
+                </el-slider>
               </div>
-            </el-dialog>
-
-            <!--设备器件-->
-            <el-drawer :title=ComponentRow.deviceName size="80%" :visible.sync="showDevProcessDrawer" direction="rtl">
-              <div class="drawer-content" style="padding-left:50px">
-                <el-row :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleComponentAdd"
-                               v-hasPermi="['ems:component:add']"
-                    >新增
-                    </el-button>
-                  </el-col>
-                </el-row>
-                <el-table v-loading="loading" :data="ComponentList">
-                  <el-table-column type="selection" width="55" align="center"/>
-                  <el-table-column label="部件编码" align="center" prop="compoCode"/>
-                  <el-table-column label="部件标签" align="center" prop="compoTag">
-                    <template slot-scope="scope">
-                      {{ objComTypeMapping[scope.row.compoTag] }}
-                    </template>
-                  </el-table-column>
-                  <el-table-column label="工艺标识代码" align="center" prop="psCode"/>
-                  <el-table-column label="外系统部件编码" align="center" prop="extCompoCode"/>
-                  <el-table-column label="部件模型" align="center" prop="compoModel"/>
-                  <el-table-column label="部件品牌" align="center" prop="compoBrand"/>
-                  <el-table-column label="部件型号" align="center" prop="compoSpec"/>
-                  <el-table-column label="祖籍列表" align="center" prop="ancestors"/>
-                  <el-table-column label="上级部件" align="center" prop="parentEqpt"/>
-
-                  <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-edit" @click="handleComponentUpdate(scope.row)"
-                                 v-hasPermi="['ems:component:edit']"
-                      >
-                        修改
-                      </el-button>
-                      <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                                 @click="handleComponentDelete(scope.row)" v-hasPermi="['ems:component:remove']"
-                      >
-                        删除
-                      </el-button>
-                    </template>
-                  </el-table-column>
-                </el-table>
-                <pagination v-show="total>0" :total="total" :page.sync="queryComponentParams.pageNum"
-                            :limit.sync="queryComponentParams.pageSize"
-                            @pagination="getComponentList"
-                />
-
-                <!-- 添加或修改设备器件对话框 -->
-                <el-dialog :title="title" :visible.sync="componentOpen" width="500px" append-to-body>
-                  <el-form ref="componentForm" :model="componentForm" :rules="componentRules" label-width="150px">
-                    <!--                <el-form-item label="设备code" prop="deviceCode">-->
-                    <!--                  <el-input v-model="componentForm.deviceCode" placeholder="请输入设备code" />-->
-                    <!--                </el-form-item>-->
-                    <el-form-item label="部件编码" prop="compoCode">
-                      <el-input v-model="componentForm.compoCode" placeholder="请输入部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件标签" prop="compoTag">
-                      <el-select v-model="componentForm.compoTag" placeholder="请输入部件标签">
-                        <el-option v-for="item in objComTypeOptions"
-                                   :label="item.name"
-                                   :value="item.code"
-                                   :key="item.code"
-                        />
-
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="工艺标签代码" prop="psCode">
-                      <el-select v-model="componentForm.psCode" placeholder="请输入工艺标签代码">
-                        <el-option v-for="item in devOptions" :label="item.psCode" :value="item.psCode"
-                                   :key="item.psCode"/>
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="外系统部件编码" prop="extCompoCode">
-                      <el-input v-model="componentForm.extCompoCode" placeholder="请输入外系统部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件模型" prop="compoModel">
-                      <el-select v-model="componentForm.compoModel" placeholder="请输入部件模型">
-                        <el-option v-for="item in this.modelList" :label="item.modelCode" :value="item.modelCode"
-                                   :key="item.modelCode"
-                        />
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="部件品牌" prop="compoBrand">
-                      <el-input v-model="componentForm.compoBrand" placeholder="请输入部件品牌"/>
-                    </el-form-item>
-                    <el-form-item label="部件型号" prop="compoSpec">
-                      <el-input v-model="componentForm.compoSpec" placeholder="请输入部件型号"/>
-                    </el-form-item>
-                    <el-form-item label="祖籍列表" prop="ancestors">
-                      <el-input v-model="componentForm.ancestors" placeholder="请输入祖籍列表"/>
-                    </el-form-item>
-                    <el-form-item label="上级列表" prop="parentCompo">
-                      <el-input v-model="componentForm.parentCompo" placeholder="请输入上级列表"/>
-                    </el-form-item>
-
-                  </el-form>
-                  <div slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="submitComponentForm">确 定</el-button>
-                    <el-button @click="ComponentCancel">取 消</el-button>
-                  </div>
-                </el-dialog>
+
+              <div style="display: flex; justify-content: space-between; padding: 0 10px; margin-top: -5px; margin-bottom: 20px;">
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMin }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ Math.floor((abilitySliderMin + abilitySliderMax) / 2) }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMax }}%</span>
               </div>
-            </el-drawer>
-
-            <!-- 详情弹框 -->
-            <el-dialog :visible.sync="showDrawer" title="设备详情">
-              <div v-if="curRow">
-                <!-- 设备基本信息 -->
-                <el-card class="box-card">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">设备基本信息</span>
-                  </div>
-                  <div>
-                    <p>设备代码:{{ curRow.deviceCode }}</p>
-                    <p>设备名称:{{ curRow.deviceName }}</p>
-                    <p>设备类型:{{ curRow.deviceCategoryName }}</p>
-                    <p>子系统:{{ curRow.subsystemName }}</p>
-                    <p>归属区域:{{ curRow.areaPath }}</p>
-                    <p>归属设施:{{ curRow.refFacsName }}</p>
-                  </div>
-                </el-card>
-                <el-card class="box-card" style="margin-top: 10px">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">状态属性</span>
-                  </div>
-                  <div>
-                    <p v-for="attr in statusAttr" :key="attr.attr">{{ attr.attr }}:{{ attr.attrValue }} {{
-                        attr.attrUnit
-                      }}</p>
-                  </div>
-                </el-card>
-                <!-- 属性信息 -->
-                <el-card class="box-card" v-if="attrData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">属性定义</span>
-                  </div>
-                  <div v-for="(item, index) in attrData" :key="index">
-                    <p>属性名称:{{ item.attrName }}</p>
-                    <p>属性值:{{ item.attrValue }}</p>
-                    <p>属性单位:{{ item.attrUnit }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < attrData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 能力信息 -->
-                <el-card class="box-card" v-if="abilityData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">能力定义</span>
-                  </div>
-                  <div v-for="(item, index) in abilityData" :key="index">
-                    <p>能力名称:{{ item.abilityName }}</p>
-                    <p>能力键:{{ item.abilityKey }}</p>
-                    <p>能力参数:{{ item.abilityParam }}</p>
-                    <p>能力描述:{{ item.abilityDesc }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < abilityData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 事件信息 -->
-                <el-card class="box-card" v-if="eventData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">事件定义</span>
-                  </div>
-                  <div v-for="(item, index) in eventData" :key="index">
-                    <p>事件名称:{{ item.eventKey }}</p>
-                    <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
-                    <p>事件代码:{{ item.eventCode }}</p>
-                    <p>外部事件代码:{{ item.extEventCode }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < eventData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
+
+              <div style="display: flex; align-items: center; gap: 15px;">
+                <el-input-number
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :step="1"
+                  :precision="0"
+                  controls-position="right"
+                  style="flex: 0 0 120px;">
+                </el-input-number>
+                <span style="color: #909399; font-size: 13px;">
+                  调节范围:{{ abilitySliderMin }} - {{ abilitySliderMax }}
+                </span>
               </div>
-            </el-dialog>
-          </div>
-        </div>
-      </el-col>
-    </el-row>
+            </div>
+          </template>
+
+          <template v-else-if="abilityParamType === 'Input'">
+            <el-input
+              v-model="abilityInputValue"
+              placeholder="请输入参数值"
+              clearable>
+            </el-input>
+          </template>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="abilityDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="executeAbilityWithParam" :loading="abilityExecuting">执行</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import {addDevice, delDevice, getDevice, listDevRecursionByArea, updateDevice} from '@/api/device/device'
-import {areaTreeSelect} from '@/api/basecfg/area'
-import {getFacsCategorygetByCode, listAllFacs} from '@/api/basecfg/emsfacs'
-import {listSubsystemAll} from '@/api/adapter/subsystem'
-import {getModelByCode, listAllModel} from '@/api/basecfg/objModel'
-import {getObjAttr} from '@/api/basecfg/objAttribute'
-import {addAttrValueBatch} from '@/api/basecfg/objAttributeValue'
-import {addComponent, delComponent, getComponent, listByDevice, updateComponent} from '@/api/basecfg/component'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
+import { getModelByCode } from '@/api/basecfg/objModel'
+import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
+import { listcallAbility } from '@/api/basecfg/objAbility'
+import { getByCondition } from '@/api/device/device'
+import { listCallLog, listEventLog, getCallLog, getEventLog } from '@/api/basecfg/objLog'
 
 export default {
-  name: 'Device',
-  components: {Treeselect},
+  name: 'SubsystemIntegration',
   data() {
     return {
-      primary1: 'primary',
-      primary2: '',
-      ComponentRow: [],
-      componentForm: {},
-      subcategoryCode: '',
-      attrList: [], // 属性模板数组
-      attrValues: [],
-      ComponentList: [],
-      attrValuesMap: {},
-      modelList: [],
-      showDrawer: false,
-      showDevProcessDrawer: false,
-      componentOpen: false,
-      istable: 2,
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 能源设备表格数据
+      // 系统代码
+      systemCode: 'SYS_CD',
+      // 系统信息
+      systemInfo: {},
+      // 系统状态
+      systemStatus: '1',
+      // 当前标签页
+      activeTab: 'attributes',
+      // 协议属性
+      protocolAttrs: [],
+      // 状态属性
+      stateAttrs: [],
+      // 系统能力
+      systemAbilities: [],
+      abilityLoading: false,
+      // 设备列表
       deviceList: [],
-      // 弹出层标题
-      title: '',
-      // 是否显示弹出层
-      open: false,
-      // 区域名称
-      areaName: undefined,
-      // 区域树选项
-      treeAreaOptions: undefined,
-      totalAreaOptions: undefined,
-      // 设施选项
-      facsOptions: undefined,
-      // 设备分类
-      subCategoryOptions: undefined,
-      subsystemOptions: undefined,
-      devOptions: undefined,
-      statusAttr: [{
-        attr: '充电功率',
-        attrUnit: 'kW',
-        attrValue: '20'
-      },
-        {
-          attr: '充电电量',
-          attrUnit: 'kW·h',
-          attrValue: '10'
-        },
-        {
-          attr: '充电次数',
-          attrUnit: '次',
-          attrValue: '200'
-        },
-        {
-          attr: '运行状态',
-          attrUnit: '',
-          attrValue: '工作中'
-        }
-      ],
-      defaultProps: {
-        children: 'children',
-        label: 'label'
+      deviceLoading: false,
+      deviceAttrs: {},
+      deviceChannels: {},
+      // 设备能力缓存
+      deviceAbilities: {},
+      // 设备统计
+      deviceStats: {
+        total: 0,
+        online: 0,
+        offline: 0,
+        points: 0
       },
-      // 查询参数
-      queryParams: {
-        psCode: null,
+      // 所有模型代码(系统 + 设备)
+      allModelCodes: [],
+      // 调用日志查询
+      callLogQuery: {
+        dateRange: [],
+        abilityKey: '',
+        callStatus: '',
         pageNum: 1,
-        pageSize: 10,
-        deviceCode: null,
-        deviceSubCategory: '',
-        deviceCategory: 'E',
-        locationType: null,
-        locationRef: null,
-        refFacs: null,
-        customAttrs: null
+        pageSize: 10
       },
-      queryComponentParams: {
+      callLogList: [],
+      callLogTotal: 0,
+      logLoading: false,
+      // 事件日志查询
+      eventLogQuery: {
+        dateRange: [],
+        eventKey: '',
         pageNum: 1,
         pageSize: 10
       },
-      objComTypeMapping: {
-        1: '总开',
-        2: '照明',
-        3: '风机'
-      },
-      objComTypeOptions: [
-        {code: 1, name: '总开'},
-        {code: 2, name: '照明'},
-        {code: 3, name: '风机'}
-
-      ],
-      curRow: {},
-      attrData: [],
-      abilityData: [],
-      eventData: [],
-
-      // 表单参数
-      form: {
-        customAttrs: [] // 自定义属性数组
+      eventLogList: [],
+      eventLogTotal: 0,
+      eventLogLoading: false,
+      // 调用日志详情
+      callLogDetailDialog: false,
+      callLogDetailData: null,
+      // 事件日志详情
+      eventLogDetailDialog: false,
+      eventLogDetailData: null,
+      // 执行结果对话框
+      executeDialog: {
+        visible: false,
+        title: '',
+        status: '',
+        type: 'success',
+        message: '',
+        data: null
       },
-      // 表单校验
-      rules: {
-        refFacs: [
-          {required: true, message: '归属设施', trigger: 'blur'}
-        ],
-        refArea: [
-          {required: true, message: '安装位置', trigger: 'blur'}
-        ],
-        deviceCode: [
-          {required: true, message: '设备代码不能为空', trigger: 'blur'}
-        ],
-        deviceName: [
-          {required: true, message: '设备名称不能为空', trigger: 'blur'}
-        ]
+      // 能力执行相关
+      abilityDialogVisible: false,
+      abilityDialogTitle: '能力执行',
+      abilityForm: {
+        abilityName: '',
+        abilityKey: '',
+        abilityDesc: '',
+        paramDefinition: null,
+        modelCode: ''
       },
-      componentRules: {
-        deviceCode: [
-          {required: true, message: '设备code不能为空', trigger: 'blur'}
-        ],
-        compoCode: [
-          {required: true, message: '部件编码不能为空', trigger: 'blur'}
+      abilityParamType: null,
+      abilitySliderValue: 50,
+      abilitySliderMin: 0,
+      abilitySliderMax: 100,
+      abilityInputValue: '',
+      abilityExecuting: false,
+      currentDevice: null,
+      currentObjType: null,
+      // 编辑系统信息相关
+      editDialogVisible: false,
+      editLoading: false,
+      editForm: {},
+      editRules: {
+        systemCode: [
+          { required: true, message: "系统代码不能为空", trigger: "blur" }
         ],
-        psCode: [
-          {required: true, message: '工艺标签代码不能为空', trigger: 'blur'}
+        systemName: [
+          { required: true, message: "系统名称不能为空", trigger: "blur" }
         ]
       }
     }
   },
-  watch: {
-    // 根据名称筛选区域树
-    areaName(val) {
-      this.$refs.tree.filter(val)
-    }
-  },
   created() {
-    this.queryParams.deviceCategory = 'Charge'; // 确保初始加载时就设置为 'Charge'
-    this.getList()
-    this.getAreaTree('0', 1)
-    this.getFacsOptions()
-    this.getSubsystem()
-    this.getSubCategorygetByCode()
-    this.getFacsModel()
-    // this.getAllDevProcess(this.subcategoryCode)
+    this.loadSystemInfo()
+    this.initDateRange()
   },
   methods: {
-    /**分页切换*/
-    switchData(v) {
-      if (v === 1) {
-        this.primary1 = "primary";
-        this.primary2 = "";
-      } else {
-        this.primary1 = "";
-        this.primary2 = "primary";
-      }
-      this.istable = v;
-    },
-    /** 查询能源设备列表 */
-    getList() {
-      this.loading = true
-      listDevRecursionByArea(this.queryParams).then(response => {
-        console.log('参数', JSON.stringify(this.queryParams))
-        this.deviceList = response.rows
-        this.total = response.total
-        this.loading = false
+    // 打开编辑对话框
+    handleEdit() {
+      this.editForm = { ...this.systemInfo }
+      this.editDialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.editForm?.clearValidate()
       })
     },
-    /**新增、修改、删除*/
-    handleComponentAdd() {
-      this.componentReset()
-      this.componentOpen = true
-      this.title = '添加设备器件属性'
-      this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
 
+    // 取消编辑
+    cancelEdit() {
+      this.editDialogVisible = false
+      this.editForm = {}
     },
-    handleComponentUpdate(row) {
-      this.componentReset()
-      const id = row.id || this.ids
-      getComponent(id).then(response => {
-        this.componentForm = response.data
-        this.componentOpen = true
-        this.title = '修改设备器件属性'
-        this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
-      })
-    },
-    handleComponentDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function () {
-        return delComponent(ids)
-      }).then(() => {
-        console.log('删除row', row.deviceCode)
-        this.getComponentList(row.deviceCode)
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    submitComponentForm() {
-      this.$refs['componentForm'].validate(valid => {
+
+    // 提交编辑
+    submitEdit() {
+      this.$refs.editForm.validate(valid => {
         if (valid) {
-          if (this.componentForm.id != null) {
-            updateComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          } else {
-            addComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          }
+          this.editLoading = true
+          updateSubsystem(this.editForm).then(response => {
+            this.$message.success("修改成功")
+            this.editDialogVisible = false
+            // 重新加载系统信息
+            this.loadSystemInfo()
+          }).catch(error => {
+            this.$message.error("修改失败:" + error.message)
+          }).finally(() => {
+            this.editLoading = false
+          })
         }
       })
     },
-    ComponentCancel() {
-      this.componentOpen = false
-      this.componentReset()
-    },
-    /**查询部件列表*/
-    getComponentList(deviceCode) {
-      listByDevice(deviceCode).then(response => {
-        this.ComponentList = response.data
-      })
-    },
-    /** 查询区域树结构 */
-    getAreaTree(areaCode, layer) {
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.treeAreaOptions = [{
-          id: '-1',
-          label: '全部',
-          children: response.data
-        }]
-      })
-    },
-    // 筛选节点
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
+
+    // 格式化滑块tooltip
+    formatTooltip(val) {
+      return `${val}%`
     },
-    // 节点单击事件
-    handleNodeClick(data) {
-      if (data.id === '-1') {
-        this.queryParams.locationType = null;
-        this.queryParams.locationRef = null;
-      } else {
-        this.queryParams.locationType = data.tier;
-        this.queryParams.locationRef = data.id;
+
+    // 解析参数定义类型
+    getParamType(paramDefinition) {
+      if (!paramDefinition) return null
+      try {
+        const def = JSON.parse(paramDefinition)
+        return def.type
+      } catch (e) {
+        return null
       }
-      this.handleQuery();
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false
-      this.reset()
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        deviceCode: null,
-        deviceName: null,
-        deviceType: null,
-        deviceStatus: null,
-        deviceModel: null,
-        refArea: null,
-        refFacs: null,
-        subsystemCode: null,
-        psCode: null,
-        createTime: null,
-        updateTime: null
 
+    // 解析Options类型的选项
+    parseOptions(paramDefinition) {
+      try {
+        const def = JSON.parse(paramDefinition)
+        if (def.type === 'Options' && def.list) {
+          return def.list
+        }
+      } catch (e) {
+        console.error('解析Options失败:', e)
       }
-      this.resetForm('form')
+      return []
     },
-    componentReset() {
-      this.componentForm = {
-        id: null,
-        deviceCode: this.ComponentRow.deviceCode || '', // 使用ComponentRow的deviceCode,或者空字符串
-        compoCode: null,
-        compoTag: null,
-        psCode: null,
-        extCompoCode: null,
-        compoModel: null,
-        compoBrand: null,
-        compoSpec: null,
-        ancestors: null,
-        parentCompo: null
 
+    // 处理系统能力点击
+    handleSystemAbilityClick(ability) {
+      const paramType = this.getParamType(ability.paramDefinition)
+
+      if (paramType === 'Slider') {
+        this.showSliderDialog(ability, this.systemInfo, 3)
+      } else if (paramType === 'Input') {
+        this.showInputDialog(ability, this.systemInfo, 3)
+      } else {
+        this.executeSystemAbility(ability)
       }
-      this.resetForm('componentForm')
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1
-      console.log('搜索按钮this.queryParams', JSON.stringify(this.queryParams))
-      this.getList()
+
+    // 执行系统能力(带Options参数)
+    executeSystemAbilityWithParam(ability, paramValue) {
+      ability.executing = true
+      ability.executingValue = paramValue
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: paramValue
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+        ability.executingValue = null
+      })
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.queryParams.locationType = null
-      this.queryParams.locationRef = null
-      this.resetForm('queryForm')
-      this.handleQuery()
+
+    // 执行系统能力(无参数)
+    executeSystemAbility(ability) {
+      ability.executing = true
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: null
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+
+        if (ability.abilityKey === 'MeterReadingGw') {
+          this.loadDevices()
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+      })
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+
+    // 显示滑块弹窗
+    showSliderDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Slider'
+
+      try {
+        const def = JSON.parse(ability.paramDefinition)
+        this.abilitySliderMin = def.min || 0
+        this.abilitySliderMax = def.max || 100
+        this.abilitySliderValue = Math.floor((this.abilitySliderMin + this.abilitySliderMax) / 2)
+      } catch (e) {
+        console.error('解析Slider参数失败:', e)
+        this.abilitySliderMin = 0
+        this.abilitySliderMax = 100
+        this.abilitySliderValue = 50
+      }
+
+      this.abilityDialogVisible = true
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '添加能源设备'
+
+    // 显示输入弹窗
+    showInputDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Input'
+      this.abilityInputValue = ''
+      this.abilityDialogVisible = true
     },
-    /**设备器件按钮*/
-    handleDevProcess(row) {
-      this.showDevProcessDrawer = true
-      this.ComponentRow = row
-      console.log('row', row)
-      listByDevice(this.ComponentRow.deviceCode).then(response => {
-        this.ComponentList = response.data
+
+    // 执行带参数的能力
+    executeAbilityWithParam() {
+      let paramValue = null
+
+      if (this.abilityParamType === 'Slider') {
+        paramValue = String(this.abilitySliderValue)
+      } else if (this.abilityParamType === 'Input') {
+        if (!this.abilityInputValue) {
+          this.$message.warning('请输入参数值')
+          return
+        }
+        paramValue = this.abilityInputValue
+      }
+
+      this.abilityExecuting = true
+
+      const callParams = {
+        objType: this.currentObjType,
+        abilityKey: this.abilityForm.abilityKey,
+        abilityParam: paramValue
+      }
+
+      if (this.currentObjType === 3) {
+        callParams.objCode = this.systemCode
+        callParams.modelCode = this.systemInfo.modelCode
+      } else if (this.currentObjType === 2) {
+        callParams.objCode = this.currentDevice.deviceCode
+        callParams.modelCode = this.currentDevice.deviceModel
+      }
+
+      listcallAbility(callParams).then(response => {
+        this.$message.success('执行成功')
+        this.abilityDialogVisible = false
+
+        if (this.abilityForm.abilityKey.toLowerCase().includes('meter') ||
+          this.abilityForm.abilityKey.toLowerCase().includes('reading')) {
+          if (this.currentObjType === 3) {
+            this.loadDevices()
+          } else if (this.currentObjType === 2) {
+            this.loadDeviceAttrs(this.currentDevice.deviceCode)
+          }
+        }
+      }).catch(() => {
+        this.$message.error('执行失败')
+      }).finally(() => {
+        this.abilityExecuting = false
       })
+    },
 
+    // 初始化时间范围
+    initDateRange() {
+      const now = new Date()
+      const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
+      const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59)
+
+      this.callLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
+      this.eventLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
     },
-    shouldShowDevProcessButton(row) {
-      const categoryIsW = this.queryParams.deviceCategory === 'W'
-      const validPsCodes = ['AA', 'AH', 'AJ', 'AM', 'AP', 'AL', 'APE', 'ALE', 'AF', 'ACC']
-      const psCodeIsValid = validPsCodes.includes(row.psCode)
-      // 只有当设备分类为输能设备且设备工艺代码有效时,才返回true
-      return categoryIsW && psCodeIsValid
+
+    // 格式化日期
+    formatDate(date) {
+      if (!date) return ''
+      const year = date.getFullYear()
+      const month = (date.getMonth() + 1).toString().padStart(2, '0')
+      const day = date.getDate().toString().padStart(2, '0')
+      const hours = date.getHours().toString().padStart(2, '0')
+      const minutes = date.getMinutes().toString().padStart(2, '0')
+      const seconds = date.getSeconds().toString().padStart(2, '0')
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
     },
-    backStyle(areaPath) {
-      const firstLevel = areaPath.split('/')[0];
-      switch (firstLevel) {
-        case '北区':
-          return 'north';
-        case '南区':
-          return 'south';
-        case '主路':
-          return 'main';
-        default:
-          return '';
+
+    // 加载系统信息
+    async loadSystemInfo() {
+      try {
+        const sysRes = await getSubsystemByCode(this.systemCode)
+        this.systemInfo = sysRes.data
+
+        if (this.systemInfo.modelCode) {
+          this.allModelCodes.push(this.systemInfo.modelCode)
+
+          const modelRes = await getModelByCode(this.systemInfo.modelCode)
+          const modelData = modelRes.data
+
+          this.systemAbilities = (modelData.abilityList || []).map(item => ({
+            ...item,
+            executing: false,
+            executingValue: null
+          }))
+        }
+
+        const attrRes = await getObjAttr(3, this.systemCode)
+        const attrData = attrRes.data
+
+        this.protocolAttrs = attrData.Protocol || []
+        this.stateAttrs = attrData.State || []
+
+        const statusAttr = this.stateAttrs.find(attr => attr.attrKey === 'interfaceStatus')
+        if (statusAttr) {
+          this.systemStatus = statusAttr.attrValue
+        }
+
+        await this.loadDevices()
+      } catch (error) {
+        this.$message.error('加载系统信息失败:' + error.message)
       }
     },
-    /**设备详情按钮*/
-    handleDetail(row) {
-      this.showDrawer = true
-      this.curRow = row
-      console.log('data', this.curRow)
-      this.subKey = this.$options.data().subKey
-      getModelByCode(this.curRow.facsModel).then(response => {
-        const code = response.data
-        console.log('code', code)
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
 
-      })
-      getObjAttr(2, this.curRow.deviceCode).then(response => {
-        console.log('response值', response.data)
-        const attrs = response.data.attrs
-        const attrValues = response.data.attrValues
-
-        // 合并 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 : ''
+    // 加载设备列表
+    async loadDevices() {
+      this.deviceLoading = true
+      try {
+        const res = await getByCondition({
+          subsystemCode: this.systemCode
+        })
+
+        const deviceData = res.data || res.rows || []
+
+        this.deviceList = deviceData.map(device => ({
+          ...device,
+          detailTab: 'attrs'
+        }))
+
+        const deviceModelCodes = new Set()
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            deviceModelCodes.add(device.deviceModel)
           }
         })
-        this.attrData = mergedData
-      })
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset()
-      const id = row.id || this.ids
-      getDevice(id).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改能源设备'
-      })
-      const layer = 1
-      const areaCode = '0'
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.totalAreaOptions = response.data
-      })
-    },
-    /** 提交按钮 */
-    submitForm() {
-      // 重置 attrList 和 form.customAttrs
-      if (!this.attrList) {
-        this.attrList = []
-      }
-      if (!this.form.customAttrs) {
-        this.form.customAttrs = []
-      }
-      // 准备要发送的数据
-      let dataToSubmit = []
-      // 添加模型属性数据
-      this.attrList.forEach(attr => {
-        const attrName = attr.attrName
-        const attrKey = attr.attrKey
-        const attrValue = this.attrValuesMap[attrKey]
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
 
-          })
-        }
-      })
+        deviceModelCodes.forEach(modelCode => {
+          if (!this.allModelCodes.includes(modelCode)) {
+            this.allModelCodes.push(modelCode)
+          }
+        })
 
-      // 添加自定义属性数据
-      this.form.customAttrs.forEach(customAttr => {
-        const attrName = customAttr.attrName
-        const attrKey = customAttr.attrKey
-        const attrValue = customAttr.attrValue
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: '', // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
-          })
+        this.deviceStats.total = this.deviceList.length
+        this.deviceStats.online = this.deviceList.filter(d => d.deviceStatus === 1).length
+        this.deviceStats.offline = this.deviceList.filter(d => d.deviceStatus !== 1).length
+
+        const devicesByModel = {}
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            if (!devicesByModel[device.deviceModel]) {
+              devicesByModel[device.deviceModel] = []
+            }
+            devicesByModel[device.deviceModel].push(device)
+          }
+        })
+
+        for (const modelCode in devicesByModel) {
+          await this.loadDeviceAttrsBatch(modelCode, devicesByModel[modelCode])
         }
-      })
+      } catch (error) {
+        this.$message.error('加载设备列表失败')
+      } finally {
+        this.deviceLoading = false
+      }
+    },
 
-      this.$refs['form'].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateDevice(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            }).catch(error => {
-              console.error('修改失败:', error)
-              this.$message.error('修改失败')
-            })
+    // 批量加载设备属性
+    async loadDeviceAttrsBatch(modelCode, devices) {
+      try {
+        const res = await getObjAttrBatch(2, modelCode)
+        const batchData = res.data || {}
 
-            if (dataToSubmit.length > 0) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
-                  }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+        let totalPoints = 0
+
+        devices.forEach(device => {
+          const deviceCode = device.deviceCode
+          const attrData = batchData[deviceCode]
+
+          if (attrData) {
+            const baseAttrs = {}
+            if (attrData.Base) {
+              attrData.Base.forEach(attr => {
+                baseAttrs[attr.attrKey] = attr.attrValue
               })
             }
-          } 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) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
+            this.deviceAttrs[deviceCode] = baseAttrs
+
+            const channels = []
+            if (attrData.Measure) {
+              attrData.Measure.forEach(attr => {
+                if (attr.attrKey.startsWith('interface')) {
+                  try {
+                    const points = JSON.parse(attr.attrValue || '[]')
+                    channels.push({
+                      name: attr.attrName,
+                      key: attr.attrKey,
+                      points: points
+                    })
+                    totalPoints += points.length
+                  } catch (e) {
+                    console.error(`解析设备 ${deviceCode} 的测点数据失败:`, e)
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+                }
               })
-            } else {
-              // this.$message.info('没有属性需要添加');
             }
+            this.deviceChannels[deviceCode] = channels
           }
+        })
+
+        this.deviceStats.points += totalPoints
+      } catch (error) {
+        console.error(`批量加载模型 ${modelCode} 的设备属性失败:`, error)
+        for (const device of devices) {
+          await this.loadDeviceAttrs(device.deviceCode)
         }
-      })
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源设备编号为"' + ids + '"的数据项?').then(function () {
-        return delDevice(ids)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('ems/basecfg/device/export', {
-        ...this.queryParams
-      }, `device_${new Date().getTime()}.xlsx`)
-    },
-    getFacsOptions() {
-      const getFacsParams = {
-        facsCategory: this.queryParams.deviceCategory,
-        subCategory: this.queryParams.deviceSubCategory
       }
-      listAllFacs(getFacsParams).then(response => {
-        this.facsOptions = response.data
-      })
-    },
-    getSubCategorygetByCode() {
-      getFacsCategorygetByCode(this.queryParams.deviceCategory).then(response => {
-        this.subCategoryOptions = response.data.subtypeList || []
-      })
-    },
-    getSubsystem() {
-      listSubsystemAll().then(response => {
-        this.subsystemOptions = response.data
-      })
     },
-    /**自定义属性表格*/
-    addCustomAttr() {
-      // 添加一个新的自定义属性
-      if (!Array.isArray(this.form.customAttrs)) {
-        this.form.customAttrs = []
-      }
-      this.form.customAttrs.push({
-        attrKey: '',
-        attrName: '',
-        attrValue: ''
-      })
-      // 强制更新视图
-      this.$forceUpdate()
 
-    },
-    deleteCustomAttr(index) {
-      // 删除指定索引的自定义属性
-      if (this.form.customAttrs.length > 0) {
-        this.form.customAttrs.splice(index, 1)
+    // 单个加载设备属性
+    async loadDeviceAttrs(deviceCode) {
+      try {
+        const res = await getObjAttr(2, deviceCode)
+        const attrData = res.data
+
+        const baseAttrs = {}
+        if (attrData.Base) {
+          attrData.Base.forEach(attr => {
+            baseAttrs[attr.attrKey] = attr.attrValue
+          })
+        }
+        this.deviceAttrs[deviceCode] = baseAttrs
+
+        const channels = []
+        let pointsCount = 0
+        if (attrData.Measure) {
+          attrData.Measure.forEach(attr => {
+            if (attr.attrKey.startsWith('interface')) {
+              try {
+                const points = JSON.parse(attr.attrValue || '[]')
+                channels.push({
+                  name: attr.attrName,
+                  key: attr.attrKey,
+                  points: points
+                })
+                pointsCount += points.length
+              } catch (e) {
+                console.error(`解析测点数据失败:`, e)
+              }
+            }
+          })
+        }
+
+        if (!this.deviceChannels[deviceCode]) {
+          this.deviceStats.points += pointsCount
+        }
+
+        this.deviceChannels[deviceCode] = channels
+      } catch (error) {
+        console.error(`加载设备 ${deviceCode} 属性失败:`, error)
       }
+    },
 
+    // 获取设备属性
+    getDeviceAttr(deviceCode, attrKey) {
+      return this.deviceAttrs[deviceCode]?.[attrKey] || '-'
     },
-    /**设备模型*/
-    updateAttrValue(attrKey, newValue) {
-      this.attrValuesMap[attrKey] = newValue
+
+    // 获取设备通道
+    getDeviceChannels(deviceCode) {
+      return this.deviceChannels[deviceCode] || []
     },
 
-    getFacsModel() {
-      listAllModel(2).then(response => {
-        this.modelList = response.data
-        console.log('this.modelList', this.modelList)
-        this.modelList.forEach(model => {
-          console.log(model.modelCode)
-        })
-      })
+    // 加载设备能力
+    async handleAbilityLoad(visible, device) {
+      if (visible && !this.deviceAbilities[device.deviceCode]) {
+        try {
+          if (!device.deviceModel) {
+            this.$set(this.deviceAbilities, device.deviceCode, [])
+            return
+          }
+
+          const res = await getModelByCode(device.deviceModel)
+          const abilities = res.data?.abilityList?.filter(item => item.hiddenFlag === 1) || []
+          this.$set(this.deviceAbilities, device.deviceCode, abilities)
+        } catch (error) {
+          this.$set(this.deviceAbilities, device.deviceCode, [])
+        }
+      }
     },
-    handleModelChange(modelCode) {
-      if (modelCode) {
-        this.getModelByCode(modelCode)
-        console.log('设备代码', this.form.deviceCode)
-        this.getObjAttr(2, this.form.deviceCode)
+
+    // 处理设备操作命令
+    async handleDeviceCommand(command) {
+      const { device, ability, paramValue } = command
+
+      if (paramValue !== undefined) {
+        try {
+          await listcallAbility({
+            objCode: device.deviceCode,
+            objType: 2,
+            modelCode: device.deviceModel,
+            abilityKey: ability.abilityKey,
+            abilityParam: paramValue
+          })
+
+          this.$message.success(`${ability.abilityName}执行成功`)
+
+          if (ability.abilityKey.toLowerCase().includes('meter') ||
+            ability.abilityKey.toLowerCase().includes('reading')) {
+            await this.loadDeviceAttrs(device.deviceCode)
+          }
+        } catch (error) {
+          this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+        }
+      } else {
+        const paramType = this.getParamType(ability.paramDefinition)
+
+        if (paramType === 'Slider') {
+          this.showSliderDialog(ability, device, 2)
+        } else if (paramType === 'Input') {
+          this.showInputDialog(ability, device, 2)
+        } else {
+          try {
+            await listcallAbility({
+              objCode: device.deviceCode,
+              objType: 2,
+              modelCode: device.deviceModel,
+              abilityKey: ability.abilityKey,
+              abilityParam: null
+            })
+
+            this.$message.success(`${ability.abilityName}执行成功`)
+
+            if (ability.abilityKey.toLowerCase().includes('meter') ||
+              ability.abilityKey.toLowerCase().includes('reading')) {
+              await this.loadDeviceAttrs(device.deviceCode)
+            }
+          } catch (error) {
+            this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+          }
+        }
       }
     },
-    getModelByCode(modelCode) {
-      getModelByCode(modelCode).then(response => {
-        // this.attrList = response.data.attrList;
-        const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
-        this.attrList = filteredAttrList
 
-      })
+    // 处理设备行点击
+    handleDeviceClick(row) {
+      this.$refs.deviceTable?.toggleRowExpansion(row)
     },
-    getObjAttr(objType, deviceCode) {
-      getObjAttr(objType, deviceCode).then(response => {
-        // const attrs = response.data.attrs;
-        const attrs = response.data.attrs.filter(attr => attr.attrType === 0)
-        console.log('attrs', attrs)
-        const attrValues = response.data.attrValues || [] // 确保是一个数组
-        console.log('attrValues', attrValues)
-
-        // 创建一个映射对象,用于存储 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] = ''
-          }
-        })
 
-        // 更新 attrValuesMap 到组件的数据中
-        this.attrValuesMap = attrValuesMap
-        // 打印更新后的 attrValuesMap,用于调试
-        console.log('Updated attrValuesMap', this.attrValuesMap)
+    // 标签页切换
+    handleTabClick(tab) {
+      if (tab.name === 'callLogs' && this.callLogList.length === 0) {
+        this.queryCallLogs()
+      } else if (tab.name === 'eventLogs' && this.eventLogList.length === 0) {
+        this.queryEventLogs()
+      }
+    },
 
-      })
-    }
-  }
-}
-</script>
-<style lang="scss" scoped>
+    // 查询调用日志
+    async queryCallLogs() {
+      this.logLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.callLogQuery.pageNum,
+          pageSize: this.callLogQuery.pageSize
+        }
 
-.divider {
-  border-bottom: 2px solid #ebeef5;
-  margin: 10px 0;
-}
+        if (this.callLogQuery.dateRange && this.callLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.callLogQuery.dateRange[0]
+          params.endRecTime = this.callLogQuery.dateRange[1]
+        }
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-  margin-top: 20px;
-  margin-bottom: 10px;
-}
+        if (this.callLogQuery.abilityKey) {
+          params.abilityKey = this.callLogQuery.abilityKey
+        }
 
-.drawer-content {
-  padding: 0 20px;
-}
+        if (this.callLogQuery.callStatus !== '') {
+          params.callStatus = this.callLogQuery.callStatus
+        }
 
+        const res = await listCallLog(params)
+        this.callLogList = res.rows || []
+        this.callLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询调用日志失败')
+      } finally {
+        this.logLoading = false
+      }
+    },
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-}
+    // 重置调用日志查询
+    resetCallLogQuery() {
+      this.initDateRange()
+      this.callLogQuery.abilityKey = ''
+      this.callLogQuery.callStatus = ''
+      this.callLogQuery.pageNum = 1
+      this.queryCallLogs()
+    },
 
-.attr-list-container {
-  border: 1px solid #ccc;
-  padding: 10px;
-  margin: 10px 0;
-  font-weight: bold;
-}
+    // 查询事件日志
+    async queryEventLogs() {
+      this.eventLogLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.eventLogQuery.pageNum,
+          pageSize: this.eventLogQuery.pageSize
+        }
 
-.attr-list-container h3 {
-  font-weight: bold;
-}
+        if (this.eventLogQuery.dateRange && this.eventLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.eventLogQuery.dateRange[0]
+          params.endRecTime = this.eventLogQuery.dateRange[1]
+        }
 
-.attr-item {
-  list-style-type: none;
-  margin-bottom: 5px;
-}
+        if (this.eventLogQuery.eventKey) {
+          params.eventKey = this.eventLogQuery.eventKey
+        }
 
-.attr-name {
-  font-weight: bold;
-}
+        const res = await listEventLog(params)
+        this.eventLogList = res.rows || []
+        this.eventLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询事件日志失败')
+      } finally {
+        this.eventLogLoading = false
+      }
+    },
 
+    // 重置事件日志查询
+    resetEventLogQuery() {
+      this.initDateRange()
+      this.eventLogQuery.eventKey = ''
+      this.eventLogQuery.pageNum = 1
+      this.queryEventLogs()
+    },
 
-.contents {
-  border: 20px solid #f2f2f5;
-  background-color: #f2f2f5;
-}
+    // 格式化调用状态
+    formatCallStatus(status) {
+      const statusMap = {
+        0: '成功',
+        1: '进行中',
+        2: '失败'
+      }
+      return statusMap[status] || '未知'
+    },
 
+    // 获取调用状态类型
+    getCallStatusType(status) {
+      const typeMap = {
+        0: 'success',
+        1: 'warning',
+        2: 'danger'
+      }
+      return typeMap[status] || 'info'
+    },
 
-.other-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-  margin-bottom: 20px;
+    // 查看调用日志详情
+    async handleCallLogDetail(row) {
+      try {
+        const res = await getCallLog(row.id)
+        this.callLogDetailData = res.data
+        this.callLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取调用日志详情失败')
+      }
+    },
+
+    // 查看事件日志详情
+    async handleEventLogDetail(row) {
+      try {
+        const res = await getEventLog(row.id)
+        this.eventLogDetailData = res.data
+        this.eventLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取事件日志详情失败')
+      }
+    }
+  }
 }
+</script>
 
-.table-content {
-  background-color: #ffffff; /* 白色背景 */
+<style lang="scss" scoped>
+.app-container {
   padding: 20px;
+  background: #f5f7fa;
+  min-height: calc(100vh - 84px);
 }
 
-.pagination-container {
+.system-info-card {
   margin-bottom: 20px;
-}
 
-.button-group-container {
-  display: flex;
-  justify-content: flex-end;
-  min-width: 200px;
-  padding: 5px;
-}
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
 
-.device-list {
-  margin-top: 20px;
-}
+    .title {
+      font-size: 18px;
+      font-weight: bold;
 
-.device-card {
-  background-color: #fff;
-  border: 1px solid #bfcbd9;
-  border-radius: 4px;
-  overflow: hidden;
-  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  transition: 0.3s;
-  padding: 10px;
-  font-size: 14px;
-  height: 200px;
-  margin-bottom: 20px;
-  display: flex;
-  flex-direction: column;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
+  }
 
-.device-header {
-  //background-color: #f2f2f5;
-  //padding: 10px;
-  color: #545353;
-  font-size: 20px;
-  font-weight: bold;
-}
+  .info-group {
+    .group-title {
+      font-size: 14px;
+      font-weight: bold;
+      color: #606266;
+      margin-bottom: 12px;
+      padding-bottom: 6px;
+      border-bottom: 1px solid #EBEEF5;
+    }
+  }
 
-.device-code {
-  color: cornflowerblue;
-}
+  .info-item {
+    margin-bottom: 12px;
+    font-size: 14px;
 
-.deviceOthers {
-  color: black;
-}
+    label {
+      color: #909399;
+      margin-right: 8px;
+      display: inline-block;
+      min-width: 80px;
+    }
 
-.device-body {
-  padding: 10px;
-  color: #666666;
-  flex: 1; /* 使设备主体内容占据剩余空间 */
-  overflow-y: auto; /* 如果内容过多,允许滚动 */
-}
+    .code {
+      font-family: monospace;
+      color: #409EFF;
+      background: #f0f9ff;
+      padding: 2px 6px;
+      border-radius: 3px;
+    }
 
-.device-footer {
-  display: flex;
-  justify-content: space-between;
-  padding: 5px;
-  // background-color: #f9f9f9;
+    .stat-number {
+      color: #409EFF;
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
 }
 
-.device-footer .el-button {
-  padding: 5px 15px;
-  border: none; /* 移除默认边框 */
-  color: #5a5e66;
-  transition: background-color 0.3s; /* 平滑过渡背景色变化 */
-}
+.detail-card {
+  .tab-content {
+    min-height: 400px;
+  }
 
-/* 为按钮分配不同的颜色 */
-.device-footer .el-button:first-child {
-  background-color: #d5f1d5; /* 淡绿色 */
-  border: 1px solid lightgreen;
-  color: #71e2aa;
+  .attr-section {
+    margin-bottom: 30px;
 
-}
+    .section-title {
+      margin: 20px 0 15px 0;
+      color: #303133;
 
-.device-footer .el-button:nth-child(2) {
-  background-color: #ffe5b4; /* 淡橙色 */
-  border: 1px solid #ffba00;
-  color: #faad14;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
 
-.device-footer .el-button:last-child {
-  background-color: #ffd5d5; /* 淡红色 */
-  border: 1px solid lightpink;
-  color: #f5222d;
-}
+    .url-text {
+      color: #409EFF;
+      font-family: monospace;
+    }
+  }
 
-/* 鼠标悬停时加深颜色 */
-.device-footer .el-button:hover {
-  filter: brightness(0.5); /* 颜色加深效果 */
-}
+  .device-stats {
+    margin-bottom: 20px;
+
+    .stat-item {
+      text-align: center;
+      padding: 20px;
+      background: #fff;
+      border: 1px solid #EBEEF5;
+      border-radius: 4px;
+
+      .stat-value {
+        font-size: 28px;
+        font-weight: bold;
+        color: #303133;
+        margin-bottom: 8px;
+      }
+
+      .stat-label {
+        font-size: 14px;
+        color: #909399;
+      }
+
+      &.online .stat-value {
+        color: #67C23A;
+      }
+
+      &.offline .stat-value {
+        color: #F56C6C;
+      }
+    }
+  }
 
-/* 背景色样式 */
-.north {
-  background: linear-gradient(to right, #e1f3d8, #fafafa);
+  .device-detail {
+    padding: 20px;
+    background: #f5f7fa;
+
+    h5 {
+      margin: 15px 0 10px 0;
+      color: #303133;
+    }
+  }
+
+  .log-filter {
+    margin-bottom: 20px;
+    padding: 15px;
+    background: #f5f7fa;
+    border-radius: 4px;
+  }
 }
 
-.south {
-  background: linear-gradient(to right, #fff7e8, #fafafa);
+.execute-result {
+  .result-data {
+    margin-top: 20px;
+
+    pre {
+      background: #f5f7fa;
+      padding: 15px;
+      border-radius: 4px;
+      overflow: auto;
+      max-height: 400px;
+      font-family: monospace;
+      font-size: 12px;
+    }
+  }
 }
 
-.main {
-  background: linear-gradient(to right, #e0e0e0, #fafafa);
+.dialog-footer {
+  text-align: right;
 }
 
+::v-deep .el-dropdown-menu {
+  .el-submenu__title {
+    padding-right: 40px !important;
 
-.el-table {
-  background-color: #ffffff; /* 白色背景 */
-}
+    &:hover {
+      background-color: #f5f7fa;
+    }
+  }
 
-.el-card {
-  background-color: #ffffff; /* 白色背景 */
+  .el-submenu__icon-arrow {
+    position: absolute;
+    right: 20px;
+  }
 }
 </style>

File diff suppressed because it is too large
+ 1918 - 546
ems-ui-cloud/src/views/adapter/devc/index.vue


+ 1392 - 1112
ems-ui-cloud/src/views/adapter/gcc/index.vue

@@ -1,1261 +1,1541 @@
 <template>
   <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="4" :xs="24">
-        <div class="head-container">
-          <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-                    style="margin-bottom: 20px"
-          />
-        </div>
-        <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
-          <el-tree :data="treeAreaOptions" :props="defaultProps" :expand-on-click-node="false"
-                   :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-                   @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"
-          />
-        </div>
-      </el-col>
-      <el-col :span="20" :xs="24">
-        <div class="contents">
-          <div class="other-content">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
-                     label-width="68px"
-            >
-              <el-form-item label="设备分类" prop="deviceSubCategory">
-                <el-select v-model="queryParams.deviceSubCategory">
-                  <el-option v-for="item in subCategoryOptions" placeholder="设备分类" :label="item.name"
-                             :value="item.code"
-                             :key="item.code"
-                  />
-                </el-select>
+    <!-- 系统基础信息卡片 - 添加编辑按钮 -->
+    <el-card class="system-info-card">
+      <div slot="header" class="card-header">
+        <span class="title">
+          <i class="el-icon-s-platform"></i>
+          光储充监测
+        </span>
+        <el-tag :type="systemStatus === '1' ? 'success' : 'danger'" effect="dark">
+          {{ systemStatus === '1' ? '正常' : '异常' }}
+        </el-tag>
+      </div>
+
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">系统信息</div>
+            <div class="info-item">
+              <label>系统代码:</label>
+              <span class="code">{{ systemInfo.systemCode }}</span>
+            </div>
+            <div class="info-item">
+              <label>系统名称:</label>
+              <span>{{ systemInfo.systemName }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">厂商信息</div>
+            <div class="info-item">
+              <label>对接厂商:</label>
+              <span>{{ systemInfo.manFacturer || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系人:</label>
+              <span>{{ systemInfo.contactPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系电话:</label>
+              <span>{{ systemInfo.contactNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">维护信息</div>
+            <div class="info-item">
+              <label>维护人:</label>
+              <span>{{ systemInfo.maintainerPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>维护电话:</label>
+              <span>{{ systemInfo.maintainerNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">设备统计</div>
+            <div class="info-item">
+              <label>设备总数:</label>
+              <span class="stat-number">{{ deviceStats.total }}</span>
+            </div>
+            <div class="info-item">
+              <label>在线设备:</label>
+              <span class="stat-number">{{ deviceStats.online }}</span>
+            </div>
+            <div class="info-item">
+              <label>测点总数:</label>
+              <span class="stat-number">{{ deviceStats.points }}</span>
+            </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEdit"
+                v-hasPermi="['ems:subsystem:edit']">
+                编辑
+              </el-button>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <!-- 系统详情标签页 -->
+    <el-card class="detail-card">
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+        <!-- 系统属性标签页 -->
+        <el-tab-pane label="系统属性" name="attributes">
+          <div class="tab-content">
+            <!-- 协议属性 -->
+            <div class="attr-section" v-if="protocolAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-connection"></i>
+                协议信息
+              </h4>
+              <el-table :data="protocolAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.attrKey === 'url'" class="url-text">
+                      {{ scope.row.attrValue }}
+                    </span>
+                    <span v-else>{{ scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+
+            <!-- 状态属性 -->
+            <div class="attr-section" v-if="stateAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-info"></i>
+                状态信息
+              </h4>
+              <el-table :data="stateAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <el-tag v-if="scope.row.attrKey === 'interfaceStatus'"
+                            :type="scope.row.attrValue === '1' ? 'success' : 'danger'">
+                      {{ scope.row.attrValueName }}
+                    </el-tag>
+                    <span v-else>{{ scope.row.attrValueName || scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="updateTime" label="更新时间" width="180"></el-table-column>
+              </el-table>
+            </div>
+          </div>
+        </el-tab-pane>
+
+        <!-- 系统能力标签页 -->
+        <el-tab-pane label="系统能力" name="abilities">
+          <div class="tab-content">
+            <el-table :data="systemAbilities" border stripe v-loading="abilityLoading">
+              <el-table-column prop="abilityName" label="能力名称" width="200"></el-table-column>
+              <el-table-column prop="abilityKey" label="能力标识" width="180"></el-table-column>
+              <el-table-column prop="abilityDesc" label="能力描述"></el-table-column>
+              <el-table-column label="操作" width="200" align="center">
+                <template slot-scope="scope">
+                  <div v-if="getParamType(scope.row.paramDefinition) === 'Options'" style="display: inline-block;">
+                    <el-button-group>
+                      <el-button
+                        v-for="option in parseOptions(scope.row.paramDefinition)"
+                        :key="option.value"
+                        size="mini"
+                        type="primary"
+                        @click="executeSystemAbilityWithParam(scope.row, option.value)"
+                        :loading="scope.row.executing && scope.row.executingValue === option.value">
+                        {{ option.key }}
+                      </el-button>
+                    </el-button-group>
+                  </div>
+                  <el-button
+                    v-else
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-caret-right"
+                    @click="handleSystemAbilityClick(scope.row)"
+                    :loading="scope.row.executing">
+                    执行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 关联设备标签页 -->
+        <el-tab-pane label="关联设备" name="devices">
+          <div class="tab-content">
+            <!-- 设备统计 -->
+            <div class="device-stats">
+              <el-row :gutter="20">
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.total }}</div>
+                    <div class="stat-label">设备总数</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item online">
+                    <div class="stat-value">{{ deviceStats.online }}</div>
+                    <div class="stat-label">在线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item offline">
+                    <div class="stat-value">{{ deviceStats.offline }}</div>
+                    <div class="stat-label">离线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.points }}</div>
+                    <div class="stat-label">测点总数</div>
+                  </div>
+                </el-col>
+              </el-row>
+            </div>
+
+            <!-- 设备列表 -->
+            <el-table
+              :data="deviceList"
+              border
+              stripe
+              v-loading="deviceLoading"
+              @row-click="handleDeviceClick"
+              ref="deviceTable">
+              <el-table-column type="expand">
+                <template slot-scope="props">
+                  <div class="device-detail">
+                    <el-tabs v-model="props.row.detailTab">
+                      <el-tab-pane label="设备属性" name="attrs">
+                        <el-descriptions :column="2" border size="small">
+                          <el-descriptions-item label="IP地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'ip') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="网关地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'gateway') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="子网掩码">
+                            {{ getDeviceAttr(props.row.deviceCode, 'subnetMask') }}
+                          </el-descriptions-item>
+                        </el-descriptions>
+                      </el-tab-pane>
+                      <el-tab-pane label="测点信息" name="points">
+                        <div v-for="(channel, idx) in getDeviceChannels(props.row.deviceCode)" :key="idx">
+                          <h5>{{ channel.name }} ({{ channel.points.length }}个测点)</h5>
+                          <el-table :data="channel.points" size="mini" max-height="200">
+                            <el-table-column prop="name" label="测点名称"></el-table-column>
+                            <el-table-column prop="key" label="测点标识"></el-table-column>
+                            <el-table-column prop="value" label="当前值">
+                              <template slot-scope="scope">
+                                {{ scope.row.value || '-' }}
+                              </template>
+                            </el-table-column>
+                            <el-table-column prop="updateTime" label="更新时间"></el-table-column>
+                          </el-table>
+                        </div>
+                      </el-tab-pane>
+                    </el-tabs>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="deviceCode" label="设备代码" width="150"></el-table-column>
+              <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+              <el-table-column prop="location" label="安装位置"></el-table-column>
+              <el-table-column prop="areaCode" label="区域" width="150">
+                <template slot-scope="scope">
+                  {{ scope.row.areaCode.includes('3001') ? '北区' : '南区' }}
+                </template>
+              </el-table-column>
+              <el-table-column label="设备状态" width="100" align="center">
+                <template slot-scope="scope">
+                  <el-tag :type="scope.row.deviceStatus === 1 ? 'success' : 'info'">
+                    {{ scope.row.deviceStatus === 1 ? '在线' : '离线' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="120" align="center">
+                <template slot-scope="scope">
+                  <el-dropdown
+                    trigger="click"
+                    @command="handleDeviceCommand"
+                    @visible-change="(visible) => handleAbilityLoad(visible, scope.row)">
+                    <el-button type="text" size="mini">
+                      操作<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                      <template v-if="deviceAbilities[scope.row.deviceCode] && deviceAbilities[scope.row.deviceCode].length > 0">
+                        <template v-for="ability in deviceAbilities[scope.row.deviceCode]">
+                          <el-submenu
+                            v-if="getParamType(ability.paramDefinition) === 'Options'"
+                            :key="ability.abilityKey"
+                            :index="ability.abilityKey">
+                            <template slot="title">
+                              {{ ability.abilityName }}
+                              <i class="el-icon-arrow-right" style="float: right;"></i>
+                            </template>
+                            <el-dropdown-item
+                              v-for="option in parseOptions(ability.paramDefinition)"
+                              :key="option.value"
+                              :command="{device: scope.row, ability: ability, paramValue: option.value}">
+                              {{ option.key }}
+                            </el-dropdown-item>
+                          </el-submenu>
+                          <el-dropdown-item
+                            v-else
+                            :key="ability.abilityKey"
+                            :command="{device: scope.row, ability: ability}">
+                            {{ ability.abilityName }}
+                          </el-dropdown-item>
+                        </template>
+                      </template>
+                      <el-dropdown-item v-else disabled>
+                        无可用操作
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 调用日志标签页 -->
+        <el-tab-pane label="调用日志" name="callLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="callLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="callLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
               </el-form-item>
-              <el-form-item label="归属设施" prop="refFacs">
-                <el-select v-model="queryParams.refFacs">
-                  <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                             :key="item.facsCode"
-                  />
-                </el-select>
+              <el-form-item label="能力标识">
+                <el-input v-model="callLogQuery.abilityKey" placeholder="请输入能力标识" clearable></el-input>
               </el-form-item>
-              <el-form-item label="子系统" prop="subsystemCode">
-                <el-select v-model="queryParams.subsystemCode">
-                  <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                             :key="item.systemCode"
-                  />
+              <el-form-item label="调用状态">
+                <el-select v-model="callLogQuery.callStatus" placeholder="全部" clearable>
+                  <el-option label="成功" :value="0"></el-option>
+                  <el-option label="进行中" :value="1"></el-option>
+                  <el-option label="失败" :value="2"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item>
-                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                <el-button type="primary" @click="queryCallLogs">查询</el-button>
+                <el-button @click="resetCallLogQuery">重置</el-button>
               </el-form-item>
             </el-form>
 
-            <el-row :gutter="10" class="mb8">
-              <el-col :span="1.5">
-                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-                           v-hasPermi="['ems:device:add']"
-                >新增
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-                           v-hasPermi="['ems:device:edit']"
-                >修改
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
-                           @click="handleDelete"
-                           v-hasPermi="['ems:device:remove']"
-                >删除
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-                           v-hasPermi="['ems:device:export']"
-                >导出
-                </el-button>
-              </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-            </el-row>
-          </div>
-
-          <div class="table-content">
-            <!--分页-->
-            <div class="button-group-container">
-              <el-button-group>
-                <el-button :type="primary1" icon="el-icon-s-fold" @click="switchData(1)"/>
-                <el-button :type="primary2" icon="el-icon-menu" @click="switchData(2)"/>
-              </el-button-group>
-            </div>
-
-            <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"
-                      v-if="istable === 1">
-              <el-table-column type="selection" width="55" align="center"/>
-              <el-table-column label="设备名称" align="left" prop="deviceName"/>
-              <el-table-column label="安装位置" align="left" prop="areaPath" width="220px"/>
-              <el-table-column label="归属设施" align="center" prop="refFacsName"/>
-              <el-table-column label="设备分类" align="center" prop="deviceCategoryName"/>
-              <el-table-column label="子系统" align="center" prop="subsystemName"/>
-              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <el-table :data="callLogList" border stripe v-loading="logLoading">
+              <el-table-column prop="objCode" label="对象代码" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="abilityName" label="能力名称" min-width="150"></el-table-column>
+              <el-table-column prop="callTime" label="调用时间" width="180"></el-table-column>
+              <el-table-column label="调用状态" width="100" align="center">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDevProcess(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']" v-if="shouldShowDevProcessButton(scope.row)"
-                  >
-                    器件
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    详情
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    修改
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                             @click="handleDelete(scope.row)" v-hasPermi="['basecfg:device:remove']"
-                  >
-                    删除
-                  </el-button>
-
+                  <el-tag size="small" :type="getCallStatusType(scope.row.callStatus)">
+                    {{ formatCallStatus(scope.row.callStatus) }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleCallLogDetail(scope.row)">详情</el-button>
                 </template>
               </el-table-column>
             </el-table>
 
-            <div v-else-if="istable === 2">
-              <el-row :gutter="20" class="device-list">
-                <el-col v-for="device in deviceList" :key="device.id" :span="6">
-                  <div :class="`device-card ${backStyle(device.areaPath)}`">
-                    <div class="device-header">
-                      <i class="el-icon-s-operation" style="margin-right: 8px;"></i>
-                      {{ device.deviceName }}
-                    </div>
-                    <div class="device-body">
-                      <p>设备代码:<span class="device-code">{{ device.deviceCode }}</span></p>
-                      <p>安装位置:<span class="deviceOthers">{{ device.areaPath }}</span></p>
-                      <p>归属设施:<span class="deviceOthers">{{ device.refFacsName }}</span></p>
-                      <p>设备分类:<span class="deviceOthers">{{ device.deviceCategoryName }}</span></p>
-                      <p>子系统:<span class="deviceOthers">{{ device.subsystemName }}</span></p>
-                    </div>
-                    <div class="device-footer">
-                      <el-button size="mini" plain icon=" el-icon-document" @click="handleDetail(device)">详情
-                      </el-button>
-                      <el-button size="mini" plain icon="el-icon-edit" @click="handleUpdate(device)">修改</el-button>
-                      <el-button size="mini" plain icon="el-icon-delete" type="danger" @click="handleDelete(device)">
-                        删除
-                      </el-button>
-                    </div>
-                  </div>
-                </el-col>
-              </el-row>
-            </div>
+            <pagination
+              v-show="callLogTotal > 0"
+              :total="callLogTotal"
+              :page.sync="callLogQuery.pageNum"
+              :limit.sync="callLogQuery.pageSize"
+              @pagination="queryCallLogs"
+            />
+          </div>
+        </el-tab-pane>
+
+        <!-- 事件日志标签页 -->
+        <el-tab-pane label="事件日志" name="eventLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="eventLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="eventLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
+              </el-form-item>
+              <el-form-item label="事件标识">
+                <el-input v-model="eventLogQuery.eventKey" placeholder="请输入事件标识" clearable></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="queryEventLogs">查询</el-button>
+                <el-button @click="resetEventLogQuery">重置</el-button>
+              </el-form-item>
+            </el-form>
 
+            <el-table :data="eventLogList" border stripe v-loading="eventLogLoading">
+              <el-table-column prop="objCode" label="对象编号" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventName" label="事件名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventTime" label="事件时间" width="180"></el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleEventLogDetail(scope.row)">详情</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
 
-            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-                        :limit.sync="queryParams.pageSize"
-                        @pagination="getList"
+            <pagination
+              v-show="eventLogTotal > 0"
+              :total="eventLogTotal"
+              :page.sync="eventLogQuery.pageNum"
+              :limit.sync="eventLogQuery.pageSize"
+              @pagination="queryEventLogs"
             />
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </el-card>
+
+    <!-- 修改系统信息对话框 -->
+    <el-dialog title="修改系统信息" :visible.sync="editDialogVisible" width="500px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="厂商" prop="manFacturer">
+          <el-input v-model="editForm.manFacturer" placeholder="请输入厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editForm.descr" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelEdit">取 消</el-button>
+        <el-button type="primary" @click="submitEdit" :loading="editLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 执行结果对话框 -->
+    <el-dialog
+      :title="executeDialog.title"
+      :visible.sync="executeDialog.visible"
+      width="600px">
+      <div class="execute-result">
+        <el-alert
+          :title="executeDialog.status"
+          :type="executeDialog.type"
+          :description="executeDialog.message"
+          show-icon>
+        </el-alert>
+        <div v-if="executeDialog.data" class="result-data">
+          <pre>{{ JSON.stringify(executeDialog.data, null, 2) }}</pre>
+        </div>
+      </div>
+      <span slot="footer">
+        <el-button @click="executeDialog.visible = false">关闭</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 调用日志详情弹窗 -->
+    <el-dialog :visible.sync="callLogDetailDialog" title="调用日志详情" width="60%">
+      <div v-if="callLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象代码">{{ callLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="模型代码">{{ callLogDetailData.modelCode }}</el-descriptions-item>
+          <el-descriptions-item label="能力标识">{{ callLogDetailData.abilityKey }}</el-descriptions-item>
+          <el-descriptions-item label="调用时间">{{ callLogDetailData.callTime }}</el-descriptions-item>
+          <el-descriptions-item label="响应时间">{{ callLogDetailData.resTime }}</el-descriptions-item>
+          <el-descriptions-item label="调用结果">
+            <el-tag :type="getCallStatusType(callLogDetailData.callStatus)">
+              {{ formatCallStatus(callLogDetailData.callStatus) }}
+            </el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>调用载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.callPayload }}</pre>
+        </div>
 
-            <!-- 添加或修改能源设备对话框 -->
-            <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-              <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-                <el-form-item label="归属设施" prop="refFacs">
-                  <el-select v-model="form.refFacs">
-                    <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                               :key="item.facsCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备代码" prop="deviceCode">
-                  <el-input v-model="form.deviceCode" placeholder="请输入设备代码"/>
-                </el-form-item>
-                <el-form-item label="设备名称" prop="deviceName">
-                  <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
-                </el-form-item>
-
-
-                <el-form-item label="功能类型" prop="psCode" v-if="queryParams.deviceCategory === 'W'">
-                  <el-select v-model="form.psCode">
-                    <el-option v-for="item in devOptions" :label="item.psName" :value="item.psCode"
-                               :key="item.psCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备类型" prop="deviceType">
-                  <el-select v-model="form.deviceCategory">
-                    <el-option v-for="item in subCategoryOptions" :label="item.name" :value="item.code"
-                               :key="item.code"
-                    />
-                  </el-select>
-                </el-form-item>
-                <el-form-item label="设备模型" prop="deviceModel">
-                  <el-select v-model="form.deviceModel" style="width:100%" @change="handleModelChange">
-                    <el-option
-                      v-for="item in modelList"
-                      :label="item.modelName"
-                      :value="item.modelCode"
-                      :key="item.modelCode"
-                    />
-                  </el-select>
-                </el-form-item>
-                <!-- 这里可以展示属性名称和属性值 -->
-                <div v-if="attrList.length > 0" class="attr-list-container">
-                  <h3>模型属性:</h3>
-                  <ul>
-                    <li v-for="attr in attrList" :key="attr.attrKey" class="attr-item">
-                      <span class="attr-name">{{ attr.attrName }} ({{ attr.attrUnit }}):</span>
-                      <!-- 使用 el-input 组件允许用户编辑属性值 -->
-                      <el-input
-                        v-model="attrValuesMap[attr.attrKey]"
-                        placeholder="点击编辑"
-                        size="small"
-                        @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])"
-                      >
-                      </el-input>
-                    </li>
-                  </ul>
-                </div>
-                <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
-                  <el-form-item label="" prop="attrList">
-                    <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px"
-                              key="'customAttrs'"
-                    >
-                      <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="attrName">
-                        <template slot-scope="scope">
-                          <el-input size="mini" v-model="scope.row.attrName" 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="请输入属性值"/>
-                        </template>
-                      </el-table-column>
-                      <el-table-column align="center" label="操作">
-                        <template slot="header">
-                          <div class="operateBtns" @click="addCustomAttr">
-                            <span>添加</span><i class="el-icon-circle-plus-outline"></i>
-                          </div>
-                        </template>
-                        <template slot-scope="scope">
-                          <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
-                        </template>
-                      </el-table-column>
-                    </el-table>
-                  </el-form-item>
-                </h3>
-                <el-form-item label="子系统" prop="subsystemCode">
-                  <el-select v-model="form.subsystemCode">
-                    <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                               :key="item.systemCode"
-                    />
-                  </el-select>
-                </el-form-item>
-              </el-form>
-              <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="submitForm">确 定</el-button>
-                <el-button @click="cancel">取 消</el-button>
+        <div style="margin-top: 20px;">
+          <h4>响应载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.resPayload }}</pre>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 事件日志详情弹窗 -->
+    <el-dialog :visible.sync="eventLogDetailDialog" title="事件日志详情" width="60%">
+      <div v-if="eventLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象编号">{{ eventLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="对象名称">{{ eventLogDetailData.objName }}</el-descriptions-item>
+          <el-descriptions-item label="事件名称">{{ eventLogDetailData.eventName }}</el-descriptions-item>
+          <el-descriptions-item label="事件标识">{{ eventLogDetailData.eventKey }}</el-descriptions-item>
+          <el-descriptions-item label="事件时间" :span="2">{{ eventLogDetailData.eventTime }}</el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>事件描述</h4>
+          <div style="background-color: #f5f5f5; padding: 10px; border-radius: 4px;">
+            {{ eventLogDetailData.eventDetail || '无' }}
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 能力执行弹窗(支持Slider和Input类型) -->
+    <el-dialog :title="abilityDialogTitle" :visible.sync="abilityDialogVisible" width="500px" append-to-body :close-on-click-modal="false">
+      <el-form ref="abilityForm" :model="abilityForm" label-width="100px">
+        <el-form-item label="能力名称">
+          <el-input v-model="abilityForm.abilityName" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="能力描述">
+          <el-input type="textarea" v-model="abilityForm.abilityDesc" disabled :rows="2"></el-input>
+        </el-form-item>
+
+        <el-form-item label="参数设置" v-if="abilityParamType">
+          <template v-if="abilityParamType === 'Slider'">
+            <div style="width: 100%;">
+              <div style="padding: 0 10px;">
+                <el-slider
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :show-tooltip="true"
+                  :format-tooltip="formatTooltip">
+                </el-slider>
               </div>
-            </el-dialog>
-
-            <!--设备器件-->
-            <el-drawer :title=ComponentRow.deviceName size="80%" :visible.sync="showDevProcessDrawer" direction="rtl">
-              <div class="drawer-content" style="padding-left:50px">
-                <el-row :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleComponentAdd"
-                               v-hasPermi="['ems:component:add']"
-                    >新增
-                    </el-button>
-                  </el-col>
-                </el-row>
-                <el-table v-loading="loading" :data="ComponentList">
-                  <el-table-column type="selection" width="55" align="center"/>
-                  <el-table-column label="部件编码" align="center" prop="compoCode"/>
-                  <el-table-column label="部件标签" align="center" prop="compoTag">
-                    <template slot-scope="scope">
-                      {{ objComTypeMapping[scope.row.compoTag] }}
-                    </template>
-                  </el-table-column>
-                  <el-table-column label="工艺标识代码" align="center" prop="psCode"/>
-                  <el-table-column label="外系统部件编码" align="center" prop="extCompoCode"/>
-                  <el-table-column label="部件模型" align="center" prop="compoModel"/>
-                  <el-table-column label="部件品牌" align="center" prop="compoBrand"/>
-                  <el-table-column label="部件型号" align="center" prop="compoSpec"/>
-                  <el-table-column label="祖籍列表" align="center" prop="ancestors"/>
-                  <el-table-column label="上级部件" align="center" prop="parentEqpt"/>
-
-                  <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-edit" @click="handleComponentUpdate(scope.row)"
-                                 v-hasPermi="['ems:component:edit']"
-                      >
-                        修改
-                      </el-button>
-                      <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                                 @click="handleComponentDelete(scope.row)" v-hasPermi="['ems:component:remove']"
-                      >
-                        删除
-                      </el-button>
-                    </template>
-                  </el-table-column>
-                </el-table>
-                <pagination v-show="total>0" :total="total" :page.sync="queryComponentParams.pageNum"
-                            :limit.sync="queryComponentParams.pageSize"
-                            @pagination="getComponentList"
-                />
-
-                <!-- 添加或修改设备器件对话框 -->
-                <el-dialog :title="title" :visible.sync="componentOpen" width="500px" append-to-body>
-                  <el-form ref="componentForm" :model="componentForm" :rules="componentRules" label-width="150px">
-                    <!--                <el-form-item label="设备code" prop="deviceCode">-->
-                    <!--                  <el-input v-model="componentForm.deviceCode" placeholder="请输入设备code" />-->
-                    <!--                </el-form-item>-->
-                    <el-form-item label="部件编码" prop="compoCode">
-                      <el-input v-model="componentForm.compoCode" placeholder="请输入部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件标签" prop="compoTag">
-                      <el-select v-model="componentForm.compoTag" placeholder="请输入部件标签">
-                        <el-option v-for="item in objComTypeOptions"
-                                   :label="item.name"
-                                   :value="item.code"
-                                   :key="item.code"
-                        />
-
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="工艺标签代码" prop="psCode">
-                      <el-select v-model="componentForm.psCode" placeholder="请输入工艺标签代码">
-                        <el-option v-for="item in devOptions" :label="item.psCode" :value="item.psCode"
-                                   :key="item.psCode"/>
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="外系统部件编码" prop="extCompoCode">
-                      <el-input v-model="componentForm.extCompoCode" placeholder="请输入外系统部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件模型" prop="compoModel">
-                      <el-select v-model="componentForm.compoModel" placeholder="请输入部件模型">
-                        <el-option v-for="item in this.modelList" :label="item.modelCode" :value="item.modelCode"
-                                   :key="item.modelCode"
-                        />
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="部件品牌" prop="compoBrand">
-                      <el-input v-model="componentForm.compoBrand" placeholder="请输入部件品牌"/>
-                    </el-form-item>
-                    <el-form-item label="部件型号" prop="compoSpec">
-                      <el-input v-model="componentForm.compoSpec" placeholder="请输入部件型号"/>
-                    </el-form-item>
-                    <el-form-item label="祖籍列表" prop="ancestors">
-                      <el-input v-model="componentForm.ancestors" placeholder="请输入祖籍列表"/>
-                    </el-form-item>
-                    <el-form-item label="上级列表" prop="parentCompo">
-                      <el-input v-model="componentForm.parentCompo" placeholder="请输入上级列表"/>
-                    </el-form-item>
-
-                  </el-form>
-                  <div slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="submitComponentForm">确 定</el-button>
-                    <el-button @click="ComponentCancel">取 消</el-button>
-                  </div>
-                </el-dialog>
+
+              <div style="display: flex; justify-content: space-between; padding: 0 10px; margin-top: -5px; margin-bottom: 20px;">
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMin }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ Math.floor((abilitySliderMin + abilitySliderMax) / 2) }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMax }}%</span>
               </div>
-            </el-drawer>
-
-            <!-- 详情弹框 -->
-            <el-dialog :visible.sync="showDrawer" title="设备详情">
-              <div v-if="curRow">
-                <!-- 设备基本信息 -->
-                <el-card class="box-card">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">设备基本信息</span>
-                  </div>
-                  <div>
-                    <p>设备代码:{{ curRow.deviceCode }}</p>
-                    <p>设备名称:{{ curRow.deviceName }}</p>
-                    <p>设备类型:{{ curRow.deviceCategoryName }}</p>
-                    <p>子系统:{{ curRow.subsystemName }}</p>
-                    <p>归属区域:{{ curRow.areaPath }}</p>
-                    <p>归属设施:{{ curRow.refFacsName }}</p>
-                  </div>
-                </el-card>
-                <el-card class="box-card" style="margin-top: 10px">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">状态属性</span>
-                  </div>
-                  <div>
-                    <p v-for="attr in statusAttr" :key="attr.attr">{{ attr.attr }}:{{ attr.attrValue }} {{
-                        attr.attrUnit
-                      }}</p>
-                  </div>
-                </el-card>
-                <!-- 属性信息 -->
-                <el-card class="box-card" v-if="attrData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">属性定义</span>
-                  </div>
-                  <div v-for="(item, index) in attrData" :key="index">
-                    <p>属性名称:{{ item.attrName }}</p>
-                    <p>属性值:{{ item.attrValue }}</p>
-                    <p>属性单位:{{ item.attrUnit }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < attrData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 能力信息 -->
-                <el-card class="box-card" v-if="abilityData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">能力定义</span>
-                  </div>
-                  <div v-for="(item, index) in abilityData" :key="index">
-                    <p>能力名称:{{ item.abilityName }}</p>
-                    <p>能力键:{{ item.abilityKey }}</p>
-                    <p>能力参数:{{ item.abilityParam }}</p>
-                    <p>能力描述:{{ item.abilityDesc }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < abilityData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 事件信息 -->
-                <el-card class="box-card" v-if="eventData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">事件定义</span>
-                  </div>
-                  <div v-for="(item, index) in eventData" :key="index">
-                    <p>事件名称:{{ item.eventKey }}</p>
-                    <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
-                    <p>事件代码:{{ item.eventCode }}</p>
-                    <p>外部事件代码:{{ item.extEventCode }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < eventData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
+
+              <div style="display: flex; align-items: center; gap: 15px;">
+                <el-input-number
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :step="1"
+                  :precision="0"
+                  controls-position="right"
+                  style="flex: 0 0 120px;">
+                </el-input-number>
+                <span style="color: #909399; font-size: 13px;">
+                  调节范围:{{ abilitySliderMin }} - {{ abilitySliderMax }}
+                </span>
               </div>
-            </el-dialog>
-          </div>
-        </div>
-      </el-col>
-    </el-row>
+            </div>
+          </template>
+
+          <template v-else-if="abilityParamType === 'Input'">
+            <el-input
+              v-model="abilityInputValue"
+              placeholder="请输入参数值"
+              clearable>
+            </el-input>
+          </template>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="abilityDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="executeAbilityWithParam" :loading="abilityExecuting">执行</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import {addDevice, delDevice, getDevice, listDevRecursionByArea, updateDevice} from '@/api/device/device'
-import {areaTreeSelect} from '@/api/basecfg/area'
-import {getFacsCategorygetByCode, listAllFacs} from '@/api/basecfg/emsfacs'
-import {listSubsystemAll} from '@/api/adapter/subsystem'
-import {getModelByCode, listAllModel} from '@/api/basecfg/objModel'
-import {getObjAttr} from '@/api/basecfg/objAttribute'
-import {addAttrValueBatch} from '@/api/basecfg/objAttributeValue'
-import {addComponent, delComponent, getComponent, listByDevice, updateComponent} from '@/api/basecfg/component'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
+import { getModelByCode } from '@/api/basecfg/objModel'
+import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
+import { listcallAbility } from '@/api/basecfg/objAbility'
+import { getByCondition } from '@/api/device/device'
+import { listCallLog, listEventLog, getCallLog, getEventLog } from '@/api/basecfg/objLog'
 
 export default {
-  name: 'Device',
-  components: {Treeselect},
+  name: 'SubsystemIntegration',
   data() {
     return {
-      primary1: 'primary',
-      primary2: '',
-      ComponentRow: [],
-      componentForm: {},
-      subcategoryCode: '',
-      attrList: [], // 属性模板数组
-      attrValues: [],
-      ComponentList: [],
-      attrValuesMap: {},
-      modelList: [],
-      showDrawer: false,
-      showDevProcessDrawer: false,
-      componentOpen: false,
-      istable: 2,
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 能源设备表格数据
+      // 系统代码
+      systemCode: 'SYS_GCC',
+      // 系统信息
+      systemInfo: {},
+      // 系统状态
+      systemStatus: '1',
+      // 当前标签页
+      activeTab: 'attributes',
+      // 协议属性
+      protocolAttrs: [],
+      // 状态属性
+      stateAttrs: [],
+      // 系统能力
+      systemAbilities: [],
+      abilityLoading: false,
+      // 设备列表
       deviceList: [],
-      // 弹出层标题
-      title: '',
-      // 是否显示弹出层
-      open: false,
-      // 区域名称
-      areaName: undefined,
-      // 区域树选项
-      treeAreaOptions: undefined,
-      totalAreaOptions: undefined,
-      // 设施选项
-      facsOptions: undefined,
-      // 设备分类
-      subCategoryOptions: undefined,
-      subsystemOptions: undefined,
-      devOptions: undefined,
-      statusAttr: [{
-        attr: '发电量',
-        attrUnit: 'kW·h',
-        attrValue: '20'
-      },
-        {
-          attr: '储电量',
-          attrUnit: 'kW·h',
-          attrValue: '10'
-        },
-        {
-          attr: '发电总量',
-          attrUnit: 'kW·h',
-          attrValue: '200'
-        },
-        {
-          attr: '运行状态',
-          attrUnit: '',
-          attrValue: '工作中'
-        }
-      ],
-      defaultProps: {
-        children: 'children',
-        label: 'label'
+      deviceLoading: false,
+      deviceAttrs: {},
+      deviceChannels: {},
+      // 设备能力缓存
+      deviceAbilities: {},
+      // 设备统计
+      deviceStats: {
+        total: 0,
+        online: 0,
+        offline: 0,
+        points: 0
       },
-      // 查询参数
-      queryParams: {
-        psCode: null,
+      // 所有模型代码(系统 + 设备)
+      allModelCodes: [],
+      // 调用日志查询
+      callLogQuery: {
+        dateRange: [],
+        abilityKey: '',
+        callStatus: '',
         pageNum: 1,
-        pageSize: 10,
-        deviceCode: null,
-        deviceSubCategory: '',
-        deviceCategory: 'E',
-        locationType: null,
-        locationRef: null,
-        refFacs: null,
-        customAttrs: null
+        pageSize: 10
       },
-      queryComponentParams: {
+      callLogList: [],
+      callLogTotal: 0,
+      logLoading: false,
+      // 事件日志查询
+      eventLogQuery: {
+        dateRange: [],
+        eventKey: '',
         pageNum: 1,
         pageSize: 10
       },
-      objComTypeMapping: {
-        1: '总开',
-        2: '照明',
-        3: '风机'
-      },
-      objComTypeOptions: [
-        {code: 1, name: '总开'},
-        {code: 2, name: '照明'},
-        {code: 3, name: '风机'}
-
-      ],
-      curRow: {},
-      attrData: [],
-      abilityData: [],
-      eventData: [],
-
-      // 表单参数
-      form: {
-        customAttrs: [] // 自定义属性数组
+      eventLogList: [],
+      eventLogTotal: 0,
+      eventLogLoading: false,
+      // 调用日志详情
+      callLogDetailDialog: false,
+      callLogDetailData: null,
+      // 事件日志详情
+      eventLogDetailDialog: false,
+      eventLogDetailData: null,
+      // 执行结果对话框
+      executeDialog: {
+        visible: false,
+        title: '',
+        status: '',
+        type: 'success',
+        message: '',
+        data: null
       },
-      // 表单校验
-      rules: {
-        refFacs: [
-          {required: true, message: '归属设施', trigger: 'blur'}
-        ],
-        refArea: [
-          {required: true, message: '安装位置', trigger: 'blur'}
-        ],
-        deviceCode: [
-          {required: true, message: '设备代码不能为空', trigger: 'blur'}
-        ],
-        deviceName: [
-          {required: true, message: '设备名称不能为空', trigger: 'blur'}
-        ]
+      // 能力执行相关
+      abilityDialogVisible: false,
+      abilityDialogTitle: '能力执行',
+      abilityForm: {
+        abilityName: '',
+        abilityKey: '',
+        abilityDesc: '',
+        paramDefinition: null,
+        modelCode: ''
       },
-      componentRules: {
-        deviceCode: [
-          {required: true, message: '设备code不能为空', trigger: 'blur'}
-        ],
-        compoCode: [
-          {required: true, message: '部件编码不能为空', trigger: 'blur'}
+      abilityParamType: null,
+      abilitySliderValue: 50,
+      abilitySliderMin: 0,
+      abilitySliderMax: 100,
+      abilityInputValue: '',
+      abilityExecuting: false,
+      currentDevice: null,
+      currentObjType: null,
+      // 编辑系统信息相关
+      editDialogVisible: false,
+      editLoading: false,
+      editForm: {},
+      editRules: {
+        systemCode: [
+          { required: true, message: "系统代码不能为空", trigger: "blur" }
         ],
-        psCode: [
-          {required: true, message: '工艺标签代码不能为空', trigger: 'blur'}
+        systemName: [
+          { required: true, message: "系统名称不能为空", trigger: "blur" }
         ]
       }
     }
   },
-  watch: {
-    // 根据名称筛选区域树
-    areaName(val) {
-      this.$refs.tree.filter(val)
-    }
-  },
   created() {
-    this.queryParams.deviceCategory = 'GCC'; // 确保初始加载时就设置为 'GCZR'
-    this.getList()
-    this.getAreaTree('0', 1)
-    this.getFacsOptions()
-    this.getSubsystem()
-    this.getSubCategorygetByCode()
-    this.getFacsModel()
-    // this.getAllDevProcess(this.subcategoryCode)
+    this.loadSystemInfo()
+    this.initDateRange()
   },
   methods: {
-    /**分页切换*/
-    switchData(v) {
-      if (v === 1) {
-        this.primary1 = "primary";
-        this.primary2 = "";
-      } else {
-        this.primary1 = "";
-        this.primary2 = "primary";
-      }
-      this.istable = v;
-    },
-    /** 查询能源设备列表 */
-    getList() {
-      this.loading = true
-      listDevRecursionByArea(this.queryParams).then(response => {
-        console.log('参数', JSON.stringify(this.queryParams))
-        this.deviceList = response.rows
-        this.total = response.total
-        this.loading = false
+    // 打开编辑对话框
+    handleEdit() {
+      this.editForm = { ...this.systemInfo }
+      this.editDialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.editForm?.clearValidate()
       })
     },
-    /**新增、修改、删除*/
-    handleComponentAdd() {
-      this.componentReset()
-      this.componentOpen = true
-      this.title = '添加设备器件属性'
-      this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
 
+    // 取消编辑
+    cancelEdit() {
+      this.editDialogVisible = false
+      this.editForm = {}
     },
-    handleComponentUpdate(row) {
-      this.componentReset()
-      const id = row.id || this.ids
-      getComponent(id).then(response => {
-        this.componentForm = response.data
-        this.componentOpen = true
-        this.title = '修改设备器件属性'
-        this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
-      })
-    },
-    handleComponentDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function () {
-        return delComponent(ids)
-      }).then(() => {
-        console.log('删除row', row.deviceCode)
-        this.getComponentList(row.deviceCode)
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    submitComponentForm() {
-      this.$refs['componentForm'].validate(valid => {
+
+    // 提交编辑
+    submitEdit() {
+      this.$refs.editForm.validate(valid => {
         if (valid) {
-          if (this.componentForm.id != null) {
-            updateComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          } else {
-            addComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          }
+          this.editLoading = true
+          updateSubsystem(this.editForm).then(response => {
+            this.$message.success("修改成功")
+            this.editDialogVisible = false
+            // 重新加载系统信息
+            this.loadSystemInfo()
+          }).catch(error => {
+            this.$message.error("修改失败:" + error.message)
+          }).finally(() => {
+            this.editLoading = false
+          })
         }
       })
     },
-    ComponentCancel() {
-      this.componentOpen = false
-      this.componentReset()
-    },
-    /**查询部件列表*/
-    getComponentList(deviceCode) {
-      listByDevice(deviceCode).then(response => {
-        this.ComponentList = response.data
-      })
-    },
-    /** 查询区域树结构 */
-    getAreaTree(areaCode, layer) {
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.treeAreaOptions = [{
-          id: '-1',
-          label: '全部',
-          children: response.data
-        }]
-      })
-    },
-    // 筛选节点
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
+
+    // 格式化滑块tooltip
+    formatTooltip(val) {
+      return `${val}%`
     },
-    // 节点单击事件
-    handleNodeClick(data) {
-      if (data.id === '-1') {
-        this.queryParams.locationType = null;
-        this.queryParams.locationRef = null;
-      } else {
-        this.queryParams.locationType = data.tier;
-        this.queryParams.locationRef = data.id;
+
+    // 解析参数定义类型
+    getParamType(paramDefinition) {
+      if (!paramDefinition) return null
+      try {
+        const def = JSON.parse(paramDefinition)
+        return def.type
+      } catch (e) {
+        return null
       }
-      this.handleQuery();
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false
-      this.reset()
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        deviceCode: null,
-        deviceName: null,
-        deviceType: null,
-        deviceStatus: null,
-        deviceModel: null,
-        refArea: null,
-        refFacs: null,
-        subsystemCode: null,
-        psCode: null,
-        createTime: null,
-        updateTime: null
 
+    // 解析Options类型的选项
+    parseOptions(paramDefinition) {
+      try {
+        const def = JSON.parse(paramDefinition)
+        if (def.type === 'Options' && def.list) {
+          return def.list
+        }
+      } catch (e) {
+        console.error('解析Options失败:', e)
       }
-      this.resetForm('form')
+      return []
     },
-    componentReset() {
-      this.componentForm = {
-        id: null,
-        deviceCode: this.ComponentRow.deviceCode || '', // 使用ComponentRow的deviceCode,或者空字符串
-        compoCode: null,
-        compoTag: null,
-        psCode: null,
-        extCompoCode: null,
-        compoModel: null,
-        compoBrand: null,
-        compoSpec: null,
-        ancestors: null,
-        parentCompo: null
 
+    // 处理系统能力点击
+    handleSystemAbilityClick(ability) {
+      const paramType = this.getParamType(ability.paramDefinition)
+
+      if (paramType === 'Slider') {
+        this.showSliderDialog(ability, this.systemInfo, 3)
+      } else if (paramType === 'Input') {
+        this.showInputDialog(ability, this.systemInfo, 3)
+      } else {
+        this.executeSystemAbility(ability)
       }
-      this.resetForm('componentForm')
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1
-      console.log('搜索按钮this.queryParams', JSON.stringify(this.queryParams))
-      this.getList()
+
+    // 执行系统能力(带Options参数)
+    executeSystemAbilityWithParam(ability, paramValue) {
+      ability.executing = true
+      ability.executingValue = paramValue
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: paramValue
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+        ability.executingValue = null
+      })
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.queryParams.locationType = null
-      this.queryParams.locationRef = null
-      this.resetForm('queryForm')
-      this.handleQuery()
+
+    // 执行系统能力(无参数)
+    executeSystemAbility(ability) {
+      ability.executing = true
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: null
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+
+        if (ability.abilityKey === 'MeterReadingGw') {
+          this.loadDevices()
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+      })
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+
+    // 显示滑块弹窗
+    showSliderDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Slider'
+
+      try {
+        const def = JSON.parse(ability.paramDefinition)
+        this.abilitySliderMin = def.min || 0
+        this.abilitySliderMax = def.max || 100
+        this.abilitySliderValue = Math.floor((this.abilitySliderMin + this.abilitySliderMax) / 2)
+      } catch (e) {
+        console.error('解析Slider参数失败:', e)
+        this.abilitySliderMin = 0
+        this.abilitySliderMax = 100
+        this.abilitySliderValue = 50
+      }
+
+      this.abilityDialogVisible = true
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '添加能源设备'
+
+    // 显示输入弹窗
+    showInputDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Input'
+      this.abilityInputValue = ''
+      this.abilityDialogVisible = true
     },
-    /**设备器件按钮*/
-    handleDevProcess(row) {
-      this.showDevProcessDrawer = true
-      this.ComponentRow = row
-      console.log('row', row)
-      listByDevice(this.ComponentRow.deviceCode).then(response => {
-        this.ComponentList = response.data
+
+    // 执行带参数的能力
+    executeAbilityWithParam() {
+      let paramValue = null
+
+      if (this.abilityParamType === 'Slider') {
+        paramValue = String(this.abilitySliderValue)
+      } else if (this.abilityParamType === 'Input') {
+        if (!this.abilityInputValue) {
+          this.$message.warning('请输入参数值')
+          return
+        }
+        paramValue = this.abilityInputValue
+      }
+
+      this.abilityExecuting = true
+
+      const callParams = {
+        objType: this.currentObjType,
+        abilityKey: this.abilityForm.abilityKey,
+        abilityParam: paramValue
+      }
+
+      if (this.currentObjType === 3) {
+        callParams.objCode = this.systemCode
+        callParams.modelCode = this.systemInfo.modelCode
+      } else if (this.currentObjType === 2) {
+        callParams.objCode = this.currentDevice.deviceCode
+        callParams.modelCode = this.currentDevice.deviceModel
+      }
+
+      listcallAbility(callParams).then(response => {
+        this.$message.success('执行成功')
+        this.abilityDialogVisible = false
+
+        if (this.abilityForm.abilityKey.toLowerCase().includes('meter') ||
+          this.abilityForm.abilityKey.toLowerCase().includes('reading')) {
+          if (this.currentObjType === 3) {
+            this.loadDevices()
+          } else if (this.currentObjType === 2) {
+            this.loadDeviceAttrs(this.currentDevice.deviceCode)
+          }
+        }
+      }).catch(() => {
+        this.$message.error('执行失败')
+      }).finally(() => {
+        this.abilityExecuting = false
       })
+    },
 
+    // 初始化时间范围
+    initDateRange() {
+      const now = new Date()
+      const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
+      const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59)
+
+      this.callLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
+      this.eventLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
     },
-    shouldShowDevProcessButton(row) {
-      const categoryIsW = this.queryParams.deviceCategory === 'W'
-      const validPsCodes = ['AA', 'AH', 'AJ', 'AM', 'AP', 'AL', 'APE', 'ALE', 'AF', 'ACC']
-      const psCodeIsValid = validPsCodes.includes(row.psCode)
-      // 只有当设备分类为输能设备且设备工艺代码有效时,才返回true
-      return categoryIsW && psCodeIsValid
+
+    // 格式化日期
+    formatDate(date) {
+      if (!date) return ''
+      const year = date.getFullYear()
+      const month = (date.getMonth() + 1).toString().padStart(2, '0')
+      const day = date.getDate().toString().padStart(2, '0')
+      const hours = date.getHours().toString().padStart(2, '0')
+      const minutes = date.getMinutes().toString().padStart(2, '0')
+      const seconds = date.getSeconds().toString().padStart(2, '0')
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
     },
-    backStyle(areaPath) {
-      const firstLevel = areaPath.split('/')[0];
-      switch (firstLevel) {
-        case '北区':
-          return 'north';
-        case '南区':
-          return 'south';
-        case '主路':
-          return 'main';
-        default:
-          return '';
+
+    // 加载系统信息
+    async loadSystemInfo() {
+      try {
+        const sysRes = await getSubsystemByCode(this.systemCode)
+        this.systemInfo = sysRes.data
+
+        if (this.systemInfo.modelCode) {
+          this.allModelCodes.push(this.systemInfo.modelCode)
+
+          const modelRes = await getModelByCode(this.systemInfo.modelCode)
+          const modelData = modelRes.data
+
+          this.systemAbilities = (modelData.abilityList || []).map(item => ({
+            ...item,
+            executing: false,
+            executingValue: null
+          }))
+        }
+
+        const attrRes = await getObjAttr(3, this.systemCode)
+        const attrData = attrRes.data
+
+        this.protocolAttrs = attrData.Protocol || []
+        this.stateAttrs = attrData.State || []
+
+        const statusAttr = this.stateAttrs.find(attr => attr.attrKey === 'interfaceStatus')
+        if (statusAttr) {
+          this.systemStatus = statusAttr.attrValue
+        }
+
+        await this.loadDevices()
+      } catch (error) {
+        this.$message.error('加载系统信息失败:' + error.message)
       }
     },
-    /**设备详情按钮*/
-    handleDetail(row) {
-      this.showDrawer = true
-      this.curRow = row
-      console.log('data', this.curRow)
-      this.subKey = this.$options.data().subKey
-      getModelByCode(this.curRow.facsModel).then(response => {
-        const code = response.data
-        console.log('code', code)
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
 
-      })
-      getObjAttr(2, this.curRow.deviceCode).then(response => {
-        console.log('response值', response.data)
-        const attrs = response.data.attrs
-        const attrValues = response.data.attrValues
-
-        // 合并 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 : ''
+    // 加载设备列表
+    async loadDevices() {
+      this.deviceLoading = true
+      try {
+        const res = await getByCondition({
+          subsystemCode: this.systemCode
+        })
+
+        const deviceData = res.data || res.rows || []
+
+        this.deviceList = deviceData.map(device => ({
+          ...device,
+          detailTab: 'attrs'
+        }))
+
+        const deviceModelCodes = new Set()
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            deviceModelCodes.add(device.deviceModel)
           }
         })
-        this.attrData = mergedData
-      })
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset()
-      const id = row.id || this.ids
-      getDevice(id).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改能源设备'
-      })
-      const layer = 1
-      const areaCode = '0'
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.totalAreaOptions = response.data
-      })
-    },
-    /** 提交按钮 */
-    submitForm() {
-      // 重置 attrList 和 form.customAttrs
-      if (!this.attrList) {
-        this.attrList = []
-      }
-      if (!this.form.customAttrs) {
-        this.form.customAttrs = []
-      }
-      // 准备要发送的数据
-      let dataToSubmit = []
-      // 添加模型属性数据
-      this.attrList.forEach(attr => {
-        const attrName = attr.attrName
-        const attrKey = attr.attrKey
-        const attrValue = this.attrValuesMap[attrKey]
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
 
-          })
-        }
-      })
+        deviceModelCodes.forEach(modelCode => {
+          if (!this.allModelCodes.includes(modelCode)) {
+            this.allModelCodes.push(modelCode)
+          }
+        })
 
-      // 添加自定义属性数据
-      this.form.customAttrs.forEach(customAttr => {
-        const attrName = customAttr.attrName
-        const attrKey = customAttr.attrKey
-        const attrValue = customAttr.attrValue
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: '', // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
-          })
+        this.deviceStats.total = this.deviceList.length
+        this.deviceStats.online = this.deviceList.filter(d => d.deviceStatus === 1).length
+        this.deviceStats.offline = this.deviceList.filter(d => d.deviceStatus !== 1).length
+
+        const devicesByModel = {}
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            if (!devicesByModel[device.deviceModel]) {
+              devicesByModel[device.deviceModel] = []
+            }
+            devicesByModel[device.deviceModel].push(device)
+          }
+        })
+
+        for (const modelCode in devicesByModel) {
+          await this.loadDeviceAttrsBatch(modelCode, devicesByModel[modelCode])
         }
-      })
+      } catch (error) {
+        this.$message.error('加载设备列表失败')
+      } finally {
+        this.deviceLoading = false
+      }
+    },
 
-      this.$refs['form'].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateDevice(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            }).catch(error => {
-              console.error('修改失败:', error)
-              this.$message.error('修改失败')
-            })
+    // 批量加载设备属性
+    async loadDeviceAttrsBatch(modelCode, devices) {
+      try {
+        const res = await getObjAttrBatch(2, modelCode)
+        const batchData = res.data || {}
 
-            if (dataToSubmit.length > 0) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
-                  }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+        let totalPoints = 0
+
+        devices.forEach(device => {
+          const deviceCode = device.deviceCode
+          const attrData = batchData[deviceCode]
+
+          if (attrData) {
+            const baseAttrs = {}
+            if (attrData.Base) {
+              attrData.Base.forEach(attr => {
+                baseAttrs[attr.attrKey] = attr.attrValue
               })
             }
-          } 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) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
+            this.deviceAttrs[deviceCode] = baseAttrs
+
+            const channels = []
+            if (attrData.Measure) {
+              attrData.Measure.forEach(attr => {
+                if (attr.attrKey.startsWith('interface')) {
+                  try {
+                    const points = JSON.parse(attr.attrValue || '[]')
+                    channels.push({
+                      name: attr.attrName,
+                      key: attr.attrKey,
+                      points: points
+                    })
+                    totalPoints += points.length
+                  } catch (e) {
+                    console.error(`解析设备 ${deviceCode} 的测点数据失败:`, e)
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+                }
               })
-            } else {
-              // this.$message.info('没有属性需要添加');
             }
+            this.deviceChannels[deviceCode] = channels
           }
+        })
+
+        this.deviceStats.points += totalPoints
+      } catch (error) {
+        console.error(`批量加载模型 ${modelCode} 的设备属性失败:`, error)
+        for (const device of devices) {
+          await this.loadDeviceAttrs(device.deviceCode)
         }
-      })
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源设备编号为"' + ids + '"的数据项?').then(function () {
-        return delDevice(ids)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('ems/basecfg/device/export', {
-        ...this.queryParams
-      }, `device_${new Date().getTime()}.xlsx`)
-    },
-    getFacsOptions() {
-      const getFacsParams = {
-        facsCategory: this.queryParams.deviceCategory,
-        subCategory: this.queryParams.deviceSubCategory
       }
-      listAllFacs(getFacsParams).then(response => {
-        this.facsOptions = response.data
-      })
-    },
-    getSubCategorygetByCode() {
-      getFacsCategorygetByCode(this.queryParams.deviceCategory).then(response => {
-        this.subCategoryOptions = response.data.subtypeList || []
-      })
-    },
-    getSubsystem() {
-      listSubsystemAll().then(response => {
-        this.subsystemOptions = response.data
-      })
     },
-    /**自定义属性表格*/
-    addCustomAttr() {
-      // 添加一个新的自定义属性
-      if (!Array.isArray(this.form.customAttrs)) {
-        this.form.customAttrs = []
-      }
-      this.form.customAttrs.push({
-        attrKey: '',
-        attrName: '',
-        attrValue: ''
-      })
-      // 强制更新视图
-      this.$forceUpdate()
 
-    },
-    deleteCustomAttr(index) {
-      // 删除指定索引的自定义属性
-      if (this.form.customAttrs.length > 0) {
-        this.form.customAttrs.splice(index, 1)
+    // 单个加载设备属性
+    async loadDeviceAttrs(deviceCode) {
+      try {
+        const res = await getObjAttr(2, deviceCode)
+        const attrData = res.data
+
+        const baseAttrs = {}
+        if (attrData.Base) {
+          attrData.Base.forEach(attr => {
+            baseAttrs[attr.attrKey] = attr.attrValue
+          })
+        }
+        this.deviceAttrs[deviceCode] = baseAttrs
+
+        const channels = []
+        let pointsCount = 0
+        if (attrData.Measure) {
+          attrData.Measure.forEach(attr => {
+            if (attr.attrKey.startsWith('interface')) {
+              try {
+                const points = JSON.parse(attr.attrValue || '[]')
+                channels.push({
+                  name: attr.attrName,
+                  key: attr.attrKey,
+                  points: points
+                })
+                pointsCount += points.length
+              } catch (e) {
+                console.error(`解析测点数据失败:`, e)
+              }
+            }
+          })
+        }
+
+        if (!this.deviceChannels[deviceCode]) {
+          this.deviceStats.points += pointsCount
+        }
+
+        this.deviceChannels[deviceCode] = channels
+      } catch (error) {
+        console.error(`加载设备 ${deviceCode} 属性失败:`, error)
       }
+    },
 
+    // 获取设备属性
+    getDeviceAttr(deviceCode, attrKey) {
+      return this.deviceAttrs[deviceCode]?.[attrKey] || '-'
     },
-    /**设备模型*/
-    updateAttrValue(attrKey, newValue) {
-      this.attrValuesMap[attrKey] = newValue
+
+    // 获取设备通道
+    getDeviceChannels(deviceCode) {
+      return this.deviceChannels[deviceCode] || []
     },
 
-    getFacsModel() {
-      listAllModel(2).then(response => {
-        this.modelList = response.data
-        console.log('this.modelList', this.modelList)
-        this.modelList.forEach(model => {
-          console.log(model.modelCode)
-        })
-      })
+    // 加载设备能力
+    async handleAbilityLoad(visible, device) {
+      if (visible && !this.deviceAbilities[device.deviceCode]) {
+        try {
+          if (!device.deviceModel) {
+            this.$set(this.deviceAbilities, device.deviceCode, [])
+            return
+          }
+
+          const res = await getModelByCode(device.deviceModel)
+          const abilities = res.data?.abilityList?.filter(item => item.hiddenFlag === 1) || []
+          this.$set(this.deviceAbilities, device.deviceCode, abilities)
+        } catch (error) {
+          this.$set(this.deviceAbilities, device.deviceCode, [])
+        }
+      }
     },
-    handleModelChange(modelCode) {
-      if (modelCode) {
-        this.getModelByCode(modelCode)
-        console.log('设备代码', this.form.deviceCode)
-        this.getObjAttr(2, this.form.deviceCode)
+
+    // 处理设备操作命令
+    async handleDeviceCommand(command) {
+      const { device, ability, paramValue } = command
+
+      if (paramValue !== undefined) {
+        try {
+          await listcallAbility({
+            objCode: device.deviceCode,
+            objType: 2,
+            modelCode: device.deviceModel,
+            abilityKey: ability.abilityKey,
+            abilityParam: paramValue
+          })
+
+          this.$message.success(`${ability.abilityName}执行成功`)
+
+          if (ability.abilityKey.toLowerCase().includes('meter') ||
+            ability.abilityKey.toLowerCase().includes('reading')) {
+            await this.loadDeviceAttrs(device.deviceCode)
+          }
+        } catch (error) {
+          this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+        }
+      } else {
+        const paramType = this.getParamType(ability.paramDefinition)
+
+        if (paramType === 'Slider') {
+          this.showSliderDialog(ability, device, 2)
+        } else if (paramType === 'Input') {
+          this.showInputDialog(ability, device, 2)
+        } else {
+          try {
+            await listcallAbility({
+              objCode: device.deviceCode,
+              objType: 2,
+              modelCode: device.deviceModel,
+              abilityKey: ability.abilityKey,
+              abilityParam: null
+            })
+
+            this.$message.success(`${ability.abilityName}执行成功`)
+
+            if (ability.abilityKey.toLowerCase().includes('meter') ||
+              ability.abilityKey.toLowerCase().includes('reading')) {
+              await this.loadDeviceAttrs(device.deviceCode)
+            }
+          } catch (error) {
+            this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+          }
+        }
       }
     },
-    getModelByCode(modelCode) {
-      getModelByCode(modelCode).then(response => {
-        // this.attrList = response.data.attrList;
-        const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
-        this.attrList = filteredAttrList
 
-      })
+    // 处理设备行点击
+    handleDeviceClick(row) {
+      this.$refs.deviceTable?.toggleRowExpansion(row)
     },
-    getObjAttr(objType, deviceCode) {
-      getObjAttr(objType, deviceCode).then(response => {
-        // const attrs = response.data.attrs;
-        const attrs = response.data.attrs.filter(attr => attr.attrType === 0)
-        console.log('attrs', attrs)
-        const attrValues = response.data.attrValues || [] // 确保是一个数组
-        console.log('attrValues', attrValues)
-
-        // 创建一个映射对象,用于存储 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] = ''
-          }
-        })
 
-        // 更新 attrValuesMap 到组件的数据中
-        this.attrValuesMap = attrValuesMap
-        // 打印更新后的 attrValuesMap,用于调试
-        console.log('Updated attrValuesMap', this.attrValuesMap)
+    // 标签页切换
+    handleTabClick(tab) {
+      if (tab.name === 'callLogs' && this.callLogList.length === 0) {
+        this.queryCallLogs()
+      } else if (tab.name === 'eventLogs' && this.eventLogList.length === 0) {
+        this.queryEventLogs()
+      }
+    },
 
-      })
-    }
-  }
-}
-</script>
-<style lang="scss" scoped>
+    // 查询调用日志
+    async queryCallLogs() {
+      this.logLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.callLogQuery.pageNum,
+          pageSize: this.callLogQuery.pageSize
+        }
 
-.divider {
-  border-bottom: 2px solid #ebeef5;
-  margin: 10px 0;
-}
+        if (this.callLogQuery.dateRange && this.callLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.callLogQuery.dateRange[0]
+          params.endRecTime = this.callLogQuery.dateRange[1]
+        }
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-  margin-top: 20px;
-  margin-bottom: 10px;
-}
+        if (this.callLogQuery.abilityKey) {
+          params.abilityKey = this.callLogQuery.abilityKey
+        }
 
-.drawer-content {
-  padding: 0 20px;
-}
+        if (this.callLogQuery.callStatus !== '') {
+          params.callStatus = this.callLogQuery.callStatus
+        }
 
+        const res = await listCallLog(params)
+        this.callLogList = res.rows || []
+        this.callLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询调用日志失败')
+      } finally {
+        this.logLoading = false
+      }
+    },
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-}
+    // 重置调用日志查询
+    resetCallLogQuery() {
+      this.initDateRange()
+      this.callLogQuery.abilityKey = ''
+      this.callLogQuery.callStatus = ''
+      this.callLogQuery.pageNum = 1
+      this.queryCallLogs()
+    },
 
-.attr-list-container {
-  border: 1px solid #ccc;
-  padding: 10px;
-  margin: 10px 0;
-  font-weight: bold;
-}
+    // 查询事件日志
+    async queryEventLogs() {
+      this.eventLogLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.eventLogQuery.pageNum,
+          pageSize: this.eventLogQuery.pageSize
+        }
 
-.attr-list-container h3 {
-  font-weight: bold;
-}
+        if (this.eventLogQuery.dateRange && this.eventLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.eventLogQuery.dateRange[0]
+          params.endRecTime = this.eventLogQuery.dateRange[1]
+        }
 
-.attr-item {
-  list-style-type: none;
-  margin-bottom: 5px;
-}
+        if (this.eventLogQuery.eventKey) {
+          params.eventKey = this.eventLogQuery.eventKey
+        }
 
-.attr-name {
-  font-weight: bold;
-}
+        const res = await listEventLog(params)
+        this.eventLogList = res.rows || []
+        this.eventLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询事件日志失败')
+      } finally {
+        this.eventLogLoading = false
+      }
+    },
 
+    // 重置事件日志查询
+    resetEventLogQuery() {
+      this.initDateRange()
+      this.eventLogQuery.eventKey = ''
+      this.eventLogQuery.pageNum = 1
+      this.queryEventLogs()
+    },
 
-.contents {
-  border: 20px solid #f2f2f5;
-  background-color: #f2f2f5;
-}
+    // 格式化调用状态
+    formatCallStatus(status) {
+      const statusMap = {
+        0: '成功',
+        1: '进行中',
+        2: '失败'
+      }
+      return statusMap[status] || '未知'
+    },
 
+    // 获取调用状态类型
+    getCallStatusType(status) {
+      const typeMap = {
+        0: 'success',
+        1: 'warning',
+        2: 'danger'
+      }
+      return typeMap[status] || 'info'
+    },
 
-.other-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-  margin-bottom: 20px;
+    // 查看调用日志详情
+    async handleCallLogDetail(row) {
+      try {
+        const res = await getCallLog(row.id)
+        this.callLogDetailData = res.data
+        this.callLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取调用日志详情失败')
+      }
+    },
+
+    // 查看事件日志详情
+    async handleEventLogDetail(row) {
+      try {
+        const res = await getEventLog(row.id)
+        this.eventLogDetailData = res.data
+        this.eventLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取事件日志详情失败')
+      }
+    }
+  }
 }
+</script>
 
-.table-content {
-  background-color: #ffffff; /* 白色背景 */
+<style lang="scss" scoped>
+.app-container {
   padding: 20px;
+  background: #f5f7fa;
+  min-height: calc(100vh - 84px);
 }
 
-.pagination-container {
+.system-info-card {
   margin-bottom: 20px;
-}
 
-.button-group-container {
-  display: flex;
-  justify-content: flex-end;
-  min-width: 200px;
-  padding: 5px;
-}
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
 
-.device-list {
-  margin-top: 20px;
-}
+    .title {
+      font-size: 18px;
+      font-weight: bold;
 
-.device-card {
-  background-color: #fff;
-  border: 1px solid #bfcbd9;
-  border-radius: 4px;
-  overflow: hidden;
-  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  transition: 0.3s;
-  padding: 10px;
-  font-size: 14px;
-  height: 200px;
-  margin-bottom: 20px;
-  display: flex;
-  flex-direction: column;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
+  }
 
-.device-header {
-  //background-color: #f2f2f5;
-  //padding: 10px;
-  color: #545353;
-  font-size: 20px;
-  font-weight: bold;
-}
+  .info-group {
+    .group-title {
+      font-size: 14px;
+      font-weight: bold;
+      color: #606266;
+      margin-bottom: 12px;
+      padding-bottom: 6px;
+      border-bottom: 1px solid #EBEEF5;
+    }
+  }
 
-.device-code {
-  color: cornflowerblue;
-}
+  .info-item {
+    margin-bottom: 12px;
+    font-size: 14px;
 
-.deviceOthers {
-  color: black;
-}
+    label {
+      color: #909399;
+      margin-right: 8px;
+      display: inline-block;
+      min-width: 80px;
+    }
 
-.device-body {
-  padding: 10px;
-  color: #666666;
-  flex: 1; /* 使设备主体内容占据剩余空间 */
-  overflow-y: auto; /* 如果内容过多,允许滚动 */
-}
+    .code {
+      font-family: monospace;
+      color: #409EFF;
+      background: #f0f9ff;
+      padding: 2px 6px;
+      border-radius: 3px;
+    }
 
-.device-footer {
-  display: flex;
-  justify-content: space-between;
-  padding: 5px;
-  // background-color: #f9f9f9;
+    .stat-number {
+      color: #409EFF;
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
 }
 
-.device-footer .el-button {
-  padding: 5px 15px;
-  border: none; /* 移除默认边框 */
-  color: #5a5e66;
-  transition: background-color 0.3s; /* 平滑过渡背景色变化 */
-}
+.detail-card {
+  .tab-content {
+    min-height: 400px;
+  }
 
-/* 为按钮分配不同的颜色 */
-.device-footer .el-button:first-child {
-  background-color: #d5f1d5; /* 淡绿色 */
-  border: 1px solid lightgreen;
-  color: #71e2aa;
+  .attr-section {
+    margin-bottom: 30px;
 
-}
+    .section-title {
+      margin: 20px 0 15px 0;
+      color: #303133;
 
-.device-footer .el-button:nth-child(2) {
-  background-color: #ffe5b4; /* 淡橙色 */
-  border: 1px solid #ffba00;
-  color: #faad14;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
 
-.device-footer .el-button:last-child {
-  background-color: #ffd5d5; /* 淡红色 */
-  border: 1px solid lightpink;
-  color: #f5222d;
-}
+    .url-text {
+      color: #409EFF;
+      font-family: monospace;
+    }
+  }
 
-/* 鼠标悬停时加深颜色 */
-.device-footer .el-button:hover {
-  filter: brightness(0.5); /* 颜色加深效果 */
-}
+  .device-stats {
+    margin-bottom: 20px;
+
+    .stat-item {
+      text-align: center;
+      padding: 20px;
+      background: #fff;
+      border: 1px solid #EBEEF5;
+      border-radius: 4px;
+
+      .stat-value {
+        font-size: 28px;
+        font-weight: bold;
+        color: #303133;
+        margin-bottom: 8px;
+      }
+
+      .stat-label {
+        font-size: 14px;
+        color: #909399;
+      }
+
+      &.online .stat-value {
+        color: #67C23A;
+      }
+
+      &.offline .stat-value {
+        color: #F56C6C;
+      }
+    }
+  }
 
-/* 背景色样式 */
-.north {
-  background: linear-gradient(to right, #e1f3d8, #fafafa);
+  .device-detail {
+    padding: 20px;
+    background: #f5f7fa;
+
+    h5 {
+      margin: 15px 0 10px 0;
+      color: #303133;
+    }
+  }
+
+  .log-filter {
+    margin-bottom: 20px;
+    padding: 15px;
+    background: #f5f7fa;
+    border-radius: 4px;
+  }
 }
 
-.south {
-  background: linear-gradient(to right, #fff7e8, #fafafa);
+.execute-result {
+  .result-data {
+    margin-top: 20px;
+
+    pre {
+      background: #f5f7fa;
+      padding: 15px;
+      border-radius: 4px;
+      overflow: auto;
+      max-height: 400px;
+      font-family: monospace;
+      font-size: 12px;
+    }
+  }
 }
 
-.main {
-  background: linear-gradient(to right, #e0e0e0, #fafafa);
+.dialog-footer {
+  text-align: right;
 }
 
+::v-deep .el-dropdown-menu {
+  .el-submenu__title {
+    padding-right: 40px !important;
 
-.el-table {
-  background-color: #ffffff; /* 白色背景 */
-}
+    &:hover {
+      background-color: #f5f7fa;
+    }
+  }
 
-.el-card {
-  background-color: #ffffff; /* 白色背景 */
+  .el-submenu__icon-arrow {
+    position: absolute;
+    right: 20px;
+  }
 }
 </style>

+ 1392 - 1107
ems-ui-cloud/src/views/adapter/gczr/index.vue

@@ -1,1256 +1,1541 @@
 <template>
   <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="4" :xs="24">
-        <div class="head-container">
-          <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-                    style="margin-bottom: 20px"
-          />
-        </div>
-        <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
-          <el-tree :data="treeAreaOptions" :props="defaultProps" :expand-on-click-node="false"
-                   :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-                   @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"
-          />
-        </div>
-      </el-col>
-      <el-col :span="20" :xs="24">
-        <div class="contents">
-          <div class="other-content">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
-                     label-width="68px"
-            >
-              <el-form-item label="设备分类" prop="deviceSubCategory">
-                <el-select v-model="queryParams.deviceSubCategory">
-                  <el-option v-for="item in subCategoryOptions" placeholder="设备分类" :label="item.name"
-                             :value="item.code"
-                             :key="item.code"
-                  />
-                </el-select>
+    <!-- 系统基础信息卡片 - 添加编辑按钮 -->
+    <el-card class="system-info-card">
+      <div slot="header" class="card-header">
+        <span class="title">
+          <i class="el-icon-s-platform"></i>
+          光储直柔监测
+        </span>
+        <el-tag :type="systemStatus === '1' ? 'success' : 'danger'" effect="dark">
+          {{ systemStatus === '1' ? '正常' : '异常' }}
+        </el-tag>
+      </div>
+
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">系统信息</div>
+            <div class="info-item">
+              <label>系统代码:</label>
+              <span class="code">{{ systemInfo.systemCode }}</span>
+            </div>
+            <div class="info-item">
+              <label>系统名称:</label>
+              <span>{{ systemInfo.systemName }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">厂商信息</div>
+            <div class="info-item">
+              <label>对接厂商:</label>
+              <span>{{ systemInfo.manFacturer || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系人:</label>
+              <span>{{ systemInfo.contactPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系电话:</label>
+              <span>{{ systemInfo.contactNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">维护信息</div>
+            <div class="info-item">
+              <label>维护人:</label>
+              <span>{{ systemInfo.maintainerPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>维护电话:</label>
+              <span>{{ systemInfo.maintainerNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">设备统计</div>
+            <div class="info-item">
+              <label>设备总数:</label>
+              <span class="stat-number">{{ deviceStats.total }}</span>
+            </div>
+            <div class="info-item">
+              <label>在线设备:</label>
+              <span class="stat-number">{{ deviceStats.online }}</span>
+            </div>
+            <div class="info-item">
+              <label>测点总数:</label>
+              <span class="stat-number">{{ deviceStats.points }}</span>
+            </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEdit"
+                v-hasPermi="['ems:subsystem:edit']">
+                编辑
+              </el-button>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <!-- 系统详情标签页 -->
+    <el-card class="detail-card">
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+        <!-- 系统属性标签页 -->
+        <el-tab-pane label="系统属性" name="attributes">
+          <div class="tab-content">
+            <!-- 协议属性 -->
+            <div class="attr-section" v-if="protocolAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-connection"></i>
+                协议信息
+              </h4>
+              <el-table :data="protocolAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.attrKey === 'url'" class="url-text">
+                      {{ scope.row.attrValue }}
+                    </span>
+                    <span v-else>{{ scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+
+            <!-- 状态属性 -->
+            <div class="attr-section" v-if="stateAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-info"></i>
+                状态信息
+              </h4>
+              <el-table :data="stateAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <el-tag v-if="scope.row.attrKey === 'interfaceStatus'"
+                            :type="scope.row.attrValue === '1' ? 'success' : 'danger'">
+                      {{ scope.row.attrValueName }}
+                    </el-tag>
+                    <span v-else>{{ scope.row.attrValueName || scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="updateTime" label="更新时间" width="180"></el-table-column>
+              </el-table>
+            </div>
+          </div>
+        </el-tab-pane>
+
+        <!-- 系统能力标签页 -->
+        <el-tab-pane label="系统能力" name="abilities">
+          <div class="tab-content">
+            <el-table :data="systemAbilities" border stripe v-loading="abilityLoading">
+              <el-table-column prop="abilityName" label="能力名称" width="200"></el-table-column>
+              <el-table-column prop="abilityKey" label="能力标识" width="180"></el-table-column>
+              <el-table-column prop="abilityDesc" label="能力描述"></el-table-column>
+              <el-table-column label="操作" width="200" align="center">
+                <template slot-scope="scope">
+                  <div v-if="getParamType(scope.row.paramDefinition) === 'Options'" style="display: inline-block;">
+                    <el-button-group>
+                      <el-button
+                        v-for="option in parseOptions(scope.row.paramDefinition)"
+                        :key="option.value"
+                        size="mini"
+                        type="primary"
+                        @click="executeSystemAbilityWithParam(scope.row, option.value)"
+                        :loading="scope.row.executing && scope.row.executingValue === option.value">
+                        {{ option.key }}
+                      </el-button>
+                    </el-button-group>
+                  </div>
+                  <el-button
+                    v-else
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-caret-right"
+                    @click="handleSystemAbilityClick(scope.row)"
+                    :loading="scope.row.executing">
+                    执行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 关联设备标签页 -->
+        <el-tab-pane label="关联设备" name="devices">
+          <div class="tab-content">
+            <!-- 设备统计 -->
+            <div class="device-stats">
+              <el-row :gutter="20">
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.total }}</div>
+                    <div class="stat-label">设备总数</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item online">
+                    <div class="stat-value">{{ deviceStats.online }}</div>
+                    <div class="stat-label">在线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item offline">
+                    <div class="stat-value">{{ deviceStats.offline }}</div>
+                    <div class="stat-label">离线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.points }}</div>
+                    <div class="stat-label">测点总数</div>
+                  </div>
+                </el-col>
+              </el-row>
+            </div>
+
+            <!-- 设备列表 -->
+            <el-table
+              :data="deviceList"
+              border
+              stripe
+              v-loading="deviceLoading"
+              @row-click="handleDeviceClick"
+              ref="deviceTable">
+              <el-table-column type="expand">
+                <template slot-scope="props">
+                  <div class="device-detail">
+                    <el-tabs v-model="props.row.detailTab">
+                      <el-tab-pane label="设备属性" name="attrs">
+                        <el-descriptions :column="2" border size="small">
+                          <el-descriptions-item label="IP地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'ip') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="网关地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'gateway') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="子网掩码">
+                            {{ getDeviceAttr(props.row.deviceCode, 'subnetMask') }}
+                          </el-descriptions-item>
+                        </el-descriptions>
+                      </el-tab-pane>
+                      <el-tab-pane label="测点信息" name="points">
+                        <div v-for="(channel, idx) in getDeviceChannels(props.row.deviceCode)" :key="idx">
+                          <h5>{{ channel.name }} ({{ channel.points.length }}个测点)</h5>
+                          <el-table :data="channel.points" size="mini" max-height="200">
+                            <el-table-column prop="name" label="测点名称"></el-table-column>
+                            <el-table-column prop="key" label="测点标识"></el-table-column>
+                            <el-table-column prop="value" label="当前值">
+                              <template slot-scope="scope">
+                                {{ scope.row.value || '-' }}
+                              </template>
+                            </el-table-column>
+                            <el-table-column prop="updateTime" label="更新时间"></el-table-column>
+                          </el-table>
+                        </div>
+                      </el-tab-pane>
+                    </el-tabs>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="deviceCode" label="设备代码" width="150"></el-table-column>
+              <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+              <el-table-column prop="location" label="安装位置"></el-table-column>
+              <el-table-column prop="areaCode" label="区域" width="150">
+                <template slot-scope="scope">
+                  {{ scope.row.areaCode.includes('3001') ? '北区' : '南区' }}
+                </template>
+              </el-table-column>
+              <el-table-column label="设备状态" width="100" align="center">
+                <template slot-scope="scope">
+                  <el-tag :type="scope.row.deviceStatus === 1 ? 'success' : 'info'">
+                    {{ scope.row.deviceStatus === 1 ? '在线' : '离线' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="120" align="center">
+                <template slot-scope="scope">
+                  <el-dropdown
+                    trigger="click"
+                    @command="handleDeviceCommand"
+                    @visible-change="(visible) => handleAbilityLoad(visible, scope.row)">
+                    <el-button type="text" size="mini">
+                      操作<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                      <template v-if="deviceAbilities[scope.row.deviceCode] && deviceAbilities[scope.row.deviceCode].length > 0">
+                        <template v-for="ability in deviceAbilities[scope.row.deviceCode]">
+                          <el-submenu
+                            v-if="getParamType(ability.paramDefinition) === 'Options'"
+                            :key="ability.abilityKey"
+                            :index="ability.abilityKey">
+                            <template slot="title">
+                              {{ ability.abilityName }}
+                              <i class="el-icon-arrow-right" style="float: right;"></i>
+                            </template>
+                            <el-dropdown-item
+                              v-for="option in parseOptions(ability.paramDefinition)"
+                              :key="option.value"
+                              :command="{device: scope.row, ability: ability, paramValue: option.value}">
+                              {{ option.key }}
+                            </el-dropdown-item>
+                          </el-submenu>
+                          <el-dropdown-item
+                            v-else
+                            :key="ability.abilityKey"
+                            :command="{device: scope.row, ability: ability}">
+                            {{ ability.abilityName }}
+                          </el-dropdown-item>
+                        </template>
+                      </template>
+                      <el-dropdown-item v-else disabled>
+                        无可用操作
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 调用日志标签页 -->
+        <el-tab-pane label="调用日志" name="callLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="callLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="callLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
               </el-form-item>
-              <el-form-item label="归属设施" prop="refFacs">
-                <el-select v-model="queryParams.refFacs">
-                  <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                             :key="item.facsCode"
-                  />
-                </el-select>
+              <el-form-item label="能力标识">
+                <el-input v-model="callLogQuery.abilityKey" placeholder="请输入能力标识" clearable></el-input>
               </el-form-item>
-              <el-form-item label="子系统" prop="subsystemCode">
-                <el-select v-model="queryParams.subsystemCode">
-                  <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                             :key="item.systemCode"
-                  />
+              <el-form-item label="调用状态">
+                <el-select v-model="callLogQuery.callStatus" placeholder="全部" clearable>
+                  <el-option label="成功" :value="0"></el-option>
+                  <el-option label="进行中" :value="1"></el-option>
+                  <el-option label="失败" :value="2"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item>
-                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                <el-button type="primary" @click="queryCallLogs">查询</el-button>
+                <el-button @click="resetCallLogQuery">重置</el-button>
               </el-form-item>
             </el-form>
 
-            <el-row :gutter="10" class="mb8">
-              <el-col :span="1.5">
-                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-                           v-hasPermi="['ems:device:add']"
-                >新增
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-                           v-hasPermi="['ems:device:edit']"
-                >修改
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
-                           @click="handleDelete"
-                           v-hasPermi="['ems:device:remove']"
-                >删除
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-                           v-hasPermi="['ems:device:export']"
-                >导出
-                </el-button>
-              </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-            </el-row>
-          </div>
-
-          <div class="table-content">
-            <!--分页-->
-            <div class="button-group-container">
-              <el-button-group>
-                <el-button :type="primary1" icon="el-icon-s-fold" @click="switchData(1)"/>
-                <el-button :type="primary2" icon="el-icon-menu" @click="switchData(2)"/>
-              </el-button-group>
-            </div>
-
-            <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"
-                      v-if="istable === 1">
-              <el-table-column type="selection" width="55" align="center"/>
-              <el-table-column label="设备名称" align="left" prop="deviceName"/>
-              <el-table-column label="安装位置" align="left" prop="areaPath" width="220px"/>
-              <el-table-column label="归属设施" align="center" prop="refFacsName"/>
-              <el-table-column label="设备分类" align="center" prop="deviceCategoryName"/>
-              <el-table-column label="子系统" align="center" prop="subsystemName"/>
-              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <el-table :data="callLogList" border stripe v-loading="logLoading">
+              <el-table-column prop="objCode" label="对象代码" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="abilityName" label="能力名称" min-width="150"></el-table-column>
+              <el-table-column prop="callTime" label="调用时间" width="180"></el-table-column>
+              <el-table-column label="调用状态" width="100" align="center">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDevProcess(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']" v-if="shouldShowDevProcessButton(scope.row)"
-                  >
-                    器件
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    详情
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    修改
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                             @click="handleDelete(scope.row)" v-hasPermi="['basecfg:device:remove']"
-                  >
-                    删除
-                  </el-button>
-
+                  <el-tag size="small" :type="getCallStatusType(scope.row.callStatus)">
+                    {{ formatCallStatus(scope.row.callStatus) }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleCallLogDetail(scope.row)">详情</el-button>
                 </template>
               </el-table-column>
             </el-table>
 
-            <div v-else-if="istable === 2">
-              <el-row :gutter="20" class="device-list">
-                <el-col v-for="device in deviceList" :key="device.id" :span="6">
-                  <div :class="`device-card ${backStyle(device.areaPath)}`">
-                    <div class="device-header">
-                      <i class="el-icon-s-operation" style="margin-right: 8px;"></i>
-                      {{ device.deviceName }}
-                    </div>
-                    <div class="device-body">
-                      <p>设备代码:<span class="device-code">{{ device.deviceCode }}</span></p>
-                      <p>安装位置:<span class="deviceOthers">{{ device.areaPath }}</span></p>
-                      <p>归属设施:<span class="deviceOthers">{{ device.refFacsName }}</span></p>
-                      <p>设备分类:<span class="deviceOthers">{{ device.deviceCategoryName }}</span></p>
-                      <p>子系统:<span class="deviceOthers">{{ device.subsystemName }}</span></p>
-                    </div>
-                    <div class="device-footer">
-                      <el-button size="mini" plain icon=" el-icon-document" @click="handleDetail(device)">详情
-                      </el-button>
-                      <el-button size="mini" plain icon="el-icon-edit" @click="handleUpdate(device)">修改</el-button>
-                      <el-button size="mini" plain icon="el-icon-delete" type="danger" @click="handleDelete(device)">
-                        删除
-                      </el-button>
-                    </div>
-                  </div>
-                </el-col>
-              </el-row>
-            </div>
+            <pagination
+              v-show="callLogTotal > 0"
+              :total="callLogTotal"
+              :page.sync="callLogQuery.pageNum"
+              :limit.sync="callLogQuery.pageSize"
+              @pagination="queryCallLogs"
+            />
+          </div>
+        </el-tab-pane>
+
+        <!-- 事件日志标签页 -->
+        <el-tab-pane label="事件日志" name="eventLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="eventLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="eventLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
+              </el-form-item>
+              <el-form-item label="事件标识">
+                <el-input v-model="eventLogQuery.eventKey" placeholder="请输入事件标识" clearable></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="queryEventLogs">查询</el-button>
+                <el-button @click="resetEventLogQuery">重置</el-button>
+              </el-form-item>
+            </el-form>
 
+            <el-table :data="eventLogList" border stripe v-loading="eventLogLoading">
+              <el-table-column prop="objCode" label="对象编号" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventName" label="事件名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventTime" label="事件时间" width="180"></el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleEventLogDetail(scope.row)">详情</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
 
-            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-                        :limit.sync="queryParams.pageSize"
-                        @pagination="getList"
+            <pagination
+              v-show="eventLogTotal > 0"
+              :total="eventLogTotal"
+              :page.sync="eventLogQuery.pageNum"
+              :limit.sync="eventLogQuery.pageSize"
+              @pagination="queryEventLogs"
             />
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </el-card>
+
+    <!-- 修改系统信息对话框 -->
+    <el-dialog title="修改系统信息" :visible.sync="editDialogVisible" width="500px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="厂商" prop="manFacturer">
+          <el-input v-model="editForm.manFacturer" placeholder="请输入厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editForm.descr" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelEdit">取 消</el-button>
+        <el-button type="primary" @click="submitEdit" :loading="editLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 执行结果对话框 -->
+    <el-dialog
+      :title="executeDialog.title"
+      :visible.sync="executeDialog.visible"
+      width="600px">
+      <div class="execute-result">
+        <el-alert
+          :title="executeDialog.status"
+          :type="executeDialog.type"
+          :description="executeDialog.message"
+          show-icon>
+        </el-alert>
+        <div v-if="executeDialog.data" class="result-data">
+          <pre>{{ JSON.stringify(executeDialog.data, null, 2) }}</pre>
+        </div>
+      </div>
+      <span slot="footer">
+        <el-button @click="executeDialog.visible = false">关闭</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 调用日志详情弹窗 -->
+    <el-dialog :visible.sync="callLogDetailDialog" title="调用日志详情" width="60%">
+      <div v-if="callLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象代码">{{ callLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="模型代码">{{ callLogDetailData.modelCode }}</el-descriptions-item>
+          <el-descriptions-item label="能力标识">{{ callLogDetailData.abilityKey }}</el-descriptions-item>
+          <el-descriptions-item label="调用时间">{{ callLogDetailData.callTime }}</el-descriptions-item>
+          <el-descriptions-item label="响应时间">{{ callLogDetailData.resTime }}</el-descriptions-item>
+          <el-descriptions-item label="调用结果">
+            <el-tag :type="getCallStatusType(callLogDetailData.callStatus)">
+              {{ formatCallStatus(callLogDetailData.callStatus) }}
+            </el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>调用载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.callPayload }}</pre>
+        </div>
 
-            <!-- 添加或修改能源设备对话框 -->
-            <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-              <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-                <el-form-item label="归属设施" prop="refFacs">
-                  <el-select v-model="form.refFacs">
-                    <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                               :key="item.facsCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备代码" prop="deviceCode">
-                  <el-input v-model="form.deviceCode" placeholder="请输入设备代码"/>
-                </el-form-item>
-                <el-form-item label="设备名称" prop="deviceName">
-                  <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
-                </el-form-item>
-
-
-                <el-form-item label="功能类型" prop="psCode" v-if="queryParams.deviceCategory === 'W'">
-                  <el-select v-model="form.psCode">
-                    <el-option v-for="item in devOptions" :label="item.psName" :value="item.psCode"
-                               :key="item.psCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备类型" prop="deviceType">
-                  <el-select v-model="form.deviceCategory">
-                    <el-option v-for="item in subCategoryOptions" :label="item.name" :value="item.code"
-                               :key="item.code"
-                    />
-                  </el-select>
-                </el-form-item>
-                <el-form-item label="设备模型" prop="deviceModel">
-                  <el-select v-model="form.deviceModel" style="width:100%" @change="handleModelChange">
-                    <el-option
-                      v-for="item in modelList"
-                      :label="item.modelName"
-                      :value="item.modelCode"
-                      :key="item.modelCode"
-                    />
-                  </el-select>
-                </el-form-item>
-                <!-- 这里可以展示属性名称和属性值 -->
-                <div v-if="attrList.length > 0" class="attr-list-container">
-                  <h3>模型属性:</h3>
-                  <ul>
-                    <li v-for="attr in attrList" :key="attr.attrKey" class="attr-item">
-                      <span class="attr-name">{{ attr.attrName }} ({{ attr.attrUnit }}):</span>
-                      <!-- 使用 el-input 组件允许用户编辑属性值 -->
-                      <el-input
-                        v-model="attrValuesMap[attr.attrKey]"
-                        placeholder="点击编辑"
-                        size="small"
-                        @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])"
-                      >
-                      </el-input>
-                    </li>
-                  </ul>
-                </div>
-                <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
-                  <el-form-item label="" prop="attrList">
-                    <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px"
-                              key="'customAttrs'"
-                    >
-                      <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="attrName">
-                        <template slot-scope="scope">
-                          <el-input size="mini" v-model="scope.row.attrName" 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="请输入属性值"/>
-                        </template>
-                      </el-table-column>
-                      <el-table-column align="center" label="操作">
-                        <template slot="header">
-                          <div class="operateBtns" @click="addCustomAttr">
-                            <span>添加</span><i class="el-icon-circle-plus-outline"></i>
-                          </div>
-                        </template>
-                        <template slot-scope="scope">
-                          <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
-                        </template>
-                      </el-table-column>
-                    </el-table>
-                  </el-form-item>
-                </h3>
-                <el-form-item label="子系统" prop="subsystemCode">
-                  <el-select v-model="form.subsystemCode">
-                    <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                               :key="item.systemCode"
-                    />
-                  </el-select>
-                </el-form-item>
-              </el-form>
-              <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="submitForm">确 定</el-button>
-                <el-button @click="cancel">取 消</el-button>
+        <div style="margin-top: 20px;">
+          <h4>响应载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.resPayload }}</pre>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 事件日志详情弹窗 -->
+    <el-dialog :visible.sync="eventLogDetailDialog" title="事件日志详情" width="60%">
+      <div v-if="eventLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象编号">{{ eventLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="对象名称">{{ eventLogDetailData.objName }}</el-descriptions-item>
+          <el-descriptions-item label="事件名称">{{ eventLogDetailData.eventName }}</el-descriptions-item>
+          <el-descriptions-item label="事件标识">{{ eventLogDetailData.eventKey }}</el-descriptions-item>
+          <el-descriptions-item label="事件时间" :span="2">{{ eventLogDetailData.eventTime }}</el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>事件描述</h4>
+          <div style="background-color: #f5f5f5; padding: 10px; border-radius: 4px;">
+            {{ eventLogDetailData.eventDetail || '无' }}
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 能力执行弹窗(支持Slider和Input类型) -->
+    <el-dialog :title="abilityDialogTitle" :visible.sync="abilityDialogVisible" width="500px" append-to-body :close-on-click-modal="false">
+      <el-form ref="abilityForm" :model="abilityForm" label-width="100px">
+        <el-form-item label="能力名称">
+          <el-input v-model="abilityForm.abilityName" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="能力描述">
+          <el-input type="textarea" v-model="abilityForm.abilityDesc" disabled :rows="2"></el-input>
+        </el-form-item>
+
+        <el-form-item label="参数设置" v-if="abilityParamType">
+          <template v-if="abilityParamType === 'Slider'">
+            <div style="width: 100%;">
+              <div style="padding: 0 10px;">
+                <el-slider
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :show-tooltip="true"
+                  :format-tooltip="formatTooltip">
+                </el-slider>
               </div>
-            </el-dialog>
-
-            <!--设备器件-->
-            <el-drawer :title=ComponentRow.deviceName size="80%" :visible.sync="showDevProcessDrawer" direction="rtl">
-              <div class="drawer-content" style="padding-left:50px">
-                <el-row :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleComponentAdd"
-                               v-hasPermi="['ems:component:add']"
-                    >新增
-                    </el-button>
-                  </el-col>
-                </el-row>
-                <el-table v-loading="loading" :data="ComponentList">
-                  <el-table-column type="selection" width="55" align="center"/>
-                  <el-table-column label="部件编码" align="center" prop="compoCode"/>
-                  <el-table-column label="部件标签" align="center" prop="compoTag">
-                    <template slot-scope="scope">
-                      {{ objComTypeMapping[scope.row.compoTag] }}
-                    </template>
-                  </el-table-column>
-                  <el-table-column label="工艺标识代码" align="center" prop="psCode"/>
-                  <el-table-column label="外系统部件编码" align="center" prop="extCompoCode"/>
-                  <el-table-column label="部件模型" align="center" prop="compoModel"/>
-                  <el-table-column label="部件品牌" align="center" prop="compoBrand"/>
-                  <el-table-column label="部件型号" align="center" prop="compoSpec"/>
-                  <el-table-column label="祖籍列表" align="center" prop="ancestors"/>
-                  <el-table-column label="上级部件" align="center" prop="parentEqpt"/>
-
-                  <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-edit" @click="handleComponentUpdate(scope.row)"
-                                 v-hasPermi="['ems:component:edit']"
-                      >
-                        修改
-                      </el-button>
-                      <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                                 @click="handleComponentDelete(scope.row)" v-hasPermi="['ems:component:remove']"
-                      >
-                        删除
-                      </el-button>
-                    </template>
-                  </el-table-column>
-                </el-table>
-                <pagination v-show="total>0" :total="total" :page.sync="queryComponentParams.pageNum"
-                            :limit.sync="queryComponentParams.pageSize"
-                            @pagination="getComponentList"
-                />
-
-                <!-- 添加或修改设备器件对话框 -->
-                <el-dialog :title="title" :visible.sync="componentOpen" width="500px" append-to-body>
-                  <el-form ref="componentForm" :model="componentForm" :rules="componentRules" label-width="150px">
-                    <!--                <el-form-item label="设备code" prop="deviceCode">-->
-                    <!--                  <el-input v-model="componentForm.deviceCode" placeholder="请输入设备code" />-->
-                    <!--                </el-form-item>-->
-                    <el-form-item label="部件编码" prop="compoCode">
-                      <el-input v-model="componentForm.compoCode" placeholder="请输入部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件标签" prop="compoTag">
-                      <el-select v-model="componentForm.compoTag" placeholder="请输入部件标签">
-                        <el-option v-for="item in objComTypeOptions"
-                                   :label="item.name"
-                                   :value="item.code"
-                                   :key="item.code"
-                        />
-
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="工艺标签代码" prop="psCode">
-                      <el-select v-model="componentForm.psCode" placeholder="请输入工艺标签代码">
-                        <el-option v-for="item in devOptions" :label="item.psCode" :value="item.psCode"
-                                   :key="item.psCode"/>
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="外系统部件编码" prop="extCompoCode">
-                      <el-input v-model="componentForm.extCompoCode" placeholder="请输入外系统部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件模型" prop="compoModel">
-                      <el-select v-model="componentForm.compoModel" placeholder="请输入部件模型">
-                        <el-option v-for="item in this.modelList" :label="item.modelCode" :value="item.modelCode"
-                                   :key="item.modelCode"
-                        />
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="部件品牌" prop="compoBrand">
-                      <el-input v-model="componentForm.compoBrand" placeholder="请输入部件品牌"/>
-                    </el-form-item>
-                    <el-form-item label="部件型号" prop="compoSpec">
-                      <el-input v-model="componentForm.compoSpec" placeholder="请输入部件型号"/>
-                    </el-form-item>
-                    <el-form-item label="祖籍列表" prop="ancestors">
-                      <el-input v-model="componentForm.ancestors" placeholder="请输入祖籍列表"/>
-                    </el-form-item>
-                    <el-form-item label="上级列表" prop="parentCompo">
-                      <el-input v-model="componentForm.parentCompo" placeholder="请输入上级列表"/>
-                    </el-form-item>
-
-                  </el-form>
-                  <div slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="submitComponentForm">确 定</el-button>
-                    <el-button @click="ComponentCancel">取 消</el-button>
-                  </div>
-                </el-dialog>
+
+              <div style="display: flex; justify-content: space-between; padding: 0 10px; margin-top: -5px; margin-bottom: 20px;">
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMin }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ Math.floor((abilitySliderMin + abilitySliderMax) / 2) }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMax }}%</span>
               </div>
-            </el-drawer>
-
-            <!-- 详情弹框 -->
-            <el-dialog :visible.sync="showDrawer" title="设备详情">
-              <div v-if="curRow">
-                <!-- 设备基本信息 -->
-                <el-card class="box-card">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">设备基本信息</span>
-                  </div>
-                  <div>
-                    <p>设备代码:{{ curRow.deviceCode }}</p>
-                    <p>设备名称:{{ curRow.deviceName }}</p>
-                    <p>设备类型:{{ curRow.deviceCategoryName }}</p>
-                    <p>子系统:{{ curRow.subsystemName }}</p>
-                    <p>归属区域:{{ curRow.areaPath }}</p>
-                    <p>归属设施:{{ curRow.refFacsName }}</p>
-                  </div>
-                </el-card>
-                <el-card class="box-card" style="margin-top: 10px">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">状态属性</span>
-                  </div>
-                  <div>
-                    <p v-for="attr in statusAttr" :key="attr.attr">{{ attr.attr }}:{{ attr.attrValue }} {{
-                        attr.attrUnit
-                      }}</p>
-                  </div>
-                </el-card>
-                <!-- 属性信息 -->
-                <el-card class="box-card" v-if="attrData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">属性定义</span>
-                  </div>
-                  <div v-for="(item, index) in attrData" :key="index">
-                    <p>属性名称:{{ item.attrName }}</p>
-                    <p>属性值:{{ item.attrValue }}</p>
-                    <p>属性单位:{{ item.attrUnit }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < attrData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 能力信息 -->
-                <el-card class="box-card" v-if="abilityData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">能力定义</span>
-                  </div>
-                  <div v-for="(item, index) in abilityData" :key="index">
-                    <p>能力名称:{{ item.abilityName }}</p>
-                    <p>能力键:{{ item.abilityKey }}</p>
-                    <p>能力参数:{{ item.abilityParam }}</p>
-                    <p>能力描述:{{ item.abilityDesc }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < abilityData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 事件信息 -->
-                <el-card class="box-card" v-if="eventData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">事件定义</span>
-                  </div>
-                  <div v-for="(item, index) in eventData" :key="index">
-                    <p>事件名称:{{ item.eventKey }}</p>
-                    <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
-                    <p>事件代码:{{ item.eventCode }}</p>
-                    <p>外部事件代码:{{ item.extEventCode }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < eventData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
+
+              <div style="display: flex; align-items: center; gap: 15px;">
+                <el-input-number
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :step="1"
+                  :precision="0"
+                  controls-position="right"
+                  style="flex: 0 0 120px;">
+                </el-input-number>
+                <span style="color: #909399; font-size: 13px;">
+                  调节范围:{{ abilitySliderMin }} - {{ abilitySliderMax }}
+                </span>
               </div>
-            </el-dialog>
-          </div>
-        </div>
-      </el-col>
-    </el-row>
+            </div>
+          </template>
+
+          <template v-else-if="abilityParamType === 'Input'">
+            <el-input
+              v-model="abilityInputValue"
+              placeholder="请输入参数值"
+              clearable>
+            </el-input>
+          </template>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="abilityDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="executeAbilityWithParam" :loading="abilityExecuting">执行</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import {addDevice, delDevice, getDevice, listDevRecursionByArea, updateDevice} from '@/api/device/device'
-import {areaTreeSelect} from '@/api/basecfg/area'
-import {getFacsCategorygetByCode, listAllFacs} from '@/api/basecfg/emsfacs'
-import {listSubsystemAll} from '@/api/adapter/subsystem'
-import {getModelByCode, listAllModel} from '@/api/basecfg/objModel'
-import {getObjAttr} from '@/api/basecfg/objAttribute'
-import {addAttrValueBatch} from '@/api/basecfg/objAttributeValue'
-import {addComponent, delComponent, getComponent, listByDevice, updateComponent} from '@/api/basecfg/component'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
+import { getModelByCode } from '@/api/basecfg/objModel'
+import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
+import { listcallAbility } from '@/api/basecfg/objAbility'
+import { getByCondition } from '@/api/device/device'
+import { listCallLog, listEventLog, getCallLog, getEventLog } from '@/api/basecfg/objLog'
 
 export default {
-  name: 'Device',
-  components: {Treeselect},
+  name: 'SubsystemIntegration',
   data() {
     return {
-      primary1: 'primary',
-      primary2: '',
-      ComponentRow: [],
-      componentForm: {},
-      subcategoryCode: '',
-      attrList: [], // 属性模板数组
-      attrValues: [],
-      ComponentList: [],
-      attrValuesMap: {},
-      modelList: [],
-      showDrawer: false,
-      showDevProcessDrawer: false,
-      componentOpen: false,
-      istable: 2,
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 能源设备表格数据
+      // 系统代码
+      systemCode: 'SYS_GCZR',
+      // 系统信息
+      systemInfo: {},
+      // 系统状态
+      systemStatus: '1',
+      // 当前标签页
+      activeTab: 'attributes',
+      // 协议属性
+      protocolAttrs: [],
+      // 状态属性
+      stateAttrs: [],
+      // 系统能力
+      systemAbilities: [],
+      abilityLoading: false,
+      // 设备列表
       deviceList: [],
-      // 弹出层标题
-      title: '',
-      // 是否显示弹出层
-      open: false,
-      // 区域名称
-      areaName: undefined,
-      // 区域树选项
-      treeAreaOptions: undefined,
-      totalAreaOptions: undefined,
-      // 设施选项
-      facsOptions: undefined,
-      // 设备分类
-      subCategoryOptions: undefined,
-      subsystemOptions: undefined,
-      devOptions: undefined,
-      statusAttr: [{
-        attr: '输入量',
-        attrUnit: 'kW·h',
-        attrValue: '20'
-      },
-        {
-          attr: '输出量',
-          attrUnit: 'kW·h',
-          attrValue: '10'
-        },
-        {
-          attr: '运行状态',
-          attrUnit: '',
-          attrValue: '工作中'
-        }
-      ],
-      defaultProps: {
-        children: 'children',
-        label: 'label'
+      deviceLoading: false,
+      deviceAttrs: {},
+      deviceChannels: {},
+      // 设备能力缓存
+      deviceAbilities: {},
+      // 设备统计
+      deviceStats: {
+        total: 0,
+        online: 0,
+        offline: 0,
+        points: 0
       },
-      // 查询参数
-      queryParams: {
-        psCode: null,
+      // 所有模型代码(系统 + 设备)
+      allModelCodes: [],
+      // 调用日志查询
+      callLogQuery: {
+        dateRange: [],
+        abilityKey: '',
+        callStatus: '',
         pageNum: 1,
-        pageSize: 10,
-        deviceCode: null,
-        deviceSubCategory: '',
-        deviceCategory: 'E',
-        locationType: null,
-        locationRef: null,
-        refFacs: null,
-        customAttrs: null
+        pageSize: 10
       },
-      queryComponentParams: {
+      callLogList: [],
+      callLogTotal: 0,
+      logLoading: false,
+      // 事件日志查询
+      eventLogQuery: {
+        dateRange: [],
+        eventKey: '',
         pageNum: 1,
         pageSize: 10
       },
-      objComTypeMapping: {
-        1: '总开',
-        2: '照明',
-        3: '风机'
-      },
-      objComTypeOptions: [
-        {code: 1, name: '总开'},
-        {code: 2, name: '照明'},
-        {code: 3, name: '风机'}
-
-      ],
-      curRow: {},
-      attrData: [],
-      abilityData: [],
-      eventData: [],
-
-      // 表单参数
-      form: {
-        customAttrs: [] // 自定义属性数组
+      eventLogList: [],
+      eventLogTotal: 0,
+      eventLogLoading: false,
+      // 调用日志详情
+      callLogDetailDialog: false,
+      callLogDetailData: null,
+      // 事件日志详情
+      eventLogDetailDialog: false,
+      eventLogDetailData: null,
+      // 执行结果对话框
+      executeDialog: {
+        visible: false,
+        title: '',
+        status: '',
+        type: 'success',
+        message: '',
+        data: null
       },
-      // 表单校验
-      rules: {
-        refFacs: [
-          {required: true, message: '归属设施', trigger: 'blur'}
-        ],
-        refArea: [
-          {required: true, message: '安装位置', trigger: 'blur'}
-        ],
-        deviceCode: [
-          {required: true, message: '设备代码不能为空', trigger: 'blur'}
-        ],
-        deviceName: [
-          {required: true, message: '设备名称不能为空', trigger: 'blur'}
-        ]
+      // 能力执行相关
+      abilityDialogVisible: false,
+      abilityDialogTitle: '能力执行',
+      abilityForm: {
+        abilityName: '',
+        abilityKey: '',
+        abilityDesc: '',
+        paramDefinition: null,
+        modelCode: ''
       },
-      componentRules: {
-        deviceCode: [
-          {required: true, message: '设备code不能为空', trigger: 'blur'}
-        ],
-        compoCode: [
-          {required: true, message: '部件编码不能为空', trigger: 'blur'}
+      abilityParamType: null,
+      abilitySliderValue: 50,
+      abilitySliderMin: 0,
+      abilitySliderMax: 100,
+      abilityInputValue: '',
+      abilityExecuting: false,
+      currentDevice: null,
+      currentObjType: null,
+      // 编辑系统信息相关
+      editDialogVisible: false,
+      editLoading: false,
+      editForm: {},
+      editRules: {
+        systemCode: [
+          { required: true, message: "系统代码不能为空", trigger: "blur" }
         ],
-        psCode: [
-          {required: true, message: '工艺标签代码不能为空', trigger: 'blur'}
+        systemName: [
+          { required: true, message: "系统名称不能为空", trigger: "blur" }
         ]
       }
     }
   },
-  watch: {
-    // 根据名称筛选区域树
-    areaName(val) {
-      this.$refs.tree.filter(val)
-    }
-  },
   created() {
-    this.queryParams.deviceCategory = 'GCZR'; // 确保初始加载时就设置为 'GCZR'
-    this.getList()
-    this.getAreaTree('0', 1)
-    this.getFacsOptions()
-    this.getSubsystem()
-    this.getSubCategorygetByCode()
-    this.getFacsModel()
-    // this.getAllDevProcess(this.subcategoryCode)
+    this.loadSystemInfo()
+    this.initDateRange()
   },
   methods: {
-    /**分页切换*/
-    switchData(v) {
-      if (v === 1) {
-        this.primary1 = "primary";
-        this.primary2 = "";
-      } else {
-        this.primary1 = "";
-        this.primary2 = "primary";
-      }
-      this.istable = v;
-    },
-    /** 查询能源设备列表 */
-    getList() {
-      this.loading = true
-      listDevRecursionByArea(this.queryParams).then(response => {
-        console.log('参数', JSON.stringify(this.queryParams))
-        this.deviceList = response.rows
-        this.total = response.total
-        this.loading = false
+    // 打开编辑对话框
+    handleEdit() {
+      this.editForm = { ...this.systemInfo }
+      this.editDialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.editForm?.clearValidate()
       })
     },
-    /**新增、修改、删除*/
-    handleComponentAdd() {
-      this.componentReset()
-      this.componentOpen = true
-      this.title = '添加设备器件属性'
-      this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
 
+    // 取消编辑
+    cancelEdit() {
+      this.editDialogVisible = false
+      this.editForm = {}
     },
-    handleComponentUpdate(row) {
-      this.componentReset()
-      const id = row.id || this.ids
-      getComponent(id).then(response => {
-        this.componentForm = response.data
-        this.componentOpen = true
-        this.title = '修改设备器件属性'
-        this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
-      })
-    },
-    handleComponentDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function () {
-        return delComponent(ids)
-      }).then(() => {
-        console.log('删除row', row.deviceCode)
-        this.getComponentList(row.deviceCode)
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    submitComponentForm() {
-      this.$refs['componentForm'].validate(valid => {
+
+    // 提交编辑
+    submitEdit() {
+      this.$refs.editForm.validate(valid => {
         if (valid) {
-          if (this.componentForm.id != null) {
-            updateComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          } else {
-            addComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          }
+          this.editLoading = true
+          updateSubsystem(this.editForm).then(response => {
+            this.$message.success("修改成功")
+            this.editDialogVisible = false
+            // 重新加载系统信息
+            this.loadSystemInfo()
+          }).catch(error => {
+            this.$message.error("修改失败:" + error.message)
+          }).finally(() => {
+            this.editLoading = false
+          })
         }
       })
     },
-    ComponentCancel() {
-      this.componentOpen = false
-      this.componentReset()
-    },
-    /**查询部件列表*/
-    getComponentList(deviceCode) {
-      listByDevice(deviceCode).then(response => {
-        this.ComponentList = response.data
-      })
-    },
-    /** 查询区域树结构 */
-    getAreaTree(areaCode, layer) {
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.treeAreaOptions = [{
-          id: '-1',
-          label: '全部',
-          children: response.data
-        }]
-      })
-    },
-    // 筛选节点
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
+
+    // 格式化滑块tooltip
+    formatTooltip(val) {
+      return `${val}%`
     },
-    // 节点单击事件
-    handleNodeClick(data) {
-      if (data.id === '-1') {
-        this.queryParams.locationType = null;
-        this.queryParams.locationRef = null;
-      } else {
-        this.queryParams.locationType = data.tier;
-        this.queryParams.locationRef = data.id;
+
+    // 解析参数定义类型
+    getParamType(paramDefinition) {
+      if (!paramDefinition) return null
+      try {
+        const def = JSON.parse(paramDefinition)
+        return def.type
+      } catch (e) {
+        return null
       }
-      this.handleQuery();
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false
-      this.reset()
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        deviceCode: null,
-        deviceName: null,
-        deviceType: null,
-        deviceStatus: null,
-        deviceModel: null,
-        refArea: null,
-        refFacs: null,
-        subsystemCode: null,
-        psCode: null,
-        createTime: null,
-        updateTime: null
 
+    // 解析Options类型的选项
+    parseOptions(paramDefinition) {
+      try {
+        const def = JSON.parse(paramDefinition)
+        if (def.type === 'Options' && def.list) {
+          return def.list
+        }
+      } catch (e) {
+        console.error('解析Options失败:', e)
       }
-      this.resetForm('form')
+      return []
     },
-    componentReset() {
-      this.componentForm = {
-        id: null,
-        deviceCode: this.ComponentRow.deviceCode || '', // 使用ComponentRow的deviceCode,或者空字符串
-        compoCode: null,
-        compoTag: null,
-        psCode: null,
-        extCompoCode: null,
-        compoModel: null,
-        compoBrand: null,
-        compoSpec: null,
-        ancestors: null,
-        parentCompo: null
 
+    // 处理系统能力点击
+    handleSystemAbilityClick(ability) {
+      const paramType = this.getParamType(ability.paramDefinition)
+
+      if (paramType === 'Slider') {
+        this.showSliderDialog(ability, this.systemInfo, 3)
+      } else if (paramType === 'Input') {
+        this.showInputDialog(ability, this.systemInfo, 3)
+      } else {
+        this.executeSystemAbility(ability)
       }
-      this.resetForm('componentForm')
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1
-      console.log('搜索按钮this.queryParams', JSON.stringify(this.queryParams))
-      this.getList()
+
+    // 执行系统能力(带Options参数)
+    executeSystemAbilityWithParam(ability, paramValue) {
+      ability.executing = true
+      ability.executingValue = paramValue
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: paramValue
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+        ability.executingValue = null
+      })
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.queryParams.locationType = null
-      this.queryParams.locationRef = null
-      this.resetForm('queryForm')
-      this.handleQuery()
+
+    // 执行系统能力(无参数)
+    executeSystemAbility(ability) {
+      ability.executing = true
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: null
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+
+        if (ability.abilityKey === 'MeterReadingGw') {
+          this.loadDevices()
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+      })
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+
+    // 显示滑块弹窗
+    showSliderDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Slider'
+
+      try {
+        const def = JSON.parse(ability.paramDefinition)
+        this.abilitySliderMin = def.min || 0
+        this.abilitySliderMax = def.max || 100
+        this.abilitySliderValue = Math.floor((this.abilitySliderMin + this.abilitySliderMax) / 2)
+      } catch (e) {
+        console.error('解析Slider参数失败:', e)
+        this.abilitySliderMin = 0
+        this.abilitySliderMax = 100
+        this.abilitySliderValue = 50
+      }
+
+      this.abilityDialogVisible = true
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '添加能源设备'
+
+    // 显示输入弹窗
+    showInputDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Input'
+      this.abilityInputValue = ''
+      this.abilityDialogVisible = true
     },
-    /**设备器件按钮*/
-    handleDevProcess(row) {
-      this.showDevProcessDrawer = true
-      this.ComponentRow = row
-      console.log('row', row)
-      listByDevice(this.ComponentRow.deviceCode).then(response => {
-        this.ComponentList = response.data
+
+    // 执行带参数的能力
+    executeAbilityWithParam() {
+      let paramValue = null
+
+      if (this.abilityParamType === 'Slider') {
+        paramValue = String(this.abilitySliderValue)
+      } else if (this.abilityParamType === 'Input') {
+        if (!this.abilityInputValue) {
+          this.$message.warning('请输入参数值')
+          return
+        }
+        paramValue = this.abilityInputValue
+      }
+
+      this.abilityExecuting = true
+
+      const callParams = {
+        objType: this.currentObjType,
+        abilityKey: this.abilityForm.abilityKey,
+        abilityParam: paramValue
+      }
+
+      if (this.currentObjType === 3) {
+        callParams.objCode = this.systemCode
+        callParams.modelCode = this.systemInfo.modelCode
+      } else if (this.currentObjType === 2) {
+        callParams.objCode = this.currentDevice.deviceCode
+        callParams.modelCode = this.currentDevice.deviceModel
+      }
+
+      listcallAbility(callParams).then(response => {
+        this.$message.success('执行成功')
+        this.abilityDialogVisible = false
+
+        if (this.abilityForm.abilityKey.toLowerCase().includes('meter') ||
+          this.abilityForm.abilityKey.toLowerCase().includes('reading')) {
+          if (this.currentObjType === 3) {
+            this.loadDevices()
+          } else if (this.currentObjType === 2) {
+            this.loadDeviceAttrs(this.currentDevice.deviceCode)
+          }
+        }
+      }).catch(() => {
+        this.$message.error('执行失败')
+      }).finally(() => {
+        this.abilityExecuting = false
       })
+    },
 
+    // 初始化时间范围
+    initDateRange() {
+      const now = new Date()
+      const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
+      const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59)
+
+      this.callLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
+      this.eventLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
     },
-    shouldShowDevProcessButton(row) {
-      const categoryIsW = this.queryParams.deviceCategory === 'W'
-      const validPsCodes = ['AA', 'AH', 'AJ', 'AM', 'AP', 'AL', 'APE', 'ALE', 'AF', 'ACC']
-      const psCodeIsValid = validPsCodes.includes(row.psCode)
-      // 只有当设备分类为输能设备且设备工艺代码有效时,才返回true
-      return categoryIsW && psCodeIsValid
+
+    // 格式化日期
+    formatDate(date) {
+      if (!date) return ''
+      const year = date.getFullYear()
+      const month = (date.getMonth() + 1).toString().padStart(2, '0')
+      const day = date.getDate().toString().padStart(2, '0')
+      const hours = date.getHours().toString().padStart(2, '0')
+      const minutes = date.getMinutes().toString().padStart(2, '0')
+      const seconds = date.getSeconds().toString().padStart(2, '0')
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
     },
-    backStyle(areaPath) {
-      const firstLevel = areaPath.split('/')[0];
-      switch (firstLevel) {
-        case '北区':
-          return 'north';
-        case '南区':
-          return 'south';
-        case '主路':
-          return 'main';
-        default:
-          return '';
+
+    // 加载系统信息
+    async loadSystemInfo() {
+      try {
+        const sysRes = await getSubsystemByCode(this.systemCode)
+        this.systemInfo = sysRes.data
+
+        if (this.systemInfo.modelCode) {
+          this.allModelCodes.push(this.systemInfo.modelCode)
+
+          const modelRes = await getModelByCode(this.systemInfo.modelCode)
+          const modelData = modelRes.data
+
+          this.systemAbilities = (modelData.abilityList || []).map(item => ({
+            ...item,
+            executing: false,
+            executingValue: null
+          }))
+        }
+
+        const attrRes = await getObjAttr(3, this.systemCode)
+        const attrData = attrRes.data
+
+        this.protocolAttrs = attrData.Protocol || []
+        this.stateAttrs = attrData.State || []
+
+        const statusAttr = this.stateAttrs.find(attr => attr.attrKey === 'interfaceStatus')
+        if (statusAttr) {
+          this.systemStatus = statusAttr.attrValue
+        }
+
+        await this.loadDevices()
+      } catch (error) {
+        this.$message.error('加载系统信息失败:' + error.message)
       }
     },
-    /**设备详情按钮*/
-    handleDetail(row) {
-      this.showDrawer = true
-      this.curRow = row
-      console.log('data', this.curRow)
-      this.subKey = this.$options.data().subKey
-      getModelByCode(this.curRow.facsModel).then(response => {
-        const code = response.data
-        console.log('code', code)
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
 
-      })
-      getObjAttr(2, this.curRow.deviceCode).then(response => {
-        console.log('response值', response.data)
-        const attrs = response.data.attrs
-        const attrValues = response.data.attrValues
-
-        // 合并 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 : ''
+    // 加载设备列表
+    async loadDevices() {
+      this.deviceLoading = true
+      try {
+        const res = await getByCondition({
+          subsystemCode: this.systemCode
+        })
+
+        const deviceData = res.data || res.rows || []
+
+        this.deviceList = deviceData.map(device => ({
+          ...device,
+          detailTab: 'attrs'
+        }))
+
+        const deviceModelCodes = new Set()
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            deviceModelCodes.add(device.deviceModel)
           }
         })
-        this.attrData = mergedData
-      })
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset()
-      const id = row.id || this.ids
-      getDevice(id).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改能源设备'
-      })
-      const layer = 1
-      const areaCode = '0'
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.totalAreaOptions = response.data
-      })
-    },
-    /** 提交按钮 */
-    submitForm() {
-      // 重置 attrList 和 form.customAttrs
-      if (!this.attrList) {
-        this.attrList = []
-      }
-      if (!this.form.customAttrs) {
-        this.form.customAttrs = []
-      }
-      // 准备要发送的数据
-      let dataToSubmit = []
-      // 添加模型属性数据
-      this.attrList.forEach(attr => {
-        const attrName = attr.attrName
-        const attrKey = attr.attrKey
-        const attrValue = this.attrValuesMap[attrKey]
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
 
-          })
-        }
-      })
+        deviceModelCodes.forEach(modelCode => {
+          if (!this.allModelCodes.includes(modelCode)) {
+            this.allModelCodes.push(modelCode)
+          }
+        })
 
-      // 添加自定义属性数据
-      this.form.customAttrs.forEach(customAttr => {
-        const attrName = customAttr.attrName
-        const attrKey = customAttr.attrKey
-        const attrValue = customAttr.attrValue
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: '', // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
-          })
+        this.deviceStats.total = this.deviceList.length
+        this.deviceStats.online = this.deviceList.filter(d => d.deviceStatus === 1).length
+        this.deviceStats.offline = this.deviceList.filter(d => d.deviceStatus !== 1).length
+
+        const devicesByModel = {}
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            if (!devicesByModel[device.deviceModel]) {
+              devicesByModel[device.deviceModel] = []
+            }
+            devicesByModel[device.deviceModel].push(device)
+          }
+        })
+
+        for (const modelCode in devicesByModel) {
+          await this.loadDeviceAttrsBatch(modelCode, devicesByModel[modelCode])
         }
-      })
+      } catch (error) {
+        this.$message.error('加载设备列表失败')
+      } finally {
+        this.deviceLoading = false
+      }
+    },
 
-      this.$refs['form'].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateDevice(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            }).catch(error => {
-              console.error('修改失败:', error)
-              this.$message.error('修改失败')
-            })
+    // 批量加载设备属性
+    async loadDeviceAttrsBatch(modelCode, devices) {
+      try {
+        const res = await getObjAttrBatch(2, modelCode)
+        const batchData = res.data || {}
 
-            if (dataToSubmit.length > 0) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
-                  }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+        let totalPoints = 0
+
+        devices.forEach(device => {
+          const deviceCode = device.deviceCode
+          const attrData = batchData[deviceCode]
+
+          if (attrData) {
+            const baseAttrs = {}
+            if (attrData.Base) {
+              attrData.Base.forEach(attr => {
+                baseAttrs[attr.attrKey] = attr.attrValue
               })
             }
-          } 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) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
+            this.deviceAttrs[deviceCode] = baseAttrs
+
+            const channels = []
+            if (attrData.Measure) {
+              attrData.Measure.forEach(attr => {
+                if (attr.attrKey.startsWith('interface')) {
+                  try {
+                    const points = JSON.parse(attr.attrValue || '[]')
+                    channels.push({
+                      name: attr.attrName,
+                      key: attr.attrKey,
+                      points: points
+                    })
+                    totalPoints += points.length
+                  } catch (e) {
+                    console.error(`解析设备 ${deviceCode} 的测点数据失败:`, e)
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+                }
               })
-            } else {
-              // this.$message.info('没有属性需要添加');
             }
+            this.deviceChannels[deviceCode] = channels
           }
+        })
+
+        this.deviceStats.points += totalPoints
+      } catch (error) {
+        console.error(`批量加载模型 ${modelCode} 的设备属性失败:`, error)
+        for (const device of devices) {
+          await this.loadDeviceAttrs(device.deviceCode)
         }
-      })
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源设备编号为"' + ids + '"的数据项?').then(function () {
-        return delDevice(ids)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('ems/basecfg/device/export', {
-        ...this.queryParams
-      }, `device_${new Date().getTime()}.xlsx`)
-    },
-    getFacsOptions() {
-      const getFacsParams = {
-        facsCategory: this.queryParams.deviceCategory,
-        subCategory: this.queryParams.deviceSubCategory
       }
-      listAllFacs(getFacsParams).then(response => {
-        this.facsOptions = response.data
-      })
-    },
-    getSubCategorygetByCode() {
-      getFacsCategorygetByCode(this.queryParams.deviceCategory).then(response => {
-        this.subCategoryOptions = response.data.subtypeList || []
-      })
-    },
-    getSubsystem() {
-      listSubsystemAll().then(response => {
-        this.subsystemOptions = response.data
-      })
     },
-    /**自定义属性表格*/
-    addCustomAttr() {
-      // 添加一个新的自定义属性
-      if (!Array.isArray(this.form.customAttrs)) {
-        this.form.customAttrs = []
-      }
-      this.form.customAttrs.push({
-        attrKey: '',
-        attrName: '',
-        attrValue: ''
-      })
-      // 强制更新视图
-      this.$forceUpdate()
 
-    },
-    deleteCustomAttr(index) {
-      // 删除指定索引的自定义属性
-      if (this.form.customAttrs.length > 0) {
-        this.form.customAttrs.splice(index, 1)
+    // 单个加载设备属性
+    async loadDeviceAttrs(deviceCode) {
+      try {
+        const res = await getObjAttr(2, deviceCode)
+        const attrData = res.data
+
+        const baseAttrs = {}
+        if (attrData.Base) {
+          attrData.Base.forEach(attr => {
+            baseAttrs[attr.attrKey] = attr.attrValue
+          })
+        }
+        this.deviceAttrs[deviceCode] = baseAttrs
+
+        const channels = []
+        let pointsCount = 0
+        if (attrData.Measure) {
+          attrData.Measure.forEach(attr => {
+            if (attr.attrKey.startsWith('interface')) {
+              try {
+                const points = JSON.parse(attr.attrValue || '[]')
+                channels.push({
+                  name: attr.attrName,
+                  key: attr.attrKey,
+                  points: points
+                })
+                pointsCount += points.length
+              } catch (e) {
+                console.error(`解析测点数据失败:`, e)
+              }
+            }
+          })
+        }
+
+        if (!this.deviceChannels[deviceCode]) {
+          this.deviceStats.points += pointsCount
+        }
+
+        this.deviceChannels[deviceCode] = channels
+      } catch (error) {
+        console.error(`加载设备 ${deviceCode} 属性失败:`, error)
       }
+    },
 
+    // 获取设备属性
+    getDeviceAttr(deviceCode, attrKey) {
+      return this.deviceAttrs[deviceCode]?.[attrKey] || '-'
     },
-    /**设备模型*/
-    updateAttrValue(attrKey, newValue) {
-      this.attrValuesMap[attrKey] = newValue
+
+    // 获取设备通道
+    getDeviceChannels(deviceCode) {
+      return this.deviceChannels[deviceCode] || []
     },
 
-    getFacsModel() {
-      listAllModel(2).then(response => {
-        this.modelList = response.data
-        console.log('this.modelList', this.modelList)
-        this.modelList.forEach(model => {
-          console.log(model.modelCode)
-        })
-      })
+    // 加载设备能力
+    async handleAbilityLoad(visible, device) {
+      if (visible && !this.deviceAbilities[device.deviceCode]) {
+        try {
+          if (!device.deviceModel) {
+            this.$set(this.deviceAbilities, device.deviceCode, [])
+            return
+          }
+
+          const res = await getModelByCode(device.deviceModel)
+          const abilities = res.data?.abilityList?.filter(item => item.hiddenFlag === 1) || []
+          this.$set(this.deviceAbilities, device.deviceCode, abilities)
+        } catch (error) {
+          this.$set(this.deviceAbilities, device.deviceCode, [])
+        }
+      }
     },
-    handleModelChange(modelCode) {
-      if (modelCode) {
-        this.getModelByCode(modelCode)
-        console.log('设备代码', this.form.deviceCode)
-        this.getObjAttr(2, this.form.deviceCode)
+
+    // 处理设备操作命令
+    async handleDeviceCommand(command) {
+      const { device, ability, paramValue } = command
+
+      if (paramValue !== undefined) {
+        try {
+          await listcallAbility({
+            objCode: device.deviceCode,
+            objType: 2,
+            modelCode: device.deviceModel,
+            abilityKey: ability.abilityKey,
+            abilityParam: paramValue
+          })
+
+          this.$message.success(`${ability.abilityName}执行成功`)
+
+          if (ability.abilityKey.toLowerCase().includes('meter') ||
+            ability.abilityKey.toLowerCase().includes('reading')) {
+            await this.loadDeviceAttrs(device.deviceCode)
+          }
+        } catch (error) {
+          this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+        }
+      } else {
+        const paramType = this.getParamType(ability.paramDefinition)
+
+        if (paramType === 'Slider') {
+          this.showSliderDialog(ability, device, 2)
+        } else if (paramType === 'Input') {
+          this.showInputDialog(ability, device, 2)
+        } else {
+          try {
+            await listcallAbility({
+              objCode: device.deviceCode,
+              objType: 2,
+              modelCode: device.deviceModel,
+              abilityKey: ability.abilityKey,
+              abilityParam: null
+            })
+
+            this.$message.success(`${ability.abilityName}执行成功`)
+
+            if (ability.abilityKey.toLowerCase().includes('meter') ||
+              ability.abilityKey.toLowerCase().includes('reading')) {
+              await this.loadDeviceAttrs(device.deviceCode)
+            }
+          } catch (error) {
+            this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+          }
+        }
       }
     },
-    getModelByCode(modelCode) {
-      getModelByCode(modelCode).then(response => {
-        // this.attrList = response.data.attrList;
-        const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
-        this.attrList = filteredAttrList
 
-      })
+    // 处理设备行点击
+    handleDeviceClick(row) {
+      this.$refs.deviceTable?.toggleRowExpansion(row)
     },
-    getObjAttr(objType, deviceCode) {
-      getObjAttr(objType, deviceCode).then(response => {
-        // const attrs = response.data.attrs;
-        const attrs = response.data.attrs.filter(attr => attr.attrType === 0)
-        console.log('attrs', attrs)
-        const attrValues = response.data.attrValues || [] // 确保是一个数组
-        console.log('attrValues', attrValues)
-
-        // 创建一个映射对象,用于存储 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] = ''
-          }
-        })
 
-        // 更新 attrValuesMap 到组件的数据中
-        this.attrValuesMap = attrValuesMap
-        // 打印更新后的 attrValuesMap,用于调试
-        console.log('Updated attrValuesMap', this.attrValuesMap)
+    // 标签页切换
+    handleTabClick(tab) {
+      if (tab.name === 'callLogs' && this.callLogList.length === 0) {
+        this.queryCallLogs()
+      } else if (tab.name === 'eventLogs' && this.eventLogList.length === 0) {
+        this.queryEventLogs()
+      }
+    },
 
-      })
-    }
-  }
-}
-</script>
-<style lang="scss" scoped>
+    // 查询调用日志
+    async queryCallLogs() {
+      this.logLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.callLogQuery.pageNum,
+          pageSize: this.callLogQuery.pageSize
+        }
 
-.divider {
-  border-bottom: 2px solid #ebeef5;
-  margin: 10px 0;
-}
+        if (this.callLogQuery.dateRange && this.callLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.callLogQuery.dateRange[0]
+          params.endRecTime = this.callLogQuery.dateRange[1]
+        }
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-  margin-top: 20px;
-  margin-bottom: 10px;
-}
+        if (this.callLogQuery.abilityKey) {
+          params.abilityKey = this.callLogQuery.abilityKey
+        }
 
-.drawer-content {
-  padding: 0 20px;
-}
+        if (this.callLogQuery.callStatus !== '') {
+          params.callStatus = this.callLogQuery.callStatus
+        }
 
+        const res = await listCallLog(params)
+        this.callLogList = res.rows || []
+        this.callLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询调用日志失败')
+      } finally {
+        this.logLoading = false
+      }
+    },
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-}
+    // 重置调用日志查询
+    resetCallLogQuery() {
+      this.initDateRange()
+      this.callLogQuery.abilityKey = ''
+      this.callLogQuery.callStatus = ''
+      this.callLogQuery.pageNum = 1
+      this.queryCallLogs()
+    },
 
-.attr-list-container {
-  border: 1px solid #ccc;
-  padding: 10px;
-  margin: 10px 0;
-  font-weight: bold;
-}
+    // 查询事件日志
+    async queryEventLogs() {
+      this.eventLogLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.eventLogQuery.pageNum,
+          pageSize: this.eventLogQuery.pageSize
+        }
 
-.attr-list-container h3 {
-  font-weight: bold;
-}
+        if (this.eventLogQuery.dateRange && this.eventLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.eventLogQuery.dateRange[0]
+          params.endRecTime = this.eventLogQuery.dateRange[1]
+        }
 
-.attr-item {
-  list-style-type: none;
-  margin-bottom: 5px;
-}
+        if (this.eventLogQuery.eventKey) {
+          params.eventKey = this.eventLogQuery.eventKey
+        }
 
-.attr-name {
-  font-weight: bold;
-}
+        const res = await listEventLog(params)
+        this.eventLogList = res.rows || []
+        this.eventLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询事件日志失败')
+      } finally {
+        this.eventLogLoading = false
+      }
+    },
 
+    // 重置事件日志查询
+    resetEventLogQuery() {
+      this.initDateRange()
+      this.eventLogQuery.eventKey = ''
+      this.eventLogQuery.pageNum = 1
+      this.queryEventLogs()
+    },
 
-.contents {
-  border: 20px solid #f2f2f5;
-  background-color: #f2f2f5;
-}
+    // 格式化调用状态
+    formatCallStatus(status) {
+      const statusMap = {
+        0: '成功',
+        1: '进行中',
+        2: '失败'
+      }
+      return statusMap[status] || '未知'
+    },
 
+    // 获取调用状态类型
+    getCallStatusType(status) {
+      const typeMap = {
+        0: 'success',
+        1: 'warning',
+        2: 'danger'
+      }
+      return typeMap[status] || 'info'
+    },
 
-.other-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-  margin-bottom: 20px;
+    // 查看调用日志详情
+    async handleCallLogDetail(row) {
+      try {
+        const res = await getCallLog(row.id)
+        this.callLogDetailData = res.data
+        this.callLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取调用日志详情失败')
+      }
+    },
+
+    // 查看事件日志详情
+    async handleEventLogDetail(row) {
+      try {
+        const res = await getEventLog(row.id)
+        this.eventLogDetailData = res.data
+        this.eventLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取事件日志详情失败')
+      }
+    }
+  }
 }
+</script>
 
-.table-content {
-  background-color: #ffffff; /* 白色背景 */
+<style lang="scss" scoped>
+.app-container {
   padding: 20px;
+  background: #f5f7fa;
+  min-height: calc(100vh - 84px);
 }
 
-.pagination-container {
+.system-info-card {
   margin-bottom: 20px;
-}
 
-.button-group-container {
-  display: flex;
-  justify-content: flex-end;
-  min-width: 200px;
-  padding: 5px;
-}
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
 
-.device-list {
-  margin-top: 20px;
-}
+    .title {
+      font-size: 18px;
+      font-weight: bold;
 
-.device-card {
-  background-color: #fff;
-  border: 1px solid #bfcbd9;
-  border-radius: 4px;
-  overflow: hidden;
-  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  transition: 0.3s;
-  padding: 10px;
-  font-size: 14px;
-  height: 200px;
-  margin-bottom: 20px;
-  display: flex;
-  flex-direction: column;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
+  }
 
-.device-header {
-  //background-color: #f2f2f5;
-  //padding: 10px;
-  color: #545353;
-  font-size: 20px;
-  font-weight: bold;
-}
+  .info-group {
+    .group-title {
+      font-size: 14px;
+      font-weight: bold;
+      color: #606266;
+      margin-bottom: 12px;
+      padding-bottom: 6px;
+      border-bottom: 1px solid #EBEEF5;
+    }
+  }
 
-.device-code {
-  color: cornflowerblue;
-}
+  .info-item {
+    margin-bottom: 12px;
+    font-size: 14px;
 
-.deviceOthers {
-  color: black;
-}
+    label {
+      color: #909399;
+      margin-right: 8px;
+      display: inline-block;
+      min-width: 80px;
+    }
 
-.device-body {
-  padding: 10px;
-  color: #666666;
-  flex: 1; /* 使设备主体内容占据剩余空间 */
-  overflow-y: auto; /* 如果内容过多,允许滚动 */
-}
+    .code {
+      font-family: monospace;
+      color: #409EFF;
+      background: #f0f9ff;
+      padding: 2px 6px;
+      border-radius: 3px;
+    }
 
-.device-footer {
-  display: flex;
-  justify-content: space-between;
-  padding: 5px;
-  // background-color: #f9f9f9;
+    .stat-number {
+      color: #409EFF;
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
 }
 
-.device-footer .el-button {
-  padding: 5px 15px;
-  border: none; /* 移除默认边框 */
-  color: #5a5e66;
-  transition: background-color 0.3s; /* 平滑过渡背景色变化 */
-}
+.detail-card {
+  .tab-content {
+    min-height: 400px;
+  }
 
-/* 为按钮分配不同的颜色 */
-.device-footer .el-button:first-child {
-  background-color: #d5f1d5; /* 淡绿色 */
-  border: 1px solid lightgreen;
-  color: #71e2aa;
+  .attr-section {
+    margin-bottom: 30px;
 
-}
+    .section-title {
+      margin: 20px 0 15px 0;
+      color: #303133;
 
-.device-footer .el-button:nth-child(2) {
-  background-color: #ffe5b4; /* 淡橙色 */
-  border: 1px solid #ffba00;
-  color: #faad14;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
 
-.device-footer .el-button:last-child {
-  background-color: #ffd5d5; /* 淡红色 */
-  border: 1px solid lightpink;
-  color: #f5222d;
-}
+    .url-text {
+      color: #409EFF;
+      font-family: monospace;
+    }
+  }
 
-/* 鼠标悬停时加深颜色 */
-.device-footer .el-button:hover {
-  filter: brightness(0.5); /* 颜色加深效果 */
-}
+  .device-stats {
+    margin-bottom: 20px;
+
+    .stat-item {
+      text-align: center;
+      padding: 20px;
+      background: #fff;
+      border: 1px solid #EBEEF5;
+      border-radius: 4px;
+
+      .stat-value {
+        font-size: 28px;
+        font-weight: bold;
+        color: #303133;
+        margin-bottom: 8px;
+      }
+
+      .stat-label {
+        font-size: 14px;
+        color: #909399;
+      }
+
+      &.online .stat-value {
+        color: #67C23A;
+      }
+
+      &.offline .stat-value {
+        color: #F56C6C;
+      }
+    }
+  }
 
-/* 背景色样式 */
-.north {
-  background: linear-gradient(to right, #e1f3d8, #fafafa);
+  .device-detail {
+    padding: 20px;
+    background: #f5f7fa;
+
+    h5 {
+      margin: 15px 0 10px 0;
+      color: #303133;
+    }
+  }
+
+  .log-filter {
+    margin-bottom: 20px;
+    padding: 15px;
+    background: #f5f7fa;
+    border-radius: 4px;
+  }
 }
 
-.south {
-  background: linear-gradient(to right, #fff7e8, #fafafa);
+.execute-result {
+  .result-data {
+    margin-top: 20px;
+
+    pre {
+      background: #f5f7fa;
+      padding: 15px;
+      border-radius: 4px;
+      overflow: auto;
+      max-height: 400px;
+      font-family: monospace;
+      font-size: 12px;
+    }
+  }
 }
 
-.main {
-  background: linear-gradient(to right, #e0e0e0, #fafafa);
+.dialog-footer {
+  text-align: right;
 }
 
+::v-deep .el-dropdown-menu {
+  .el-submenu__title {
+    padding-right: 40px !important;
 
-.el-table {
-  background-color: #ffffff; /* 白色背景 */
-}
+    &:hover {
+      background-color: #f5f7fa;
+    }
+  }
 
-.el-card {
-  background-color: #ffffff; /* 白色背景 */
+  .el-submenu__icon-arrow {
+    position: absolute;
+    right: 20px;
+  }
 }
 </style>

+ 1393 - 1110
ems-ui-cloud/src/views/adapter/hm/index.vue

@@ -1,1258 +1,1541 @@
 <template>
   <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="4" :xs="24">
-        <div class="head-container">
-          <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-                    style="margin-bottom: 20px"
-          />
-        </div>
-        <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
-          <el-tree :data="treeAreaOptions" :props="defaultProps" :expand-on-click-node="false"
-                   :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-                   @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"
-          />
-        </div>
-      </el-col>
-      <el-col :span="20" :xs="24">
-        <div class="contents">
-          <div class="other-content">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
-                     label-width="68px"
-            >
-              <el-form-item label="设备分类" prop="deviceSubCategory">
-                <el-select v-model="queryParams.deviceSubCategory">
-                  <el-option v-for="item in subCategoryOptions" placeholder="设备分类" :label="item.name" :value="item.code"
-                             :key="item.code"
-                  />
-                </el-select>
+    <!-- 系统基础信息卡片 - 添加编辑按钮 -->
+    <el-card class="system-info-card">
+      <div slot="header" class="card-header">
+        <span class="title">
+          <i class="el-icon-s-platform"></i>
+          垃圾厨余监测
+        </span>
+        <el-tag :type="systemStatus === '1' ? 'success' : 'danger'" effect="dark">
+          {{ systemStatus === '1' ? '正常' : '异常' }}
+        </el-tag>
+      </div>
+
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">系统信息</div>
+            <div class="info-item">
+              <label>系统代码:</label>
+              <span class="code">{{ systemInfo.systemCode }}</span>
+            </div>
+            <div class="info-item">
+              <label>系统名称:</label>
+              <span>{{ systemInfo.systemName }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">厂商信息</div>
+            <div class="info-item">
+              <label>对接厂商:</label>
+              <span>{{ systemInfo.manFacturer || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系人:</label>
+              <span>{{ systemInfo.contactPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系电话:</label>
+              <span>{{ systemInfo.contactNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">维护信息</div>
+            <div class="info-item">
+              <label>维护人:</label>
+              <span>{{ systemInfo.maintainerPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>维护电话:</label>
+              <span>{{ systemInfo.maintainerNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">设备统计</div>
+            <div class="info-item">
+              <label>设备总数:</label>
+              <span class="stat-number">{{ deviceStats.total }}</span>
+            </div>
+            <div class="info-item">
+              <label>在线设备:</label>
+              <span class="stat-number">{{ deviceStats.online }}</span>
+            </div>
+            <div class="info-item">
+              <label>测点总数:</label>
+              <span class="stat-number">{{ deviceStats.points }}</span>
+            </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEdit"
+                v-hasPermi="['ems:subsystem:edit']">
+                编辑
+              </el-button>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <!-- 系统详情标签页 -->
+    <el-card class="detail-card">
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+        <!-- 系统属性标签页 -->
+        <el-tab-pane label="系统属性" name="attributes">
+          <div class="tab-content">
+            <!-- 协议属性 -->
+            <div class="attr-section" v-if="protocolAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-connection"></i>
+                协议信息
+              </h4>
+              <el-table :data="protocolAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.attrKey === 'url'" class="url-text">
+                      {{ scope.row.attrValue }}
+                    </span>
+                    <span v-else>{{ scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+
+            <!-- 状态属性 -->
+            <div class="attr-section" v-if="stateAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-info"></i>
+                状态信息
+              </h4>
+              <el-table :data="stateAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <el-tag v-if="scope.row.attrKey === 'interfaceStatus'"
+                            :type="scope.row.attrValue === '1' ? 'success' : 'danger'">
+                      {{ scope.row.attrValueName }}
+                    </el-tag>
+                    <span v-else>{{ scope.row.attrValueName || scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="updateTime" label="更新时间" width="180"></el-table-column>
+              </el-table>
+            </div>
+          </div>
+        </el-tab-pane>
+
+        <!-- 系统能力标签页 -->
+        <el-tab-pane label="系统能力" name="abilities">
+          <div class="tab-content">
+            <el-table :data="systemAbilities" border stripe v-loading="abilityLoading">
+              <el-table-column prop="abilityName" label="能力名称" width="200"></el-table-column>
+              <el-table-column prop="abilityKey" label="能力标识" width="180"></el-table-column>
+              <el-table-column prop="abilityDesc" label="能力描述"></el-table-column>
+              <el-table-column label="操作" width="200" align="center">
+                <template slot-scope="scope">
+                  <div v-if="getParamType(scope.row.paramDefinition) === 'Options'" style="display: inline-block;">
+                    <el-button-group>
+                      <el-button
+                        v-for="option in parseOptions(scope.row.paramDefinition)"
+                        :key="option.value"
+                        size="mini"
+                        type="primary"
+                        @click="executeSystemAbilityWithParam(scope.row, option.value)"
+                        :loading="scope.row.executing && scope.row.executingValue === option.value">
+                        {{ option.key }}
+                      </el-button>
+                    </el-button-group>
+                  </div>
+                  <el-button
+                    v-else
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-caret-right"
+                    @click="handleSystemAbilityClick(scope.row)"
+                    :loading="scope.row.executing">
+                    执行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 关联设备标签页 -->
+        <el-tab-pane label="关联设备" name="devices">
+          <div class="tab-content">
+            <!-- 设备统计 -->
+            <div class="device-stats">
+              <el-row :gutter="20">
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.total }}</div>
+                    <div class="stat-label">设备总数</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item online">
+                    <div class="stat-value">{{ deviceStats.online }}</div>
+                    <div class="stat-label">在线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item offline">
+                    <div class="stat-value">{{ deviceStats.offline }}</div>
+                    <div class="stat-label">离线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.points }}</div>
+                    <div class="stat-label">测点总数</div>
+                  </div>
+                </el-col>
+              </el-row>
+            </div>
+
+            <!-- 设备列表 -->
+            <el-table
+              :data="deviceList"
+              border
+              stripe
+              v-loading="deviceLoading"
+              @row-click="handleDeviceClick"
+              ref="deviceTable">
+              <el-table-column type="expand">
+                <template slot-scope="props">
+                  <div class="device-detail">
+                    <el-tabs v-model="props.row.detailTab">
+                      <el-tab-pane label="设备属性" name="attrs">
+                        <el-descriptions :column="2" border size="small">
+                          <el-descriptions-item label="IP地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'ip') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="网关地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'gateway') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="子网掩码">
+                            {{ getDeviceAttr(props.row.deviceCode, 'subnetMask') }}
+                          </el-descriptions-item>
+                        </el-descriptions>
+                      </el-tab-pane>
+                      <el-tab-pane label="测点信息" name="points">
+                        <div v-for="(channel, idx) in getDeviceChannels(props.row.deviceCode)" :key="idx">
+                          <h5>{{ channel.name }} ({{ channel.points.length }}个测点)</h5>
+                          <el-table :data="channel.points" size="mini" max-height="200">
+                            <el-table-column prop="name" label="测点名称"></el-table-column>
+                            <el-table-column prop="key" label="测点标识"></el-table-column>
+                            <el-table-column prop="value" label="当前值">
+                              <template slot-scope="scope">
+                                {{ scope.row.value || '-' }}
+                              </template>
+                            </el-table-column>
+                            <el-table-column prop="updateTime" label="更新时间"></el-table-column>
+                          </el-table>
+                        </div>
+                      </el-tab-pane>
+                    </el-tabs>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="deviceCode" label="设备代码" width="150"></el-table-column>
+              <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+              <el-table-column prop="location" label="安装位置"></el-table-column>
+              <el-table-column prop="areaCode" label="区域" width="150">
+                <template slot-scope="scope">
+                  {{ scope.row.areaCode.includes('3001') ? '北区' : '南区' }}
+                </template>
+              </el-table-column>
+              <el-table-column label="设备状态" width="100" align="center">
+                <template slot-scope="scope">
+                  <el-tag :type="scope.row.deviceStatus === 1 ? 'success' : 'info'">
+                    {{ scope.row.deviceStatus === 1 ? '在线' : '离线' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="120" align="center">
+                <template slot-scope="scope">
+                  <el-dropdown
+                    trigger="click"
+                    @command="handleDeviceCommand"
+                    @visible-change="(visible) => handleAbilityLoad(visible, scope.row)">
+                    <el-button type="text" size="mini">
+                      操作<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                      <template v-if="deviceAbilities[scope.row.deviceCode] && deviceAbilities[scope.row.deviceCode].length > 0">
+                        <template v-for="ability in deviceAbilities[scope.row.deviceCode]">
+                          <el-submenu
+                            v-if="getParamType(ability.paramDefinition) === 'Options'"
+                            :key="ability.abilityKey"
+                            :index="ability.abilityKey">
+                            <template slot="title">
+                              {{ ability.abilityName }}
+                              <i class="el-icon-arrow-right" style="float: right;"></i>
+                            </template>
+                            <el-dropdown-item
+                              v-for="option in parseOptions(ability.paramDefinition)"
+                              :key="option.value"
+                              :command="{device: scope.row, ability: ability, paramValue: option.value}">
+                              {{ option.key }}
+                            </el-dropdown-item>
+                          </el-submenu>
+                          <el-dropdown-item
+                            v-else
+                            :key="ability.abilityKey"
+                            :command="{device: scope.row, ability: ability}">
+                            {{ ability.abilityName }}
+                          </el-dropdown-item>
+                        </template>
+                      </template>
+                      <el-dropdown-item v-else disabled>
+                        无可用操作
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 调用日志标签页 -->
+        <el-tab-pane label="调用日志" name="callLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="callLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="callLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
               </el-form-item>
-              <el-form-item label="归属设施" prop="refFacs">
-                <el-select v-model="queryParams.refFacs">
-                  <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                             :key="item.facsCode"
-                  />
-                </el-select>
+              <el-form-item label="能力标识">
+                <el-input v-model="callLogQuery.abilityKey" placeholder="请输入能力标识" clearable></el-input>
               </el-form-item>
-              <el-form-item label="子系统" prop="subsystemCode">
-                <el-select v-model="queryParams.subsystemCode">
-                  <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                             :key="item.systemCode"
-                  />
+              <el-form-item label="调用状态">
+                <el-select v-model="callLogQuery.callStatus" placeholder="全部" clearable>
+                  <el-option label="成功" :value="0"></el-option>
+                  <el-option label="进行中" :value="1"></el-option>
+                  <el-option label="失败" :value="2"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item>
-                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                <el-button type="primary" @click="queryCallLogs">查询</el-button>
+                <el-button @click="resetCallLogQuery">重置</el-button>
               </el-form-item>
             </el-form>
 
-            <el-row :gutter="10" class="mb8">
-              <el-col :span="1.5">
-                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-                           v-hasPermi="['ems:device:add']"
-                >新增
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-                           v-hasPermi="['ems:device:edit']"
-                >修改
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
-                           v-hasPermi="['ems:device:remove']"
-                >删除
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-                           v-hasPermi="['ems:device:export']"
-                >导出
-                </el-button>
-              </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-            </el-row>
-          </div>
-
-          <div class="table-content">
-            <!--分页-->
-            <div class="button-group-container">
-              <el-button-group>
-                <el-button :type="primary1" icon="el-icon-s-fold" @click="switchData(1)" />
-                <el-button :type="primary2" icon="el-icon-menu" @click="switchData(2)" />
-              </el-button-group>
-            </div>
-
-            <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange" v-if="istable === 1">
-              <el-table-column type="selection" width="55" align="center"/>
-              <el-table-column label="设备名称" align="left" prop="deviceName"/>
-              <el-table-column label="安装位置" align="left" prop="areaPath" width="220px"/>
-              <el-table-column label="归属设施" align="center" prop="refFacsName"/>
-              <el-table-column label="设备分类" align="center" prop="deviceCategoryName"/>
-              <el-table-column label="子系统" align="center" prop="subsystemName"/>
-              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <el-table :data="callLogList" border stripe v-loading="logLoading">
+              <el-table-column prop="objCode" label="对象代码" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="abilityName" label="能力名称" min-width="150"></el-table-column>
+              <el-table-column prop="callTime" label="调用时间" width="180"></el-table-column>
+              <el-table-column label="调用状态" width="100" align="center">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDevProcess(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']" v-if="shouldShowDevProcessButton(scope.row)"
-                  >
-                    器件
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    详情
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    修改
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                             @click="handleDelete(scope.row)" v-hasPermi="['basecfg:device:remove']"
-                  >
-                    删除
-                  </el-button>
-
+                  <el-tag size="small" :type="getCallStatusType(scope.row.callStatus)">
+                    {{ formatCallStatus(scope.row.callStatus) }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleCallLogDetail(scope.row)">详情</el-button>
                 </template>
               </el-table-column>
             </el-table>
 
-            <div v-else-if="istable === 2" >
-              <el-row :gutter="20" class="device-list">
-                <el-col v-for="device in deviceList" :key="device.id" :span="6">
-                  <div :class="`device-card ${backStyle(device.areaPath)}`">
-                    <div class="device-header">
-                      <i class="el-icon-s-operation" style="margin-right: 8px;"></i>
-                      {{ device.deviceName }}
-                    </div>
-                    <div class="device-body">
-                      <p>设备代码:<span class="device-code">{{ device.deviceCode }}</span></p>
-                      <p>安装位置:<span class="deviceOthers">{{ device.areaPath }}</span></p>
-                      <p>归属设施:<span class="deviceOthers">{{ device.refFacsName }}</span></p>
-                      <p>设备分类:<span class="deviceOthers">{{ device.deviceCategoryName }}</span></p>
-                      <p>子系统:<span class="deviceOthers">{{ device.subsystemName }}</span></p>
-                    </div>
-                    <div class="device-footer">
-                      <el-button size="mini" plain icon=" el-icon-document"  @click="handleDetail(device)">详情</el-button>
-                      <el-button size="mini" plain icon="el-icon-edit" @click="handleUpdate(device)">修改</el-button>
-                      <el-button size="mini" plain icon="el-icon-delete"  type="danger" @click="handleDelete(device)">删除</el-button>
-                    </div>
-                  </div>
-                </el-col>
-              </el-row>
-            </div>
+            <pagination
+              v-show="callLogTotal > 0"
+              :total="callLogTotal"
+              :page.sync="callLogQuery.pageNum"
+              :limit.sync="callLogQuery.pageSize"
+              @pagination="queryCallLogs"
+            />
+          </div>
+        </el-tab-pane>
+
+        <!-- 事件日志标签页 -->
+        <el-tab-pane label="事件日志" name="eventLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="eventLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="eventLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
+              </el-form-item>
+              <el-form-item label="事件标识">
+                <el-input v-model="eventLogQuery.eventKey" placeholder="请输入事件标识" clearable></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="queryEventLogs">查询</el-button>
+                <el-button @click="resetEventLogQuery">重置</el-button>
+              </el-form-item>
+            </el-form>
 
+            <el-table :data="eventLogList" border stripe v-loading="eventLogLoading">
+              <el-table-column prop="objCode" label="对象编号" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventName" label="事件名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventTime" label="事件时间" width="180"></el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleEventLogDetail(scope.row)">详情</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
 
-            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-                        :limit.sync="queryParams.pageSize"
-                        @pagination="getList"
+            <pagination
+              v-show="eventLogTotal > 0"
+              :total="eventLogTotal"
+              :page.sync="eventLogQuery.pageNum"
+              :limit.sync="eventLogQuery.pageSize"
+              @pagination="queryEventLogs"
             />
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </el-card>
+
+    <!-- 修改系统信息对话框 -->
+    <el-dialog title="修改系统信息" :visible.sync="editDialogVisible" width="500px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="厂商" prop="manFacturer">
+          <el-input v-model="editForm.manFacturer" placeholder="请输入厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editForm.descr" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelEdit">取 消</el-button>
+        <el-button type="primary" @click="submitEdit" :loading="editLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 执行结果对话框 -->
+    <el-dialog
+      :title="executeDialog.title"
+      :visible.sync="executeDialog.visible"
+      width="600px">
+      <div class="execute-result">
+        <el-alert
+          :title="executeDialog.status"
+          :type="executeDialog.type"
+          :description="executeDialog.message"
+          show-icon>
+        </el-alert>
+        <div v-if="executeDialog.data" class="result-data">
+          <pre>{{ JSON.stringify(executeDialog.data, null, 2) }}</pre>
+        </div>
+      </div>
+      <span slot="footer">
+        <el-button @click="executeDialog.visible = false">关闭</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 调用日志详情弹窗 -->
+    <el-dialog :visible.sync="callLogDetailDialog" title="调用日志详情" width="60%">
+      <div v-if="callLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象代码">{{ callLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="模型代码">{{ callLogDetailData.modelCode }}</el-descriptions-item>
+          <el-descriptions-item label="能力标识">{{ callLogDetailData.abilityKey }}</el-descriptions-item>
+          <el-descriptions-item label="调用时间">{{ callLogDetailData.callTime }}</el-descriptions-item>
+          <el-descriptions-item label="响应时间">{{ callLogDetailData.resTime }}</el-descriptions-item>
+          <el-descriptions-item label="调用结果">
+            <el-tag :type="getCallStatusType(callLogDetailData.callStatus)">
+              {{ formatCallStatus(callLogDetailData.callStatus) }}
+            </el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>调用载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.callPayload }}</pre>
+        </div>
 
-            <!-- 添加或修改能源设备对话框 -->
-            <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-              <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-                <el-form-item label="归属设施" prop="refFacs">
-                  <el-select v-model="form.refFacs">
-                    <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                               :key="item.facsCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备代码" prop="deviceCode">
-                  <el-input v-model="form.deviceCode" placeholder="请输入设备代码"/>
-                </el-form-item>
-                <el-form-item label="设备名称" prop="deviceName">
-                  <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
-                </el-form-item>
-
-
-                <el-form-item label="功能类型" prop="psCode" v-if="queryParams.deviceCategory === 'W'">
-                  <el-select v-model="form.psCode">
-                    <el-option v-for="item in devOptions" :label="item.psName" :value="item.psCode"
-                               :key="item.psCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备类型" prop="deviceType">
-                  <el-select v-model="form.deviceCategory">
-                    <el-option v-for="item in subCategoryOptions" :label="item.name" :value="item.code"
-                               :key="item.code"
-                    />
-                  </el-select>
-                </el-form-item>
-                <el-form-item label="设备模型" prop="deviceModel">
-                  <el-select v-model="form.deviceModel" style="width:100%" @change="handleModelChange">
-                    <el-option
-                      v-for="item in modelList"
-                      :label="item.modelName"
-                      :value="item.modelCode"
-                      :key="item.modelCode"
-                    />
-                  </el-select>
-                </el-form-item>
-                <!-- 这里可以展示属性名称和属性值 -->
-                <div v-if="attrList.length > 0" class="attr-list-container">
-                  <h3>模型属性:</h3>
-                  <ul>
-                    <li v-for="attr in attrList" :key="attr.attrKey" class="attr-item">
-                      <span class="attr-name">{{ attr.attrName }} ({{ attr.attrUnit }}):</span>
-                      <!-- 使用 el-input 组件允许用户编辑属性值 -->
-                      <el-input
-                        v-model="attrValuesMap[attr.attrKey]"
-                        placeholder="点击编辑"
-                        size="small"
-                        @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])"
-                      >
-                      </el-input>
-                    </li>
-                  </ul>
-                </div>
-                <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
-                  <el-form-item label="" prop="attrList">
-                    <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px"
-                              key="'customAttrs'"
-                    >
-                      <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="attrName">
-                        <template slot-scope="scope">
-                          <el-input size="mini" v-model="scope.row.attrName" 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="请输入属性值"/>
-                        </template>
-                      </el-table-column>
-                      <el-table-column align="center" label="操作">
-                        <template slot="header">
-                          <div class="operateBtns" @click="addCustomAttr">
-                            <span>添加</span><i class="el-icon-circle-plus-outline"></i>
-                          </div>
-                        </template>
-                        <template slot-scope="scope">
-                          <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
-                        </template>
-                      </el-table-column>
-                    </el-table>
-                  </el-form-item>
-                </h3>
-                <el-form-item label="子系统" prop="subsystemCode">
-                  <el-select v-model="form.subsystemCode">
-                    <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                               :key="item.systemCode"
-                    />
-                  </el-select>
-                </el-form-item>
-              </el-form>
-              <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="submitForm">确 定</el-button>
-                <el-button @click="cancel">取 消</el-button>
+        <div style="margin-top: 20px;">
+          <h4>响应载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.resPayload }}</pre>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 事件日志详情弹窗 -->
+    <el-dialog :visible.sync="eventLogDetailDialog" title="事件日志详情" width="60%">
+      <div v-if="eventLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象编号">{{ eventLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="对象名称">{{ eventLogDetailData.objName }}</el-descriptions-item>
+          <el-descriptions-item label="事件名称">{{ eventLogDetailData.eventName }}</el-descriptions-item>
+          <el-descriptions-item label="事件标识">{{ eventLogDetailData.eventKey }}</el-descriptions-item>
+          <el-descriptions-item label="事件时间" :span="2">{{ eventLogDetailData.eventTime }}</el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>事件描述</h4>
+          <div style="background-color: #f5f5f5; padding: 10px; border-radius: 4px;">
+            {{ eventLogDetailData.eventDetail || '无' }}
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 能力执行弹窗(支持Slider和Input类型) -->
+    <el-dialog :title="abilityDialogTitle" :visible.sync="abilityDialogVisible" width="500px" append-to-body :close-on-click-modal="false">
+      <el-form ref="abilityForm" :model="abilityForm" label-width="100px">
+        <el-form-item label="能力名称">
+          <el-input v-model="abilityForm.abilityName" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="能力描述">
+          <el-input type="textarea" v-model="abilityForm.abilityDesc" disabled :rows="2"></el-input>
+        </el-form-item>
+
+        <el-form-item label="参数设置" v-if="abilityParamType">
+          <template v-if="abilityParamType === 'Slider'">
+            <div style="width: 100%;">
+              <div style="padding: 0 10px;">
+                <el-slider
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :show-tooltip="true"
+                  :format-tooltip="formatTooltip">
+                </el-slider>
               </div>
-            </el-dialog>
-
-            <!--设备器件-->
-            <el-drawer :title=ComponentRow.deviceName size="80%" :visible.sync="showDevProcessDrawer" direction="rtl">
-              <div class="drawer-content" style="padding-left:50px">
-                <el-row :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleComponentAdd"
-                               v-hasPermi="['ems:component:add']"
-                    >新增
-                    </el-button>
-                  </el-col>
-                </el-row>
-                <el-table v-loading="loading" :data="ComponentList">
-                  <el-table-column type="selection" width="55" align="center"/>
-                  <el-table-column label="部件编码" align="center" prop="compoCode"/>
-                  <el-table-column label="部件标签" align="center" prop="compoTag">
-                    <template slot-scope="scope">
-                      {{ objComTypeMapping[scope.row.compoTag] }}
-                    </template>
-                  </el-table-column>
-                  <el-table-column label="工艺标识代码" align="center" prop="psCode"/>
-                  <el-table-column label="外系统部件编码" align="center" prop="extCompoCode"/>
-                  <el-table-column label="部件模型" align="center" prop="compoModel"/>
-                  <el-table-column label="部件品牌" align="center" prop="compoBrand"/>
-                  <el-table-column label="部件型号" align="center" prop="compoSpec"/>
-                  <el-table-column label="祖籍列表" align="center" prop="ancestors"/>
-                  <el-table-column label="上级部件" align="center" prop="parentEqpt"/>
-
-                  <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-edit" @click="handleComponentUpdate(scope.row)"
-                                 v-hasPermi="['ems:component:edit']"
-                      >
-                        修改
-                      </el-button>
-                      <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                                 @click="handleComponentDelete(scope.row)" v-hasPermi="['ems:component:remove']"
-                      >
-                        删除
-                      </el-button>
-                    </template>
-                  </el-table-column>
-                </el-table>
-                <pagination v-show="total>0" :total="total" :page.sync="queryComponentParams.pageNum"
-                            :limit.sync="queryComponentParams.pageSize"
-                            @pagination="getComponentList"
-                />
-
-                <!-- 添加或修改设备器件对话框 -->
-                <el-dialog :title="title" :visible.sync="componentOpen" width="500px" append-to-body>
-                  <el-form ref="componentForm" :model="componentForm" :rules="componentRules" label-width="150px">
-                    <!--                <el-form-item label="设备code" prop="deviceCode">-->
-                    <!--                  <el-input v-model="componentForm.deviceCode" placeholder="请输入设备code" />-->
-                    <!--                </el-form-item>-->
-                    <el-form-item label="部件编码" prop="compoCode">
-                      <el-input v-model="componentForm.compoCode" placeholder="请输入部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件标签" prop="compoTag">
-                      <el-select v-model="componentForm.compoTag" placeholder="请输入部件标签">
-                        <el-option v-for="item in objComTypeOptions"
-                                   :label="item.name"
-                                   :value="item.code"
-                                   :key="item.code"
-                        />
-
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="工艺标签代码" prop="psCode">
-                      <el-select v-model="componentForm.psCode" placeholder="请输入工艺标签代码">
-                        <el-option v-for="item in devOptions" :label="item.psCode" :value="item.psCode" :key="item.psCode"/>
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="外系统部件编码" prop="extCompoCode">
-                      <el-input v-model="componentForm.extCompoCode" placeholder="请输入外系统部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件模型" prop="compoModel">
-                      <el-select v-model="componentForm.compoModel" placeholder="请输入部件模型">
-                        <el-option v-for="item in this.modelList" :label="item.modelCode" :value="item.modelCode"
-                                   :key="item.modelCode"
-                        />
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="部件品牌" prop="compoBrand">
-                      <el-input v-model="componentForm.compoBrand" placeholder="请输入部件品牌"/>
-                    </el-form-item>
-                    <el-form-item label="部件型号" prop="compoSpec">
-                      <el-input v-model="componentForm.compoSpec" placeholder="请输入部件型号"/>
-                    </el-form-item>
-                    <el-form-item label="祖籍列表" prop="ancestors">
-                      <el-input v-model="componentForm.ancestors" placeholder="请输入祖籍列表"/>
-                    </el-form-item>
-                    <el-form-item label="上级列表" prop="parentCompo">
-                      <el-input v-model="componentForm.parentCompo" placeholder="请输入上级列表"/>
-                    </el-form-item>
-
-                  </el-form>
-                  <div slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="submitComponentForm">确 定</el-button>
-                    <el-button @click="ComponentCancel">取 消</el-button>
-                  </div>
-                </el-dialog>
+
+              <div style="display: flex; justify-content: space-between; padding: 0 10px; margin-top: -5px; margin-bottom: 20px;">
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMin }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ Math.floor((abilitySliderMin + abilitySliderMax) / 2) }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMax }}%</span>
               </div>
-            </el-drawer>
-
-            <!-- 详情弹框 -->
-            <el-dialog :visible.sync="showDrawer" title="设备详情">
-              <div v-if="curRow">
-                <!-- 设备基本信息 -->
-                <el-card class="box-card">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">设备基本信息</span>
-                  </div>
-                  <div>
-                    <p>设备代码:{{ curRow.deviceCode }}</p>
-                    <p>设备名称:{{ curRow.deviceName }}</p>
-                    <p>设备类型:{{ curRow.deviceCategoryName }}</p>
-                    <p>子系统:{{ curRow.subsystemName }}</p>
-                    <p>归属区域:{{ curRow.areaPath }}</p>
-                    <p>归属设施:{{ curRow.refFacsName }}</p>
-                  </div>
-                </el-card>
-                <el-card class="box-card" style="margin-top: 10px">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">状态属性</span>
-                  </div>
-                  <div>
-                    <p v-for="attr in statusAttr" :key="attr.attr">{{ attr.attr }}:{{ attr.attrValue }} {{
-                        attr.attrUnit
-                      }}</p>
-                  </div>
-                </el-card>
-                <!-- 属性信息 -->
-                <el-card class="box-card" v-if="attrData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">属性定义</span>
-                  </div>
-                  <div v-for="(item, index) in attrData" :key="index">
-                    <p>属性名称:{{ item.attrName }}</p>
-                    <p>属性值:{{ item.attrValue }}</p>
-                    <p>属性单位:{{ item.attrUnit }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < attrData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 能力信息 -->
-                <el-card class="box-card" v-if="abilityData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">能力定义</span>
-                  </div>
-                  <div v-for="(item, index) in abilityData" :key="index">
-                    <p>能力名称:{{ item.abilityName }}</p>
-                    <p>能力键:{{ item.abilityKey }}</p>
-                    <p>能力参数:{{ item.abilityParam }}</p>
-                    <p>能力描述:{{ item.abilityDesc }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < abilityData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 事件信息 -->
-                <el-card class="box-card" v-if="eventData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">事件定义</span>
-                  </div>
-                  <div v-for="(item, index) in eventData" :key="index">
-                    <p>事件名称:{{ item.eventKey }}</p>
-                    <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
-                    <p>事件代码:{{ item.eventCode }}</p>
-                    <p>外部事件代码:{{ item.extEventCode }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < eventData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
+
+              <div style="display: flex; align-items: center; gap: 15px;">
+                <el-input-number
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :step="1"
+                  :precision="0"
+                  controls-position="right"
+                  style="flex: 0 0 120px;">
+                </el-input-number>
+                <span style="color: #909399; font-size: 13px;">
+                  调节范围:{{ abilitySliderMin }} - {{ abilitySliderMax }}
+                </span>
               </div>
-            </el-dialog>
-          </div>
-        </div>
-      </el-col>
-    </el-row>
+            </div>
+          </template>
+
+          <template v-else-if="abilityParamType === 'Input'">
+            <el-input
+              v-model="abilityInputValue"
+              placeholder="请输入参数值"
+              clearable>
+            </el-input>
+          </template>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="abilityDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="executeAbilityWithParam" :loading="abilityExecuting">执行</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listDevRecursionByArea, getDevice, delDevice, addDevice, updateDevice } from '@/api/device/device'
-import { areaTreeSelect } from '@/api/basecfg/area'
-import { getFacsCategorygetByCode, listAllFacs } from '@/api/basecfg/emsfacs'
-import { listSubsystemAll } from '@/api/adapter/subsystem'
-import { getModelByCode, listAllModel } from '@/api/basecfg/objModel'
-import { getObjAttr } from '@/api/basecfg/objAttribute'
-import { addAttrValueBatch } from '@/api/basecfg/objAttributeValue'
-import { getDevProcess } from '@/api/commonApi'
-import { addComponent, delComponent, getComponent, listByDevice, updateComponent } from '@/api/basecfg/component'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
+import { getModelByCode } from '@/api/basecfg/objModel'
+import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
+import { listcallAbility } from '@/api/basecfg/objAbility'
+import { getByCondition } from '@/api/device/device'
+import { listCallLog, listEventLog, getCallLog, getEventLog } from '@/api/basecfg/objLog'
 
 export default {
-  name: 'Device',
-  components: { Treeselect },
+  name: 'SubsystemIntegration',
   data() {
     return {
-      primary1: 'primary',
-      primary2: '',
-      ComponentRow: [],
-      componentForm: {},
-      subcategoryCode: '',
-      attrList: [], // 属性模板数组
-      attrValues: [],
-      ComponentList: [],
-      attrValuesMap: {},
-      modelList: [],
-      showDrawer: false,
-      showDevProcessDrawer: false,
-      componentOpen: false,
-      istable: 2,
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 能源设备表格数据
+      // 系统代码
+      systemCode: 'SYS_ZHHM',
+      // 系统信息
+      systemInfo: {},
+      // 系统状态
+      systemStatus: '1',
+      // 当前标签页
+      activeTab: 'attributes',
+      // 协议属性
+      protocolAttrs: [],
+      // 状态属性
+      stateAttrs: [],
+      // 系统能力
+      systemAbilities: [],
+      abilityLoading: false,
+      // 设备列表
       deviceList: [],
-      // 弹出层标题
-      title: '',
-      // 是否显示弹出层
-      open: false,
-      // 区域名称
-      areaName: undefined,
-      // 区域树选项
-      treeAreaOptions: undefined,
-      totalAreaOptions: undefined,
-      // 设施选项
-      facsOptions: undefined,
-      // 设备分类
-      subCategoryOptions: undefined,
-      subsystemOptions: undefined,
-      devOptions: undefined,
-
-      defaultProps: {
-        children: 'children',
-        label: 'label'
+      deviceLoading: false,
+      deviceAttrs: {},
+      deviceChannels: {},
+      // 设备能力缓存
+      deviceAbilities: {},
+      // 设备统计
+      deviceStats: {
+        total: 0,
+        online: 0,
+        offline: 0,
+        points: 0
       },
-      // 查询参数
-      queryParams: {
-        psCode: null,
+      // 所有模型代码(系统 + 设备)
+      allModelCodes: [],
+      // 调用日志查询
+      callLogQuery: {
+        dateRange: [],
+        abilityKey: '',
+        callStatus: '',
         pageNum: 1,
-        pageSize: 10,
-        deviceCode: null,
-        deviceSubCategory: '',
-        deviceCategory: 'E',
-        locationType: null,
-        locationRef: null,
-        refFacs: null,
-        customAttrs: null
+        pageSize: 10
       },
-      queryComponentParams: {
+      callLogList: [],
+      callLogTotal: 0,
+      logLoading: false,
+      // 事件日志查询
+      eventLogQuery: {
+        dateRange: [],
+        eventKey: '',
         pageNum: 1,
         pageSize: 10
       },
-      objComTypeMapping: {
-        1: '总开',
-        2: '照明',
-        3: '风机'
-      },
-      objComTypeOptions: [
-        { code: 1, name: '总开' },
-        { code: 2, name: '照明' },
-        { code: 3, name: '风机' }
-
-      ],
-      curRow: {},
-      attrData: [],
-      abilityData: [],
-      eventData: [],
-      statusAttr: [{
-        attr: '蓄水量',
-        attrUnit: 'm³',
-        attrValue: '20'
-      },
-        {
-          attr: '温度',
-          attrUnit: '℃',
-          attrValue: '10'
-        },
-        {
-          attr: '湿度',
-          attrUnit: '',
-          attrValue: '95%'
-        },
-        {
-          attr: '调蓄量',
-          attrUnit: 'm³',
-          attrValue: '10'
-        },
-        {
-          attr: '运行状态',
-          attrUnit: '',
-          attrValue: '工作中'
-        }
-      ],
-      // 表单参数
-      form: {
-        customAttrs: [] // 自定义属性数组
+      eventLogList: [],
+      eventLogTotal: 0,
+      eventLogLoading: false,
+      // 调用日志详情
+      callLogDetailDialog: false,
+      callLogDetailData: null,
+      // 事件日志详情
+      eventLogDetailDialog: false,
+      eventLogDetailData: null,
+      // 执行结果对话框
+      executeDialog: {
+        visible: false,
+        title: '',
+        status: '',
+        type: 'success',
+        message: '',
+        data: null
       },
-      // 表单校验
-      rules: {
-        refFacs: [
-          { required: true, message: '归属设施', trigger: 'blur' }
-        ],
-        refArea: [
-          { required: true, message: '安装位置', trigger: 'blur' }
-        ],
-        deviceCode: [
-          { required: true, message: '设备代码不能为空', trigger: 'blur' }
-        ],
-        deviceName: [
-          { required: true, message: '设备名称不能为空', trigger: 'blur' }
-        ]
+      // 能力执行相关
+      abilityDialogVisible: false,
+      abilityDialogTitle: '能力执行',
+      abilityForm: {
+        abilityName: '',
+        abilityKey: '',
+        abilityDesc: '',
+        paramDefinition: null,
+        modelCode: ''
       },
-      componentRules: {
-        deviceCode: [
-          { required: true, message: '设备code不能为空', trigger: 'blur' }
-        ],
-        compoCode: [
-          { required: true, message: '部件编码不能为空', trigger: 'blur' }
+      abilityParamType: null,
+      abilitySliderValue: 50,
+      abilitySliderMin: 0,
+      abilitySliderMax: 100,
+      abilityInputValue: '',
+      abilityExecuting: false,
+      currentDevice: null,
+      currentObjType: null,
+      // 编辑系统信息相关
+      editDialogVisible: false,
+      editLoading: false,
+      editForm: {},
+      editRules: {
+        systemCode: [
+          { required: true, message: "系统代码不能为空", trigger: "blur" }
         ],
-        psCode: [
-          { required: true, message: '工艺标签代码不能为空', trigger: 'blur' }
+        systemName: [
+          { required: true, message: "系统名称不能为空", trigger: "blur" }
         ]
       }
     }
   },
-  watch: {
-    // 根据名称筛选区域树
-    areaName(val) {
-      this.$refs.tree.filter(val)
-    }
-  },
   created() {
-    this.queryParams.deviceCategory = 'ZHHM'; // 确保初始加载时就设置为 'ZHHM'
-    this.getList()
-    this.getAreaTree('0', 1)
-    this.getFacsOptions()
-    this.getSubsystem()
-    this.getSubCategorygetByCode()
-    this.getFacsModel()
-    // this.getAllDevProcess(this.subcategoryCode)
+    this.loadSystemInfo()
+    this.initDateRange()
   },
   methods: {
-    /**分页切换*/
-    switchData(v) {
-      if (v === 1) {
-        this.primary1 = "primary";
-        this.primary2 = "";
-      } else {
-        this.primary1 = "";
-        this.primary2 = "primary";
-      }
-      this.istable = v;
-    },
-    /** 查询能源设备列表 */
-    getList() {
-      this.loading = true
-      listDevRecursionByArea(this.queryParams).then(response => {
-        console.log('参数', JSON.stringify(this.queryParams))
-        this.deviceList = response.rows
-        this.total = response.total
-        this.loading = false
+    // 打开编辑对话框
+    handleEdit() {
+      this.editForm = { ...this.systemInfo }
+      this.editDialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.editForm?.clearValidate()
       })
     },
-    /**新增、修改、删除*/
-    handleComponentAdd() {
-      this.componentReset()
-      this.componentOpen = true
-      this.title = '添加设备器件属性'
-      this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
 
+    // 取消编辑
+    cancelEdit() {
+      this.editDialogVisible = false
+      this.editForm = {}
     },
-    handleComponentUpdate(row) {
-      this.componentReset()
-      const id = row.id || this.ids
-      getComponent(id).then(response => {
-        this.componentForm = response.data
-        this.componentOpen = true
-        this.title = '修改设备器件属性'
-        this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
-      })
-    },
-    handleComponentDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function() {
-        return delComponent(ids)
-      }).then(() => {
-        console.log('删除row', row.deviceCode)
-        this.getComponentList(row.deviceCode)
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    submitComponentForm() {
-      this.$refs['componentForm'].validate(valid => {
+
+    // 提交编辑
+    submitEdit() {
+      this.$refs.editForm.validate(valid => {
         if (valid) {
-          if (this.componentForm.id != null) {
-            updateComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          } else {
-            addComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          }
+          this.editLoading = true
+          updateSubsystem(this.editForm).then(response => {
+            this.$message.success("修改成功")
+            this.editDialogVisible = false
+            // 重新加载系统信息
+            this.loadSystemInfo()
+          }).catch(error => {
+            this.$message.error("修改失败:" + error.message)
+          }).finally(() => {
+            this.editLoading = false
+          })
         }
       })
     },
-    ComponentCancel() {
-      this.componentOpen = false
-      this.componentReset()
-    },
-    /**查询部件列表*/
-    getComponentList(deviceCode) {
-      listByDevice(deviceCode).then(response => {
-        this.ComponentList = response.data
-      })
-    },
-    /** 查询区域树结构 */
-    getAreaTree(areaCode, layer) {
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.treeAreaOptions =  [{
-          id: '-1',
-          label: '全部',
-          children: response.data
-        }]
-      })
-    },
-    // 筛选节点
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
+
+    // 格式化滑块tooltip
+    formatTooltip(val) {
+      return `${val}%`
     },
-    // 节点单击事件
-    handleNodeClick(data) {
-      if (data.id === '-1') {
-        this.queryParams.locationType = null;
-        this.queryParams.locationRef = null;
-      } else {
-        this.queryParams.locationType = data.tier;
-        this.queryParams.locationRef = data.id;
+
+    // 解析参数定义类型
+    getParamType(paramDefinition) {
+      if (!paramDefinition) return null
+      try {
+        const def = JSON.parse(paramDefinition)
+        return def.type
+      } catch (e) {
+        return null
       }
-      this.handleQuery();
     },
-    // 取消按钮
-    cancel() {
-      this.open = false
-      this.reset()
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        deviceCode: null,
-        deviceName: null,
-        deviceType: null,
-        deviceStatus: null,
-        deviceModel: null,
-        refArea: null,
-        refFacs: null,
-        subsystemCode: null,
-        psCode: null,
-        createTime: null,
-        updateTime: null
 
+    // 解析Options类型的选项
+    parseOptions(paramDefinition) {
+      try {
+        const def = JSON.parse(paramDefinition)
+        if (def.type === 'Options' && def.list) {
+          return def.list
+        }
+      } catch (e) {
+        console.error('解析Options失败:', e)
       }
-      this.resetForm('form')
+      return []
     },
-    componentReset() {
-      this.componentForm = {
-        id: null,
-        deviceCode: this.ComponentRow.deviceCode || '', // 使用ComponentRow的deviceCode,或者空字符串
-        compoCode: null,
-        compoTag: null,
-        psCode: null,
-        extCompoCode: null,
-        compoModel: null,
-        compoBrand: null,
-        compoSpec: null,
-        ancestors: null,
-        parentCompo: null
 
+    // 处理系统能力点击
+    handleSystemAbilityClick(ability) {
+      const paramType = this.getParamType(ability.paramDefinition)
+
+      if (paramType === 'Slider') {
+        this.showSliderDialog(ability, this.systemInfo, 3)
+      } else if (paramType === 'Input') {
+        this.showInputDialog(ability, this.systemInfo, 3)
+      } else {
+        this.executeSystemAbility(ability)
       }
-      this.resetForm('componentForm')
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1
-      console.log('搜索按钮this.queryParams', JSON.stringify(this.queryParams))
-      this.getList()
+
+    // 执行系统能力(带Options参数)
+    executeSystemAbilityWithParam(ability, paramValue) {
+      ability.executing = true
+      ability.executingValue = paramValue
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: paramValue
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+        ability.executingValue = null
+      })
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.queryParams.locationType = null
-      this.queryParams.locationRef = null
-      this.resetForm('queryForm')
-      this.handleQuery()
+
+    // 执行系统能力(无参数)
+    executeSystemAbility(ability) {
+      ability.executing = true
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: null
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+
+        if (ability.abilityKey === 'MeterReadingGw') {
+          this.loadDevices()
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+      })
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+
+    // 显示滑块弹窗
+    showSliderDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Slider'
+
+      try {
+        const def = JSON.parse(ability.paramDefinition)
+        this.abilitySliderMin = def.min || 0
+        this.abilitySliderMax = def.max || 100
+        this.abilitySliderValue = Math.floor((this.abilitySliderMin + this.abilitySliderMax) / 2)
+      } catch (e) {
+        console.error('解析Slider参数失败:', e)
+        this.abilitySliderMin = 0
+        this.abilitySliderMax = 100
+        this.abilitySliderValue = 50
+      }
+
+      this.abilityDialogVisible = true
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '添加能源设备'
+
+    // 显示输入弹窗
+    showInputDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Input'
+      this.abilityInputValue = ''
+      this.abilityDialogVisible = true
     },
-    /**设备器件按钮*/
-    handleDevProcess(row) {
-      this.showDevProcessDrawer = true
-      this.ComponentRow = row
-      console.log('row', row)
-      listByDevice(this.ComponentRow.deviceCode).then(response => {
-        this.ComponentList = response.data
+
+    // 执行带参数的能力
+    executeAbilityWithParam() {
+      let paramValue = null
+
+      if (this.abilityParamType === 'Slider') {
+        paramValue = String(this.abilitySliderValue)
+      } else if (this.abilityParamType === 'Input') {
+        if (!this.abilityInputValue) {
+          this.$message.warning('请输入参数值')
+          return
+        }
+        paramValue = this.abilityInputValue
+      }
+
+      this.abilityExecuting = true
+
+      const callParams = {
+        objType: this.currentObjType,
+        abilityKey: this.abilityForm.abilityKey,
+        abilityParam: paramValue
+      }
+
+      if (this.currentObjType === 3) {
+        callParams.objCode = this.systemCode
+        callParams.modelCode = this.systemInfo.modelCode
+      } else if (this.currentObjType === 2) {
+        callParams.objCode = this.currentDevice.deviceCode
+        callParams.modelCode = this.currentDevice.deviceModel
+      }
+
+      listcallAbility(callParams).then(response => {
+        this.$message.success('执行成功')
+        this.abilityDialogVisible = false
+
+        if (this.abilityForm.abilityKey.toLowerCase().includes('meter') ||
+          this.abilityForm.abilityKey.toLowerCase().includes('reading')) {
+          if (this.currentObjType === 3) {
+            this.loadDevices()
+          } else if (this.currentObjType === 2) {
+            this.loadDeviceAttrs(this.currentDevice.deviceCode)
+          }
+        }
+      }).catch(() => {
+        this.$message.error('执行失败')
+      }).finally(() => {
+        this.abilityExecuting = false
       })
+    },
 
+    // 初始化时间范围
+    initDateRange() {
+      const now = new Date()
+      const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
+      const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59)
+
+      this.callLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
+      this.eventLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
     },
-    shouldShowDevProcessButton(row) {
-      const categoryIsW = this.queryParams.deviceCategory === 'W'
-      const validPsCodes = ['AA', 'AH', 'AJ', 'AM', 'AP', 'AL', 'APE', 'ALE', 'AF', 'ACC']
-      const psCodeIsValid = validPsCodes.includes(row.psCode)
-      // 只有当设备分类为输能设备且设备工艺代码有效时,才返回true
-      return categoryIsW && psCodeIsValid
+
+    // 格式化日期
+    formatDate(date) {
+      if (!date) return ''
+      const year = date.getFullYear()
+      const month = (date.getMonth() + 1).toString().padStart(2, '0')
+      const day = date.getDate().toString().padStart(2, '0')
+      const hours = date.getHours().toString().padStart(2, '0')
+      const minutes = date.getMinutes().toString().padStart(2, '0')
+      const seconds = date.getSeconds().toString().padStart(2, '0')
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
     },
-    backStyle(areaPath) {
-      const firstLevel = areaPath.split('/')[0];
-      switch (firstLevel) {
-        case '北区':
-          return 'north';
-        case '南区':
-          return 'south';
-        case '主路':
-          return 'main';
-        default:
-          return '';
+
+    // 加载系统信息
+    async loadSystemInfo() {
+      try {
+        const sysRes = await getSubsystemByCode(this.systemCode)
+        this.systemInfo = sysRes.data
+
+        if (this.systemInfo.modelCode) {
+          this.allModelCodes.push(this.systemInfo.modelCode)
+
+          const modelRes = await getModelByCode(this.systemInfo.modelCode)
+          const modelData = modelRes.data
+
+          this.systemAbilities = (modelData.abilityList || []).map(item => ({
+            ...item,
+            executing: false,
+            executingValue: null
+          }))
+        }
+
+        const attrRes = await getObjAttr(3, this.systemCode)
+        const attrData = attrRes.data
+
+        this.protocolAttrs = attrData.Protocol || []
+        this.stateAttrs = attrData.State || []
+
+        const statusAttr = this.stateAttrs.find(attr => attr.attrKey === 'interfaceStatus')
+        if (statusAttr) {
+          this.systemStatus = statusAttr.attrValue
+        }
+
+        await this.loadDevices()
+      } catch (error) {
+        this.$message.error('加载系统信息失败:' + error.message)
       }
     },
-    /**设备详情按钮*/
-    handleDetail(row) {
-      this.showDrawer = true
-      this.curRow = row
-      console.log('data', this.curRow)
-      this.subKey = this.$options.data().subKey
-      getModelByCode(this.curRow.facsModel).then(response => {
-        const code = response.data
-        console.log('code', code)
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
 
-      })
-      getObjAttr(2, this.curRow.deviceCode).then(response => {
-        console.log('response值', response.data)
-        const attrs = response.data.attrs
-        const attrValues = response.data.attrValues
-
-        // 合并 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 : ''
+    // 加载设备列表
+    async loadDevices() {
+      this.deviceLoading = true
+      try {
+        const res = await getByCondition({
+          subsystemCode: this.systemCode
+        })
+
+        const deviceData = res.data || res.rows || []
+
+        this.deviceList = deviceData.map(device => ({
+          ...device,
+          detailTab: 'attrs'
+        }))
+
+        const deviceModelCodes = new Set()
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            deviceModelCodes.add(device.deviceModel)
           }
         })
-        this.attrData = mergedData
-      })
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset()
-      const id = row.id || this.ids
-      getDevice(id).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改能源设备'
-      })
-      const layer = 1
-      const areaCode = '0'
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.totalAreaOptions = response.data
-      })
-    },
-    /** 提交按钮 */
-    submitForm() {
-      // 重置 attrList 和 form.customAttrs
-      if (!this.attrList) {
-        this.attrList = []
-      }
-      if (!this.form.customAttrs) {
-        this.form.customAttrs = []
-      }
-      // 准备要发送的数据
-      let dataToSubmit = []
-      // 添加模型属性数据
-      this.attrList.forEach(attr => {
-        const attrName = attr.attrName
-        const attrKey = attr.attrKey
-        const attrValue = this.attrValuesMap[attrKey]
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
 
-          })
-        }
-      })
+        deviceModelCodes.forEach(modelCode => {
+          if (!this.allModelCodes.includes(modelCode)) {
+            this.allModelCodes.push(modelCode)
+          }
+        })
 
-      // 添加自定义属性数据
-      this.form.customAttrs.forEach(customAttr => {
-        const attrName = customAttr.attrName
-        const attrKey = customAttr.attrKey
-        const attrValue = customAttr.attrValue
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: '', // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
-          })
+        this.deviceStats.total = this.deviceList.length
+        this.deviceStats.online = this.deviceList.filter(d => d.deviceStatus === 1).length
+        this.deviceStats.offline = this.deviceList.filter(d => d.deviceStatus !== 1).length
+
+        const devicesByModel = {}
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            if (!devicesByModel[device.deviceModel]) {
+              devicesByModel[device.deviceModel] = []
+            }
+            devicesByModel[device.deviceModel].push(device)
+          }
+        })
+
+        for (const modelCode in devicesByModel) {
+          await this.loadDeviceAttrsBatch(modelCode, devicesByModel[modelCode])
         }
-      })
+      } catch (error) {
+        this.$message.error('加载设备列表失败')
+      } finally {
+        this.deviceLoading = false
+      }
+    },
 
-      this.$refs['form'].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateDevice(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            }).catch(error => {
-              console.error('修改失败:', error)
-              this.$message.error('修改失败')
-            })
+    // 批量加载设备属性
+    async loadDeviceAttrsBatch(modelCode, devices) {
+      try {
+        const res = await getObjAttrBatch(2, modelCode)
+        const batchData = res.data || {}
 
-            if (dataToSubmit.length > 0) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
-                  }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+        let totalPoints = 0
+
+        devices.forEach(device => {
+          const deviceCode = device.deviceCode
+          const attrData = batchData[deviceCode]
+
+          if (attrData) {
+            const baseAttrs = {}
+            if (attrData.Base) {
+              attrData.Base.forEach(attr => {
+                baseAttrs[attr.attrKey] = attr.attrValue
               })
             }
-          } 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) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
+            this.deviceAttrs[deviceCode] = baseAttrs
+
+            const channels = []
+            if (attrData.Measure) {
+              attrData.Measure.forEach(attr => {
+                if (attr.attrKey.startsWith('interface')) {
+                  try {
+                    const points = JSON.parse(attr.attrValue || '[]')
+                    channels.push({
+                      name: attr.attrName,
+                      key: attr.attrKey,
+                      points: points
+                    })
+                    totalPoints += points.length
+                  } catch (e) {
+                    console.error(`解析设备 ${deviceCode} 的测点数据失败:`, e)
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+                }
               })
-            } else {
-              // this.$message.info('没有属性需要添加');
             }
+            this.deviceChannels[deviceCode] = channels
           }
+        })
+
+        this.deviceStats.points += totalPoints
+      } catch (error) {
+        console.error(`批量加载模型 ${modelCode} 的设备属性失败:`, error)
+        for (const device of devices) {
+          await this.loadDeviceAttrs(device.deviceCode)
         }
-      })
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源设备编号为"' + ids + '"的数据项?').then(function() {
-        return delDevice(ids)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('ems/basecfg/device/export', {
-        ...this.queryParams
-      }, `device_${new Date().getTime()}.xlsx`)
-    },
-    getFacsOptions() {
-      const getFacsParams = {
-        facsCategory: this.queryParams.deviceCategory,
-        subCategory: this.queryParams.deviceSubCategory
       }
-      listAllFacs(getFacsParams).then(response => {
-        this.facsOptions = response.data
-      })
     },
-    getSubCategorygetByCode() {
-      getFacsCategorygetByCode(this.queryParams.deviceCategory).then(response => {
-        this.subCategoryOptions = response.data.subtypeList || []
-      })
+
+    // 单个加载设备属性
+    async loadDeviceAttrs(deviceCode) {
+      try {
+        const res = await getObjAttr(2, deviceCode)
+        const attrData = res.data
+
+        const baseAttrs = {}
+        if (attrData.Base) {
+          attrData.Base.forEach(attr => {
+            baseAttrs[attr.attrKey] = attr.attrValue
+          })
+        }
+        this.deviceAttrs[deviceCode] = baseAttrs
+
+        const channels = []
+        let pointsCount = 0
+        if (attrData.Measure) {
+          attrData.Measure.forEach(attr => {
+            if (attr.attrKey.startsWith('interface')) {
+              try {
+                const points = JSON.parse(attr.attrValue || '[]')
+                channels.push({
+                  name: attr.attrName,
+                  key: attr.attrKey,
+                  points: points
+                })
+                pointsCount += points.length
+              } catch (e) {
+                console.error(`解析测点数据失败:`, e)
+              }
+            }
+          })
+        }
+
+        if (!this.deviceChannels[deviceCode]) {
+          this.deviceStats.points += pointsCount
+        }
+
+        this.deviceChannels[deviceCode] = channels
+      } catch (error) {
+        console.error(`加载设备 ${deviceCode} 属性失败:`, error)
+      }
     },
-    getSubsystem() {
-      listSubsystemAll().then(response => {
-        this.subsystemOptions = response.data
-      })
+
+    // 获取设备属性
+    getDeviceAttr(deviceCode, attrKey) {
+      return this.deviceAttrs[deviceCode]?.[attrKey] || '-'
     },
-    /**自定义属性表格*/
-    addCustomAttr() {
-      // 添加一个新的自定义属性
-      if (!Array.isArray(this.form.customAttrs)) {
-        this.form.customAttrs = []
-      }
-      this.form.customAttrs.push({
-        attrKey: '',
-        attrName: '',
-        attrValue: ''
-      })
-      // 强制更新视图
-      this.$forceUpdate()
 
+    // 获取设备通道
+    getDeviceChannels(deviceCode) {
+      return this.deviceChannels[deviceCode] || []
     },
-    deleteCustomAttr(index) {
-      // 删除指定索引的自定义属性
-      if (this.form.customAttrs.length > 0) {
-        this.form.customAttrs.splice(index, 1)
+
+    // 加载设备能力
+    async handleAbilityLoad(visible, device) {
+      if (visible && !this.deviceAbilities[device.deviceCode]) {
+        try {
+          if (!device.deviceModel) {
+            this.$set(this.deviceAbilities, device.deviceCode, [])
+            return
+          }
+
+          const res = await getModelByCode(device.deviceModel)
+          const abilities = res.data?.abilityList?.filter(item => item.hiddenFlag === 1) || []
+          this.$set(this.deviceAbilities, device.deviceCode, abilities)
+        } catch (error) {
+          this.$set(this.deviceAbilities, device.deviceCode, [])
+        }
       }
+    },
+
+    // 处理设备操作命令
+    async handleDeviceCommand(command) {
+      const { device, ability, paramValue } = command
+
+      if (paramValue !== undefined) {
+        try {
+          await listcallAbility({
+            objCode: device.deviceCode,
+            objType: 2,
+            modelCode: device.deviceModel,
+            abilityKey: ability.abilityKey,
+            abilityParam: paramValue
+          })
+
+          this.$message.success(`${ability.abilityName}执行成功`)
+
+          if (ability.abilityKey.toLowerCase().includes('meter') ||
+            ability.abilityKey.toLowerCase().includes('reading')) {
+            await this.loadDeviceAttrs(device.deviceCode)
+          }
+        } catch (error) {
+          this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+        }
+      } else {
+        const paramType = this.getParamType(ability.paramDefinition)
+
+        if (paramType === 'Slider') {
+          this.showSliderDialog(ability, device, 2)
+        } else if (paramType === 'Input') {
+          this.showInputDialog(ability, device, 2)
+        } else {
+          try {
+            await listcallAbility({
+              objCode: device.deviceCode,
+              objType: 2,
+              modelCode: device.deviceModel,
+              abilityKey: ability.abilityKey,
+              abilityParam: null
+            })
+
+            this.$message.success(`${ability.abilityName}执行成功`)
 
+            if (ability.abilityKey.toLowerCase().includes('meter') ||
+              ability.abilityKey.toLowerCase().includes('reading')) {
+              await this.loadDeviceAttrs(device.deviceCode)
+            }
+          } catch (error) {
+            this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+          }
+        }
+      }
     },
-    /**设备模型*/
-    updateAttrValue(attrKey, newValue) {
-      this.attrValuesMap[attrKey] = newValue
+
+    // 处理设备行点击
+    handleDeviceClick(row) {
+      this.$refs.deviceTable?.toggleRowExpansion(row)
     },
 
-    getFacsModel() {
-      listAllModel(2).then(response => {
-        this.modelList = response.data
-        console.log('this.modelList', this.modelList)
-        this.modelList.forEach(model => {
-          console.log(model.modelCode)
-        })
-      })
+    // 标签页切换
+    handleTabClick(tab) {
+      if (tab.name === 'callLogs' && this.callLogList.length === 0) {
+        this.queryCallLogs()
+      } else if (tab.name === 'eventLogs' && this.eventLogList.length === 0) {
+        this.queryEventLogs()
+      }
     },
-    handleModelChange(modelCode) {
-      if (modelCode) {
-        this.getModelByCode(modelCode)
-        console.log('设备代码', this.form.deviceCode)
-        this.getObjAttr(2, this.form.deviceCode)
+
+    // 查询调用日志
+    async queryCallLogs() {
+      this.logLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.callLogQuery.pageNum,
+          pageSize: this.callLogQuery.pageSize
+        }
+
+        if (this.callLogQuery.dateRange && this.callLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.callLogQuery.dateRange[0]
+          params.endRecTime = this.callLogQuery.dateRange[1]
+        }
+
+        if (this.callLogQuery.abilityKey) {
+          params.abilityKey = this.callLogQuery.abilityKey
+        }
+
+        if (this.callLogQuery.callStatus !== '') {
+          params.callStatus = this.callLogQuery.callStatus
+        }
+
+        const res = await listCallLog(params)
+        this.callLogList = res.rows || []
+        this.callLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询调用日志失败')
+      } finally {
+        this.logLoading = false
       }
     },
-    getModelByCode(modelCode) {
-      getModelByCode(modelCode).then(response => {
-        // this.attrList = response.data.attrList;
-        const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
-        this.attrList = filteredAttrList
 
-      })
+    // 重置调用日志查询
+    resetCallLogQuery() {
+      this.initDateRange()
+      this.callLogQuery.abilityKey = ''
+      this.callLogQuery.callStatus = ''
+      this.callLogQuery.pageNum = 1
+      this.queryCallLogs()
     },
-    getObjAttr(objType, deviceCode) {
-      getObjAttr(objType, deviceCode).then(response => {
-        // const attrs = response.data.attrs;
-        const attrs = response.data.attrs.filter(attr => attr.attrType === 0)
-        console.log('attrs', attrs)
-        const attrValues = response.data.attrValues || [] // 确保是一个数组
-        console.log('attrValues', attrValues)
-
-        // 创建一个映射对象,用于存储 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] = ''
-          }
-        })
 
-        // 更新 attrValuesMap 到组件的数据中
-        this.attrValuesMap = attrValuesMap
-        // 打印更新后的 attrValuesMap,用于调试
-        console.log('Updated attrValuesMap', this.attrValuesMap)
+    // 查询事件日志
+    async queryEventLogs() {
+      this.eventLogLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.eventLogQuery.pageNum,
+          pageSize: this.eventLogQuery.pageSize
+        }
 
-      })
-    }
-  }
-}
-</script>
-<style lang="scss" scoped>
+        if (this.eventLogQuery.dateRange && this.eventLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.eventLogQuery.dateRange[0]
+          params.endRecTime = this.eventLogQuery.dateRange[1]
+        }
 
-.divider {
-  border-bottom: 2px solid #ebeef5;
-  margin: 10px 0;
-}
+        if (this.eventLogQuery.eventKey) {
+          params.eventKey = this.eventLogQuery.eventKey
+        }
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-  margin-top: 20px;
-  margin-bottom: 10px;
-}
+        const res = await listEventLog(params)
+        this.eventLogList = res.rows || []
+        this.eventLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询事件日志失败')
+      } finally {
+        this.eventLogLoading = false
+      }
+    },
 
-.drawer-content {
-  padding: 0 20px;
-}
+    // 重置事件日志查询
+    resetEventLogQuery() {
+      this.initDateRange()
+      this.eventLogQuery.eventKey = ''
+      this.eventLogQuery.pageNum = 1
+      this.queryEventLogs()
+    },
 
+    // 格式化调用状态
+    formatCallStatus(status) {
+      const statusMap = {
+        0: '成功',
+        1: '进行中',
+        2: '失败'
+      }
+      return statusMap[status] || '未知'
+    },
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-}
+    // 获取调用状态类型
+    getCallStatusType(status) {
+      const typeMap = {
+        0: 'success',
+        1: 'warning',
+        2: 'danger'
+      }
+      return typeMap[status] || 'info'
+    },
 
-.attr-list-container {
-  border: 1px solid #ccc;
-  padding: 10px;
-  margin: 10px 0;
-  font-weight: bold;
-}
+    // 查看调用日志详情
+    async handleCallLogDetail(row) {
+      try {
+        const res = await getCallLog(row.id)
+        this.callLogDetailData = res.data
+        this.callLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取调用日志详情失败')
+      }
+    },
 
-.attr-list-container h3 {
-  font-weight: bold;
+    // 查看事件日志详情
+    async handleEventLogDetail(row) {
+      try {
+        const res = await getEventLog(row.id)
+        this.eventLogDetailData = res.data
+        this.eventLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取事件日志详情失败')
+      }
+    }
+  }
 }
+</script>
 
-.attr-item {
-  list-style-type: none;
-  margin-bottom: 5px;
+<style lang="scss" scoped>
+.app-container {
+  padding: 20px;
+  background: #f5f7fa;
+  min-height: calc(100vh - 84px);
 }
 
-.attr-name {
-  font-weight: bold;
-}
+.system-info-card {
+  margin-bottom: 20px;
 
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
 
-.contents{
-  border: 20px solid #f2f2f5;
-  background-color: #f2f2f5;
-}
+    .title {
+      font-size: 18px;
+      font-weight: bold;
 
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
+  }
 
-.other-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-  margin-bottom: 20px;
-}
+  .info-group {
+    .group-title {
+      font-size: 14px;
+      font-weight: bold;
+      color: #606266;
+      margin-bottom: 12px;
+      padding-bottom: 6px;
+      border-bottom: 1px solid #EBEEF5;
+    }
+  }
 
-.table-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-}
+  .info-item {
+    margin-bottom: 12px;
+    font-size: 14px;
 
-.pagination-container {
-  margin-bottom: 20px;
-}
+    label {
+      color: #909399;
+      margin-right: 8px;
+      display: inline-block;
+      min-width: 80px;
+    }
 
-.button-group-container {
-  display: flex;
-  justify-content: flex-end;
-  min-width: 200px;
-  padding: 5px;
-}
+    .code {
+      font-family: monospace;
+      color: #409EFF;
+      background: #f0f9ff;
+      padding: 2px 6px;
+      border-radius: 3px;
+    }
 
-.device-list {
-  margin-top: 20px;
+    .stat-number {
+      color: #409EFF;
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
 }
 
-.device-card {
-  background-color: #fff;
-  border: 1px solid #bfcbd9;
-  border-radius: 4px;
-  overflow: hidden;
-  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
-  transition: 0.3s;
-  padding: 10px;
-  font-size: 14px;
-  height: 200px;
-  margin-bottom: 20px;
-  display: flex;
-  flex-direction: column;
-}
+.detail-card {
+  .tab-content {
+    min-height: 400px;
+  }
 
-.device-header {
-  //background-color: #f2f2f5;
-  //padding: 10px;
-  color: #545353;
-  font-size: 20px;
-  font-weight: bold;
-}
-.device-code{
-  color:cornflowerblue;
-}
-.deviceOthers{
-  color: black;
-}
+  .attr-section {
+    margin-bottom: 30px;
 
-.device-body {
-  padding: 10px;
-  color: #666666;
-  flex: 1; /* 使设备主体内容占据剩余空间 */
-  overflow-y: auto; /* 如果内容过多,允许滚动 */
-}
+    .section-title {
+      margin: 20px 0 15px 0;
+      color: #303133;
 
-.device-footer {
-  display: flex;
-  justify-content: space-between;
-  padding: 5px;
-  // background-color: #f9f9f9;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
 
-.device-footer .el-button {
-  padding: 5px 15px;
-  border: none; /* 移除默认边框 */
-  color: #5a5e66;
-  transition: background-color 0.3s; /* 平滑过渡背景色变化 */
-}
+    .url-text {
+      color: #409EFF;
+      font-family: monospace;
+    }
+  }
 
-/* 为按钮分配不同的颜色 */
-.device-footer .el-button:first-child {
-  background-color: #d5f1d5; /* 淡绿色 */
-  border: 1px solid lightgreen;
-  color: #71e2aa;
+  .device-stats {
+    margin-bottom: 20px;
+
+    .stat-item {
+      text-align: center;
+      padding: 20px;
+      background: #fff;
+      border: 1px solid #EBEEF5;
+      border-radius: 4px;
+
+      .stat-value {
+        font-size: 28px;
+        font-weight: bold;
+        color: #303133;
+        margin-bottom: 8px;
+      }
 
-}
+      .stat-label {
+        font-size: 14px;
+        color: #909399;
+      }
 
-.device-footer .el-button:nth-child(2) {
-  background-color: #ffe5b4; /* 淡橙色 */
-  border: 1px solid #ffba00;
-  color: #faad14;
-}
+      &.online .stat-value {
+        color: #67C23A;
+      }
 
-.device-footer .el-button:last-child {
-  background-color: #ffd5d5; /* 淡红色 */
-  border: 1px solid lightpink;
-  color: #f5222d;
-}
+      &.offline .stat-value {
+        color: #F56C6C;
+      }
+    }
+  }
 
-/* 鼠标悬停时加深颜色 */
-.device-footer .el-button:hover {
-  filter: brightness(0.5); /* 颜色加深效果 */
-}
+  .device-detail {
+    padding: 20px;
+    background: #f5f7fa;
+
+    h5 {
+      margin: 15px 0 10px 0;
+      color: #303133;
+    }
+  }
 
-/* 背景色样式 */
-.north {
-  background: linear-gradient(to right, #e1f3d8, #fafafa);
+  .log-filter {
+    margin-bottom: 20px;
+    padding: 15px;
+    background: #f5f7fa;
+    border-radius: 4px;
+  }
 }
 
-.south {
-  background: linear-gradient(to right, #fff7e8, #fafafa);
+.execute-result {
+  .result-data {
+    margin-top: 20px;
+
+    pre {
+      background: #f5f7fa;
+      padding: 15px;
+      border-radius: 4px;
+      overflow: auto;
+      max-height: 400px;
+      font-family: monospace;
+      font-size: 12px;
+    }
+  }
 }
 
-.main {
-  background: linear-gradient(to right, #e0e0e0, #fafafa);
+.dialog-footer {
+  text-align: right;
 }
 
+::v-deep .el-dropdown-menu {
+  .el-submenu__title {
+    padding-right: 40px !important;
 
-.el-table {
-  background-color: #ffffff; /* 白色背景 */
-}
+    &:hover {
+      background-color: #f5f7fa;
+    }
+  }
 
-.el-card {
-  background-color: #ffffff; /* 白色背景 */
+  .el-submenu__icon-arrow {
+    position: absolute;
+    right: 20px;
+  }
 }
 </style>

+ 1393 - 1100
ems-ui-cloud/src/views/adapter/ljcy/index.vue

@@ -1,1248 +1,1541 @@
 <template>
   <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="4" :xs="24">
-        <div class="head-container">
-          <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-                    style="margin-bottom: 20px"
-          />
-        </div>
-        <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
-          <el-tree :data="treeAreaOptions" :props="defaultProps" :expand-on-click-node="false"
-                   :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-                   @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"
-          />
-        </div>
-      </el-col>
-      <el-col :span="20" :xs="24">
-        <div class="contents">
-          <div class="other-content">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
-                     label-width="68px"
-            >
-              <el-form-item label="设备分类" prop="deviceSubCategory">
-                <el-select v-model="queryParams.deviceSubCategory">
-                  <el-option v-for="item in subCategoryOptions" placeholder="设备分类" :label="item.name" :value="item.code"
-                             :key="item.code"
-                  />
-                </el-select>
+    <!-- 系统基础信息卡片 - 添加编辑按钮 -->
+    <el-card class="system-info-card">
+      <div slot="header" class="card-header">
+        <span class="title">
+          <i class="el-icon-s-platform"></i>
+          海绵系统监测
+        </span>
+        <el-tag :type="systemStatus === '1' ? 'success' : 'danger'" effect="dark">
+          {{ systemStatus === '1' ? '正常' : '异常' }}
+        </el-tag>
+      </div>
+
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">系统信息</div>
+            <div class="info-item">
+              <label>系统代码:</label>
+              <span class="code">{{ systemInfo.systemCode }}</span>
+            </div>
+            <div class="info-item">
+              <label>系统名称:</label>
+              <span>{{ systemInfo.systemName }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">厂商信息</div>
+            <div class="info-item">
+              <label>对接厂商:</label>
+              <span>{{ systemInfo.manFacturer || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系人:</label>
+              <span>{{ systemInfo.contactPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系电话:</label>
+              <span>{{ systemInfo.contactNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">维护信息</div>
+            <div class="info-item">
+              <label>维护人:</label>
+              <span>{{ systemInfo.maintainerPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>维护电话:</label>
+              <span>{{ systemInfo.maintainerNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">设备统计</div>
+            <div class="info-item">
+              <label>设备总数:</label>
+              <span class="stat-number">{{ deviceStats.total }}</span>
+            </div>
+            <div class="info-item">
+              <label>在线设备:</label>
+              <span class="stat-number">{{ deviceStats.online }}</span>
+            </div>
+            <div class="info-item">
+              <label>测点总数:</label>
+              <span class="stat-number">{{ deviceStats.points }}</span>
+            </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEdit"
+                v-hasPermi="['ems:subsystem:edit']">
+                编辑
+              </el-button>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <!-- 系统详情标签页 -->
+    <el-card class="detail-card">
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+        <!-- 系统属性标签页 -->
+        <el-tab-pane label="系统属性" name="attributes">
+          <div class="tab-content">
+            <!-- 协议属性 -->
+            <div class="attr-section" v-if="protocolAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-connection"></i>
+                协议信息
+              </h4>
+              <el-table :data="protocolAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.attrKey === 'url'" class="url-text">
+                      {{ scope.row.attrValue }}
+                    </span>
+                    <span v-else>{{ scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+
+            <!-- 状态属性 -->
+            <div class="attr-section" v-if="stateAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-info"></i>
+                状态信息
+              </h4>
+              <el-table :data="stateAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <el-tag v-if="scope.row.attrKey === 'interfaceStatus'"
+                            :type="scope.row.attrValue === '1' ? 'success' : 'danger'">
+                      {{ scope.row.attrValueName }}
+                    </el-tag>
+                    <span v-else>{{ scope.row.attrValueName || scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="updateTime" label="更新时间" width="180"></el-table-column>
+              </el-table>
+            </div>
+          </div>
+        </el-tab-pane>
+
+        <!-- 系统能力标签页 -->
+        <el-tab-pane label="系统能力" name="abilities">
+          <div class="tab-content">
+            <el-table :data="systemAbilities" border stripe v-loading="abilityLoading">
+              <el-table-column prop="abilityName" label="能力名称" width="200"></el-table-column>
+              <el-table-column prop="abilityKey" label="能力标识" width="180"></el-table-column>
+              <el-table-column prop="abilityDesc" label="能力描述"></el-table-column>
+              <el-table-column label="操作" width="200" align="center">
+                <template slot-scope="scope">
+                  <div v-if="getParamType(scope.row.paramDefinition) === 'Options'" style="display: inline-block;">
+                    <el-button-group>
+                      <el-button
+                        v-for="option in parseOptions(scope.row.paramDefinition)"
+                        :key="option.value"
+                        size="mini"
+                        type="primary"
+                        @click="executeSystemAbilityWithParam(scope.row, option.value)"
+                        :loading="scope.row.executing && scope.row.executingValue === option.value">
+                        {{ option.key }}
+                      </el-button>
+                    </el-button-group>
+                  </div>
+                  <el-button
+                    v-else
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-caret-right"
+                    @click="handleSystemAbilityClick(scope.row)"
+                    :loading="scope.row.executing">
+                    执行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 关联设备标签页 -->
+        <el-tab-pane label="关联设备" name="devices">
+          <div class="tab-content">
+            <!-- 设备统计 -->
+            <div class="device-stats">
+              <el-row :gutter="20">
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.total }}</div>
+                    <div class="stat-label">设备总数</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item online">
+                    <div class="stat-value">{{ deviceStats.online }}</div>
+                    <div class="stat-label">在线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item offline">
+                    <div class="stat-value">{{ deviceStats.offline }}</div>
+                    <div class="stat-label">离线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.points }}</div>
+                    <div class="stat-label">测点总数</div>
+                  </div>
+                </el-col>
+              </el-row>
+            </div>
+
+            <!-- 设备列表 -->
+            <el-table
+              :data="deviceList"
+              border
+              stripe
+              v-loading="deviceLoading"
+              @row-click="handleDeviceClick"
+              ref="deviceTable">
+              <el-table-column type="expand">
+                <template slot-scope="props">
+                  <div class="device-detail">
+                    <el-tabs v-model="props.row.detailTab">
+                      <el-tab-pane label="设备属性" name="attrs">
+                        <el-descriptions :column="2" border size="small">
+                          <el-descriptions-item label="IP地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'ip') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="网关地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'gateway') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="子网掩码">
+                            {{ getDeviceAttr(props.row.deviceCode, 'subnetMask') }}
+                          </el-descriptions-item>
+                        </el-descriptions>
+                      </el-tab-pane>
+                      <el-tab-pane label="测点信息" name="points">
+                        <div v-for="(channel, idx) in getDeviceChannels(props.row.deviceCode)" :key="idx">
+                          <h5>{{ channel.name }} ({{ channel.points.length }}个测点)</h5>
+                          <el-table :data="channel.points" size="mini" max-height="200">
+                            <el-table-column prop="name" label="测点名称"></el-table-column>
+                            <el-table-column prop="key" label="测点标识"></el-table-column>
+                            <el-table-column prop="value" label="当前值">
+                              <template slot-scope="scope">
+                                {{ scope.row.value || '-' }}
+                              </template>
+                            </el-table-column>
+                            <el-table-column prop="updateTime" label="更新时间"></el-table-column>
+                          </el-table>
+                        </div>
+                      </el-tab-pane>
+                    </el-tabs>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="deviceCode" label="设备代码" width="150"></el-table-column>
+              <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+              <el-table-column prop="location" label="安装位置"></el-table-column>
+              <el-table-column prop="areaCode" label="区域" width="150">
+                <template slot-scope="scope">
+                  {{ scope.row.areaCode.includes('3001') ? '北区' : '南区' }}
+                </template>
+              </el-table-column>
+              <el-table-column label="设备状态" width="100" align="center">
+                <template slot-scope="scope">
+                  <el-tag :type="scope.row.deviceStatus === 1 ? 'success' : 'info'">
+                    {{ scope.row.deviceStatus === 1 ? '在线' : '离线' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="120" align="center">
+                <template slot-scope="scope">
+                  <el-dropdown
+                    trigger="click"
+                    @command="handleDeviceCommand"
+                    @visible-change="(visible) => handleAbilityLoad(visible, scope.row)">
+                    <el-button type="text" size="mini">
+                      操作<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                      <template v-if="deviceAbilities[scope.row.deviceCode] && deviceAbilities[scope.row.deviceCode].length > 0">
+                        <template v-for="ability in deviceAbilities[scope.row.deviceCode]">
+                          <el-submenu
+                            v-if="getParamType(ability.paramDefinition) === 'Options'"
+                            :key="ability.abilityKey"
+                            :index="ability.abilityKey">
+                            <template slot="title">
+                              {{ ability.abilityName }}
+                              <i class="el-icon-arrow-right" style="float: right;"></i>
+                            </template>
+                            <el-dropdown-item
+                              v-for="option in parseOptions(ability.paramDefinition)"
+                              :key="option.value"
+                              :command="{device: scope.row, ability: ability, paramValue: option.value}">
+                              {{ option.key }}
+                            </el-dropdown-item>
+                          </el-submenu>
+                          <el-dropdown-item
+                            v-else
+                            :key="ability.abilityKey"
+                            :command="{device: scope.row, ability: ability}">
+                            {{ ability.abilityName }}
+                          </el-dropdown-item>
+                        </template>
+                      </template>
+                      <el-dropdown-item v-else disabled>
+                        无可用操作
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 调用日志标签页 -->
+        <el-tab-pane label="调用日志" name="callLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="callLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="callLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
               </el-form-item>
-              <el-form-item label="归属设施" prop="refFacs">
-                <el-select v-model="queryParams.refFacs">
-                  <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                             :key="item.facsCode"
-                  />
-                </el-select>
+              <el-form-item label="能力标识">
+                <el-input v-model="callLogQuery.abilityKey" placeholder="请输入能力标识" clearable></el-input>
               </el-form-item>
-              <el-form-item label="子系统" prop="subsystemCode">
-                <el-select v-model="queryParams.subsystemCode">
-                  <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                             :key="item.systemCode"
-                  />
+              <el-form-item label="调用状态">
+                <el-select v-model="callLogQuery.callStatus" placeholder="全部" clearable>
+                  <el-option label="成功" :value="0"></el-option>
+                  <el-option label="进行中" :value="1"></el-option>
+                  <el-option label="失败" :value="2"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item>
-                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                <el-button type="primary" @click="queryCallLogs">查询</el-button>
+                <el-button @click="resetCallLogQuery">重置</el-button>
               </el-form-item>
             </el-form>
 
-            <el-row :gutter="10" class="mb8">
-              <el-col :span="1.5">
-                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-                           v-hasPermi="['ems:device:add']"
-                >新增
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-                           v-hasPermi="['ems:device:edit']"
-                >修改
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
-                           v-hasPermi="['ems:device:remove']"
-                >删除
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-                           v-hasPermi="['ems:device:export']"
-                >导出
-                </el-button>
-              </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-            </el-row>
-          </div>
-
-          <div class="table-content">
-            <!--分页-->
-            <div class="button-group-container">
-              <el-button-group>
-                <el-button :type="primary1" icon="el-icon-s-fold" @click="switchData(1)" />
-                <el-button :type="primary2" icon="el-icon-menu" @click="switchData(2)" />
-              </el-button-group>
-            </div>
-
-            <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange" v-if="istable === 1">
-              <el-table-column type="selection" width="55" align="center"/>
-              <el-table-column label="设备名称" align="left" prop="deviceName"/>
-              <el-table-column label="安装位置" align="left" prop="areaPath" width="220px"/>
-              <el-table-column label="归属设施" align="center" prop="refFacsName"/>
-              <el-table-column label="设备分类" align="center" prop="deviceCategoryName"/>
-              <el-table-column label="子系统" align="center" prop="subsystemName"/>
-              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <el-table :data="callLogList" border stripe v-loading="logLoading">
+              <el-table-column prop="objCode" label="对象代码" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="abilityName" label="能力名称" min-width="150"></el-table-column>
+              <el-table-column prop="callTime" label="调用时间" width="180"></el-table-column>
+              <el-table-column label="调用状态" width="100" align="center">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDevProcess(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']" v-if="shouldShowDevProcessButton(scope.row)"
-                  >
-                    器件
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    详情
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    修改
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                             @click="handleDelete(scope.row)" v-hasPermi="['basecfg:device:remove']"
-                  >
-                    删除
-                  </el-button>
-
+                  <el-tag size="small" :type="getCallStatusType(scope.row.callStatus)">
+                    {{ formatCallStatus(scope.row.callStatus) }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleCallLogDetail(scope.row)">详情</el-button>
                 </template>
               </el-table-column>
             </el-table>
 
-            <div v-else-if="istable === 2" >
-              <el-row :gutter="20" class="device-list">
-                <el-col v-for="device in deviceList" :key="device.id" :span="6">
-                  <div :class="`device-card ${backStyle(device.areaPath)}`">
-                    <div class="device-header">
-                      <i class="el-icon-s-operation" style="margin-right: 8px;"></i>
-                      {{ device.deviceName }}
-                    </div>
-                    <div class="device-body">
-                      <p>设备代码:<span class="device-code">{{ device.deviceCode }}</span></p>
-                      <p>安装位置:<span class="deviceOthers">{{ device.areaPath }}</span></p>
-                      <p>归属设施:<span class="deviceOthers">{{ device.refFacsName }}</span></p>
-                      <p>设备分类:<span class="deviceOthers">{{ device.deviceCategoryName }}</span></p>
-                      <p>子系统:<span class="deviceOthers">{{ device.subsystemName }}</span></p>
-                    </div>
-                    <div class="device-footer">
-                      <el-button size="mini" plain icon=" el-icon-document"  @click="handleDetail(device)">详情</el-button>
-                      <el-button size="mini" plain icon="el-icon-edit" @click="handleUpdate(device)">修改</el-button>
-                      <el-button size="mini" plain icon="el-icon-delete"  type="danger" @click="handleDelete(device)">删除</el-button>
-                    </div>
-                  </div>
-                </el-col>
-              </el-row>
-            </div>
+            <pagination
+              v-show="callLogTotal > 0"
+              :total="callLogTotal"
+              :page.sync="callLogQuery.pageNum"
+              :limit.sync="callLogQuery.pageSize"
+              @pagination="queryCallLogs"
+            />
+          </div>
+        </el-tab-pane>
+
+        <!-- 事件日志标签页 -->
+        <el-tab-pane label="事件日志" name="eventLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="eventLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="eventLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
+              </el-form-item>
+              <el-form-item label="事件标识">
+                <el-input v-model="eventLogQuery.eventKey" placeholder="请输入事件标识" clearable></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="queryEventLogs">查询</el-button>
+                <el-button @click="resetEventLogQuery">重置</el-button>
+              </el-form-item>
+            </el-form>
 
+            <el-table :data="eventLogList" border stripe v-loading="eventLogLoading">
+              <el-table-column prop="objCode" label="对象编号" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventName" label="事件名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventTime" label="事件时间" width="180"></el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleEventLogDetail(scope.row)">详情</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
 
-            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-                        :limit.sync="queryParams.pageSize"
-                        @pagination="getList"
+            <pagination
+              v-show="eventLogTotal > 0"
+              :total="eventLogTotal"
+              :page.sync="eventLogQuery.pageNum"
+              :limit.sync="eventLogQuery.pageSize"
+              @pagination="queryEventLogs"
             />
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </el-card>
+
+    <!-- 修改系统信息对话框 -->
+    <el-dialog title="修改系统信息" :visible.sync="editDialogVisible" width="500px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="厂商" prop="manFacturer">
+          <el-input v-model="editForm.manFacturer" placeholder="请输入厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editForm.descr" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelEdit">取 消</el-button>
+        <el-button type="primary" @click="submitEdit" :loading="editLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 执行结果对话框 -->
+    <el-dialog
+      :title="executeDialog.title"
+      :visible.sync="executeDialog.visible"
+      width="600px">
+      <div class="execute-result">
+        <el-alert
+          :title="executeDialog.status"
+          :type="executeDialog.type"
+          :description="executeDialog.message"
+          show-icon>
+        </el-alert>
+        <div v-if="executeDialog.data" class="result-data">
+          <pre>{{ JSON.stringify(executeDialog.data, null, 2) }}</pre>
+        </div>
+      </div>
+      <span slot="footer">
+        <el-button @click="executeDialog.visible = false">关闭</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 调用日志详情弹窗 -->
+    <el-dialog :visible.sync="callLogDetailDialog" title="调用日志详情" width="60%">
+      <div v-if="callLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象代码">{{ callLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="模型代码">{{ callLogDetailData.modelCode }}</el-descriptions-item>
+          <el-descriptions-item label="能力标识">{{ callLogDetailData.abilityKey }}</el-descriptions-item>
+          <el-descriptions-item label="调用时间">{{ callLogDetailData.callTime }}</el-descriptions-item>
+          <el-descriptions-item label="响应时间">{{ callLogDetailData.resTime }}</el-descriptions-item>
+          <el-descriptions-item label="调用结果">
+            <el-tag :type="getCallStatusType(callLogDetailData.callStatus)">
+              {{ formatCallStatus(callLogDetailData.callStatus) }}
+            </el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>调用载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.callPayload }}</pre>
+        </div>
 
-            <!-- 添加或修改能源设备对话框 -->
-            <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-              <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-                <el-form-item label="归属设施" prop="refFacs">
-                  <el-select v-model="form.refFacs">
-                    <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                               :key="item.facsCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备代码" prop="deviceCode">
-                  <el-input v-model="form.deviceCode" placeholder="请输入设备代码"/>
-                </el-form-item>
-                <el-form-item label="设备名称" prop="deviceName">
-                  <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
-                </el-form-item>
-
-
-                <el-form-item label="功能类型" prop="psCode" v-if="queryParams.deviceCategory === 'W'">
-                  <el-select v-model="form.psCode">
-                    <el-option v-for="item in devOptions" :label="item.psName" :value="item.psCode"
-                               :key="item.psCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备类型" prop="deviceType">
-                  <el-select v-model="form.deviceCategory">
-                    <el-option v-for="item in subCategoryOptions" :label="item.name" :value="item.code"
-                               :key="item.code"
-                    />
-                  </el-select>
-                </el-form-item>
-                <el-form-item label="设备模型" prop="deviceModel">
-                  <el-select v-model="form.deviceModel" style="width:100%" @change="handleModelChange">
-                    <el-option
-                      v-for="item in modelList"
-                      :label="item.modelName"
-                      :value="item.modelCode"
-                      :key="item.modelCode"
-                    />
-                  </el-select>
-                </el-form-item>
-                <!-- 这里可以展示属性名称和属性值 -->
-                <div v-if="attrList.length > 0" class="attr-list-container">
-                  <h3>模型属性:</h3>
-                  <ul>
-                    <li v-for="attr in attrList" :key="attr.attrKey" class="attr-item">
-                      <span class="attr-name">{{ attr.attrName }} ({{ attr.attrUnit }}):</span>
-                      <!-- 使用 el-input 组件允许用户编辑属性值 -->
-                      <el-input
-                        v-model="attrValuesMap[attr.attrKey]"
-                        placeholder="点击编辑"
-                        size="small"
-                        @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])"
-                      >
-                      </el-input>
-                    </li>
-                  </ul>
-                </div>
-                <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
-                  <el-form-item label="" prop="attrList">
-                    <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px"
-                              key="'customAttrs'"
-                    >
-                      <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="attrName">
-                        <template slot-scope="scope">
-                          <el-input size="mini" v-model="scope.row.attrName" 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="请输入属性值"/>
-                        </template>
-                      </el-table-column>
-                      <el-table-column align="center" label="操作">
-                        <template slot="header">
-                          <div class="operateBtns" @click="addCustomAttr">
-                            <span>添加</span><i class="el-icon-circle-plus-outline"></i>
-                          </div>
-                        </template>
-                        <template slot-scope="scope">
-                          <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
-                        </template>
-                      </el-table-column>
-                    </el-table>
-                  </el-form-item>
-                </h3>
-                <el-form-item label="子系统" prop="subsystemCode">
-                  <el-select v-model="form.subsystemCode">
-                    <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                               :key="item.systemCode"
-                    />
-                  </el-select>
-                </el-form-item>
-              </el-form>
-              <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="submitForm">确 定</el-button>
-                <el-button @click="cancel">取 消</el-button>
+        <div style="margin-top: 20px;">
+          <h4>响应载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.resPayload }}</pre>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 事件日志详情弹窗 -->
+    <el-dialog :visible.sync="eventLogDetailDialog" title="事件日志详情" width="60%">
+      <div v-if="eventLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象编号">{{ eventLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="对象名称">{{ eventLogDetailData.objName }}</el-descriptions-item>
+          <el-descriptions-item label="事件名称">{{ eventLogDetailData.eventName }}</el-descriptions-item>
+          <el-descriptions-item label="事件标识">{{ eventLogDetailData.eventKey }}</el-descriptions-item>
+          <el-descriptions-item label="事件时间" :span="2">{{ eventLogDetailData.eventTime }}</el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>事件描述</h4>
+          <div style="background-color: #f5f5f5; padding: 10px; border-radius: 4px;">
+            {{ eventLogDetailData.eventDetail || '无' }}
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 能力执行弹窗(支持Slider和Input类型) -->
+    <el-dialog :title="abilityDialogTitle" :visible.sync="abilityDialogVisible" width="500px" append-to-body :close-on-click-modal="false">
+      <el-form ref="abilityForm" :model="abilityForm" label-width="100px">
+        <el-form-item label="能力名称">
+          <el-input v-model="abilityForm.abilityName" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="能力描述">
+          <el-input type="textarea" v-model="abilityForm.abilityDesc" disabled :rows="2"></el-input>
+        </el-form-item>
+
+        <el-form-item label="参数设置" v-if="abilityParamType">
+          <template v-if="abilityParamType === 'Slider'">
+            <div style="width: 100%;">
+              <div style="padding: 0 10px;">
+                <el-slider
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :show-tooltip="true"
+                  :format-tooltip="formatTooltip">
+                </el-slider>
               </div>
-            </el-dialog>
-
-            <!--设备器件-->
-            <el-drawer :title=ComponentRow.deviceName size="80%" :visible.sync="showDevProcessDrawer" direction="rtl">
-              <div class="drawer-content" style="padding-left:50px">
-                <el-row :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleComponentAdd"
-                               v-hasPermi="['ems:component:add']"
-                    >新增
-                    </el-button>
-                  </el-col>
-                </el-row>
-                <el-table v-loading="loading" :data="ComponentList">
-                  <el-table-column type="selection" width="55" align="center"/>
-                  <el-table-column label="部件编码" align="center" prop="compoCode"/>
-                  <el-table-column label="部件标签" align="center" prop="compoTag">
-                    <template slot-scope="scope">
-                      {{ objComTypeMapping[scope.row.compoTag] }}
-                    </template>
-                  </el-table-column>
-                  <el-table-column label="工艺标识代码" align="center" prop="psCode"/>
-                  <el-table-column label="外系统部件编码" align="center" prop="extCompoCode"/>
-                  <el-table-column label="部件模型" align="center" prop="compoModel"/>
-                  <el-table-column label="部件品牌" align="center" prop="compoBrand"/>
-                  <el-table-column label="部件型号" align="center" prop="compoSpec"/>
-                  <el-table-column label="祖籍列表" align="center" prop="ancestors"/>
-                  <el-table-column label="上级部件" align="center" prop="parentEqpt"/>
-
-                  <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-edit" @click="handleComponentUpdate(scope.row)"
-                                 v-hasPermi="['ems:component:edit']"
-                      >
-                        修改
-                      </el-button>
-                      <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                                 @click="handleComponentDelete(scope.row)" v-hasPermi="['ems:component:remove']"
-                      >
-                        删除
-                      </el-button>
-                    </template>
-                  </el-table-column>
-                </el-table>
-                <pagination v-show="total>0" :total="total" :page.sync="queryComponentParams.pageNum"
-                            :limit.sync="queryComponentParams.pageSize"
-                            @pagination="getComponentList"
-                />
-
-                <!-- 添加或修改设备器件对话框 -->
-                <el-dialog :title="title" :visible.sync="componentOpen" width="500px" append-to-body>
-                  <el-form ref="componentForm" :model="componentForm" :rules="componentRules" label-width="150px">
-                    <!--                <el-form-item label="设备code" prop="deviceCode">-->
-                    <!--                  <el-input v-model="componentForm.deviceCode" placeholder="请输入设备code" />-->
-                    <!--                </el-form-item>-->
-                    <el-form-item label="部件编码" prop="compoCode">
-                      <el-input v-model="componentForm.compoCode" placeholder="请输入部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件标签" prop="compoTag">
-                      <el-select v-model="componentForm.compoTag" placeholder="请输入部件标签">
-                        <el-option v-for="item in objComTypeOptions"
-                                   :label="item.name"
-                                   :value="item.code"
-                                   :key="item.code"
-                        />
-
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="工艺标签代码" prop="psCode">
-                      <el-select v-model="componentForm.psCode" placeholder="请输入工艺标签代码">
-                        <el-option v-for="item in devOptions" :label="item.psCode" :value="item.psCode" :key="item.psCode"/>
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="外系统部件编码" prop="extCompoCode">
-                      <el-input v-model="componentForm.extCompoCode" placeholder="请输入外系统部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件模型" prop="compoModel">
-                      <el-select v-model="componentForm.compoModel" placeholder="请输入部件模型">
-                        <el-option v-for="item in this.modelList" :label="item.modelCode" :value="item.modelCode"
-                                   :key="item.modelCode"
-                        />
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="部件品牌" prop="compoBrand">
-                      <el-input v-model="componentForm.compoBrand" placeholder="请输入部件品牌"/>
-                    </el-form-item>
-                    <el-form-item label="部件型号" prop="compoSpec">
-                      <el-input v-model="componentForm.compoSpec" placeholder="请输入部件型号"/>
-                    </el-form-item>
-                    <el-form-item label="祖籍列表" prop="ancestors">
-                      <el-input v-model="componentForm.ancestors" placeholder="请输入祖籍列表"/>
-                    </el-form-item>
-                    <el-form-item label="上级列表" prop="parentCompo">
-                      <el-input v-model="componentForm.parentCompo" placeholder="请输入上级列表"/>
-                    </el-form-item>
-
-                  </el-form>
-                  <div slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="submitComponentForm">确 定</el-button>
-                    <el-button @click="ComponentCancel">取 消</el-button>
-                  </div>
-                </el-dialog>
+
+              <div style="display: flex; justify-content: space-between; padding: 0 10px; margin-top: -5px; margin-bottom: 20px;">
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMin }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ Math.floor((abilitySliderMin + abilitySliderMax) / 2) }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMax }}%</span>
               </div>
-            </el-drawer>
-
-            <!-- 详情弹框 -->
-            <el-dialog :visible.sync="showDrawer" title="设备详情">
-              <div v-if="curRow">
-                <!-- 设备基本信息 -->
-                <el-card class="box-card">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">设备基本信息</span>
-                  </div>
-                  <div>
-                    <p>设备代码:{{ curRow.deviceCode }}</p>
-                    <p>设备名称:{{ curRow.deviceName }}</p>
-                    <p>设备类型:{{ curRow.deviceCategoryName }}</p>
-                    <p>子系统:{{ curRow.subsystemName }}</p>
-                    <p>归属区域:{{ curRow.areaPath }}</p>
-                    <p>归属设施:{{ curRow.refFacsName }}</p>
-                  </div>
-                </el-card>
-                <el-card class="box-card" style="margin-top: 10px">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">状态属性</span>
-                  </div>
-                  <div>
-                    <p v-for="attr in statusAttr" :key="attr.attr">{{ attr.attr }}:{{ attr.attrValue }} {{
-                        attr.attrUnit
-                      }}</p>
-                  </div>
-                </el-card>
-                <!-- 属性信息 -->
-                <el-card class="box-card" v-if="attrData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">属性定义</span>
-                  </div>
-                  <div v-for="(item, index) in attrData" :key="index">
-                    <p>属性名称:{{ item.attrName }}</p>
-                    <p>属性值:{{ item.attrValue }}</p>
-                    <p>属性单位:{{ item.attrUnit }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < attrData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 能力信息 -->
-                <el-card class="box-card" v-if="abilityData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">能力定义</span>
-                  </div>
-                  <div v-for="(item, index) in abilityData" :key="index">
-                    <p>能力名称:{{ item.abilityName }}</p>
-                    <p>能力键:{{ item.abilityKey }}</p>
-                    <p>能力参数:{{ item.abilityParam }}</p>
-                    <p>能力描述:{{ item.abilityDesc }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < abilityData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 事件信息 -->
-                <el-card class="box-card" v-if="eventData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">事件定义</span>
-                  </div>
-                  <div v-for="(item, index) in eventData" :key="index">
-                    <p>事件名称:{{ item.eventKey }}</p>
-                    <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
-                    <p>事件代码:{{ item.eventCode }}</p>
-                    <p>外部事件代码:{{ item.extEventCode }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < eventData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
+
+              <div style="display: flex; align-items: center; gap: 15px;">
+                <el-input-number
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :step="1"
+                  :precision="0"
+                  controls-position="right"
+                  style="flex: 0 0 120px;">
+                </el-input-number>
+                <span style="color: #909399; font-size: 13px;">
+                  调节范围:{{ abilitySliderMin }} - {{ abilitySliderMax }}
+                </span>
               </div>
-            </el-dialog>
-          </div>
-        </div>
-      </el-col>
-    </el-row>
+            </div>
+          </template>
+
+          <template v-else-if="abilityParamType === 'Input'">
+            <el-input
+              v-model="abilityInputValue"
+              placeholder="请输入参数值"
+              clearable>
+            </el-input>
+          </template>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="abilityDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="executeAbilityWithParam" :loading="abilityExecuting">执行</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listDevRecursionByArea, getDevice, delDevice, addDevice, updateDevice } from '@/api/device/device'
-import { areaTreeSelect } from '@/api/basecfg/area'
-import { getFacsCategorygetByCode, listAllFacs } from '@/api/basecfg/emsfacs'
-import { listSubsystemAll } from '@/api/adapter/subsystem'
-import { getModelByCode, listAllModel } from '@/api/basecfg/objModel'
-import { getObjAttr } from '@/api/basecfg/objAttribute'
-import { addAttrValueBatch } from '@/api/basecfg/objAttributeValue'
-import { getDevProcess } from '@/api/commonApi'
-import { addComponent, delComponent, getComponent, listByDevice, updateComponent } from '@/api/basecfg/component'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
+import { getModelByCode } from '@/api/basecfg/objModel'
+import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
+import { listcallAbility } from '@/api/basecfg/objAbility'
+import { getByCondition } from '@/api/device/device'
+import { listCallLog, listEventLog, getCallLog, getEventLog } from '@/api/basecfg/objLog'
 
 export default {
-  name: 'Device',
-  components: { Treeselect },
+  name: 'SubsystemIntegration',
   data() {
     return {
-      primary1: 'primary',
-      primary2: '',
-      ComponentRow: [],
-      componentForm: {},
-      subcategoryCode: '',
-      attrList: [], // 属性模板数组
-      attrValues: [],
-      ComponentList: [],
-      attrValuesMap: {},
-      modelList: [],
-      showDrawer: false,
-      showDevProcessDrawer: false,
-      componentOpen: false,
-      istable: 2,
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 能源设备表格数据
+      // 系统代码
+      systemCode: 'SYS_LG',
+      // 系统信息
+      systemInfo: {},
+      // 系统状态
+      systemStatus: '1',
+      // 当前标签页
+      activeTab: 'attributes',
+      // 协议属性
+      protocolAttrs: [],
+      // 状态属性
+      stateAttrs: [],
+      // 系统能力
+      systemAbilities: [],
+      abilityLoading: false,
+      // 设备列表
       deviceList: [],
-      // 弹出层标题
-      title: '',
-      // 是否显示弹出层
-      open: false,
-      // 区域名称
-      areaName: undefined,
-      // 区域树选项
-      treeAreaOptions: undefined,
-      totalAreaOptions: undefined,
-      // 设施选项
-      facsOptions: undefined,
-      // 设备分类
-      subCategoryOptions: undefined,
-      subsystemOptions: undefined,
-      devOptions: undefined,
-
-      defaultProps: {
-        children: 'children',
-        label: 'label'
+      deviceLoading: false,
+      deviceAttrs: {},
+      deviceChannels: {},
+      // 设备能力缓存
+      deviceAbilities: {},
+      // 设备统计
+      deviceStats: {
+        total: 0,
+        online: 0,
+        offline: 0,
+        points: 0
       },
-      // 查询参数
-      queryParams: {
-        psCode: null,
+      // 所有模型代码(系统 + 设备)
+      allModelCodes: [],
+      // 调用日志查询
+      callLogQuery: {
+        dateRange: [],
+        abilityKey: '',
+        callStatus: '',
         pageNum: 1,
-        pageSize: 10,
-        deviceCode: null,
-        deviceSubCategory: '',
-        deviceCategory: 'E',
-        locationType: null,
-        locationRef: null,
-        refFacs: null,
-        customAttrs: null
+        pageSize: 10
       },
-      queryComponentParams: {
+      callLogList: [],
+      callLogTotal: 0,
+      logLoading: false,
+      // 事件日志查询
+      eventLogQuery: {
+        dateRange: [],
+        eventKey: '',
         pageNum: 1,
         pageSize: 10
       },
-      objComTypeMapping: {
-        1: '总开',
-        2: '照明',
-        3: '风机'
-      },
-      objComTypeOptions: [
-        { code: 1, name: '总开' },
-        { code: 2, name: '照明' },
-        { code: 3, name: '风机' }
-
-      ],
-      curRow: {},
-      attrData: [],
-      abilityData: [],
-      eventData: [],
-      statusAttr: [{
-        attr: '真空输送量',
-        attrUnit: 't/h',
-        attrValue: '1'
-      },
-        {
-          attr: '生化处理量',
-          attrUnit: 't/h',
-          attrValue: '1.3'
-        },
-        {
-          attr: '运行状态',
-          attrUnit: '',
-          attrValue: '工作中'
-        }
-      ],
-      // 表单参数
-      form: {
-        customAttrs: [] // 自定义属性数组
+      eventLogList: [],
+      eventLogTotal: 0,
+      eventLogLoading: false,
+      // 调用日志详情
+      callLogDetailDialog: false,
+      callLogDetailData: null,
+      // 事件日志详情
+      eventLogDetailDialog: false,
+      eventLogDetailData: null,
+      // 执行结果对话框
+      executeDialog: {
+        visible: false,
+        title: '',
+        status: '',
+        type: 'success',
+        message: '',
+        data: null
       },
-      // 表单校验
-      rules: {
-        refFacs: [
-          { required: true, message: '归属设施', trigger: 'blur' }
-        ],
-        refArea: [
-          { required: true, message: '安装位置', trigger: 'blur' }
-        ],
-        deviceCode: [
-          { required: true, message: '设备代码不能为空', trigger: 'blur' }
-        ],
-        deviceName: [
-          { required: true, message: '设备名称不能为空', trigger: 'blur' }
-        ]
+      // 能力执行相关
+      abilityDialogVisible: false,
+      abilityDialogTitle: '能力执行',
+      abilityForm: {
+        abilityName: '',
+        abilityKey: '',
+        abilityDesc: '',
+        paramDefinition: null,
+        modelCode: ''
       },
-      componentRules: {
-        deviceCode: [
-          { required: true, message: '设备code不能为空', trigger: 'blur' }
-        ],
-        compoCode: [
-          { required: true, message: '部件编码不能为空', trigger: 'blur' }
+      abilityParamType: null,
+      abilitySliderValue: 50,
+      abilitySliderMin: 0,
+      abilitySliderMax: 100,
+      abilityInputValue: '',
+      abilityExecuting: false,
+      currentDevice: null,
+      currentObjType: null,
+      // 编辑系统信息相关
+      editDialogVisible: false,
+      editLoading: false,
+      editForm: {},
+      editRules: {
+        systemCode: [
+          { required: true, message: "系统代码不能为空", trigger: "blur" }
         ],
-        psCode: [
-          { required: true, message: '工艺标签代码不能为空', trigger: 'blur' }
+        systemName: [
+          { required: true, message: "系统名称不能为空", trigger: "blur" }
         ]
       }
     }
   },
-  watch: {
-    // 根据名称筛选区域树
-    areaName(val) {
-      this.$refs.tree.filter(val)
-    }
-  },
   created() {
-    this.queryParams.deviceCategory = 'LG'; // 确保初始加载时就设置为 'LG'
-    this.getList()
-    this.getAreaTree('0', 1)
-    this.getFacsOptions()
-    this.getSubsystem()
-    this.getSubCategorygetByCode()
-    this.getFacsModel()
-    // this.getAllDevProcess(this.subcategoryCode)
+    this.loadSystemInfo()
+    this.initDateRange()
   },
   methods: {
-    /**分页切换*/
-    switchData(v) {
-      if (v === 1) {
-        this.primary1 = "primary";
-        this.primary2 = "";
-      } else {
-        this.primary1 = "";
-        this.primary2 = "primary";
-      }
-      this.istable = v;
-    },
-    /** 查询能源设备列表 */
-    getList() {
-      this.loading = true
-      listDevRecursionByArea(this.queryParams).then(response => {
-        console.log('参数', JSON.stringify(this.queryParams))
-        this.deviceList = response.rows
-        this.total = response.total
-        this.loading = false
+    // 打开编辑对话框
+    handleEdit() {
+      this.editForm = { ...this.systemInfo }
+      this.editDialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.editForm?.clearValidate()
       })
     },
-    /**新增、修改、删除*/
-    handleComponentAdd() {
-      this.componentReset()
-      this.componentOpen = true
-      this.title = '添加设备器件属性'
-      this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
 
+    // 取消编辑
+    cancelEdit() {
+      this.editDialogVisible = false
+      this.editForm = {}
     },
-    handleComponentUpdate(row) {
-      this.componentReset()
-      const id = row.id || this.ids
-      getComponent(id).then(response => {
-        this.componentForm = response.data
-        this.componentOpen = true
-        this.title = '修改设备器件属性'
-        this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
-      })
-    },
-    handleComponentDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function() {
-        return delComponent(ids)
-      }).then(() => {
-        console.log('删除row', row.deviceCode)
-        this.getComponentList(row.deviceCode)
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    submitComponentForm() {
-      this.$refs['componentForm'].validate(valid => {
+
+    // 提交编辑
+    submitEdit() {
+      this.$refs.editForm.validate(valid => {
         if (valid) {
-          if (this.componentForm.id != null) {
-            updateComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          } else {
-            addComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          }
+          this.editLoading = true
+          updateSubsystem(this.editForm).then(response => {
+            this.$message.success("修改成功")
+            this.editDialogVisible = false
+            // 重新加载系统信息
+            this.loadSystemInfo()
+          }).catch(error => {
+            this.$message.error("修改失败:" + error.message)
+          }).finally(() => {
+            this.editLoading = false
+          })
         }
       })
     },
-    ComponentCancel() {
-      this.componentOpen = false
-      this.componentReset()
-    },
-    /**查询部件列表*/
-    getComponentList(deviceCode) {
-      listByDevice(deviceCode).then(response => {
-        this.ComponentList = response.data
-      })
-    },
-    /** 查询区域树结构 */
-    getAreaTree(areaCode, layer) {
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.treeAreaOptions =  [{
-          id: '-1',
-          label: '全部',
-          children: response.data
-        }]
-      })
-    },
-    // 筛选节点
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
+
+    // 格式化滑块tooltip
+    formatTooltip(val) {
+      return `${val}%`
     },
-    // 节点单击事件
-    handleNodeClick(data) {
-      if (data.id === '-1') {
-        this.queryParams.locationType = null;
-        this.queryParams.locationRef = null;
-      } else {
-        this.queryParams.locationType = data.tier;
-        this.queryParams.locationRef = data.id;
+
+    // 解析参数定义类型
+    getParamType(paramDefinition) {
+      if (!paramDefinition) return null
+      try {
+        const def = JSON.parse(paramDefinition)
+        return def.type
+      } catch (e) {
+        return null
       }
-      this.handleQuery();
     },
-    // 取消按钮
-    cancel() {
-      this.open = false
-      this.reset()
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        deviceCode: null,
-        deviceName: null,
-        deviceType: null,
-        deviceStatus: null,
-        deviceModel: null,
-        refArea: null,
-        refFacs: null,
-        subsystemCode: null,
-        psCode: null,
-        createTime: null,
-        updateTime: null
 
+    // 解析Options类型的选项
+    parseOptions(paramDefinition) {
+      try {
+        const def = JSON.parse(paramDefinition)
+        if (def.type === 'Options' && def.list) {
+          return def.list
+        }
+      } catch (e) {
+        console.error('解析Options失败:', e)
       }
-      this.resetForm('form')
+      return []
     },
-    componentReset() {
-      this.componentForm = {
-        id: null,
-        deviceCode: this.ComponentRow.deviceCode || '', // 使用ComponentRow的deviceCode,或者空字符串
-        compoCode: null,
-        compoTag: null,
-        psCode: null,
-        extCompoCode: null,
-        compoModel: null,
-        compoBrand: null,
-        compoSpec: null,
-        ancestors: null,
-        parentCompo: null
 
+    // 处理系统能力点击
+    handleSystemAbilityClick(ability) {
+      const paramType = this.getParamType(ability.paramDefinition)
+
+      if (paramType === 'Slider') {
+        this.showSliderDialog(ability, this.systemInfo, 3)
+      } else if (paramType === 'Input') {
+        this.showInputDialog(ability, this.systemInfo, 3)
+      } else {
+        this.executeSystemAbility(ability)
       }
-      this.resetForm('componentForm')
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1
-      console.log('搜索按钮this.queryParams', JSON.stringify(this.queryParams))
-      this.getList()
+
+    // 执行系统能力(带Options参数)
+    executeSystemAbilityWithParam(ability, paramValue) {
+      ability.executing = true
+      ability.executingValue = paramValue
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: paramValue
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+        ability.executingValue = null
+      })
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.queryParams.locationType = null
-      this.queryParams.locationRef = null
-      this.resetForm('queryForm')
-      this.handleQuery()
+
+    // 执行系统能力(无参数)
+    executeSystemAbility(ability) {
+      ability.executing = true
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: null
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+
+        if (ability.abilityKey === 'MeterReadingGw') {
+          this.loadDevices()
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+      })
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+
+    // 显示滑块弹窗
+    showSliderDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Slider'
+
+      try {
+        const def = JSON.parse(ability.paramDefinition)
+        this.abilitySliderMin = def.min || 0
+        this.abilitySliderMax = def.max || 100
+        this.abilitySliderValue = Math.floor((this.abilitySliderMin + this.abilitySliderMax) / 2)
+      } catch (e) {
+        console.error('解析Slider参数失败:', e)
+        this.abilitySliderMin = 0
+        this.abilitySliderMax = 100
+        this.abilitySliderValue = 50
+      }
+
+      this.abilityDialogVisible = true
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '添加能源设备'
+
+    // 显示输入弹窗
+    showInputDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Input'
+      this.abilityInputValue = ''
+      this.abilityDialogVisible = true
     },
-    /**设备器件按钮*/
-    handleDevProcess(row) {
-      this.showDevProcessDrawer = true
-      this.ComponentRow = row
-      console.log('row', row)
-      listByDevice(this.ComponentRow.deviceCode).then(response => {
-        this.ComponentList = response.data
+
+    // 执行带参数的能力
+    executeAbilityWithParam() {
+      let paramValue = null
+
+      if (this.abilityParamType === 'Slider') {
+        paramValue = String(this.abilitySliderValue)
+      } else if (this.abilityParamType === 'Input') {
+        if (!this.abilityInputValue) {
+          this.$message.warning('请输入参数值')
+          return
+        }
+        paramValue = this.abilityInputValue
+      }
+
+      this.abilityExecuting = true
+
+      const callParams = {
+        objType: this.currentObjType,
+        abilityKey: this.abilityForm.abilityKey,
+        abilityParam: paramValue
+      }
+
+      if (this.currentObjType === 3) {
+        callParams.objCode = this.systemCode
+        callParams.modelCode = this.systemInfo.modelCode
+      } else if (this.currentObjType === 2) {
+        callParams.objCode = this.currentDevice.deviceCode
+        callParams.modelCode = this.currentDevice.deviceModel
+      }
+
+      listcallAbility(callParams).then(response => {
+        this.$message.success('执行成功')
+        this.abilityDialogVisible = false
+
+        if (this.abilityForm.abilityKey.toLowerCase().includes('meter') ||
+          this.abilityForm.abilityKey.toLowerCase().includes('reading')) {
+          if (this.currentObjType === 3) {
+            this.loadDevices()
+          } else if (this.currentObjType === 2) {
+            this.loadDeviceAttrs(this.currentDevice.deviceCode)
+          }
+        }
+      }).catch(() => {
+        this.$message.error('执行失败')
+      }).finally(() => {
+        this.abilityExecuting = false
       })
+    },
 
+    // 初始化时间范围
+    initDateRange() {
+      const now = new Date()
+      const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
+      const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59)
+
+      this.callLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
+      this.eventLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
     },
-    shouldShowDevProcessButton(row) {
-      const categoryIsW = this.queryParams.deviceCategory === 'W'
-      const validPsCodes = ['AA', 'AH', 'AJ', 'AM', 'AP', 'AL', 'APE', 'ALE', 'AF', 'ACC']
-      const psCodeIsValid = validPsCodes.includes(row.psCode)
-      // 只有当设备分类为输能设备且设备工艺代码有效时,才返回true
-      return categoryIsW && psCodeIsValid
+
+    // 格式化日期
+    formatDate(date) {
+      if (!date) return ''
+      const year = date.getFullYear()
+      const month = (date.getMonth() + 1).toString().padStart(2, '0')
+      const day = date.getDate().toString().padStart(2, '0')
+      const hours = date.getHours().toString().padStart(2, '0')
+      const minutes = date.getMinutes().toString().padStart(2, '0')
+      const seconds = date.getSeconds().toString().padStart(2, '0')
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
     },
-    backStyle(areaPath) {
-      const firstLevel = areaPath.split('/')[0];
-      switch (firstLevel) {
-        case '北区':
-          return 'north';
-        case '南区':
-          return 'south';
-        case '主路':
-          return 'main';
-        default:
-          return '';
+
+    // 加载系统信息
+    async loadSystemInfo() {
+      try {
+        const sysRes = await getSubsystemByCode(this.systemCode)
+        this.systemInfo = sysRes.data
+
+        if (this.systemInfo.modelCode) {
+          this.allModelCodes.push(this.systemInfo.modelCode)
+
+          const modelRes = await getModelByCode(this.systemInfo.modelCode)
+          const modelData = modelRes.data
+
+          this.systemAbilities = (modelData.abilityList || []).map(item => ({
+            ...item,
+            executing: false,
+            executingValue: null
+          }))
+        }
+
+        const attrRes = await getObjAttr(3, this.systemCode)
+        const attrData = attrRes.data
+
+        this.protocolAttrs = attrData.Protocol || []
+        this.stateAttrs = attrData.State || []
+
+        const statusAttr = this.stateAttrs.find(attr => attr.attrKey === 'interfaceStatus')
+        if (statusAttr) {
+          this.systemStatus = statusAttr.attrValue
+        }
+
+        await this.loadDevices()
+      } catch (error) {
+        this.$message.error('加载系统信息失败:' + error.message)
       }
     },
-    /**设备详情按钮*/
-    handleDetail(row) {
-      this.showDrawer = true
-      this.curRow = row
-      console.log('data', this.curRow)
-      this.subKey = this.$options.data().subKey
-      getModelByCode(this.curRow.facsModel).then(response => {
-        const code = response.data
-        console.log('code', code)
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
 
-      })
-      getObjAttr(2, this.curRow.deviceCode).then(response => {
-        console.log('response值', response.data)
-        const attrs = response.data.attrs
-        const attrValues = response.data.attrValues
-
-        // 合并 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 : ''
+    // 加载设备列表
+    async loadDevices() {
+      this.deviceLoading = true
+      try {
+        const res = await getByCondition({
+          subsystemCode: this.systemCode
+        })
+
+        const deviceData = res.data || res.rows || []
+
+        this.deviceList = deviceData.map(device => ({
+          ...device,
+          detailTab: 'attrs'
+        }))
+
+        const deviceModelCodes = new Set()
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            deviceModelCodes.add(device.deviceModel)
           }
         })
-        this.attrData = mergedData
-      })
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset()
-      const id = row.id || this.ids
-      getDevice(id).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改能源设备'
-      })
-      const layer = 1
-      const areaCode = '0'
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.totalAreaOptions = response.data
-      })
-    },
-    /** 提交按钮 */
-    submitForm() {
-      // 重置 attrList 和 form.customAttrs
-      if (!this.attrList) {
-        this.attrList = []
-      }
-      if (!this.form.customAttrs) {
-        this.form.customAttrs = []
-      }
-      // 准备要发送的数据
-      let dataToSubmit = []
-      // 添加模型属性数据
-      this.attrList.forEach(attr => {
-        const attrName = attr.attrName
-        const attrKey = attr.attrKey
-        const attrValue = this.attrValuesMap[attrKey]
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
 
-          })
-        }
-      })
+        deviceModelCodes.forEach(modelCode => {
+          if (!this.allModelCodes.includes(modelCode)) {
+            this.allModelCodes.push(modelCode)
+          }
+        })
 
-      // 添加自定义属性数据
-      this.form.customAttrs.forEach(customAttr => {
-        const attrName = customAttr.attrName
-        const attrKey = customAttr.attrKey
-        const attrValue = customAttr.attrValue
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: '', // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
-          })
+        this.deviceStats.total = this.deviceList.length
+        this.deviceStats.online = this.deviceList.filter(d => d.deviceStatus === 1).length
+        this.deviceStats.offline = this.deviceList.filter(d => d.deviceStatus !== 1).length
+
+        const devicesByModel = {}
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            if (!devicesByModel[device.deviceModel]) {
+              devicesByModel[device.deviceModel] = []
+            }
+            devicesByModel[device.deviceModel].push(device)
+          }
+        })
+
+        for (const modelCode in devicesByModel) {
+          await this.loadDeviceAttrsBatch(modelCode, devicesByModel[modelCode])
         }
-      })
+      } catch (error) {
+        this.$message.error('加载设备列表失败')
+      } finally {
+        this.deviceLoading = false
+      }
+    },
 
-      this.$refs['form'].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateDevice(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            }).catch(error => {
-              console.error('修改失败:', error)
-              this.$message.error('修改失败')
-            })
+    // 批量加载设备属性
+    async loadDeviceAttrsBatch(modelCode, devices) {
+      try {
+        const res = await getObjAttrBatch(2, modelCode)
+        const batchData = res.data || {}
 
-            if (dataToSubmit.length > 0) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
-                  }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+        let totalPoints = 0
+
+        devices.forEach(device => {
+          const deviceCode = device.deviceCode
+          const attrData = batchData[deviceCode]
+
+          if (attrData) {
+            const baseAttrs = {}
+            if (attrData.Base) {
+              attrData.Base.forEach(attr => {
+                baseAttrs[attr.attrKey] = attr.attrValue
               })
             }
-          } 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) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
+            this.deviceAttrs[deviceCode] = baseAttrs
+
+            const channels = []
+            if (attrData.Measure) {
+              attrData.Measure.forEach(attr => {
+                if (attr.attrKey.startsWith('interface')) {
+                  try {
+                    const points = JSON.parse(attr.attrValue || '[]')
+                    channels.push({
+                      name: attr.attrName,
+                      key: attr.attrKey,
+                      points: points
+                    })
+                    totalPoints += points.length
+                  } catch (e) {
+                    console.error(`解析设备 ${deviceCode} 的测点数据失败:`, e)
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+                }
               })
-            } else {
-              // this.$message.info('没有属性需要添加');
             }
+            this.deviceChannels[deviceCode] = channels
           }
+        })
+
+        this.deviceStats.points += totalPoints
+      } catch (error) {
+        console.error(`批量加载模型 ${modelCode} 的设备属性失败:`, error)
+        for (const device of devices) {
+          await this.loadDeviceAttrs(device.deviceCode)
         }
-      })
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源设备编号为"' + ids + '"的数据项?').then(function() {
-        return delDevice(ids)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('ems/basecfg/device/export', {
-        ...this.queryParams
-      }, `device_${new Date().getTime()}.xlsx`)
-    },
-    getFacsOptions() {
-      const getFacsParams = {
-        facsCategory: this.queryParams.deviceCategory,
-        subCategory: this.queryParams.deviceSubCategory
       }
-      listAllFacs(getFacsParams).then(response => {
-        this.facsOptions = response.data
-      })
     },
-    getSubCategorygetByCode() {
-      getFacsCategorygetByCode(this.queryParams.deviceCategory).then(response => {
-        this.subCategoryOptions = response.data.subtypeList || []
-      })
+
+    // 单个加载设备属性
+    async loadDeviceAttrs(deviceCode) {
+      try {
+        const res = await getObjAttr(2, deviceCode)
+        const attrData = res.data
+
+        const baseAttrs = {}
+        if (attrData.Base) {
+          attrData.Base.forEach(attr => {
+            baseAttrs[attr.attrKey] = attr.attrValue
+          })
+        }
+        this.deviceAttrs[deviceCode] = baseAttrs
+
+        const channels = []
+        let pointsCount = 0
+        if (attrData.Measure) {
+          attrData.Measure.forEach(attr => {
+            if (attr.attrKey.startsWith('interface')) {
+              try {
+                const points = JSON.parse(attr.attrValue || '[]')
+                channels.push({
+                  name: attr.attrName,
+                  key: attr.attrKey,
+                  points: points
+                })
+                pointsCount += points.length
+              } catch (e) {
+                console.error(`解析测点数据失败:`, e)
+              }
+            }
+          })
+        }
+
+        if (!this.deviceChannels[deviceCode]) {
+          this.deviceStats.points += pointsCount
+        }
+
+        this.deviceChannels[deviceCode] = channels
+      } catch (error) {
+        console.error(`加载设备 ${deviceCode} 属性失败:`, error)
+      }
     },
-    getSubsystem() {
-      listSubsystemAll().then(response => {
-        this.subsystemOptions = response.data
-      })
+
+    // 获取设备属性
+    getDeviceAttr(deviceCode, attrKey) {
+      return this.deviceAttrs[deviceCode]?.[attrKey] || '-'
     },
-    /**自定义属性表格*/
-    addCustomAttr() {
-      // 添加一个新的自定义属性
-      if (!Array.isArray(this.form.customAttrs)) {
-        this.form.customAttrs = []
-      }
-      this.form.customAttrs.push({
-        attrKey: '',
-        attrName: '',
-        attrValue: ''
-      })
-      // 强制更新视图
-      this.$forceUpdate()
 
+    // 获取设备通道
+    getDeviceChannels(deviceCode) {
+      return this.deviceChannels[deviceCode] || []
     },
-    deleteCustomAttr(index) {
-      // 删除指定索引的自定义属性
-      if (this.form.customAttrs.length > 0) {
-        this.form.customAttrs.splice(index, 1)
+
+    // 加载设备能力
+    async handleAbilityLoad(visible, device) {
+      if (visible && !this.deviceAbilities[device.deviceCode]) {
+        try {
+          if (!device.deviceModel) {
+            this.$set(this.deviceAbilities, device.deviceCode, [])
+            return
+          }
+
+          const res = await getModelByCode(device.deviceModel)
+          const abilities = res.data?.abilityList?.filter(item => item.hiddenFlag === 1) || []
+          this.$set(this.deviceAbilities, device.deviceCode, abilities)
+        } catch (error) {
+          this.$set(this.deviceAbilities, device.deviceCode, [])
+        }
       }
+    },
+
+    // 处理设备操作命令
+    async handleDeviceCommand(command) {
+      const { device, ability, paramValue } = command
+
+      if (paramValue !== undefined) {
+        try {
+          await listcallAbility({
+            objCode: device.deviceCode,
+            objType: 2,
+            modelCode: device.deviceModel,
+            abilityKey: ability.abilityKey,
+            abilityParam: paramValue
+          })
+
+          this.$message.success(`${ability.abilityName}执行成功`)
+
+          if (ability.abilityKey.toLowerCase().includes('meter') ||
+            ability.abilityKey.toLowerCase().includes('reading')) {
+            await this.loadDeviceAttrs(device.deviceCode)
+          }
+        } catch (error) {
+          this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+        }
+      } else {
+        const paramType = this.getParamType(ability.paramDefinition)
+
+        if (paramType === 'Slider') {
+          this.showSliderDialog(ability, device, 2)
+        } else if (paramType === 'Input') {
+          this.showInputDialog(ability, device, 2)
+        } else {
+          try {
+            await listcallAbility({
+              objCode: device.deviceCode,
+              objType: 2,
+              modelCode: device.deviceModel,
+              abilityKey: ability.abilityKey,
+              abilityParam: null
+            })
+
+            this.$message.success(`${ability.abilityName}执行成功`)
 
+            if (ability.abilityKey.toLowerCase().includes('meter') ||
+              ability.abilityKey.toLowerCase().includes('reading')) {
+              await this.loadDeviceAttrs(device.deviceCode)
+            }
+          } catch (error) {
+            this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+          }
+        }
+      }
     },
-    /**设备模型*/
-    updateAttrValue(attrKey, newValue) {
-      this.attrValuesMap[attrKey] = newValue
+
+    // 处理设备行点击
+    handleDeviceClick(row) {
+      this.$refs.deviceTable?.toggleRowExpansion(row)
     },
 
-    getFacsModel() {
-      listAllModel(2).then(response => {
-        this.modelList = response.data
-        console.log('this.modelList', this.modelList)
-        this.modelList.forEach(model => {
-          console.log(model.modelCode)
-        })
-      })
+    // 标签页切换
+    handleTabClick(tab) {
+      if (tab.name === 'callLogs' && this.callLogList.length === 0) {
+        this.queryCallLogs()
+      } else if (tab.name === 'eventLogs' && this.eventLogList.length === 0) {
+        this.queryEventLogs()
+      }
     },
-    handleModelChange(modelCode) {
-      if (modelCode) {
-        this.getModelByCode(modelCode)
-        console.log('设备代码', this.form.deviceCode)
-        this.getObjAttr(2, this.form.deviceCode)
+
+    // 查询调用日志
+    async queryCallLogs() {
+      this.logLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.callLogQuery.pageNum,
+          pageSize: this.callLogQuery.pageSize
+        }
+
+        if (this.callLogQuery.dateRange && this.callLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.callLogQuery.dateRange[0]
+          params.endRecTime = this.callLogQuery.dateRange[1]
+        }
+
+        if (this.callLogQuery.abilityKey) {
+          params.abilityKey = this.callLogQuery.abilityKey
+        }
+
+        if (this.callLogQuery.callStatus !== '') {
+          params.callStatus = this.callLogQuery.callStatus
+        }
+
+        const res = await listCallLog(params)
+        this.callLogList = res.rows || []
+        this.callLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询调用日志失败')
+      } finally {
+        this.logLoading = false
       }
     },
-    getModelByCode(modelCode) {
-      getModelByCode(modelCode).then(response => {
-        // this.attrList = response.data.attrList;
-        const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
-        this.attrList = filteredAttrList
 
-      })
+    // 重置调用日志查询
+    resetCallLogQuery() {
+      this.initDateRange()
+      this.callLogQuery.abilityKey = ''
+      this.callLogQuery.callStatus = ''
+      this.callLogQuery.pageNum = 1
+      this.queryCallLogs()
     },
-    getObjAttr(objType, deviceCode) {
-      getObjAttr(objType, deviceCode).then(response => {
-        // const attrs = response.data.attrs;
-        const attrs = response.data.attrs.filter(attr => attr.attrType === 0)
-        console.log('attrs', attrs)
-        const attrValues = response.data.attrValues || [] // 确保是一个数组
-        console.log('attrValues', attrValues)
-
-        // 创建一个映射对象,用于存储 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] = ''
-          }
-        })
 
-        // 更新 attrValuesMap 到组件的数据中
-        this.attrValuesMap = attrValuesMap
-        // 打印更新后的 attrValuesMap,用于调试
-        console.log('Updated attrValuesMap', this.attrValuesMap)
+    // 查询事件日志
+    async queryEventLogs() {
+      this.eventLogLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.eventLogQuery.pageNum,
+          pageSize: this.eventLogQuery.pageSize
+        }
 
-      })
-    }
-  }
-}
-</script>
-<style lang="scss" scoped>
+        if (this.eventLogQuery.dateRange && this.eventLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.eventLogQuery.dateRange[0]
+          params.endRecTime = this.eventLogQuery.dateRange[1]
+        }
 
-.divider {
-  border-bottom: 2px solid #ebeef5;
-  margin: 10px 0;
-}
+        if (this.eventLogQuery.eventKey) {
+          params.eventKey = this.eventLogQuery.eventKey
+        }
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-  margin-top: 20px;
-  margin-bottom: 10px;
-}
+        const res = await listEventLog(params)
+        this.eventLogList = res.rows || []
+        this.eventLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询事件日志失败')
+      } finally {
+        this.eventLogLoading = false
+      }
+    },
 
-.drawer-content {
-  padding: 0 20px;
-}
+    // 重置事件日志查询
+    resetEventLogQuery() {
+      this.initDateRange()
+      this.eventLogQuery.eventKey = ''
+      this.eventLogQuery.pageNum = 1
+      this.queryEventLogs()
+    },
 
+    // 格式化调用状态
+    formatCallStatus(status) {
+      const statusMap = {
+        0: '成功',
+        1: '进行中',
+        2: '失败'
+      }
+      return statusMap[status] || '未知'
+    },
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-}
+    // 获取调用状态类型
+    getCallStatusType(status) {
+      const typeMap = {
+        0: 'success',
+        1: 'warning',
+        2: 'danger'
+      }
+      return typeMap[status] || 'info'
+    },
 
-.attr-list-container {
-  border: 1px solid #ccc;
-  padding: 10px;
-  margin: 10px 0;
-  font-weight: bold;
-}
+    // 查看调用日志详情
+    async handleCallLogDetail(row) {
+      try {
+        const res = await getCallLog(row.id)
+        this.callLogDetailData = res.data
+        this.callLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取调用日志详情失败')
+      }
+    },
 
-.attr-list-container h3 {
-  font-weight: bold;
+    // 查看事件日志详情
+    async handleEventLogDetail(row) {
+      try {
+        const res = await getEventLog(row.id)
+        this.eventLogDetailData = res.data
+        this.eventLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取事件日志详情失败')
+      }
+    }
+  }
 }
+</script>
 
-.attr-item {
-  list-style-type: none;
-  margin-bottom: 5px;
+<style lang="scss" scoped>
+.app-container {
+  padding: 20px;
+  background: #f5f7fa;
+  min-height: calc(100vh - 84px);
 }
 
-.attr-name {
-  font-weight: bold;
-}
+.system-info-card {
+  margin-bottom: 20px;
 
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
 
-.contents{
-  border: 20px solid #f2f2f5;
-  background-color: #f2f2f5;
-}
+    .title {
+      font-size: 18px;
+      font-weight: bold;
 
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
+  }
 
-.other-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-  margin-bottom: 20px;
-}
+  .info-group {
+    .group-title {
+      font-size: 14px;
+      font-weight: bold;
+      color: #606266;
+      margin-bottom: 12px;
+      padding-bottom: 6px;
+      border-bottom: 1px solid #EBEEF5;
+    }
+  }
 
-.table-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-}
+  .info-item {
+    margin-bottom: 12px;
+    font-size: 14px;
 
-.pagination-container {
-  margin-bottom: 20px;
-}
+    label {
+      color: #909399;
+      margin-right: 8px;
+      display: inline-block;
+      min-width: 80px;
+    }
 
-.button-group-container {
-  display: flex;
-  justify-content: flex-end;
-  min-width: 200px;
-  padding: 5px;
-}
+    .code {
+      font-family: monospace;
+      color: #409EFF;
+      background: #f0f9ff;
+      padding: 2px 6px;
+      border-radius: 3px;
+    }
 
-.device-list {
-  margin-top: 20px;
+    .stat-number {
+      color: #409EFF;
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
 }
 
-.device-card {
-  background-color: #fff;
-  border: 1px solid #bfcbd9;
-  border-radius: 4px;
-  overflow: hidden;
-  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
-  transition: 0.3s;
-  padding: 10px;
-  font-size: 14px;
-  height: 200px;
-  margin-bottom: 20px;
-  display: flex;
-  flex-direction: column;
-}
+.detail-card {
+  .tab-content {
+    min-height: 400px;
+  }
 
-.device-header {
-  //background-color: #f2f2f5;
-  //padding: 10px;
-  color: #545353;
-  font-size: 20px;
-  font-weight: bold;
-}
-.device-code{
-  color:cornflowerblue;
-}
-.deviceOthers{
-  color: black;
-}
+  .attr-section {
+    margin-bottom: 30px;
 
-.device-body {
-  padding: 10px;
-  color: #666666;
-  flex: 1; /* 使设备主体内容占据剩余空间 */
-  overflow-y: auto; /* 如果内容过多,允许滚动 */
-}
+    .section-title {
+      margin: 20px 0 15px 0;
+      color: #303133;
 
-.device-footer {
-  display: flex;
-  justify-content: space-between;
-  padding: 5px;
-  // background-color: #f9f9f9;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
 
-.device-footer .el-button {
-  padding: 5px 15px;
-  border: none; /* 移除默认边框 */
-  color: #5a5e66;
-  transition: background-color 0.3s; /* 平滑过渡背景色变化 */
-}
+    .url-text {
+      color: #409EFF;
+      font-family: monospace;
+    }
+  }
 
-/* 为按钮分配不同的颜色 */
-.device-footer .el-button:first-child {
-  background-color: #d5f1d5; /* 淡绿色 */
-  border: 1px solid lightgreen;
-  color: #71e2aa;
+  .device-stats {
+    margin-bottom: 20px;
+
+    .stat-item {
+      text-align: center;
+      padding: 20px;
+      background: #fff;
+      border: 1px solid #EBEEF5;
+      border-radius: 4px;
+
+      .stat-value {
+        font-size: 28px;
+        font-weight: bold;
+        color: #303133;
+        margin-bottom: 8px;
+      }
 
-}
+      .stat-label {
+        font-size: 14px;
+        color: #909399;
+      }
 
-.device-footer .el-button:nth-child(2) {
-  background-color: #ffe5b4; /* 淡橙色 */
-  border: 1px solid #ffba00;
-  color: #faad14;
-}
+      &.online .stat-value {
+        color: #67C23A;
+      }
 
-.device-footer .el-button:last-child {
-  background-color: #ffd5d5; /* 淡红色 */
-  border: 1px solid lightpink;
-  color: #f5222d;
-}
+      &.offline .stat-value {
+        color: #F56C6C;
+      }
+    }
+  }
 
-/* 鼠标悬停时加深颜色 */
-.device-footer .el-button:hover {
-  filter: brightness(0.5); /* 颜色加深效果 */
-}
+  .device-detail {
+    padding: 20px;
+    background: #f5f7fa;
+
+    h5 {
+      margin: 15px 0 10px 0;
+      color: #303133;
+    }
+  }
 
-/* 背景色样式 */
-.north {
-  background: linear-gradient(to right, #e1f3d8, #fafafa);
+  .log-filter {
+    margin-bottom: 20px;
+    padding: 15px;
+    background: #f5f7fa;
+    border-radius: 4px;
+  }
 }
 
-.south {
-  background: linear-gradient(to right, #fff7e8, #fafafa);
+.execute-result {
+  .result-data {
+    margin-top: 20px;
+
+    pre {
+      background: #f5f7fa;
+      padding: 15px;
+      border-radius: 4px;
+      overflow: auto;
+      max-height: 400px;
+      font-family: monospace;
+      font-size: 12px;
+    }
+  }
 }
 
-.main {
-  background: linear-gradient(to right, #e0e0e0, #fafafa);
+.dialog-footer {
+  text-align: right;
 }
 
+::v-deep .el-dropdown-menu {
+  .el-submenu__title {
+    padding-right: 40px !important;
 
-.el-table {
-  background-color: #ffffff; /* 白色背景 */
-}
+    &:hover {
+      background-color: #f5f7fa;
+    }
+  }
 
-.el-card {
-  background-color: #ffffff; /* 白色背景 */
+  .el-submenu__icon-arrow {
+    position: absolute;
+    right: 20px;
+  }
 }
 </style>

+ 142 - 100
ems-ui-cloud/src/views/adapter/nhjc/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <!-- 系统基础信息卡片 -->
+    <!-- 系统基础信息卡片 - 添加编辑按钮 -->
     <el-card class="system-info-card">
       <div slot="header" class="card-header">
         <span class="title">
@@ -13,7 +13,7 @@
       </div>
 
       <el-row :gutter="20">
-        <el-col :span="8">
+        <el-col :span="6">
           <div class="info-group">
             <div class="group-title">系统信息</div>
             <div class="info-item">
@@ -26,7 +26,7 @@
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
+        <el-col :span="6">
           <div class="info-group">
             <div class="group-title">厂商信息</div>
             <div class="info-item">
@@ -43,7 +43,7 @@
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
+        <el-col :span="6">
           <div class="info-group">
             <div class="group-title">维护信息</div>
             <div class="info-item">
@@ -56,6 +56,33 @@
             </div>
           </div>
         </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">设备统计</div>
+            <div class="info-item">
+              <label>设备总数:</label>
+              <span class="stat-number">{{ deviceStats.total }}</span>
+            </div>
+            <div class="info-item">
+              <label>在线设备:</label>
+              <span class="stat-number">{{ deviceStats.online }}</span>
+            </div>
+            <div class="info-item">
+              <label>测点总数:</label>
+              <span class="stat-number">{{ deviceStats.points }}</span>
+            </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEdit"
+                v-hasPermi="['ems:subsystem:edit']">
+                编辑
+              </el-button>
+            </div>
+          </div>
+        </el-col>
       </el-row>
     </el-card>
 
@@ -107,7 +134,7 @@
           </div>
         </el-tab-pane>
 
-        <!-- 系统能力标签页 - 改进支持新的参数定义 -->
+        <!-- 系统能力标签页 -->
         <el-tab-pane label="系统能力" name="abilities">
           <div class="tab-content">
             <el-table :data="systemAbilities" border stripe v-loading="abilityLoading">
@@ -116,9 +143,7 @@
               <el-table-column prop="abilityDesc" label="能力描述"></el-table-column>
               <el-table-column label="操作" width="200" align="center">
                 <template slot-scope="scope">
-                  <!-- 根据参数类型展示不同的操作界面 -->
                   <div v-if="getParamType(scope.row.paramDefinition) === 'Options'" style="display: inline-block;">
-                    <!-- Options类型:显示多个按钮 -->
                     <el-button-group>
                       <el-button
                         v-for="option in parseOptions(scope.row.paramDefinition)"
@@ -250,7 +275,6 @@
                     <el-dropdown-menu slot="dropdown">
                       <template v-if="deviceAbilities[scope.row.deviceCode] && deviceAbilities[scope.row.deviceCode].length > 0">
                         <template v-for="ability in deviceAbilities[scope.row.deviceCode]">
-                          <!-- Options类型:显示子菜单 -->
                           <el-submenu
                             v-if="getParamType(ability.paramDefinition) === 'Options'"
                             :key="ability.abilityKey"
@@ -266,7 +290,6 @@
                               {{ option.key }}
                             </el-dropdown-item>
                           </el-submenu>
-                          <!-- 其他类型:普通菜单项 -->
                           <el-dropdown-item
                             v-else
                             :key="ability.abilityKey"
@@ -392,6 +415,43 @@
       </el-tabs>
     </el-card>
 
+    <!-- 修改系统信息对话框 -->
+    <el-dialog title="修改系统信息" :visible.sync="editDialogVisible" width="500px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="厂商" prop="manFacturer">
+          <el-input v-model="editForm.manFacturer" placeholder="请输入厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editForm.descr" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelEdit">取 消</el-button>
+        <el-button type="primary" @click="submitEdit" :loading="editLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
     <!-- 执行结果对话框 -->
     <el-dialog
       :title="executeDialog.title"
@@ -461,7 +521,7 @@
       </div>
     </el-dialog>
 
-    <!-- 新增:能力执行弹窗(支持Slider和Input类型) -->
+    <!-- 能力执行弹窗(支持Slider和Input类型) -->
     <el-dialog :title="abilityDialogTitle" :visible.sync="abilityDialogVisible" width="500px" append-to-body :close-on-click-modal="false">
       <el-form ref="abilityForm" :model="abilityForm" label-width="100px">
         <el-form-item label="能力名称">
@@ -471,9 +531,7 @@
           <el-input type="textarea" v-model="abilityForm.abilityDesc" disabled :rows="2"></el-input>
         </el-form-item>
 
-        <!-- 根据参数类型显示不同的输入组件 -->
         <el-form-item label="参数设置" v-if="abilityParamType">
-          <!-- Slider类型:显示滑块 -->
           <template v-if="abilityParamType === 'Slider'">
             <div style="width: 100%;">
               <div style="padding: 0 10px;">
@@ -509,7 +567,6 @@
             </div>
           </template>
 
-          <!-- Input类型:显示输入框 -->
           <template v-else-if="abilityParamType === 'Input'">
             <el-input
               v-model="abilityInputValue"
@@ -528,7 +585,7 @@
 </template>
 
 <script>
-import { getSubsystemByCode } from '@/api/adapter/subsystem'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
 import { getModelByCode } from '@/api/basecfg/objModel'
 import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
 import { listcallAbility } from '@/api/basecfg/objAbility'
@@ -606,7 +663,7 @@ export default {
         message: '',
         data: null
       },
-      // 新增:能力执行相关
+      // 能力执行相关
       abilityDialogVisible: false,
       abilityDialogTitle: '能力执行',
       abilityForm: {
@@ -623,7 +680,19 @@ export default {
       abilityInputValue: '',
       abilityExecuting: false,
       currentDevice: null,
-      currentObjType: null  // 1:设施, 2:设备, 3:系统
+      currentObjType: null,
+      // 编辑系统信息相关
+      editDialogVisible: false,
+      editLoading: false,
+      editForm: {},
+      editRules: {
+        systemCode: [
+          { required: true, message: "系统代码不能为空", trigger: "blur" }
+        ],
+        systemName: [
+          { required: true, message: "系统名称不能为空", trigger: "blur" }
+        ]
+      }
     }
   },
   created() {
@@ -631,12 +700,46 @@ export default {
     this.initDateRange()
   },
   methods: {
-    // 新增:格式化滑块tooltip
+    // 打开编辑对话框
+    handleEdit() {
+      this.editForm = { ...this.systemInfo }
+      this.editDialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.editForm?.clearValidate()
+      })
+    },
+
+    // 取消编辑
+    cancelEdit() {
+      this.editDialogVisible = false
+      this.editForm = {}
+    },
+
+    // 提交编辑
+    submitEdit() {
+      this.$refs.editForm.validate(valid => {
+        if (valid) {
+          this.editLoading = true
+          updateSubsystem(this.editForm).then(response => {
+            this.$message.success("修改成功")
+            this.editDialogVisible = false
+            // 重新加载系统信息
+            this.loadSystemInfo()
+          }).catch(error => {
+            this.$message.error("修改失败:" + error.message)
+          }).finally(() => {
+            this.editLoading = false
+          })
+        }
+      })
+    },
+
+    // 格式化滑块tooltip
     formatTooltip(val) {
       return `${val}%`
     },
 
-    // 新增:解析参数定义类型
+    // 解析参数定义类型
     getParamType(paramDefinition) {
       if (!paramDefinition) return null
       try {
@@ -647,29 +750,7 @@ export default {
       }
     },
 
-    // 新增:获取参数类型名称
-    getParamTypeName(paramDefinition) {
-      const type = this.getParamType(paramDefinition)
-      const typeNames = {
-        'Options': '选项型',
-        'Slider': '滑块型',
-        'Input': '输入型'
-      }
-      return typeNames[type] || '无参数'
-    },
-
-    // 新增:获取参数类型标签样式
-    getParamTypeTagType(paramDefinition) {
-      const type = this.getParamType(paramDefinition)
-      const typeStyles = {
-        'Options': 'primary',
-        'Slider': 'success',
-        'Input': 'warning'
-      }
-      return typeStyles[type] || 'info'
-    },
-
-    // 新增:解析Options类型的选项
+    // 解析Options类型的选项
     parseOptions(paramDefinition) {
       try {
         const def = JSON.parse(paramDefinition)
@@ -682,7 +763,7 @@ export default {
       return []
     },
 
-    // 新增:处理系统能力点击
+    // 处理系统能力点击
     handleSystemAbilityClick(ability) {
       const paramType = this.getParamType(ability.paramDefinition)
 
@@ -691,12 +772,11 @@ export default {
       } else if (paramType === 'Input') {
         this.showInputDialog(ability, this.systemInfo, 3)
       } else {
-        // 无参数:直接执行
         this.executeSystemAbility(ability)
       }
     },
 
-    // 新增:执行系统能力(带Options参数)
+    // 执行系统能力(带Options参数)
     executeSystemAbilityWithParam(ability, paramValue) {
       ability.executing = true
       ability.executingValue = paramValue
@@ -731,7 +811,7 @@ export default {
       })
     },
 
-    // 修改:执行系统能力(无参数)
+    // 执行系统能力(无参数)
     executeSystemAbility(ability) {
       ability.executing = true
 
@@ -751,7 +831,6 @@ export default {
           data: res.data
         }
 
-        // 刷新设备数据
         if (ability.abilityKey === 'MeterReadingGw') {
           this.loadDevices()
         }
@@ -769,13 +848,12 @@ export default {
       })
     },
 
-    // 新增:显示滑块弹窗
+    // 显示滑块弹窗
     showSliderDialog(ability, obj, objType) {
       this.currentDevice = obj
       this.currentObjType = objType
       this.abilityForm = { ...ability }
 
-      // 根据对象类型设置标题
       const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
       this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
       this.abilityParamType = 'Slider'
@@ -795,13 +873,12 @@ export default {
       this.abilityDialogVisible = true
     },
 
-    // 新增:显示输入弹窗
+    // 显示输入弹窗
     showInputDialog(ability, obj, objType) {
       this.currentDevice = obj
       this.currentObjType = objType
       this.abilityForm = { ...ability }
 
-      // 根据对象类型设置标题
       const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
       this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
       this.abilityParamType = 'Input'
@@ -809,7 +886,7 @@ export default {
       this.abilityDialogVisible = true
     },
 
-    // 新增:执行带参数的能力
+    // 执行带参数的能力
     executeAbilityWithParam() {
       let paramValue = null
 
@@ -825,20 +902,16 @@ export default {
 
       this.abilityExecuting = true
 
-      // 构建调用参数
       const callParams = {
         objType: this.currentObjType,
         abilityKey: this.abilityForm.abilityKey,
         abilityParam: paramValue
       }
 
-      // 根据对象类型设置不同的参数
       if (this.currentObjType === 3) {
-        // 系统
         callParams.objCode = this.systemCode
         callParams.modelCode = this.systemInfo.modelCode
       } else if (this.currentObjType === 2) {
-        // 设备
         callParams.objCode = this.currentDevice.deviceCode
         callParams.modelCode = this.currentDevice.deviceModel
       }
@@ -847,7 +920,6 @@ export default {
         this.$message.success('执行成功')
         this.abilityDialogVisible = false
 
-        // 如果是抄表相关能力,重新加载数据
         if (this.abilityForm.abilityKey.toLowerCase().includes('meter') ||
           this.abilityForm.abilityKey.toLowerCase().includes('reading')) {
           if (this.currentObjType === 3) {
@@ -863,7 +935,7 @@ export default {
       })
     },
 
-    // 初始化时间范围(默认今天)
+    // 初始化时间范围
     initDateRange() {
       const now = new Date()
       const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
@@ -894,47 +966,40 @@ export default {
     // 加载系统信息
     async loadSystemInfo() {
       try {
-        // 1. 获取系统基础信息
         const sysRes = await getSubsystemByCode(this.systemCode)
         this.systemInfo = sysRes.data
 
-        // 2. 获取模型信息
         if (this.systemInfo.modelCode) {
-          // 添加系统模型代码
           this.allModelCodes.push(this.systemInfo.modelCode)
 
           const modelRes = await getModelByCode(this.systemInfo.modelCode)
           const modelData = modelRes.data
 
-          // 获取能力列表,添加执行状态
           this.systemAbilities = (modelData.abilityList || []).map(item => ({
             ...item,
             executing: false,
-            executingValue: null  // 用于Options类型按钮的加载状态
+            executingValue: null
           }))
         }
 
-        // 3. 获取系统属性值
         const attrRes = await getObjAttr(3, this.systemCode)
         const attrData = attrRes.data
 
         this.protocolAttrs = attrData.Protocol || []
         this.stateAttrs = attrData.State || []
 
-        // 设置系统状态
         const statusAttr = this.stateAttrs.find(attr => attr.attrKey === 'interfaceStatus')
         if (statusAttr) {
           this.systemStatus = statusAttr.attrValue
         }
 
-        // 4. 加载关联设备
         await this.loadDevices()
       } catch (error) {
         this.$message.error('加载系统信息失败:' + error.message)
       }
     },
 
-    // 修改 loadDevices 方法
+    // 加载设备列表
     async loadDevices() {
       this.deviceLoading = true
       try {
@@ -942,7 +1007,6 @@ export default {
           subsystemCode: this.systemCode
         })
 
-        // 兼容不同的数据结构
         const deviceData = res.data || res.rows || []
 
         this.deviceList = deviceData.map(device => ({
@@ -950,7 +1014,6 @@ export default {
           detailTab: 'attrs'
         }))
 
-        // 收集所有设备的模型代码
         const deviceModelCodes = new Set()
         this.deviceList.forEach(device => {
           if (device.deviceModel) {
@@ -958,19 +1021,16 @@ export default {
           }
         })
 
-        // 将设备模型代码添加到总列表
         deviceModelCodes.forEach(modelCode => {
           if (!this.allModelCodes.includes(modelCode)) {
             this.allModelCodes.push(modelCode)
           }
         })
 
-        // 统计设备信息
         this.deviceStats.total = this.deviceList.length
         this.deviceStats.online = this.deviceList.filter(d => d.deviceStatus === 1).length
         this.deviceStats.offline = this.deviceList.filter(d => d.deviceStatus !== 1).length
 
-        // 批量加载设备属性(按设备模型分组)
         const devicesByModel = {}
         this.deviceList.forEach(device => {
           if (device.deviceModel) {
@@ -981,7 +1041,6 @@ export default {
           }
         })
 
-        // 对每个模型的设备批量获取属性
         for (const modelCode in devicesByModel) {
           await this.loadDeviceAttrsBatch(modelCode, devicesByModel[modelCode])
         }
@@ -992,22 +1051,19 @@ export default {
       }
     },
 
-// 新增批量加载设备属性方法
+    // 批量加载设备属性
     async loadDeviceAttrsBatch(modelCode, devices) {
       try {
         const res = await getObjAttrBatch(2, modelCode)
         const batchData = res.data || {}
 
-        // 重置测点统计
         let totalPoints = 0
 
-        // 处理每个设备的属性数据
         devices.forEach(device => {
           const deviceCode = device.deviceCode
           const attrData = batchData[deviceCode]
 
           if (attrData) {
-            // 存储基础属性
             const baseAttrs = {}
             if (attrData.Base) {
               attrData.Base.forEach(attr => {
@@ -1016,7 +1072,6 @@ export default {
             }
             this.deviceAttrs[deviceCode] = baseAttrs
 
-            // 处理测点通道信息
             const channels = []
             if (attrData.Measure) {
               attrData.Measure.forEach(attr => {
@@ -1028,7 +1083,6 @@ export default {
                       key: attr.attrKey,
                       points: points
                     })
-                    // 统计测点数
                     totalPoints += points.length
                   } catch (e) {
                     console.error(`解析设备 ${deviceCode} 的测点数据失败:`, e)
@@ -1040,24 +1094,21 @@ export default {
           }
         })
 
-        // 更新总测点数
         this.deviceStats.points += totalPoints
       } catch (error) {
         console.error(`批量加载模型 ${modelCode} 的设备属性失败:`, error)
-        // 如果批量接口失败,可以降级到单个加载
         for (const device of devices) {
           await this.loadDeviceAttrs(device.deviceCode)
         }
       }
     },
 
-// 保留原来的单个加载方法作为备用或用于设备操作后的刷新
+    // 单个加载设备属性
     async loadDeviceAttrs(deviceCode) {
       try {
         const res = await getObjAttr(2, deviceCode)
         const attrData = res.data
 
-        // 存储基础属性
         const baseAttrs = {}
         if (attrData.Base) {
           attrData.Base.forEach(attr => {
@@ -1066,7 +1117,6 @@ export default {
         }
         this.deviceAttrs[deviceCode] = baseAttrs
 
-        // 处理测点通道信息
         const channels = []
         let pointsCount = 0
         if (attrData.Measure) {
@@ -1087,7 +1137,6 @@ export default {
           })
         }
 
-        // 更新测点统计(仅在首次加载时)
         if (!this.deviceChannels[deviceCode]) {
           this.deviceStats.points += pointsCount
         }
@@ -1108,18 +1157,16 @@ export default {
       return this.deviceChannels[deviceCode] || []
     },
 
-    // 加载设备能力(当下拉菜单显示时)
+    // 加载设备能力
     async handleAbilityLoad(visible, device) {
       if (visible && !this.deviceAbilities[device.deviceCode]) {
         try {
-          // 确保设备有模型代码
           if (!device.deviceModel) {
             this.$set(this.deviceAbilities, device.deviceCode, [])
             return
           }
 
           const res = await getModelByCode(device.deviceModel)
-          // 获取能力列表,hiddenFlag = 1 表示在操作菜单中显示的能力
           const abilities = res.data?.abilityList?.filter(item => item.hiddenFlag === 1) || []
           this.$set(this.deviceAbilities, device.deviceCode, abilities)
         } catch (error) {
@@ -1128,11 +1175,10 @@ export default {
       }
     },
 
-    // 处理设备操作命令(改进以支持新参数)
+    // 处理设备操作命令
     async handleDeviceCommand(command) {
       const { device, ability, paramValue } = command
 
-      // 如果直接提供了参数值(Options类型),直接执行
       if (paramValue !== undefined) {
         try {
           await listcallAbility({
@@ -1145,7 +1191,6 @@ export default {
 
           this.$message.success(`${ability.abilityName}执行成功`)
 
-          // 如果是抄表相关能力,重新加载设备属性
           if (ability.abilityKey.toLowerCase().includes('meter') ||
             ability.abilityKey.toLowerCase().includes('reading')) {
             await this.loadDeviceAttrs(device.deviceCode)
@@ -1154,7 +1199,6 @@ export default {
           this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
         }
       } else {
-        // 根据参数类型处理
         const paramType = this.getParamType(ability.paramDefinition)
 
         if (paramType === 'Slider') {
@@ -1162,7 +1206,6 @@ export default {
         } else if (paramType === 'Input') {
           this.showInputDialog(ability, device, 2)
         } else {
-          // 无参数:直接执行
           try {
             await listcallAbility({
               objCode: device.deviceCode,
@@ -1174,7 +1217,6 @@ export default {
 
             this.$message.success(`${ability.abilityName}执行成功`)
 
-            // 如果是抄表相关能力,重新加载设备属性
             if (ability.abilityKey.toLowerCase().includes('meter') ||
               ability.abilityKey.toLowerCase().includes('reading')) {
               await this.loadDeviceAttrs(device.deviceCode)
@@ -1186,7 +1228,7 @@ export default {
       }
     },
 
-    // 处理设备行点击 - 展开/收起行详情
+    // 处理设备行点击
     handleDeviceClick(row) {
       this.$refs.deviceTable?.toggleRowExpansion(row)
     },
@@ -1210,18 +1252,15 @@ export default {
           pageSize: this.callLogQuery.pageSize
         }
 
-        // 添加时间范围
         if (this.callLogQuery.dateRange && this.callLogQuery.dateRange.length === 2) {
           params.startRecTime = this.callLogQuery.dateRange[0]
           params.endRecTime = this.callLogQuery.dateRange[1]
         }
 
-        // 添加能力标识
         if (this.callLogQuery.abilityKey) {
           params.abilityKey = this.callLogQuery.abilityKey
         }
 
-        // 添加调用状态
         if (this.callLogQuery.callStatus !== '') {
           params.callStatus = this.callLogQuery.callStatus
         }
@@ -1255,13 +1294,11 @@ export default {
           pageSize: this.eventLogQuery.pageSize
         }
 
-        // 添加时间范围
         if (this.eventLogQuery.dateRange && this.eventLogQuery.dateRange.length === 2) {
           params.startRecTime = this.eventLogQuery.dateRange[0]
           params.endRecTime = this.eventLogQuery.dateRange[1]
         }
 
-        // 添加事件标识
         if (this.eventLogQuery.eventKey) {
           params.eventKey = this.eventLogQuery.eventKey
         }
@@ -1384,6 +1421,12 @@ export default {
       padding: 2px 6px;
       border-radius: 3px;
     }
+
+    .stat-number {
+      color: #409EFF;
+      font-weight: bold;
+      font-size: 16px;
+    }
   }
 }
 
@@ -1481,7 +1524,6 @@ export default {
   text-align: right;
 }
 
-// 下拉菜单中的子菜单样式
 ::v-deep .el-dropdown-menu {
   .el-submenu__title {
     padding-right: 40px !important;

+ 1392 - 1119
ems-ui-cloud/src/views/adapter/pv/index.vue

@@ -1,1268 +1,1541 @@
 <template>
   <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="4" :xs="24">
-        <div class="head-container">
-          <el-input v-model="areaName" placeholder="请输入区域名称" clearable size="small" prefix-icon="el-icon-search"
-                    style="margin-bottom: 20px"
-          />
-        </div>
-        <div class="head-container" style="height: 100vh; overflow: hidden; position: relative;">
-          <el-tree :data="treeAreaOptions" :props="defaultProps" :expand-on-click-node="false"
-                   :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current
-                   @node-click="handleNodeClick" style="height: calc(100vh - 50px); overflow-y: auto;"
-          />
-        </div>
-      </el-col>
-      <el-col :span="20" :xs="24">
-        <div class="contents">
-          <div class="other-content">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
-                     label-width="68px"
-            >
-              <el-form-item label="设备分类" prop="deviceSubCategory">
-                <el-select v-model="queryParams.deviceSubCategory">
-                  <el-option v-for="item in subCategoryOptions" placeholder="设备分类" :label="item.name"
-                             :value="item.code"
-                             :key="item.code"
-                  />
-                </el-select>
+    <!-- 系统基础信息卡片 - 添加编辑按钮 -->
+    <el-card class="system-info-card">
+      <div slot="header" class="card-header">
+        <span class="title">
+          <i class="el-icon-s-platform"></i>
+          光伏监测
+        </span>
+        <el-tag :type="systemStatus === '1' ? 'success' : 'danger'" effect="dark">
+          {{ systemStatus === '1' ? '正常' : '异常' }}
+        </el-tag>
+      </div>
+
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">系统信息</div>
+            <div class="info-item">
+              <label>系统代码:</label>
+              <span class="code">{{ systemInfo.systemCode }}</span>
+            </div>
+            <div class="info-item">
+              <label>系统名称:</label>
+              <span>{{ systemInfo.systemName }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">厂商信息</div>
+            <div class="info-item">
+              <label>对接厂商:</label>
+              <span>{{ systemInfo.manFacturer || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系人:</label>
+              <span>{{ systemInfo.contactPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>联系电话:</label>
+              <span>{{ systemInfo.contactNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">维护信息</div>
+            <div class="info-item">
+              <label>维护人:</label>
+              <span>{{ systemInfo.maintainerPerson || '-' }}</span>
+            </div>
+            <div class="info-item">
+              <label>维护电话:</label>
+              <span>{{ systemInfo.maintainerNumber || '-' }}</span>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <div class="info-group">
+            <div class="group-title">设备统计</div>
+            <div class="info-item">
+              <label>设备总数:</label>
+              <span class="stat-number">{{ deviceStats.total }}</span>
+            </div>
+            <div class="info-item">
+              <label>在线设备:</label>
+              <span class="stat-number">{{ deviceStats.online }}</span>
+            </div>
+            <div class="info-item">
+              <label>测点总数:</label>
+              <span class="stat-number">{{ deviceStats.points }}</span>
+            </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEdit"
+                v-hasPermi="['ems:subsystem:edit']">
+                编辑
+              </el-button>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </el-card>
+
+    <!-- 系统详情标签页 -->
+    <el-card class="detail-card">
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+        <!-- 系统属性标签页 -->
+        <el-tab-pane label="系统属性" name="attributes">
+          <div class="tab-content">
+            <!-- 协议属性 -->
+            <div class="attr-section" v-if="protocolAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-connection"></i>
+                协议信息
+              </h4>
+              <el-table :data="protocolAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <span v-if="scope.row.attrKey === 'url'" class="url-text">
+                      {{ scope.row.attrValue }}
+                    </span>
+                    <span v-else>{{ scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+
+            <!-- 状态属性 -->
+            <div class="attr-section" v-if="stateAttrs.length > 0">
+              <h4 class="section-title">
+                <i class="el-icon-info"></i>
+                状态信息
+              </h4>
+              <el-table :data="stateAttrs" border stripe>
+                <el-table-column prop="attrName" label="属性名称" width="200"></el-table-column>
+                <el-table-column label="属性值">
+                  <template slot-scope="scope">
+                    <el-tag v-if="scope.row.attrKey === 'interfaceStatus'"
+                            :type="scope.row.attrValue === '1' ? 'success' : 'danger'">
+                      {{ scope.row.attrValueName }}
+                    </el-tag>
+                    <span v-else>{{ scope.row.attrValueName || scope.row.attrValue || '-' }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="updateTime" label="更新时间" width="180"></el-table-column>
+              </el-table>
+            </div>
+          </div>
+        </el-tab-pane>
+
+        <!-- 系统能力标签页 -->
+        <el-tab-pane label="系统能力" name="abilities">
+          <div class="tab-content">
+            <el-table :data="systemAbilities" border stripe v-loading="abilityLoading">
+              <el-table-column prop="abilityName" label="能力名称" width="200"></el-table-column>
+              <el-table-column prop="abilityKey" label="能力标识" width="180"></el-table-column>
+              <el-table-column prop="abilityDesc" label="能力描述"></el-table-column>
+              <el-table-column label="操作" width="200" align="center">
+                <template slot-scope="scope">
+                  <div v-if="getParamType(scope.row.paramDefinition) === 'Options'" style="display: inline-block;">
+                    <el-button-group>
+                      <el-button
+                        v-for="option in parseOptions(scope.row.paramDefinition)"
+                        :key="option.value"
+                        size="mini"
+                        type="primary"
+                        @click="executeSystemAbilityWithParam(scope.row, option.value)"
+                        :loading="scope.row.executing && scope.row.executingValue === option.value">
+                        {{ option.key }}
+                      </el-button>
+                    </el-button-group>
+                  </div>
+                  <el-button
+                    v-else
+                    type="primary"
+                    size="mini"
+                    icon="el-icon-caret-right"
+                    @click="handleSystemAbilityClick(scope.row)"
+                    :loading="scope.row.executing">
+                    执行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 关联设备标签页 -->
+        <el-tab-pane label="关联设备" name="devices">
+          <div class="tab-content">
+            <!-- 设备统计 -->
+            <div class="device-stats">
+              <el-row :gutter="20">
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.total }}</div>
+                    <div class="stat-label">设备总数</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item online">
+                    <div class="stat-value">{{ deviceStats.online }}</div>
+                    <div class="stat-label">在线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item offline">
+                    <div class="stat-value">{{ deviceStats.offline }}</div>
+                    <div class="stat-label">离线设备</div>
+                  </div>
+                </el-col>
+                <el-col :span="6">
+                  <div class="stat-item">
+                    <div class="stat-value">{{ deviceStats.points }}</div>
+                    <div class="stat-label">测点总数</div>
+                  </div>
+                </el-col>
+              </el-row>
+            </div>
+
+            <!-- 设备列表 -->
+            <el-table
+              :data="deviceList"
+              border
+              stripe
+              v-loading="deviceLoading"
+              @row-click="handleDeviceClick"
+              ref="deviceTable">
+              <el-table-column type="expand">
+                <template slot-scope="props">
+                  <div class="device-detail">
+                    <el-tabs v-model="props.row.detailTab">
+                      <el-tab-pane label="设备属性" name="attrs">
+                        <el-descriptions :column="2" border size="small">
+                          <el-descriptions-item label="IP地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'ip') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="网关地址">
+                            {{ getDeviceAttr(props.row.deviceCode, 'gateway') }}
+                          </el-descriptions-item>
+                          <el-descriptions-item label="子网掩码">
+                            {{ getDeviceAttr(props.row.deviceCode, 'subnetMask') }}
+                          </el-descriptions-item>
+                        </el-descriptions>
+                      </el-tab-pane>
+                      <el-tab-pane label="测点信息" name="points">
+                        <div v-for="(channel, idx) in getDeviceChannels(props.row.deviceCode)" :key="idx">
+                          <h5>{{ channel.name }} ({{ channel.points.length }}个测点)</h5>
+                          <el-table :data="channel.points" size="mini" max-height="200">
+                            <el-table-column prop="name" label="测点名称"></el-table-column>
+                            <el-table-column prop="key" label="测点标识"></el-table-column>
+                            <el-table-column prop="value" label="当前值">
+                              <template slot-scope="scope">
+                                {{ scope.row.value || '-' }}
+                              </template>
+                            </el-table-column>
+                            <el-table-column prop="updateTime" label="更新时间"></el-table-column>
+                          </el-table>
+                        </div>
+                      </el-tab-pane>
+                    </el-tabs>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="deviceCode" label="设备代码" width="150"></el-table-column>
+              <el-table-column prop="deviceName" label="设备名称"></el-table-column>
+              <el-table-column prop="location" label="安装位置"></el-table-column>
+              <el-table-column prop="areaCode" label="区域" width="150">
+                <template slot-scope="scope">
+                  {{ scope.row.areaCode.includes('3001') ? '北区' : '南区' }}
+                </template>
+              </el-table-column>
+              <el-table-column label="设备状态" width="100" align="center">
+                <template slot-scope="scope">
+                  <el-tag :type="scope.row.deviceStatus === 1 ? 'success' : 'info'">
+                    {{ scope.row.deviceStatus === 1 ? '在线' : '离线' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="120" align="center">
+                <template slot-scope="scope">
+                  <el-dropdown
+                    trigger="click"
+                    @command="handleDeviceCommand"
+                    @visible-change="(visible) => handleAbilityLoad(visible, scope.row)">
+                    <el-button type="text" size="mini">
+                      操作<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                      <template v-if="deviceAbilities[scope.row.deviceCode] && deviceAbilities[scope.row.deviceCode].length > 0">
+                        <template v-for="ability in deviceAbilities[scope.row.deviceCode]">
+                          <el-submenu
+                            v-if="getParamType(ability.paramDefinition) === 'Options'"
+                            :key="ability.abilityKey"
+                            :index="ability.abilityKey">
+                            <template slot="title">
+                              {{ ability.abilityName }}
+                              <i class="el-icon-arrow-right" style="float: right;"></i>
+                            </template>
+                            <el-dropdown-item
+                              v-for="option in parseOptions(ability.paramDefinition)"
+                              :key="option.value"
+                              :command="{device: scope.row, ability: ability, paramValue: option.value}">
+                              {{ option.key }}
+                            </el-dropdown-item>
+                          </el-submenu>
+                          <el-dropdown-item
+                            v-else
+                            :key="ability.abilityKey"
+                            :command="{device: scope.row, ability: ability}">
+                            {{ ability.abilityName }}
+                          </el-dropdown-item>
+                        </template>
+                      </template>
+                      <el-dropdown-item v-else disabled>
+                        无可用操作
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-tab-pane>
+
+        <!-- 调用日志标签页 -->
+        <el-tab-pane label="调用日志" name="callLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="callLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="callLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
               </el-form-item>
-              <el-form-item label="归属设施" prop="refFacs">
-                <el-select v-model="queryParams.refFacs">
-                  <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                             :key="item.facsCode"
-                  />
-                </el-select>
+              <el-form-item label="能力标识">
+                <el-input v-model="callLogQuery.abilityKey" placeholder="请输入能力标识" clearable></el-input>
               </el-form-item>
-              <el-form-item label="子系统" prop="subsystemCode">
-                <el-select v-model="queryParams.subsystemCode">
-                  <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                             :key="item.systemCode"
-                  />
+              <el-form-item label="调用状态">
+                <el-select v-model="callLogQuery.callStatus" placeholder="全部" clearable>
+                  <el-option label="成功" :value="0"></el-option>
+                  <el-option label="进行中" :value="1"></el-option>
+                  <el-option label="失败" :value="2"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item>
-                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+                <el-button type="primary" @click="queryCallLogs">查询</el-button>
+                <el-button @click="resetCallLogQuery">重置</el-button>
               </el-form-item>
             </el-form>
 
-            <el-row :gutter="10" class="mb8">
-              <el-col :span="1.5">
-                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-                           v-hasPermi="['ems:device:add']"
-                >新增
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-                           v-hasPermi="['ems:device:edit']"
-                >修改
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
-                           @click="handleDelete"
-                           v-hasPermi="['ems:device:remove']"
-                >删除
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-                           v-hasPermi="['ems:device:export']"
-                >导出
-                </el-button>
-              </el-col>
-              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-            </el-row>
-          </div>
-
-          <div class="table-content">
-            <!--分页-->
-            <div class="button-group-container">
-              <el-button-group>
-                <el-button :type="primary1" icon="el-icon-s-fold" @click="switchData(1)"/>
-                <el-button :type="primary2" icon="el-icon-menu" @click="switchData(2)"/>
-              </el-button-group>
-            </div>
-
-            <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"
-                      v-if="istable === 1">
-              <el-table-column type="selection" width="55" align="center"/>
-              <el-table-column label="设备名称" align="left" prop="deviceName"/>
-              <el-table-column label="安装位置" align="left" prop="areaPath" width="220px"/>
-              <el-table-column label="归属设施" align="center" prop="refFacsName"/>
-              <el-table-column label="设备分类" align="center" prop="deviceCategoryName"/>
-              <el-table-column label="子系统" align="center" prop="subsystemName"/>
-              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <el-table :data="callLogList" border stripe v-loading="logLoading">
+              <el-table-column prop="objCode" label="对象代码" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="abilityName" label="能力名称" min-width="150"></el-table-column>
+              <el-table-column prop="callTime" label="调用时间" width="180"></el-table-column>
+              <el-table-column label="调用状态" width="100" align="center">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDevProcess(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']" v-if="shouldShowDevProcessButton(scope.row)"
-                  >
-                    器件
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-info" @click="handleDetail(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    详情
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                             v-hasPermi="['basecfg:device:edit']"
-                  >
-                    修改
-                  </el-button>
-                  <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                             @click="handleDelete(scope.row)" v-hasPermi="['basecfg:device:remove']"
-                  >
-                    删除
-                  </el-button>
-
+                  <el-tag size="small" :type="getCallStatusType(scope.row.callStatus)">
+                    {{ formatCallStatus(scope.row.callStatus) }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleCallLogDetail(scope.row)">详情</el-button>
                 </template>
               </el-table-column>
             </el-table>
 
-            <div v-else-if="istable === 2">
-              <el-row :gutter="20" class="device-list">
-                <el-col v-for="device in deviceList" :key="device.id" :span="6">
-                  <div :class="`device-card ${backStyle(device.areaPath)}`">
-                    <div class="device-header">
-                      <i class="el-icon-s-operation" style="margin-right: 8px;"></i>
-                      {{ device.deviceName }}
-                    </div>
-                    <div class="device-body">
-                      <p>设备代码:<span class="device-code">{{ device.deviceCode }}</span></p>
-                      <p>安装位置:<span class="deviceOthers">{{ device.areaPath }}</span></p>
-                      <p>归属设施:<span class="deviceOthers">{{ device.refFacsName }}</span></p>
-                      <p>设备分类:<span class="deviceOthers">{{ device.deviceCategoryName }}</span></p>
-                      <p>子系统:<span class="deviceOthers">{{ device.subsystemName }}</span></p>
-                    </div>
-                    <div class="device-footer">
-                      <el-button size="mini" plain icon=" el-icon-document" @click="handleDetail(device)">详情
-                      </el-button>
-                      <el-button size="mini" plain icon="el-icon-edit" @click="handleUpdate(device)">修改</el-button>
-                      <el-button size="mini" plain icon="el-icon-delete" type="danger" @click="handleDelete(device)">
-                        删除
-                      </el-button>
-                    </div>
-                  </div>
-                </el-col>
-              </el-row>
-            </div>
+            <pagination
+              v-show="callLogTotal > 0"
+              :total="callLogTotal"
+              :page.sync="callLogQuery.pageNum"
+              :limit.sync="callLogQuery.pageSize"
+              @pagination="queryCallLogs"
+            />
+          </div>
+        </el-tab-pane>
+
+        <!-- 事件日志标签页 -->
+        <el-tab-pane label="事件日志" name="eventLogs">
+          <div class="tab-content">
+            <el-form :inline="true" :model="eventLogQuery" class="log-filter">
+              <el-form-item label="时间范围">
+                <el-date-picker
+                  v-model="eventLogQuery.dateRange"
+                  type="datetimerange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="yyyy-MM-dd HH:mm:ss">
+                </el-date-picker>
+              </el-form-item>
+              <el-form-item label="事件标识">
+                <el-input v-model="eventLogQuery.eventKey" placeholder="请输入事件标识" clearable></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="queryEventLogs">查询</el-button>
+                <el-button @click="resetEventLogQuery">重置</el-button>
+              </el-form-item>
+            </el-form>
 
+            <el-table :data="eventLogList" border stripe v-loading="eventLogLoading">
+              <el-table-column prop="objCode" label="对象编号" min-width="150"></el-table-column>
+              <el-table-column prop="objName" label="对象名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventName" label="事件名称" min-width="200"></el-table-column>
+              <el-table-column prop="eventTime" label="事件时间" width="180"></el-table-column>
+              <el-table-column label="操作" width="80" align="center">
+                <template slot-scope="scope">
+                  <el-button type="text" size="mini" @click="handleEventLogDetail(scope.row)">详情</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
 
-            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-                        :limit.sync="queryParams.pageSize"
-                        @pagination="getList"
+            <pagination
+              v-show="eventLogTotal > 0"
+              :total="eventLogTotal"
+              :page.sync="eventLogQuery.pageNum"
+              :limit.sync="eventLogQuery.pageSize"
+              @pagination="queryEventLogs"
             />
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </el-card>
+
+    <!-- 修改系统信息对话框 -->
+    <el-dialog title="修改系统信息" :visible.sync="editDialogVisible" width="500px" append-to-body>
+      <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="厂商" prop="manFacturer">
+          <el-input v-model="editForm.manFacturer" placeholder="请输入厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editForm.descr" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelEdit">取 消</el-button>
+        <el-button type="primary" @click="submitEdit" :loading="editLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 执行结果对话框 -->
+    <el-dialog
+      :title="executeDialog.title"
+      :visible.sync="executeDialog.visible"
+      width="600px">
+      <div class="execute-result">
+        <el-alert
+          :title="executeDialog.status"
+          :type="executeDialog.type"
+          :description="executeDialog.message"
+          show-icon>
+        </el-alert>
+        <div v-if="executeDialog.data" class="result-data">
+          <pre>{{ JSON.stringify(executeDialog.data, null, 2) }}</pre>
+        </div>
+      </div>
+      <span slot="footer">
+        <el-button @click="executeDialog.visible = false">关闭</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 调用日志详情弹窗 -->
+    <el-dialog :visible.sync="callLogDetailDialog" title="调用日志详情" width="60%">
+      <div v-if="callLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象代码">{{ callLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="模型代码">{{ callLogDetailData.modelCode }}</el-descriptions-item>
+          <el-descriptions-item label="能力标识">{{ callLogDetailData.abilityKey }}</el-descriptions-item>
+          <el-descriptions-item label="调用时间">{{ callLogDetailData.callTime }}</el-descriptions-item>
+          <el-descriptions-item label="响应时间">{{ callLogDetailData.resTime }}</el-descriptions-item>
+          <el-descriptions-item label="调用结果">
+            <el-tag :type="getCallStatusType(callLogDetailData.callStatus)">
+              {{ formatCallStatus(callLogDetailData.callStatus) }}
+            </el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>调用载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.callPayload }}</pre>
+        </div>
 
-            <!-- 添加或修改能源设备对话框 -->
-            <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-              <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-                <el-form-item label="归属设施" prop="refFacs">
-                  <el-select v-model="form.refFacs">
-                    <el-option v-for="item in facsOptions" :label="item.facsName" :value="item.facsCode"
-                               :key="item.facsCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备代码" prop="deviceCode">
-                  <el-input v-model="form.deviceCode" placeholder="请输入设备代码"/>
-                </el-form-item>
-                <el-form-item label="设备名称" prop="deviceName">
-                  <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
-                </el-form-item>
-
-
-                <el-form-item label="功能类型" prop="psCode" v-if="queryParams.deviceCategory === 'W'">
-                  <el-select v-model="form.psCode">
-                    <el-option v-for="item in devOptions" :label="item.psName" :value="item.psCode"
-                               :key="item.psCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <el-form-item label="设备类型" prop="deviceType">
-                  <el-select v-model="form.deviceCategory">
-                    <el-option v-for="item in subCategoryOptions" :label="item.name" :value="item.code"
-                               :key="item.code"
-                    />
-                  </el-select>
-                </el-form-item>
-                <el-form-item label="设备模型" prop="deviceModel">
-                  <el-select v-model="form.deviceModel" style="width:100%" @change="handleModelChange">
-                    <el-option
-                      v-for="item in modelList"
-                      :label="item.modelName"
-                      :value="item.modelCode"
-                      :key="item.modelCode"
-                    />
-                  </el-select>
-                </el-form-item>
-
-                <!-- 这里可以展示属性名称和属性值 -->
-                <div v-if="attrList.length > 0" class="attr-list-container">
-                  <h3>模型属性:</h3>
-                  <ul>
-                    <li v-for="attr in attrList" :key="attr.attrKey" class="attr-item">
-                      <span class="attr-name">{{ attr.attrName }} ({{ attr.attrUnit }}):</span>
-                      <!-- 使用 el-input 组件允许用户编辑属性值 -->
-                      <el-input
-                        v-model="attrValuesMap[attr.attrKey]"
-                        placeholder="点击编辑"
-                        size="small"
-                        @blur="updateAttrValue(attr.attrKey, attrValuesMap[attr.attrKey])"
-                      >
-                      </el-input>
-                    </li>
-                  </ul>
-                </div>
-                <h3 class="attr-list-container" v-if="attrList.length > 0">自定义属性
-                  <el-form-item label="" prop="attrList">
-                    <el-table class="attr-table" v-loading="loading" :data="form.customAttrs" max-height="280px"
-                              key="'customAttrs'"
-                    >
-                      <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="attrName">
-                        <template slot-scope="scope">
-                          <el-input size="mini" v-model="scope.row.attrName" 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="请输入属性值"/>
-                        </template>
-                      </el-table-column>
-                      <el-table-column align="center" label="操作">
-                        <template slot="header">
-                          <div class="operateBtns" @click="addCustomAttr">
-                            <span>添加</span><i class="el-icon-circle-plus-outline"></i>
-                          </div>
-                        </template>
-                        <template slot-scope="scope">
-                          <i class="el-icon-delete" @click="deleteCustomAttr(scope.$index)"></i>
-                        </template>
-                      </el-table-column>
-                    </el-table>
-                  </el-form-item>
-                </h3>
-                <el-form-item label="子系统" prop="subsystemCode">
-                  <el-select v-model="form.subsystemCode">
-                    <el-option v-for="item in subsystemOptions" :label="item.systemName" :value="item.systemCode"
-                               :key="item.systemCode"
-                    />
-                  </el-select>
-                </el-form-item>
-              </el-form>
-              <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="submitForm">确 定</el-button>
-                <el-button @click="cancel">取 消</el-button>
+        <div style="margin-top: 20px;">
+          <h4>响应载体</h4>
+          <pre style="white-space: pre-wrap; background-color: #f5f5f5; padding: 10px; border-radius: 4px; max-height: 300px; overflow: auto;">{{ callLogDetailData.resPayload }}</pre>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 事件日志详情弹窗 -->
+    <el-dialog :visible.sync="eventLogDetailDialog" title="事件日志详情" width="60%">
+      <div v-if="eventLogDetailData">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="对象编号">{{ eventLogDetailData.objCode }}</el-descriptions-item>
+          <el-descriptions-item label="对象名称">{{ eventLogDetailData.objName }}</el-descriptions-item>
+          <el-descriptions-item label="事件名称">{{ eventLogDetailData.eventName }}</el-descriptions-item>
+          <el-descriptions-item label="事件标识">{{ eventLogDetailData.eventKey }}</el-descriptions-item>
+          <el-descriptions-item label="事件时间" :span="2">{{ eventLogDetailData.eventTime }}</el-descriptions-item>
+        </el-descriptions>
+
+        <div style="margin-top: 20px;">
+          <h4>事件描述</h4>
+          <div style="background-color: #f5f5f5; padding: 10px; border-radius: 4px;">
+            {{ eventLogDetailData.eventDetail || '无' }}
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <!-- 能力执行弹窗(支持Slider和Input类型) -->
+    <el-dialog :title="abilityDialogTitle" :visible.sync="abilityDialogVisible" width="500px" append-to-body :close-on-click-modal="false">
+      <el-form ref="abilityForm" :model="abilityForm" label-width="100px">
+        <el-form-item label="能力名称">
+          <el-input v-model="abilityForm.abilityName" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="能力描述">
+          <el-input type="textarea" v-model="abilityForm.abilityDesc" disabled :rows="2"></el-input>
+        </el-form-item>
+
+        <el-form-item label="参数设置" v-if="abilityParamType">
+          <template v-if="abilityParamType === 'Slider'">
+            <div style="width: 100%;">
+              <div style="padding: 0 10px;">
+                <el-slider
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :show-tooltip="true"
+                  :format-tooltip="formatTooltip">
+                </el-slider>
               </div>
-            </el-dialog>
-
-            <!--设备器件-->
-            <el-drawer :title=ComponentRow.deviceName size="80%" :visible.sync="showDevProcessDrawer" direction="rtl">
-              <div class="drawer-content" style="padding-left:50px">
-                <el-row :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleComponentAdd"
-                               v-hasPermi="['ems:component:add']"
-                    >新增
-                    </el-button>
-                  </el-col>
-                </el-row>
-                <el-table v-loading="loading" :data="ComponentList">
-                  <el-table-column type="selection" width="55" align="center"/>
-                  <el-table-column label="部件编码" align="center" prop="compoCode"/>
-                  <el-table-column label="部件标签" align="center" prop="compoTag">
-                    <template slot-scope="scope">
-                      {{ objComTypeMapping[scope.row.compoTag] }}
-                    </template>
-                  </el-table-column>
-                  <el-table-column label="工艺标识代码" align="center" prop="psCode"/>
-                  <el-table-column label="外系统部件编码" align="center" prop="extCompoCode"/>
-                  <el-table-column label="部件模型" align="center" prop="compoModel"/>
-                  <el-table-column label="部件品牌" align="center" prop="compoBrand"/>
-                  <el-table-column label="部件型号" align="center" prop="compoSpec"/>
-                  <el-table-column label="祖籍列表" align="center" prop="ancestors"/>
-                  <el-table-column label="上级部件" align="center" prop="parentEqpt"/>
-
-                  <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-edit" @click="handleComponentUpdate(scope.row)"
-                                 v-hasPermi="['ems:component:edit']"
-                      >
-                        修改
-                      </el-button>
-                      <el-button size="mini" type="text" icon="el-icon-delete" class="deleteBtn"
-                                 @click="handleComponentDelete(scope.row)" v-hasPermi="['ems:component:remove']"
-                      >
-                        删除
-                      </el-button>
-                    </template>
-                  </el-table-column>
-                </el-table>
-                <pagination v-show="total>0" :total="total" :page.sync="queryComponentParams.pageNum"
-                            :limit.sync="queryComponentParams.pageSize"
-                            @pagination="getComponentList"
-                />
-
-                <!-- 添加或修改设备器件对话框 -->
-                <el-dialog :title="title" :visible.sync="componentOpen" width="500px" append-to-body>
-                  <el-form ref="componentForm" :model="componentForm" :rules="componentRules" label-width="150px">
-                    <!--                <el-form-item label="设备code" prop="deviceCode">-->
-                    <!--                  <el-input v-model="componentForm.deviceCode" placeholder="请输入设备code" />-->
-                    <!--                </el-form-item>-->
-                    <el-form-item label="部件编码" prop="compoCode">
-                      <el-input v-model="componentForm.compoCode" placeholder="请输入部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件标签" prop="compoTag">
-                      <el-select v-model="componentForm.compoTag" placeholder="请输入部件标签">
-                        <el-option v-for="item in objComTypeOptions"
-                                   :label="item.name"
-                                   :value="item.code"
-                                   :key="item.code"
-                        />
-
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="工艺标签代码" prop="psCode">
-                      <el-select v-model="componentForm.psCode" placeholder="请输入工艺标签代码">
-                        <el-option v-for="item in devOptions" :label="item.psCode" :value="item.psCode"
-                                   :key="item.psCode"/>
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="外系统部件编码" prop="extCompoCode">
-                      <el-input v-model="componentForm.extCompoCode" placeholder="请输入外系统部件编码"/>
-                    </el-form-item>
-                    <el-form-item label="部件模型" prop="compoModel">
-                      <el-select v-model="componentForm.compoModel" placeholder="请输入部件模型">
-                        <el-option v-for="item in this.modelList" :label="item.modelCode" :value="item.modelCode"
-                                   :key="item.modelCode"
-                        />
-                      </el-select>
-                    </el-form-item>
-                    <el-form-item label="部件品牌" prop="compoBrand">
-                      <el-input v-model="componentForm.compoBrand" placeholder="请输入部件品牌"/>
-                    </el-form-item>
-                    <el-form-item label="部件型号" prop="compoSpec">
-                      <el-input v-model="componentForm.compoSpec" placeholder="请输入部件型号"/>
-                    </el-form-item>
-                    <el-form-item label="祖籍列表" prop="ancestors">
-                      <el-input v-model="componentForm.ancestors" placeholder="请输入祖籍列表"/>
-                    </el-form-item>
-                    <el-form-item label="上级列表" prop="parentCompo">
-                      <el-input v-model="componentForm.parentCompo" placeholder="请输入上级列表"/>
-                    </el-form-item>
-
-                  </el-form>
-                  <div slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="submitComponentForm">确 定</el-button>
-                    <el-button @click="ComponentCancel">取 消</el-button>
-                  </div>
-                </el-dialog>
+
+              <div style="display: flex; justify-content: space-between; padding: 0 10px; margin-top: -5px; margin-bottom: 20px;">
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMin }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ Math.floor((abilitySliderMin + abilitySliderMax) / 2) }}%</span>
+                <span style="font-size: 12px; color: #909399;">{{ abilitySliderMax }}%</span>
               </div>
-            </el-drawer>
-
-            <!-- 详情弹框 -->
-            <el-dialog :visible.sync="showDrawer" title="设备详情">
-              <div v-if="curRow">
-                <!-- 设备基本信息 -->
-                <el-card class="box-card">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">设备基本信息</span>
-                  </div>
-                  <div>
-                    <p>设备代码:{{ curRow.deviceCode }}</p>
-                    <p>设备名称:{{ curRow.deviceName }}</p>
-                    <p>设备类型:{{ curRow.deviceCategoryName }}</p>
-                    <p>子系统:{{ curRow.subsystemName }}</p>
-                    <p>归属区域:{{ curRow.areaPath }}</p>
-                    <p>归属设施:{{ curRow.refFacsName }}</p>
-                  </div>
-                </el-card>
-                <el-card class="box-card" style="margin-top: 10px">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">状态属性</span>
-                  </div>
-                  <div>
-                    <p v-for="attr in statusAttr" :key="attr.attr">{{ attr.attr }}:{{ attr.attrValue }} {{
-                        attr.attrUnit
-                      }}</p>
-                  </div>
-                </el-card>
-                <!-- 属性信息 -->
-                <el-card class="box-card" v-if="attrData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">属性定义</span>
-                  </div>
-                  <div v-for="(item, index) in attrData" :key="index">
-                    <p>属性名称:{{ item.attrName }}</p>
-                    <p>属性值:{{ item.attrValue }}</p>
-                    <p>属性单位:{{ item.attrUnit }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < attrData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 能力信息 -->
-                <el-card class="box-card" v-if="abilityData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">能力定义</span>
-                  </div>
-                  <div v-for="(item, index) in abilityData" :key="index">
-                    <p>能力名称:{{ item.abilityName }}</p>
-                    <p>能力键:{{ item.abilityKey }}</p>
-                    <p>能力参数:{{ item.abilityParam }}</p>
-                    <p>能力描述:{{ item.abilityDesc }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < abilityData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
-                <!-- 事件信息 -->
-                <el-card class="box-card" v-if="eventData.length > 0">
-                  <div slot="header" class="clearfix">
-                    <span class="section-title">事件定义</span>
-                  </div>
-                  <div v-for="(item, index) in eventData" :key="index">
-                    <p>事件名称:{{ item.eventKey }}</p>
-                    <p>事件类型:{{ item.eventType === 1 ? '消息上报' : '异常告警' }}</p>
-                    <p>事件代码:{{ item.eventCode }}</p>
-                    <p>外部事件代码:{{ item.extEventCode }}</p>
-                    <!-- 在每个条目之后添加横线,除了最后一个条目 -->
-                    <div v-if="index < eventData.length - 1" class="divider"></div>
-                  </div>
-                </el-card>
+
+              <div style="display: flex; align-items: center; gap: 15px;">
+                <el-input-number
+                  v-model="abilitySliderValue"
+                  :min="abilitySliderMin"
+                  :max="abilitySliderMax"
+                  :step="1"
+                  :precision="0"
+                  controls-position="right"
+                  style="flex: 0 0 120px;">
+                </el-input-number>
+                <span style="color: #909399; font-size: 13px;">
+                  调节范围:{{ abilitySliderMin }} - {{ abilitySliderMax }}
+                </span>
               </div>
-            </el-dialog>
-          </div>
-        </div>
-      </el-col>
-    </el-row>
+            </div>
+          </template>
+
+          <template v-else-if="abilityParamType === 'Input'">
+            <el-input
+              v-model="abilityInputValue"
+              placeholder="请输入参数值"
+              clearable>
+            </el-input>
+          </template>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="abilityDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="executeAbilityWithParam" :loading="abilityExecuting">执行</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import {addDevice, delDevice, getDevice, listDevRecursionByArea, updateDevice} from '@/api/device/device'
-import {areaTreeSelect} from '@/api/basecfg/area'
-import {getFacsCategorygetByCode, listAllFacs} from '@/api/basecfg/emsfacs'
-import {listSubsystemAll} from '@/api/adapter/subsystem'
-import {getModelByCode, listAllModel} from '@/api/basecfg/objModel'
-import {getObjAttr} from '@/api/basecfg/objAttribute'
-import {addAttrValueBatch} from '@/api/basecfg/objAttributeValue'
-import {addComponent, delComponent, getComponent, listByDevice, updateComponent} from '@/api/basecfg/component'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
+import { getModelByCode } from '@/api/basecfg/objModel'
+import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
+import { listcallAbility } from '@/api/basecfg/objAbility'
+import { getByCondition } from '@/api/device/device'
+import { listCallLog, listEventLog, getCallLog, getEventLog } from '@/api/basecfg/objLog'
 
 export default {
-  name: 'Device',
-  components: {Treeselect},
+  name: 'SubsystemIntegration',
   data() {
     return {
-      primary1: 'primary',
-      primary2: '',
-      ComponentRow: [],
-      componentForm: {},
-      subcategoryCode: '',
-      attrList: [], // 属性模板数组
-      attrValues: [],
-      ComponentList: [],
-      attrValuesMap: {},
-      modelList: [],
-      showDrawer: false,
-      showDevProcessDrawer: false,
-      componentOpen: false,
-      istable: 2,
-      statusAttr: [{
-        attr: '实施电量',
-        attrUnit: 'kW·h',
-        attrValue: '10.3'
-      },
-        {
-          attr: '设备运行状态',
-          attrUnit: '',
-          attrValue: '工作中'
-        },
-        {
-          attr: '设备电压',
-          attrUnit: 'V',
-          attrValue: '20'
-        },
-        {
-          attr: '设备电流',
-          attrUnit: 'A',
-          attrValue: '5'
-        },
-        {
-          attr: '设备功率',
-          attrUnit: 'W',
-          attrValue: '100'
-        },
-      ],
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 能源设备表格数据
+      // 系统代码
+      systemCode: 'SYS_GF',
+      // 系统信息
+      systemInfo: {},
+      // 系统状态
+      systemStatus: '1',
+      // 当前标签页
+      activeTab: 'attributes',
+      // 协议属性
+      protocolAttrs: [],
+      // 状态属性
+      stateAttrs: [],
+      // 系统能力
+      systemAbilities: [],
+      abilityLoading: false,
+      // 设备列表
       deviceList: [],
-      // 弹出层标题
-      title: '',
-      // 是否显示弹出层
-      open: false,
-      // 区域名称
-      areaName: undefined,
-      // 区域树选项
-      treeAreaOptions: undefined,
-      totalAreaOptions: undefined,
-      // 设施选项
-      facsOptions: undefined,
-      // 设备分类
-      subCategoryOptions: undefined,
-      subsystemOptions: undefined,
-      devOptions: undefined,
-
-      defaultProps: {
-        children: 'children',
-        label: 'label'
+      deviceLoading: false,
+      deviceAttrs: {},
+      deviceChannels: {},
+      // 设备能力缓存
+      deviceAbilities: {},
+      // 设备统计
+      deviceStats: {
+        total: 0,
+        online: 0,
+        offline: 0,
+        points: 0
       },
-      // 查询参数
-      queryParams: {
-        psCode: null,
+      // 所有模型代码(系统 + 设备)
+      allModelCodes: [],
+      // 调用日志查询
+      callLogQuery: {
+        dateRange: [],
+        abilityKey: '',
+        callStatus: '',
         pageNum: 1,
-        pageSize: 10,
-        deviceCode: null,
-        deviceSubCategory: '',
-        deviceCategory: 'E',
-        locationType: null,
-        locationRef: null,
-        refFacs: null,
-        customAttrs: null
+        pageSize: 10
       },
-      queryComponentParams: {
+      callLogList: [],
+      callLogTotal: 0,
+      logLoading: false,
+      // 事件日志查询
+      eventLogQuery: {
+        dateRange: [],
+        eventKey: '',
         pageNum: 1,
         pageSize: 10
       },
-      objComTypeMapping: {
-        1: '总开',
-        2: '照明',
-        3: '风机'
-      },
-      objComTypeOptions: [
-        {code: 1, name: '总开'},
-        {code: 2, name: '照明'},
-        {code: 3, name: '风机'}
-
-      ],
-      curRow: {},
-      attrData: [],
-      abilityData: [],
-      eventData: [],
-
-      // 表单参数
-      form: {
-        customAttrs: [] // 自定义属性数组
+      eventLogList: [],
+      eventLogTotal: 0,
+      eventLogLoading: false,
+      // 调用日志详情
+      callLogDetailDialog: false,
+      callLogDetailData: null,
+      // 事件日志详情
+      eventLogDetailDialog: false,
+      eventLogDetailData: null,
+      // 执行结果对话框
+      executeDialog: {
+        visible: false,
+        title: '',
+        status: '',
+        type: 'success',
+        message: '',
+        data: null
       },
-      // 表单校验
-      rules: {
-        refFacs: [
-          {required: true, message: '归属设施', trigger: 'blur'}
-        ],
-        refArea: [
-          {required: true, message: '安装位置', trigger: 'blur'}
-        ],
-        deviceCode: [
-          {required: true, message: '设备代码不能为空', trigger: 'blur'}
-        ],
-        deviceName: [
-          {required: true, message: '设备名称不能为空', trigger: 'blur'}
-        ]
+      // 能力执行相关
+      abilityDialogVisible: false,
+      abilityDialogTitle: '能力执行',
+      abilityForm: {
+        abilityName: '',
+        abilityKey: '',
+        abilityDesc: '',
+        paramDefinition: null,
+        modelCode: ''
       },
-      componentRules: {
-        deviceCode: [
-          {required: true, message: '设备code不能为空', trigger: 'blur'}
+      abilityParamType: null,
+      abilitySliderValue: 50,
+      abilitySliderMin: 0,
+      abilitySliderMax: 100,
+      abilityInputValue: '',
+      abilityExecuting: false,
+      currentDevice: null,
+      currentObjType: null,
+      // 编辑系统信息相关
+      editDialogVisible: false,
+      editLoading: false,
+      editForm: {},
+      editRules: {
+        systemCode: [
+          { required: true, message: "系统代码不能为空", trigger: "blur" }
         ],
-        compoCode: [
-          {required: true, message: '部件编码不能为空', trigger: 'blur'}
-        ],
-        psCode: [
-          {required: true, message: '工艺标签代码不能为空', trigger: 'blur'}
+        systemName: [
+          { required: true, message: "系统名称不能为空", trigger: "blur" }
         ]
       }
     }
   },
-  watch: {
-    // 根据名称筛选区域树
-    areaName(val) {
-      this.$refs.tree.filter(val)
-    }
-  },
   created() {
-    this.queryParams.deviceCategory = 'E'; // 确保初始加载时就设置为 'E'
-    this.getList()
-    this.getAreaTree('0', 1)
-    this.getFacsOptions()
-    this.getSubsystem()
-    this.getSubCategorygetByCode()
-    this.getFacsModel()
-    // this.getAllDevProcess(this.subcategoryCode)
+    this.loadSystemInfo()
+    this.initDateRange()
   },
   methods: {
-    /**分页切换*/
-    switchData(v) {
-      if (v === 1) {
-        this.primary1 = "primary";
-        this.primary2 = "";
-      } else {
-        this.primary1 = "";
-        this.primary2 = "primary";
-      }
-      this.istable = v;
-    },
-    /** 查询能源设备列表 */
-    getList() {
-      this.loading = true
-      listDevRecursionByArea(this.queryParams).then(response => {
-        console.log('参数', JSON.stringify(this.queryParams))
-        this.deviceList = response.rows
-        this.total = response.total
-        this.loading = false
+    // 打开编辑对话框
+    handleEdit() {
+      this.editForm = { ...this.systemInfo }
+      this.editDialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.editForm?.clearValidate()
       })
     },
-    /**新增、修改、删除*/
-    handleComponentAdd() {
-      this.componentReset()
-      this.componentOpen = true
-      this.title = '添加设备器件属性'
-      this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
 
+    // 取消编辑
+    cancelEdit() {
+      this.editDialogVisible = false
+      this.editForm = {}
     },
-    handleComponentUpdate(row) {
-      this.componentReset()
-      const id = row.id || this.ids
-      getComponent(id).then(response => {
-        this.componentForm = response.data
-        this.componentOpen = true
-        this.title = '修改设备器件属性'
-        this.componentForm.deviceCode = this.ComponentRow.deviceCode // 设置默认设备代码
-      })
-    },
-    handleComponentDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源对象属性编号为"' + ids + '"的数据项?').then(function () {
-        return delComponent(ids)
-      }).then(() => {
-        console.log('删除row', row.deviceCode)
-        this.getComponentList(row.deviceCode)
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    submitComponentForm() {
-      this.$refs['componentForm'].validate(valid => {
+
+    // 提交编辑
+    submitEdit() {
+      this.$refs.editForm.validate(valid => {
         if (valid) {
-          if (this.componentForm.id != null) {
-            updateComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          } else {
-            addComponent(this.componentForm).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.componentOpen = false
-              this.getComponentList(this.componentForm.deviceCode)
-            })
-          }
+          this.editLoading = true
+          updateSubsystem(this.editForm).then(response => {
+            this.$message.success("修改成功")
+            this.editDialogVisible = false
+            // 重新加载系统信息
+            this.loadSystemInfo()
+          }).catch(error => {
+            this.$message.error("修改失败:" + error.message)
+          }).finally(() => {
+            this.editLoading = false
+          })
         }
       })
     },
-    ComponentCancel() {
-      this.componentOpen = false
-      this.componentReset()
-    },
-    /**查询部件列表*/
-    getComponentList(deviceCode) {
-      listByDevice(deviceCode).then(response => {
-        this.ComponentList = response.data
-      })
-    },
-    /** 查询区域树结构 */
-    getAreaTree(areaCode, layer) {
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.treeAreaOptions = [{
-          id: '-1',
-          label: '全部',
-          children: response.data
-        }]
-      })
-    },
-    // 筛选节点
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
+
+    // 格式化滑块tooltip
+    formatTooltip(val) {
+      return `${val}%`
     },
-    // 节点单击事件
-    handleNodeClick(data) {
-      if (data.id === '-1') {
-        this.queryParams.locationType = null;
-        this.queryParams.locationRef = null;
-      } else {
-        this.queryParams.locationType = data.tier;
-        this.queryParams.locationRef = data.id;
+
+    // 解析参数定义类型
+    getParamType(paramDefinition) {
+      if (!paramDefinition) return null
+      try {
+        const def = JSON.parse(paramDefinition)
+        return def.type
+      } catch (e) {
+        return null
       }
-      this.handleQuery();
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false
-      this.reset()
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        deviceCode: null,
-        deviceName: null,
-        deviceType: null,
-        deviceStatus: null,
-        deviceModel: null,
-        refArea: null,
-        refFacs: null,
-        subsystemCode: null,
-        psCode: null,
-        createTime: null,
-        updateTime: null
 
+    // 解析Options类型的选项
+    parseOptions(paramDefinition) {
+      try {
+        const def = JSON.parse(paramDefinition)
+        if (def.type === 'Options' && def.list) {
+          return def.list
+        }
+      } catch (e) {
+        console.error('解析Options失败:', e)
       }
-      this.resetForm('form')
+      return []
     },
-    componentReset() {
-      this.componentForm = {
-        id: null,
-        deviceCode: this.ComponentRow.deviceCode || '', // 使用ComponentRow的deviceCode,或者空字符串
-        compoCode: null,
-        compoTag: null,
-        psCode: null,
-        extCompoCode: null,
-        compoModel: null,
-        compoBrand: null,
-        compoSpec: null,
-        ancestors: null,
-        parentCompo: null
 
+    // 处理系统能力点击
+    handleSystemAbilityClick(ability) {
+      const paramType = this.getParamType(ability.paramDefinition)
+
+      if (paramType === 'Slider') {
+        this.showSliderDialog(ability, this.systemInfo, 3)
+      } else if (paramType === 'Input') {
+        this.showInputDialog(ability, this.systemInfo, 3)
+      } else {
+        this.executeSystemAbility(ability)
       }
-      this.resetForm('componentForm')
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1
-      console.log('搜索按钮this.queryParams', JSON.stringify(this.queryParams))
-      this.getList()
+
+    // 执行系统能力(带Options参数)
+    executeSystemAbilityWithParam(ability, paramValue) {
+      ability.executing = true
+      ability.executingValue = paramValue
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: paramValue
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+        ability.executingValue = null
+      })
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.queryParams.locationType = null
-      this.queryParams.locationRef = null
-      this.resetForm('queryForm')
-      this.handleQuery()
+
+    // 执行系统能力(无参数)
+    executeSystemAbility(ability) {
+      ability.executing = true
+
+      listcallAbility({
+        objCode: this.systemCode,
+        objType: 3,
+        modelCode: this.systemInfo.modelCode,
+        abilityKey: ability.abilityKey,
+        abilityParam: null
+      }).then(res => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行成功',
+          type: 'success',
+          message: '系统能力执行完成',
+          data: res.data
+        }
+
+        if (ability.abilityKey === 'MeterReadingGw') {
+          this.loadDevices()
+        }
+      }).catch(error => {
+        this.executeDialog = {
+          visible: true,
+          title: '执行结果 - ' + ability.abilityName,
+          status: '执行失败',
+          type: 'error',
+          message: error.message,
+          data: null
+        }
+      }).finally(() => {
+        ability.executing = false
+      })
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+
+    // 显示滑块弹窗
+    showSliderDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Slider'
+
+      try {
+        const def = JSON.parse(ability.paramDefinition)
+        this.abilitySliderMin = def.min || 0
+        this.abilitySliderMax = def.max || 100
+        this.abilitySliderValue = Math.floor((this.abilitySliderMin + this.abilitySliderMax) / 2)
+      } catch (e) {
+        console.error('解析Slider参数失败:', e)
+        this.abilitySliderMin = 0
+        this.abilitySliderMax = 100
+        this.abilitySliderValue = 50
+      }
+
+      this.abilityDialogVisible = true
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '添加能源设备'
+
+    // 显示输入弹窗
+    showInputDialog(ability, obj, objType) {
+      this.currentDevice = obj
+      this.currentObjType = objType
+      this.abilityForm = { ...ability }
+
+      const objName = objType === 3 ? this.systemInfo.systemName : obj.deviceName
+      this.abilityDialogTitle = `${ability.abilityName} - ${objName}`
+      this.abilityParamType = 'Input'
+      this.abilityInputValue = ''
+      this.abilityDialogVisible = true
     },
-    /**设备器件按钮*/
-    handleDevProcess(row) {
-      this.showDevProcessDrawer = true
-      this.ComponentRow = row
-      console.log('row', row)
-      listByDevice(this.ComponentRow.deviceCode).then(response => {
-        this.ComponentList = response.data
+
+    // 执行带参数的能力
+    executeAbilityWithParam() {
+      let paramValue = null
+
+      if (this.abilityParamType === 'Slider') {
+        paramValue = String(this.abilitySliderValue)
+      } else if (this.abilityParamType === 'Input') {
+        if (!this.abilityInputValue) {
+          this.$message.warning('请输入参数值')
+          return
+        }
+        paramValue = this.abilityInputValue
+      }
+
+      this.abilityExecuting = true
+
+      const callParams = {
+        objType: this.currentObjType,
+        abilityKey: this.abilityForm.abilityKey,
+        abilityParam: paramValue
+      }
+
+      if (this.currentObjType === 3) {
+        callParams.objCode = this.systemCode
+        callParams.modelCode = this.systemInfo.modelCode
+      } else if (this.currentObjType === 2) {
+        callParams.objCode = this.currentDevice.deviceCode
+        callParams.modelCode = this.currentDevice.deviceModel
+      }
+
+      listcallAbility(callParams).then(response => {
+        this.$message.success('执行成功')
+        this.abilityDialogVisible = false
+
+        if (this.abilityForm.abilityKey.toLowerCase().includes('meter') ||
+          this.abilityForm.abilityKey.toLowerCase().includes('reading')) {
+          if (this.currentObjType === 3) {
+            this.loadDevices()
+          } else if (this.currentObjType === 2) {
+            this.loadDeviceAttrs(this.currentDevice.deviceCode)
+          }
+        }
+      }).catch(() => {
+        this.$message.error('执行失败')
+      }).finally(() => {
+        this.abilityExecuting = false
       })
+    },
 
+    // 初始化时间范围
+    initDateRange() {
+      const now = new Date()
+      const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
+      const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59)
+
+      this.callLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
+      this.eventLogQuery.dateRange = [
+        this.formatDate(startOfDay),
+        this.formatDate(endOfDay)
+      ]
     },
-    shouldShowDevProcessButton(row) {
-      const categoryIsW = this.queryParams.deviceCategory === 'W'
-      const validPsCodes = ['AA', 'AH', 'AJ', 'AM', 'AP', 'AL', 'APE', 'ALE', 'AF', 'ACC']
-      const psCodeIsValid = validPsCodes.includes(row.psCode)
-      // 只有当设备分类为输能设备且设备工艺代码有效时,才返回true
-      return categoryIsW && psCodeIsValid
+
+    // 格式化日期
+    formatDate(date) {
+      if (!date) return ''
+      const year = date.getFullYear()
+      const month = (date.getMonth() + 1).toString().padStart(2, '0')
+      const day = date.getDate().toString().padStart(2, '0')
+      const hours = date.getHours().toString().padStart(2, '0')
+      const minutes = date.getMinutes().toString().padStart(2, '0')
+      const seconds = date.getSeconds().toString().padStart(2, '0')
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
     },
-    backStyle(areaPath) {
-      const firstLevel = areaPath.split('/')[0];
-      switch (firstLevel) {
-        case '北区':
-          return 'north';
-        case '南区':
-          return 'south';
-        case '主路':
-          return 'main';
-        default:
-          return '';
+
+    // 加载系统信息
+    async loadSystemInfo() {
+      try {
+        const sysRes = await getSubsystemByCode(this.systemCode)
+        this.systemInfo = sysRes.data
+
+        if (this.systemInfo.modelCode) {
+          this.allModelCodes.push(this.systemInfo.modelCode)
+
+          const modelRes = await getModelByCode(this.systemInfo.modelCode)
+          const modelData = modelRes.data
+
+          this.systemAbilities = (modelData.abilityList || []).map(item => ({
+            ...item,
+            executing: false,
+            executingValue: null
+          }))
+        }
+
+        const attrRes = await getObjAttr(3, this.systemCode)
+        const attrData = attrRes.data
+
+        this.protocolAttrs = attrData.Protocol || []
+        this.stateAttrs = attrData.State || []
+
+        const statusAttr = this.stateAttrs.find(attr => attr.attrKey === 'interfaceStatus')
+        if (statusAttr) {
+          this.systemStatus = statusAttr.attrValue
+        }
+
+        await this.loadDevices()
+      } catch (error) {
+        this.$message.error('加载系统信息失败:' + error.message)
       }
     },
-    /**设备详情按钮*/
-    handleDetail(row) {
-      this.showDrawer = true
-      this.curRow = row
-      console.log('data', this.curRow)
-      this.subKey = this.$options.data().subKey
-      getModelByCode(this.curRow.facsModel).then(response => {
-        const code = response.data
-        console.log('code', code)
-        this.eventData = response.data.eventList
-        this.abilityData = response.data.abilityList
 
-      })
-      getObjAttr(2, this.curRow.deviceCode).then(response => {
-        console.log('response值', response.data)
-        const attrs = response.data.attrs
-        const attrValues = response.data.attrValues
-
-        // 合并 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 : ''
+    // 加载设备列表
+    async loadDevices() {
+      this.deviceLoading = true
+      try {
+        const res = await getByCondition({
+          subsystemCode: this.systemCode
+        })
+
+        const deviceData = res.data || res.rows || []
+
+        this.deviceList = deviceData.map(device => ({
+          ...device,
+          detailTab: 'attrs'
+        }))
+
+        const deviceModelCodes = new Set()
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            deviceModelCodes.add(device.deviceModel)
           }
         })
-        this.attrData = mergedData
-      })
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset()
-      const id = row.id || this.ids
-      getDevice(id).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改能源设备'
-      })
-      const layer = 1
-      const areaCode = '0'
-      areaTreeSelect(areaCode, layer).then(response => {
-        this.totalAreaOptions = response.data
-      })
-    },
-    /** 提交按钮 */
-    submitForm() {
-      // 重置 attrList 和 form.customAttrs
-      if (!this.attrList) {
-        this.attrList = []
-      }
-      if (!this.form.customAttrs) {
-        this.form.customAttrs = []
-      }
-      // 准备要发送的数据
-      let dataToSubmit = []
-      // 添加模型属性数据
-      this.attrList.forEach(attr => {
-        const attrName = attr.attrName
-        const attrKey = attr.attrKey
-        const attrValue = this.attrValuesMap[attrKey]
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: this.form.deviceModel, // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
 
-          })
-        }
-      })
+        deviceModelCodes.forEach(modelCode => {
+          if (!this.allModelCodes.includes(modelCode)) {
+            this.allModelCodes.push(modelCode)
+          }
+        })
 
-      // 添加自定义属性数据
-      this.form.customAttrs.forEach(customAttr => {
-        const attrName = customAttr.attrName
-        const attrKey = customAttr.attrKey
-        const attrValue = customAttr.attrValue
-        const existingIndex = dataToSubmit.findIndex(item => item.attrKey === attrKey)
-        if (existingIndex === -1) {
-          // 如果attrKey不存在于dataToSubmit中,则添加
-          dataToSubmit.push({
-            modelCode: '', // 模型代码
-            objCode: this.form.deviceCode, // 设备代码
-            objType: 2, // 对象类型
-            attrKey: attrKey,
-            attrValue: attrValue,
-            attrName: attrName
-          })
+        this.deviceStats.total = this.deviceList.length
+        this.deviceStats.online = this.deviceList.filter(d => d.deviceStatus === 1).length
+        this.deviceStats.offline = this.deviceList.filter(d => d.deviceStatus !== 1).length
+
+        const devicesByModel = {}
+        this.deviceList.forEach(device => {
+          if (device.deviceModel) {
+            if (!devicesByModel[device.deviceModel]) {
+              devicesByModel[device.deviceModel] = []
+            }
+            devicesByModel[device.deviceModel].push(device)
+          }
+        })
+
+        for (const modelCode in devicesByModel) {
+          await this.loadDeviceAttrsBatch(modelCode, devicesByModel[modelCode])
         }
-      })
+      } catch (error) {
+        this.$message.error('加载设备列表失败')
+      } finally {
+        this.deviceLoading = false
+      }
+    },
 
-      this.$refs['form'].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateDevice(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            }).catch(error => {
-              console.error('修改失败:', error)
-              this.$message.error('修改失败')
-            })
+    // 批量加载设备属性
+    async loadDeviceAttrsBatch(modelCode, devices) {
+      try {
+        const res = await getObjAttrBatch(2, modelCode)
+        const batchData = res.data || {}
 
-            if (dataToSubmit.length > 0) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
-                  }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+        let totalPoints = 0
+
+        devices.forEach(device => {
+          const deviceCode = device.deviceCode
+          const attrData = batchData[deviceCode]
+
+          if (attrData) {
+            const baseAttrs = {}
+            if (attrData.Base) {
+              attrData.Base.forEach(attr => {
+                baseAttrs[attr.attrKey] = attr.attrValue
               })
             }
-          } 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) {
-              addAttrValueBatch(dataToSubmit)
-                .then(response => {
-                  if (response.code === 200) {
-                    this.$message.success('属性添加成功')
-                  } else {
-                    this.$message.error('属性添加失败')
+            this.deviceAttrs[deviceCode] = baseAttrs
+
+            const channels = []
+            if (attrData.Measure) {
+              attrData.Measure.forEach(attr => {
+                if (attr.attrKey.startsWith('interface')) {
+                  try {
+                    const points = JSON.parse(attr.attrValue || '[]')
+                    channels.push({
+                      name: attr.attrName,
+                      key: attr.attrKey,
+                      points: points
+                    })
+                    totalPoints += points.length
+                  } catch (e) {
+                    console.error(`解析设备 ${deviceCode} 的测点数据失败:`, e)
                   }
-                }).catch(error => {
-                console.error('属性添加失败:', error)
-                this.$message.error('属性添加失败')
+                }
               })
-            } else {
-              // this.$message.info('没有属性需要添加');
             }
+            this.deviceChannels[deviceCode] = channels
           }
+        })
+
+        this.deviceStats.points += totalPoints
+      } catch (error) {
+        console.error(`批量加载模型 ${modelCode} 的设备属性失败:`, error)
+        for (const device of devices) {
+          await this.loadDeviceAttrs(device.deviceCode)
         }
-      })
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('是否确认删除能源设备编号为"' + ids + '"的数据项?').then(function () {
-        return delDevice(ids)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('ems/basecfg/device/export', {
-        ...this.queryParams
-      }, `device_${new Date().getTime()}.xlsx`)
-    },
-    getFacsOptions() {
-      const getFacsParams = {
-        facsCategory: this.queryParams.deviceCategory,
-        subCategory: this.queryParams.deviceSubCategory
       }
-      listAllFacs(getFacsParams).then(response => {
-        this.facsOptions = response.data
-      })
-    },
-    getSubCategorygetByCode() {
-      getFacsCategorygetByCode(this.queryParams.deviceCategory).then(response => {
-        this.subCategoryOptions = response.data.subtypeList || []
-      })
-    },
-    getSubsystem() {
-      listSubsystemAll().then(response => {
-        this.subsystemOptions = response.data
-      })
     },
-    /**自定义属性表格*/
-    addCustomAttr() {
-      // 添加一个新的自定义属性
-      if (!Array.isArray(this.form.customAttrs)) {
-        this.form.customAttrs = []
-      }
-      this.form.customAttrs.push({
-        attrKey: '',
-        attrName: '',
-        attrValue: ''
-      })
-      // 强制更新视图
-      this.$forceUpdate()
 
-    },
-    deleteCustomAttr(index) {
-      // 删除指定索引的自定义属性
-      if (this.form.customAttrs.length > 0) {
-        this.form.customAttrs.splice(index, 1)
+    // 单个加载设备属性
+    async loadDeviceAttrs(deviceCode) {
+      try {
+        const res = await getObjAttr(2, deviceCode)
+        const attrData = res.data
+
+        const baseAttrs = {}
+        if (attrData.Base) {
+          attrData.Base.forEach(attr => {
+            baseAttrs[attr.attrKey] = attr.attrValue
+          })
+        }
+        this.deviceAttrs[deviceCode] = baseAttrs
+
+        const channels = []
+        let pointsCount = 0
+        if (attrData.Measure) {
+          attrData.Measure.forEach(attr => {
+            if (attr.attrKey.startsWith('interface')) {
+              try {
+                const points = JSON.parse(attr.attrValue || '[]')
+                channels.push({
+                  name: attr.attrName,
+                  key: attr.attrKey,
+                  points: points
+                })
+                pointsCount += points.length
+              } catch (e) {
+                console.error(`解析测点数据失败:`, e)
+              }
+            }
+          })
+        }
+
+        if (!this.deviceChannels[deviceCode]) {
+          this.deviceStats.points += pointsCount
+        }
+
+        this.deviceChannels[deviceCode] = channels
+      } catch (error) {
+        console.error(`加载设备 ${deviceCode} 属性失败:`, error)
       }
+    },
 
+    // 获取设备属性
+    getDeviceAttr(deviceCode, attrKey) {
+      return this.deviceAttrs[deviceCode]?.[attrKey] || '-'
     },
-    /**设备模型*/
-    updateAttrValue(attrKey, newValue) {
-      this.attrValuesMap[attrKey] = newValue
+
+    // 获取设备通道
+    getDeviceChannels(deviceCode) {
+      return this.deviceChannels[deviceCode] || []
     },
 
-    getFacsModel() {
-      listAllModel(2).then(response => {
-        this.modelList = response.data
-        console.log('this.modelList', this.modelList)
-        this.modelList.forEach(model => {
-          console.log(model.modelCode)
-        })
-      })
+    // 加载设备能力
+    async handleAbilityLoad(visible, device) {
+      if (visible && !this.deviceAbilities[device.deviceCode]) {
+        try {
+          if (!device.deviceModel) {
+            this.$set(this.deviceAbilities, device.deviceCode, [])
+            return
+          }
+
+          const res = await getModelByCode(device.deviceModel)
+          const abilities = res.data?.abilityList?.filter(item => item.hiddenFlag === 1) || []
+          this.$set(this.deviceAbilities, device.deviceCode, abilities)
+        } catch (error) {
+          this.$set(this.deviceAbilities, device.deviceCode, [])
+        }
+      }
     },
-    handleModelChange(modelCode) {
-      if (modelCode) {
-        this.getModelByCode(modelCode)
-        console.log('设备代码', this.form.deviceCode)
-        this.getObjAttr(2, this.form.deviceCode)
+
+    // 处理设备操作命令
+    async handleDeviceCommand(command) {
+      const { device, ability, paramValue } = command
+
+      if (paramValue !== undefined) {
+        try {
+          await listcallAbility({
+            objCode: device.deviceCode,
+            objType: 2,
+            modelCode: device.deviceModel,
+            abilityKey: ability.abilityKey,
+            abilityParam: paramValue
+          })
+
+          this.$message.success(`${ability.abilityName}执行成功`)
+
+          if (ability.abilityKey.toLowerCase().includes('meter') ||
+            ability.abilityKey.toLowerCase().includes('reading')) {
+            await this.loadDeviceAttrs(device.deviceCode)
+          }
+        } catch (error) {
+          this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+        }
+      } else {
+        const paramType = this.getParamType(ability.paramDefinition)
+
+        if (paramType === 'Slider') {
+          this.showSliderDialog(ability, device, 2)
+        } else if (paramType === 'Input') {
+          this.showInputDialog(ability, device, 2)
+        } else {
+          try {
+            await listcallAbility({
+              objCode: device.deviceCode,
+              objType: 2,
+              modelCode: device.deviceModel,
+              abilityKey: ability.abilityKey,
+              abilityParam: null
+            })
+
+            this.$message.success(`${ability.abilityName}执行成功`)
+
+            if (ability.abilityKey.toLowerCase().includes('meter') ||
+              ability.abilityKey.toLowerCase().includes('reading')) {
+              await this.loadDeviceAttrs(device.deviceCode)
+            }
+          } catch (error) {
+            this.$message.error(`${ability.abilityName}执行失败:${error.message}`)
+          }
+        }
       }
     },
-    getModelByCode(modelCode) {
-      getModelByCode(modelCode).then(response => {
-        // this.attrList = response.data.attrList;
-        const filteredAttrList = response.data.attrList.filter(attr => attr.attrType === 0)
-        this.attrList = filteredAttrList
 
-      })
+    // 处理设备行点击
+    handleDeviceClick(row) {
+      this.$refs.deviceTable?.toggleRowExpansion(row)
     },
-    getObjAttr(objType, deviceCode) {
-      getObjAttr(objType, deviceCode).then(response => {
-        // const attrs = response.data.attrs;
-        const attrs = response.data.attrs.filter(attr => attr.attrType === 0)
-        console.log('attrs', attrs)
-        const attrValues = response.data.attrValues || [] // 确保是一个数组
-        console.log('attrValues', attrValues)
-
-        // 创建一个映射对象,用于存储 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] = ''
-          }
-        })
 
-        // 更新 attrValuesMap 到组件的数据中
-        this.attrValuesMap = attrValuesMap
-        // 打印更新后的 attrValuesMap,用于调试
-        console.log('Updated attrValuesMap', this.attrValuesMap)
+    // 标签页切换
+    handleTabClick(tab) {
+      if (tab.name === 'callLogs' && this.callLogList.length === 0) {
+        this.queryCallLogs()
+      } else if (tab.name === 'eventLogs' && this.eventLogList.length === 0) {
+        this.queryEventLogs()
+      }
+    },
 
-      })
-    }
-  }
-}
-</script>
-<style lang="scss" scoped>
+    // 查询调用日志
+    async queryCallLogs() {
+      this.logLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.callLogQuery.pageNum,
+          pageSize: this.callLogQuery.pageSize
+        }
 
-.divider {
-  border-bottom: 2px solid #ebeef5;
-  margin: 10px 0;
-}
+        if (this.callLogQuery.dateRange && this.callLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.callLogQuery.dateRange[0]
+          params.endRecTime = this.callLogQuery.dateRange[1]
+        }
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-  margin-top: 20px;
-  margin-bottom: 10px;
-}
+        if (this.callLogQuery.abilityKey) {
+          params.abilityKey = this.callLogQuery.abilityKey
+        }
 
-.drawer-content {
-  padding: 0 20px;
-}
+        if (this.callLogQuery.callStatus !== '') {
+          params.callStatus = this.callLogQuery.callStatus
+        }
 
+        const res = await listCallLog(params)
+        this.callLogList = res.rows || []
+        this.callLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询调用日志失败')
+      } finally {
+        this.logLoading = false
+      }
+    },
 
-.section-title {
-  font-size: 18px;
-  font-weight: bold;
-}
+    // 重置调用日志查询
+    resetCallLogQuery() {
+      this.initDateRange()
+      this.callLogQuery.abilityKey = ''
+      this.callLogQuery.callStatus = ''
+      this.callLogQuery.pageNum = 1
+      this.queryCallLogs()
+    },
 
-.attr-list-container {
-  border: 1px solid #ccc;
-  padding: 10px;
-  margin: 10px 0;
-  font-weight: bold;
-}
+    // 查询事件日志
+    async queryEventLogs() {
+      this.eventLogLoading = true
+      try {
+        const params = {
+          modelCodes: this.allModelCodes,
+          pageNum: this.eventLogQuery.pageNum,
+          pageSize: this.eventLogQuery.pageSize
+        }
 
-.attr-list-container h3 {
-  font-weight: bold;
-}
+        if (this.eventLogQuery.dateRange && this.eventLogQuery.dateRange.length === 2) {
+          params.startRecTime = this.eventLogQuery.dateRange[0]
+          params.endRecTime = this.eventLogQuery.dateRange[1]
+        }
 
-.attr-item {
-  list-style-type: none;
-  margin-bottom: 5px;
-}
+        if (this.eventLogQuery.eventKey) {
+          params.eventKey = this.eventLogQuery.eventKey
+        }
 
-.attr-name {
-  font-weight: bold;
-}
+        const res = await listEventLog(params)
+        this.eventLogList = res.rows || []
+        this.eventLogTotal = res.total || 0
+      } catch (error) {
+        this.$message.error('查询事件日志失败')
+      } finally {
+        this.eventLogLoading = false
+      }
+    },
 
+    // 重置事件日志查询
+    resetEventLogQuery() {
+      this.initDateRange()
+      this.eventLogQuery.eventKey = ''
+      this.eventLogQuery.pageNum = 1
+      this.queryEventLogs()
+    },
 
-.contents {
-  border: 20px solid #f2f2f5;
-  background-color: #f2f2f5;
-}
+    // 格式化调用状态
+    formatCallStatus(status) {
+      const statusMap = {
+        0: '成功',
+        1: '进行中',
+        2: '失败'
+      }
+      return statusMap[status] || '未知'
+    },
 
+    // 获取调用状态类型
+    getCallStatusType(status) {
+      const typeMap = {
+        0: 'success',
+        1: 'warning',
+        2: 'danger'
+      }
+      return typeMap[status] || 'info'
+    },
 
-.other-content {
-  background-color: #ffffff; /* 白色背景 */
-  padding: 20px;
-  margin-bottom: 20px;
+    // 查看调用日志详情
+    async handleCallLogDetail(row) {
+      try {
+        const res = await getCallLog(row.id)
+        this.callLogDetailData = res.data
+        this.callLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取调用日志详情失败')
+      }
+    },
+
+    // 查看事件日志详情
+    async handleEventLogDetail(row) {
+      try {
+        const res = await getEventLog(row.id)
+        this.eventLogDetailData = res.data
+        this.eventLogDetailDialog = true
+      } catch (error) {
+        this.$message.error('获取事件日志详情失败')
+      }
+    }
+  }
 }
+</script>
 
-.table-content {
-  background-color: #ffffff; /* 白色背景 */
+<style lang="scss" scoped>
+.app-container {
   padding: 20px;
+  background: #f5f7fa;
+  min-height: calc(100vh - 84px);
 }
 
-.pagination-container {
+.system-info-card {
   margin-bottom: 20px;
-}
 
-.button-group-container {
-  display: flex;
-  justify-content: flex-end;
-  min-width: 200px;
-  padding: 5px;
-}
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
 
-.device-list {
-  margin-top: 20px;
-}
+    .title {
+      font-size: 18px;
+      font-weight: bold;
 
-.device-card {
-  background-color: #fff;
-  border: 1px solid #bfcbd9;
-  border-radius: 4px;
-  overflow: hidden;
-  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-  transition: 0.3s;
-  padding: 10px;
-  font-size: 14px;
-  height: 200px;
-  margin-bottom: 20px;
-  display: flex;
-  flex-direction: column;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
+  }
 
-.device-header {
-  //background-color: #f2f2f5;
-  //padding: 10px;
-  color: #545353;
-  font-size: 20px;
-  font-weight: bold;
-}
+  .info-group {
+    .group-title {
+      font-size: 14px;
+      font-weight: bold;
+      color: #606266;
+      margin-bottom: 12px;
+      padding-bottom: 6px;
+      border-bottom: 1px solid #EBEEF5;
+    }
+  }
 
-.device-code {
-  color: cornflowerblue;
-}
+  .info-item {
+    margin-bottom: 12px;
+    font-size: 14px;
 
-.deviceOthers {
-  color: black;
-}
+    label {
+      color: #909399;
+      margin-right: 8px;
+      display: inline-block;
+      min-width: 80px;
+    }
 
-.device-body {
-  padding: 10px;
-  color: #666666;
-  flex: 1; /* 使设备主体内容占据剩余空间 */
-  overflow-y: auto; /* 如果内容过多,允许滚动 */
-}
+    .code {
+      font-family: monospace;
+      color: #409EFF;
+      background: #f0f9ff;
+      padding: 2px 6px;
+      border-radius: 3px;
+    }
 
-.device-footer {
-  display: flex;
-  justify-content: space-between;
-  padding: 5px;
-  // background-color: #f9f9f9;
+    .stat-number {
+      color: #409EFF;
+      font-weight: bold;
+      font-size: 16px;
+    }
+  }
 }
 
-.device-footer .el-button {
-  padding: 5px 15px;
-  border: none; /* 移除默认边框 */
-  color: #5a5e66;
-  transition: background-color 0.3s; /* 平滑过渡背景色变化 */
-}
+.detail-card {
+  .tab-content {
+    min-height: 400px;
+  }
 
-/* 为按钮分配不同的颜色 */
-.device-footer .el-button:first-child {
-  background-color: #d5f1d5; /* 淡绿色 */
-  border: 1px solid lightgreen;
-  color: #71e2aa;
+  .attr-section {
+    margin-bottom: 30px;
 
-}
+    .section-title {
+      margin: 20px 0 15px 0;
+      color: #303133;
 
-.device-footer .el-button:nth-child(2) {
-  background-color: #ffe5b4; /* 淡橙色 */
-  border: 1px solid #ffba00;
-  color: #faad14;
-}
+      i {
+        margin-right: 8px;
+        color: #409EFF;
+      }
+    }
 
-.device-footer .el-button:last-child {
-  background-color: #ffd5d5; /* 淡红色 */
-  border: 1px solid lightpink;
-  color: #f5222d;
-}
+    .url-text {
+      color: #409EFF;
+      font-family: monospace;
+    }
+  }
 
-/* 鼠标悬停时加深颜色 */
-.device-footer .el-button:hover {
-  filter: brightness(0.5); /* 颜色加深效果 */
-}
+  .device-stats {
+    margin-bottom: 20px;
+
+    .stat-item {
+      text-align: center;
+      padding: 20px;
+      background: #fff;
+      border: 1px solid #EBEEF5;
+      border-radius: 4px;
+
+      .stat-value {
+        font-size: 28px;
+        font-weight: bold;
+        color: #303133;
+        margin-bottom: 8px;
+      }
+
+      .stat-label {
+        font-size: 14px;
+        color: #909399;
+      }
+
+      &.online .stat-value {
+        color: #67C23A;
+      }
+
+      &.offline .stat-value {
+        color: #F56C6C;
+      }
+    }
+  }
 
-/* 背景色样式 */
-.north {
-  background: linear-gradient(to right, #e1f3d8, #fafafa);
+  .device-detail {
+    padding: 20px;
+    background: #f5f7fa;
+
+    h5 {
+      margin: 15px 0 10px 0;
+      color: #303133;
+    }
+  }
+
+  .log-filter {
+    margin-bottom: 20px;
+    padding: 15px;
+    background: #f5f7fa;
+    border-radius: 4px;
+  }
 }
 
-.south {
-  background: linear-gradient(to right, #fff7e8, #fafafa);
+.execute-result {
+  .result-data {
+    margin-top: 20px;
+
+    pre {
+      background: #f5f7fa;
+      padding: 15px;
+      border-radius: 4px;
+      overflow: auto;
+      max-height: 400px;
+      font-family: monospace;
+      font-size: 12px;
+    }
+  }
 }
 
-.main {
-  background: linear-gradient(to right, #e0e0e0, #fafafa);
+.dialog-footer {
+  text-align: right;
 }
 
+::v-deep .el-dropdown-menu {
+  .el-submenu__title {
+    padding-right: 40px !important;
 
-.el-table {
-  background-color: #ffffff; /* 白色背景 */
-}
+    &:hover {
+      background-color: #f5f7fa;
+    }
+  }
 
-.el-card {
-  background-color: #ffffff; /* 白色背景 */
+  .el-submenu__icon-arrow {
+    position: absolute;
+    right: 20px;
+  }
 }
 </style>

+ 129 - 7
ems-ui-cloud/src/views/adapter/zm/index.vue

@@ -12,7 +12,7 @@
         </el-tag>
       </div>
 
-      <el-row :gutter="20">
+      <el-row :gutter="20" style="position: relative;">
         <el-col :span="6">
           <div class="info-group">
             <div class="group-title">系统信息</div>
@@ -79,6 +79,15 @@
               <label>设备总数:</label>
               <span class="stat-number">{{ deviceStats.total }}</span>
             </div>
+            <div style="text-align: right; margin-top: 10px;">
+              <el-button
+                type="primary"
+                size="mini"
+                icon="el-icon-edit"
+                @click="handleEditSystem">
+                编辑
+              </el-button>
+            </div>
           </div>
         </el-col>
       </el-row>
@@ -694,6 +703,14 @@
                           </div>
                         </template>
                       </el-table-column>
+
+                      <!-- 设备名称列(新增) -->
+                      <el-table-column label="设备名称" width="120">
+                        <template slot-scope="scope">
+                          {{ getLampGroupAttrValue(scope.row.deviceCode, 'deviceName') || '-' }}
+                        </template>
+                      </el-table-column>
+
                       <el-table-column prop="deviceCode" label="灯组代码" min-width="180"></el-table-column>
                       <el-table-column label="设备SN" width="110">
                         <template slot-scope="scope">
@@ -1068,11 +1085,48 @@
         </el-button-group>
       </div>
     </el-dialog>
+
+    <!-- 编辑系统信息对话框 -->
+    <el-dialog title="编辑系统信息" :visible.sync="editSystemDialogVisible" width="600px" append-to-body :close-on-click-modal="false">
+      <el-form ref="editSystemForm" :model="editSystemForm" :rules="editSystemRules" label-width="100px">
+        <el-form-item label="系统代码" prop="systemCode">
+          <el-input v-model="editSystemForm.systemCode" placeholder="请输入系统代码" disabled />
+        </el-form-item>
+        <el-form-item label="系统名称" prop="systemName">
+          <el-input v-model="editSystemForm.systemName" placeholder="请输入系统名称" />
+        </el-form-item>
+        <el-form-item label="系统简称" prop="shortName">
+          <el-input v-model="editSystemForm.shortName" placeholder="请输入系统简称" />
+        </el-form-item>
+        <el-form-item label="对接厂商" prop="manFacturer">
+          <el-input v-model="editSystemForm.manFacturer" placeholder="请输入对接厂商" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactPerson">
+          <el-input v-model="editSystemForm.contactPerson" placeholder="请输入联系人" />
+        </el-form-item>
+        <el-form-item label="联系电话" prop="contactNumber">
+          <el-input v-model="editSystemForm.contactNumber" placeholder="请输入联系电话" />
+        </el-form-item>
+        <el-form-item label="维护人" prop="maintainerPerson">
+          <el-input v-model="editSystemForm.maintainerPerson" placeholder="请输入维护人" />
+        </el-form-item>
+        <el-form-item label="维护电话" prop="maintainerNumber">
+          <el-input v-model="editSystemForm.maintainerNumber" placeholder="请输入维护电话" />
+        </el-form-item>
+        <el-form-item label="备注说明" prop="descr">
+          <el-input v-model="editSystemForm.descr" type="textarea" :rows="3" placeholder="请输入备注说明" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="editSystemDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="submitEditSystem" :loading="editSystemSubmitting">保存</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { getSubsystemByCode } from '@/api/adapter/subsystem'
+import { getSubsystemByCode, updateSubsystem } from '@/api/adapter/subsystem'
 import { getModelByCode } from '@/api/basecfg/objModel'
 import { getObjAttr, getObjAttrBatch } from '@/api/basecfg/objAttribute'
 import { listcallAbility } from '@/api/basecfg/objAbility'
@@ -1208,7 +1262,31 @@ export default {
       quickAbilityOptions: [],
       quickAbilityExecuting: false,
       quickAbilityValue: null,
-      quickAbilityData: null
+      quickAbilityData: null,
+      // 编辑系统信息
+      editSystemDialogVisible: false,
+      editSystemSubmitting: false,
+      editSystemForm: {
+        id: null,
+        systemCode: null,
+        systemName: null,
+        shortName: null,
+        manFacturer: null,
+        contactPerson: null,
+        contactNumber: null,
+        maintainerPerson: null,
+        maintainerNumber: null,
+        descr: null,
+        modelCode: null
+      },
+      editSystemRules: {
+        systemCode: [
+          { required: true, message: '系统代码不能为空', trigger: 'blur' }
+        ],
+        systemName: [
+          { required: true, message: '系统名称不能为空', trigger: 'blur' }
+        ]
+      }
     }
   },
   created() {
@@ -2472,6 +2550,48 @@ export default {
       } catch (error) {
         this.$message.error('获取事件日志详情失败')
       }
+    },
+
+    // 打开编辑系统信息对话框
+    handleEditSystem() {
+      // 填充表单数据
+      this.editSystemForm = {
+        id: this.systemInfo.id,
+        systemCode: this.systemInfo.systemCode,
+        systemName: this.systemInfo.systemName,
+        shortName: this.systemInfo.shortName,
+        manFacturer: this.systemInfo.manFacturer,
+        contactPerson: this.systemInfo.contactPerson,
+        contactNumber: this.systemInfo.contactNumber,
+        maintainerPerson: this.systemInfo.maintainerPerson,
+        maintainerNumber: this.systemInfo.maintainerNumber,
+        descr: this.systemInfo.descr,
+        modelCode: this.systemInfo.modelCode
+      }
+      this.editSystemDialogVisible = true
+    },
+
+    // 提交编辑系统信息
+    async submitEditSystem() {
+      this.$refs.editSystemForm.validate(async (valid) => {
+        if (!valid) {
+          return
+        }
+
+        this.editSystemSubmitting = true
+        try {
+          await updateSubsystem(this.editSystemForm)
+          this.$message.success('保存成功')
+          this.editSystemDialogVisible = false
+
+          // 重新加载系统信息
+          await this.loadSystemInfo()
+        } catch (error) {
+          this.$message.error('保存失败:' + error.message)
+        } finally {
+          this.editSystemSubmitting = false
+        }
+      })
     }
   }
 }
@@ -2504,6 +2624,8 @@ export default {
   }
 
   .info-group {
+    position: relative;
+
     .group-title {
       font-size: 14px;
       font-weight: bold;
@@ -2990,21 +3112,21 @@ export default {
     }
 
     // 优化描述列表样式
-    ::v-deep .el-descriptions {
-      .el-descriptions__label {
+    .lamp-group-descriptions {
+      ::v-deep .el-descriptions__label {
         background: #fafafa;
         color: #606266;
         font-weight: 500;
         padding: 10px 12px;
       }
 
-      .el-descriptions__content {
+      ::v-deep .el-descriptions__content {
         background: #fff;
         color: #303133;
         padding: 10px 12px;
       }
 
-      .el-descriptions-item__cell {
+      ::v-deep .el-descriptions-item__cell {
         border-color: #e4e7ed;
       }
     }

Some files were not shown because too many files changed in this diff