Commit 43a2778856fc012c7663ad463c0a1df1a220d739

Authored by dev001
1 parent d45566e6

fix: DEFECT-1878 修复批量处理产品,选择分配产品时,mqtt分配到TCP设备后,TCP数据错误

@@ -5,10 +5,13 @@ import { isString } from '/@/utils/is'; @@ -5,10 +5,13 @@ import { isString } from '/@/utils/is';
5 import { OrderByEnum } from '/@/views/device/localtion/cpns/TimePeriodForm/config'; 5 import { OrderByEnum } from '/@/views/device/localtion/cpns/TimePeriodForm/config';
6 6
7 // 获取设备配置 7 // 获取设备配置
8 -export const getDeviceProfile = (deviceType?: string) => { 8 +export const getDeviceProfile = ({ deviceType, transportType }) => {
9 return defHttp.get<DeviceProfileModel[]>({ 9 return defHttp.get<DeviceProfileModel[]>({
10 url: '/device_profile/me/list', 10 url: '/device_profile/me/list',
11 - params: { deviceType: isString(deviceType) ? deviceType : undefined }, 11 + params: {
  12 + deviceType: isString(deviceType) ? deviceType : undefined,
  13 + transportType: isString(transportType) ? transportType : undefined,
  14 + },
12 }); 15 });
13 }; 16 };
14 17
@@ -5,12 +5,20 @@ enum FormFieldsEnum { @@ -5,12 +5,20 @@ enum FormFieldsEnum {
5 DEVICE_TYPE = 'deviceType', 5 DEVICE_TYPE = 'deviceType',
6 SOURCE_DEVICE_PROFILE_ID = 'sourceDeviceProfileName', 6 SOURCE_DEVICE_PROFILE_ID = 'sourceDeviceProfileName',
7 TARGET_DEVICE_PROFILE_ID = 'deviceProfileId', 7 TARGET_DEVICE_PROFILE_ID = 'deviceProfileId',
  8 + TRANSPORT_TYPE = 'transportType',
8 } 9 }
9 10
10 export type FormGetFiledValueResultType = Record<FormFieldsEnum, string>; 11 export type FormGetFiledValueResultType = Record<FormFieldsEnum, string>;
11 12
12 export const formSchemas: FormSchema[] = [ 13 export const formSchemas: FormSchema[] = [
13 { 14 {
  15 + field: FormFieldsEnum.TRANSPORT_TYPE,
  16 + component: 'Input',
  17 + label: '协议类型',
  18 + dynamicDisabled: true,
  19 + show: false,
  20 + },
  21 + {
14 field: FormFieldsEnum.SOURCE_DEVICE_PROFILE_ID, 22 field: FormFieldsEnum.SOURCE_DEVICE_PROFILE_ID,
15 component: 'Input', 23 component: 'Input',
16 label: '源产品', 24 label: '源产品',
@@ -28,10 +36,15 @@ export const formSchemas: FormSchema[] = [ @@ -28,10 +36,15 @@ export const formSchemas: FormSchema[] = [
28 component: 'ApiSelect', 36 component: 'ApiSelect',
29 label: '目标产品', 37 label: '目标产品',
30 required: true, 38 required: true,
31 - componentProps: ({ formModel }) => { 39 + componentProps: ({ formModel, formActionType }) => {
  40 + const { getFieldsValue } = formActionType;
  41 + const { transportType } = getFieldsValue();
32 return { 42 return {
33 api: getDeviceProfile, 43 api: getDeviceProfile,
34 - params: formModel[FormFieldsEnum.DEVICE_TYPE], 44 + params: {
  45 + deviceType: formModel[FormFieldsEnum.DEVICE_TYPE],
  46 + transportType,
  47 + },
35 labelField: 'name', 48 labelField: 'name',
36 valueField: 'tbProfileId', 49 valueField: 'tbProfileId',
37 placeholder: '请选择目标产品', 50 placeholder: '请选择目标产品',
1 export { default as BatchUpdateProductModal } from './index.vue'; 1 export { default as BatchUpdateProductModal } from './index.vue';
2 2
3 export type BatchUpdateProductModalParamsType = ModalParamsType< 3 export type BatchUpdateProductModalParamsType = ModalParamsType<
4 - Record<'sourceDeviceProfileName' | 'deviceType', string> & Record<'deviceIds', string[]> 4 + Record<'sourceDeviceProfileName' | 'deviceType', string> &
  5 + Record<'deviceIds', string[]> &
  6 + Record<'deviceProfile', Recordable>
5 >; 7 >;
@@ -21,7 +21,10 @@ @@ -21,7 +21,10 @@
21 async ({ record }: BatchUpdateProductModalParamsType) => { 21 async ({ record }: BatchUpdateProductModalParamsType) => {
22 resetFields(); 22 resetFields();
23 deviceIds.value = record.deviceIds; 23 deviceIds.value = record.deviceIds;
24 - setFieldsValue(record); 24 + setFieldsValue({
  25 + ...record,
  26 + transportType: record?.deviceProfile?.transportType,
  27 + });
25 } 28 }
26 ); 29 );
27 30
@@ -577,6 +577,7 @@ @@ -577,6 +577,7 @@
577 sourceDeviceProfileName: firstItem.deviceProfile.name, 577 sourceDeviceProfileName: firstItem.deviceProfile.name,
578 deviceType: firstItem.deviceType, 578 deviceType: firstItem.deviceType,
579 deviceIds: rows.map((item) => item.tbDeviceId), 579 deviceIds: rows.map((item) => item.tbDeviceId),
  580 + deviceProfile: firstItem.deviceProfile,
580 }, 581 },
581 } as BatchUpdateProductModalParamsType); 582 } as BatchUpdateProductModalParamsType);
582 }; 583 };