Commit 9a4fb61fd0a5375afac97f526b01d7255ee72abc

Authored by dev001
1 parent 9cacf393

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

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