|
@@ -290,7 +290,7 @@ const selectParameters = (value: number, id: number) => {
|
|
|
|
|
|
postGatewayLinkProtocolList(value, id, 'monitor');
|
|
|
postGatewayLinkProtocolList(value, id, 'control');
|
|
|
- open.value = true;
|
|
|
+ obtainParamValueListAutomatic(value);
|
|
|
} else {
|
|
|
message.warning(t('createDevice.pleasePhysicalInterface'));
|
|
|
}
|
|
@@ -540,6 +540,7 @@ const obtainParamValueListAutomatic = (linkId: number) => {
|
|
|
if (paramValueListAutomaticData.value.length) {
|
|
|
open2.value = true;
|
|
|
}
|
|
|
+ open.value = true;
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -561,8 +562,6 @@ const linkSwitch = (value: SelectValue, option: DefaultOptionType, index: number
|
|
|
const control = controlAssociationGatewayList.value.filter((item) => bKeys.has(`${item.gatewayId},${item.linkId}`));
|
|
|
|
|
|
controlAssociationGatewayList.value = control;
|
|
|
-
|
|
|
- obtainParamValueListAutomatic(option.linkId);
|
|
|
};
|
|
|
|
|
|
const addSelect = (record: GatewayList) => {
|
|
@@ -683,6 +682,10 @@ const finish = async () => {
|
|
|
if (dataList.some((item) => item.deviceParamCode == '')) {
|
|
|
throw new Error(t('createDevice.parameterEncodingEmpty'));
|
|
|
}
|
|
|
+
|
|
|
+ if (dataList.some((item) => item.deviceParamName == '')) {
|
|
|
+ throw new Error(t('createDevice.equipmentParameterNameEmpty'));
|
|
|
+ }
|
|
|
const valueList = validateParams();
|
|
|
if (valueList.length) {
|
|
|
throw new Error(t('createDevice.parameterEncodingRepeat'));
|
|
@@ -784,9 +787,17 @@ const handleOk1 = () => {
|
|
|
open1.value = false;
|
|
|
};
|
|
|
|
|
|
+const useUniqueArray = (data: ListEquipmentParametersItem[]) => {
|
|
|
+ const seen = new Set<string>();
|
|
|
+ return data.filter((item) => {
|
|
|
+ if (seen.has(item.deviceParamCode)) return false;
|
|
|
+ seen.add(item.deviceParamCode);
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const addAutomaticMatching = () => {
|
|
|
- monitorChooselistEquipment.value = [];
|
|
|
- controlChooselistEquipment.value = [];
|
|
|
+ console.log(paramValueListAutomaticData.value);
|
|
|
paramValueListAutomaticData.value.forEach((item) => {
|
|
|
const { gatewayParamCode, gatewayParamName, platformParamCode, platformParamName, id, unit } = item;
|
|
|
if (item.readWriteTypeCode === 'read_only') {
|
|
@@ -810,8 +821,8 @@ const addAutomaticMatching = () => {
|
|
|
controlChooselistEquipment.value.push({
|
|
|
gatewayParamCode,
|
|
|
gatewayParamName,
|
|
|
- deviceParamCode: gatewayParamCode,
|
|
|
- deviceParamName: gatewayParamName,
|
|
|
+ deviceParamCode: platformParamCode,
|
|
|
+ deviceParamName: platformParamName,
|
|
|
id,
|
|
|
groupId: undefined,
|
|
|
groupSerialNum: 1,
|
|
@@ -826,14 +837,25 @@ const addAutomaticMatching = () => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- monitorAssociationGatewayList.value = mergeArrays(
|
|
|
- monitorAssociationGatewayList.value,
|
|
|
- monitorChooselistEquipment.value,
|
|
|
- );
|
|
|
- controlAssociationGatewayList.value = mergeArrays(
|
|
|
- controlAssociationGatewayList.value,
|
|
|
- controlChooselistEquipment.value,
|
|
|
- );
|
|
|
+ console.log(monitorChooselistEquipment.value);
|
|
|
+
|
|
|
+ monitorChooselistEquipment.value = useUniqueArray(monitorChooselistEquipment.value);
|
|
|
+ controlChooselistEquipment.value = useUniqueArray(controlChooselistEquipment.value);
|
|
|
+
|
|
|
+ monitorChooselistEquipment.value.forEach((item) => {
|
|
|
+ if (gatewayId === item.gatewayId) {
|
|
|
+ monitorEquipmentLsit.value.push(item.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ monitorEquipmentLsit.value = [...new Set(monitorEquipmentLsit.value)];
|
|
|
+
|
|
|
+ controlChooselistEquipment.value.forEach((item) => {
|
|
|
+ if (gatewayId === item.gatewayId) {
|
|
|
+ controlEquipmentLsit.value.push(item.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ controlEquipmentLsit.value = [...new Set(controlEquipmentLsit.value)];
|
|
|
|
|
|
open2.value = false;
|
|
|
};
|