Commit 9a4fb61fd0a5375afac97f526b01d7255ee72abc

Authored by dev001
1 parent 9cacf393

fix: 修改选择模板产品创建组态时产品接口调用

... ... @@ -144,7 +144,6 @@
144 144
145 145 const handleTemplateChange = async (_, option) => {
146 146 const { productAndDevice } = option;
147   - console.log(option, 'option');
148 147 if (!productAndDevice) return;
149 148 selectOptions.value = productAndDevice.map((item) => ({
150 149 label: item.name,
... ...
... ... @@ -45,7 +45,10 @@
45 45 organizationId: props.organizationId,
46 46 deviceProfileId: props.value.value,
47 47 });
48   - selectOptions.value = resp.map((item) => ({ label: item.name, value: item.tbDeviceId }));
  48 + selectOptions.value = resp.map((item) => ({
  49 + label: item.alias || item.name,
  50 + value: item.tbDeviceId,
  51 + }));
49 52 }
50 53 dynamicInput.params.push({
51 54 name: props.value.label,
... ...
... ... @@ -19,11 +19,13 @@
19 19 </template>
20 20 </template>
21 21 <script lang="ts" setup name="SelectDevice">
22   - import { ref, Ref, PropType, unref, nextTick } from 'vue';
  22 + import { ref, Ref, PropType, unref, nextTick, onMounted } from 'vue';
23 23 import { Select } from 'ant-design-vue';
24 24 import SelectDevice from './SelectDevice.vue';
25 25 import { createPickerSearch } from '/@/utils/pickerSearch';
26 26
  27 + import { getDeviceProfile } from '/@/api/alarm/position';
  28 +
27 29 defineProps({
28 30 selectOptions: {
29 31 type: Array as PropType<any[]>,
... ... @@ -36,6 +38,7 @@
36 38 });
37 39
38 40 const selectValue = ref([]);
  41 + const selectOptions = ref<any>([]);
39 42
40 43 const bindDeviceRef = {
41 44 deviceAttrRef: ref([]),
... ... @@ -62,12 +65,10 @@
62 65 };
63 66
64 67 const setValue = (value: any) => {
65   - console.log(value);
66 68 selectValue.value = value.map((item) => ({
67 69 label: item.name,
68 70 key: item.profileId,
69 71 }));
70   -
71 72 profileList.value = value.map((item) => {
72 73 return {
73 74 label: item.name,
... ... @@ -81,6 +82,14 @@
81 82 profileList.value = [];
82 83 };
83 84
  85 + onMounted(async () => {
  86 + const values = await getDeviceProfile();
  87 + selectOptions.value = values.map((item) => ({
  88 + label: item.name,
  89 + value: item.id,
  90 + }));
  91 + });
  92 +
84 93 defineExpose({
85 94 getSelectDevice,
86 95 setValue,
... ...