Commit 43a2778856fc012c7663ad463c0a1df1a220d739

Authored by dev001
1 parent d45566e6

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

... ... @@ -5,10 +5,13 @@ import { isString } from '/@/utils/is';
5 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 9 return defHttp.get<DeviceProfileModel[]>({
10 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 5 DEVICE_TYPE = 'deviceType',
6 6 SOURCE_DEVICE_PROFILE_ID = 'sourceDeviceProfileName',
7 7 TARGET_DEVICE_PROFILE_ID = 'deviceProfileId',
  8 + TRANSPORT_TYPE = 'transportType',
8 9 }
9 10
10 11 export type FormGetFiledValueResultType = Record<FormFieldsEnum, string>;
11 12
12 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 22 field: FormFieldsEnum.SOURCE_DEVICE_PROFILE_ID,
15 23 component: 'Input',
16 24 label: '源产品',
... ... @@ -28,10 +36,15 @@ export const formSchemas: FormSchema[] = [
28 36 component: 'ApiSelect',
29 37 label: '目标产品',
30 38 required: true,
31   - componentProps: ({ formModel }) => {
  39 + componentProps: ({ formModel, formActionType }) => {
  40 + const { getFieldsValue } = formActionType;
  41 + const { transportType } = getFieldsValue();
32 42 return {
33 43 api: getDeviceProfile,
34   - params: formModel[FormFieldsEnum.DEVICE_TYPE],
  44 + params: {
  45 + deviceType: formModel[FormFieldsEnum.DEVICE_TYPE],
  46 + transportType,
  47 + },
35 48 labelField: 'name',
36 49 valueField: 'tbProfileId',
37 50 placeholder: '请选择目标产品',
... ...
1 1 export { default as BatchUpdateProductModal } from './index.vue';
2 2
3 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 21 async ({ record }: BatchUpdateProductModalParamsType) => {
22 22 resetFields();
23 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 577 sourceDeviceProfileName: firstItem.deviceProfile.name,
578 578 deviceType: firstItem.deviceType,
579 579 deviceIds: rows.map((item) => item.tbDeviceId),
  580 + deviceProfile: firstItem.deviceProfile,
580 581 },
581 582 } as BatchUpdateProductModalParamsType);
582 583 };
... ...