|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, ref, useTemplateRef } from 'vue';
|
|
|
+import { computed, onMounted, ref, useTemplateRef } from 'vue';
|
|
|
import { message } from 'ant-design-vue';
|
|
|
|
|
|
import ConfirmModal from '@/components/ConfirmModal.vue';
|
|
@@ -785,12 +785,6 @@ const finish = async () => {
|
|
|
deviceGateways.value = [];
|
|
|
deviceParamGroupRels.value = [];
|
|
|
|
|
|
- groupingList.value.forEach((item) => {
|
|
|
- deviceParamGroups.value.push({
|
|
|
- groupName: item.groupName,
|
|
|
- deviceId,
|
|
|
- });
|
|
|
- });
|
|
|
customizationData.value.forEach((item) => {
|
|
|
const {
|
|
|
customFormula,
|
|
@@ -802,6 +796,10 @@ const finish = async () => {
|
|
|
deviceParamCode,
|
|
|
paramGroupName,
|
|
|
} = item;
|
|
|
+ deviceParamGroups.value.push({
|
|
|
+ groupName: paramGroupName,
|
|
|
+ deviceId,
|
|
|
+ });
|
|
|
customParameters.value.push({
|
|
|
customFormula,
|
|
|
unit,
|
|
@@ -828,6 +826,10 @@ const finish = async () => {
|
|
|
unit,
|
|
|
gatewayLinkProtocolId,
|
|
|
} = item;
|
|
|
+ deviceParamGroups.value.push({
|
|
|
+ groupName,
|
|
|
+ deviceId,
|
|
|
+ });
|
|
|
deviceGateways.value.push({
|
|
|
deviceId,
|
|
|
gatewayId,
|
|
@@ -849,6 +851,15 @@ const finish = async () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ const uniqueList = computed(() => {
|
|
|
+ const map = new Map<string, DeviceParamGroups>();
|
|
|
+ deviceParamGroups.value.forEach((item) => {
|
|
|
+ map.set(item.groupName, item); // 始终覆盖,保留最后一次
|
|
|
+ });
|
|
|
+ return Array.from(map.values());
|
|
|
+ });
|
|
|
+ deviceParamGroups.value = uniqueList.value;
|
|
|
+
|
|
|
await addDeviceBind({
|
|
|
deviceParamGroups: deviceParamGroups.value,
|
|
|
deviceGateways: deviceGateways.value,
|