Bläddra i källkod

perf(components): 优化“协议内容”组件协议参数表格

1. 初步添加网关参数扩展候选配置
wangcong 1 månad sedan
förälder
incheckning
a4173c7d50

+ 1 - 0
src/types/index.ts

@@ -193,6 +193,7 @@ export interface ProtocolParamInfo {
   platformParamName: string;
   gatewayParamCode: string;
   gatewayParamName: string;
+  gatewayParamExt: string | null;
   paramCode: string;
   paramName: string;
   unit: string;

+ 29 - 0
src/views/setup-protocol/GatewayParamExt.vue

@@ -0,0 +1,29 @@
+<script setup lang="ts">
+interface Props {
+  extInfo: {
+    deviceName?: string;
+    deviceParam?: string;
+    deviceNum?: string;
+    moduleName?: string;
+    moduleParam?: string;
+    moduleNum?: string;
+    statusName?: string;
+    statusParam?: string;
+  };
+}
+
+defineProps<Props>();
+</script>
+
+<template>
+  <div>
+    <div v-if="extInfo.deviceName && extInfo.deviceNum">
+      {{ extInfo.deviceName }}
+      <AInputNumber :value="extInfo.deviceNum" :min="0" :precision="0" />
+    </div>
+    <div v-if="extInfo.moduleName && extInfo.moduleNum">
+      {{ extInfo.moduleName }}
+      <AInputNumber :value="extInfo.moduleNum" :min="0" :precision="0" />
+    </div>
+  </div>
+</template>

+ 7 - 1
src/views/setup-protocol/ProtocolContent.vue

@@ -11,6 +11,7 @@ import { batchDeleleProtocolParam, getProtocolParamList, getProtocolStandardPara
 import { DictCode, ProtocolRecognitionResult, ProtocolType } from '@/constants';
 
 import CustomParams from './CustomParams.vue';
+import GatewayParamExt from './GatewayParamExt.vue';
 import SelectStandardParams from './SelectStandardParams.vue';
 
 import type { FormInstance, TableProps } from 'ant-design-vue';
@@ -670,7 +671,12 @@ defineExpose({
         :title="$t('setupProtocol.protocolParamFields.gatewayParamName')"
         data-index="gatewayParamName"
         :width="200"
-      />
+      >
+        <template #default="{ record }">
+          <GatewayParamExt v-if="record.gatewayParamExt" :ext-info="JSON.parse(record.gatewayParamExt || '{}')" />
+          <div v-else>{{ record.gatewayParamName }}</div>
+        </template>
+      </ATableColumn>
       <ATableColumn
         class="table-column-item-required"
         :title="$t('setupProtocol.protocolParamFields.gatewayParamCode')"