Commit bac6c3009c3d20715e5e6979b422d5621c79beda

Authored by dev001
1 parent e0978015

fix: 组态,修改选择设备顺序问题

... ... @@ -50,6 +50,7 @@
50 50 value: item.tbDeviceId,
51 51 }));
52 52 }
  53 + console.log();
53 54 dynamicInput.params.push({
54 55 name: props.value.label,
55 56 profileId: props.value.value,
... ... @@ -69,17 +70,20 @@
69 70
70 71 //chang改变
71 72 const emitChange = () => {
72   - const findDeviceDict = selectOptions.value.map((item) => {
73   - if (dynamicInput.params[0].deviceList?.includes(item.value)) {
74   - return {
75   - name: item.label,
76   - deviceId: item.value,
77   - };
78   - }
  73 + const tempDeviceList: Recordable[] = []; // fix: 修改选择设备顺序问题
  74 + dynamicInput.params[0].deviceList?.forEach((item) => {
  75 + selectOptions.value?.forEach((newItem) => {
  76 + if (item === newItem.value) {
  77 + tempDeviceList.push({
  78 + name: newItem.label,
  79 + deviceId: newItem.value,
  80 + });
  81 + }
  82 + });
79 83 });
80 84 return {
81 85 ...dynamicInput.params[0],
82   - deviceList: findDeviceDict.filter(Boolean),
  86 + deviceList: tempDeviceList.filter(Boolean), // 过滤假值
83 87 };
84 88 };
85 89 defineExpose({
... ...