فهرست منبع

perf(views): 优化"创建设备"模块接口变更与传参处理

wangshun 1 ماه پیش
والد
کامیت
7c9d589316

+ 0 - 1
src/views/create-device/BasicInformation.vue

@@ -45,7 +45,6 @@ onMounted(() => {
             :field-names="{ label: 'groupName', value: 'id', children: 'deviceGroupChilds' }"
             :options="deviceGroup"
             :placeholder="$t('common.plzSelect')"
-            change-on-select
           />
         </AFormItem>
         <AFormItem :label="$t('setupProtocol.deviceType')" name="deviceType">

+ 11 - 6
src/views/create-device/GatewayParameters.vue

@@ -17,6 +17,7 @@ import {
 import type { DefaultOptionType, SelectValue } from 'ant-design-vue/es/select';
 import type { Key } from 'ant-design-vue/es/table/interface';
 import type {
+  AutomaticMatchingItem,
   CustomizationData,
   CustomParameters,
   DeviceGateways,
@@ -25,7 +26,6 @@ import type {
   EquipmentInformationForm,
   GroupingList,
   ListEquipmentParametersItem,
-  ParamValueListAutomaticData,
   PhysicalInterfaceList,
   SerialNumberItem,
   UseGuideStepItemExpose,
@@ -175,6 +175,7 @@ const protocolEquipmentColumns = [
     dataIndex: 'index',
     key: 'index',
     ellipsis: true,
+    width: 60,
   },
   {
     title: t('createDevice.gatewayParameterEncoding'),
@@ -224,7 +225,7 @@ const props = defineProps<UseGuideStepItemProps<EquipmentInformationForm>>();
 const gatewayList = ref<GatewayList[]>([]);
 const monitorAssociationGatewayList = ref<ListEquipmentParametersItem[]>([]);
 const controlAssociationGatewayList = ref<ListEquipmentParametersItem[]>([]);
-const paramValueListAutomaticData = ref<ParamValueListAutomaticData[]>([]);
+const paramValueListAutomaticData = ref<AutomaticMatchingItem[]>([]);
 
 const groupingList = ref<GroupingList[]>([
   {
@@ -529,10 +530,13 @@ const serialNumberAdd = (value: SelectValue, option: DefaultOptionType, index: n
 
 const obtainParamValueListAutomatic = (linkId: number) => {
   handleRequest(async () => {
-    paramValueListAutomaticData.value = await getParamValueListAutomatic({
+    const { autoVos } = await getParamValueListAutomatic({
       linkId,
       deviceTypeId: Number(props.form.deviceType),
+      deviceId,
     });
+
+    paramValueListAutomaticData.value = autoVos;
     if (paramValueListAutomaticData.value.length) {
       open2.value = true;
     }
@@ -737,6 +741,7 @@ const finish = async () => {
       deviceParamName,
       isProcessData,
       unit,
+      gatewayId,
     });
   });
 
@@ -783,13 +788,13 @@ const addAutomaticMatching = () => {
   monitorChooselistEquipment.value = [];
   controlChooselistEquipment.value = [];
   paramValueListAutomaticData.value.forEach((item) => {
-    const { gatewayParamCode, gatewayParamName, id, unit } = item;
+    const { gatewayParamCode, gatewayParamName, platformParamCode, platformParamName, id, unit } = item;
     if (item.readWriteTypeCode === 'read_only') {
       monitorChooselistEquipment.value.push({
         gatewayParamCode,
         gatewayParamName,
-        deviceParamCode: gatewayParamCode,
-        deviceParamName: gatewayParamName,
+        deviceParamCode: platformParamCode,
+        deviceParamName: platformParamName,
         id,
         groupId: undefined,
         groupSerialNum: 1,

+ 5 - 5
src/views/create-device/VerifyParameters.vue

@@ -2,13 +2,13 @@
 import { onMounted, ref } from 'vue';
 
 import { useRequest } from '@/hooks/request';
-import { postParameterVerification } from '@/api';
+import { getDeviceParams } from '@/api';
 
-import type { EquipmentInformationForm, ParameterVerification, UseGuideStepItemProps } from '@/types';
+import type { DeviceParamGroup, EquipmentInformationForm, UseGuideStepItemProps } from '@/types';
 
 const props = defineProps<UseGuideStepItemProps<EquipmentInformationForm>>();
 
-const parameterVerificationList = ref<ParameterVerification[]>([]);
+const parameterVerificationList = ref<DeviceParamGroup[]>([]);
 
 const { handleRequest } = useRequest();
 
@@ -22,7 +22,7 @@ const colorShow = (value: number | string) => {
 
 onMounted(() => {
   handleRequest(async () => {
-    parameterVerificationList.value = await postParameterVerification(props.form.devId);
+    parameterVerificationList.value = await getDeviceParams(props.form.devId, false);
   });
 });
 </script>
@@ -35,7 +35,7 @@ onMounted(() => {
         <div class="host-parameters-header-right">{{ item.deviceParamGroupName }}</div>
       </AFlex>
       <AFlex class="host-parameters" wrap="wrap">
-        <div v-for="ite in item.valueVos" :key="ite.valueId" class="host-parameters-div">
+        <div v-for="(ite, index) in item.valueVos" :key="index" class="host-parameters-div">
           <span :style="colorShow(ite.value)">{{ ite.paramName }}:</span>
           <span style="margin-left: 10px">{{ ite.value }}</span>
           <span v-if="ite.value">{{ ite.unit }}</span>