Commit cc4527f42479f14bf8a4361d6c1060e180f88d45
Merge branch 'ww' into 'main'
fix: BUG in teambition See merge request huang/yun-teng-iot-front!460
Showing
9 changed files
with
34 additions
and
17 deletions
@@ -90,6 +90,13 @@ export const deviceProfile = () => { | @@ -90,6 +90,13 @@ export const deviceProfile = () => { | ||
90 | }); | 90 | }); |
91 | }; | 91 | }; |
92 | 92 | ||
93 | +export const queryDeviceProfileBy = (params: Recordable) => { | ||
94 | + return defHttp.get<DeviceRecord[]>({ | ||
95 | + url: DeviceManagerApi.DEVICE_PROFILE_URL_ME, | ||
96 | + params, | ||
97 | + }); | ||
98 | +}; | ||
99 | + | ||
93 | // 创建或编辑设备 | 100 | // 创建或编辑设备 |
94 | export const createOrEditDevice = (data) => { | 101 | export const createOrEditDevice = (data) => { |
95 | return defHttp.post({ | 102 | return defHttp.post({ |
@@ -247,7 +247,7 @@ | @@ -247,7 +247,7 @@ | ||
247 | getSonFormValue.value, | 247 | getSonFormValue.value, |
248 | getNameObj, | 248 | getNameObj, |
249 | id, | 249 | id, |
250 | - additionalInfoV | 250 | + additionalInfoV.additionalInfo.description ? additionalInfoV : {} |
251 | ); | 251 | ); |
252 | if (!unref(isUpdate)) { | 252 | if (!unref(isUpdate)) { |
253 | delete allPostForm.id; | 253 | delete allPostForm.id; |
@@ -219,14 +219,14 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -219,14 +219,14 @@ export const modeKafkaForm: FormSchema[] = [ | ||
219 | return !!values.addMetadataKeyValuesAsKafkaHeaders; | 219 | return !!values.addMetadataKeyValuesAsKafkaHeaders; |
220 | }, | 220 | }, |
221 | }, | 221 | }, |
222 | - | ||
223 | { | 222 | { |
224 | field: 'description', | 223 | field: 'description', |
225 | label: '说明', | 224 | label: '说明', |
226 | - colProps: { span: 12 }, | 225 | + colProps: { span: 24 }, |
227 | component: 'InputTextArea', | 226 | component: 'InputTextArea', |
228 | componentProps: { | 227 | componentProps: { |
229 | maxLength: 255, | 228 | maxLength: 255, |
229 | + rows: 4, | ||
230 | placeholder: '请输入说明', | 230 | placeholder: '请输入说明', |
231 | }, | 231 | }, |
232 | }, | 232 | }, |
@@ -440,10 +440,11 @@ export const modeMqttForm: FormSchema[] = [ | @@ -440,10 +440,11 @@ export const modeMqttForm: FormSchema[] = [ | ||
440 | { | 440 | { |
441 | field: 'description', | 441 | field: 'description', |
442 | label: '说明', | 442 | label: '说明', |
443 | - colProps: { span: 12 }, | 443 | + colProps: { span: 24 }, |
444 | component: 'InputTextArea', | 444 | component: 'InputTextArea', |
445 | componentProps: { | 445 | componentProps: { |
446 | maxLength: 255, | 446 | maxLength: 255, |
447 | + rows: 4, | ||
447 | placeholder: '请输入说明', | 448 | placeholder: '请输入说明', |
448 | }, | 449 | }, |
449 | }, | 450 | }, |
@@ -610,10 +611,11 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -610,10 +611,11 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
610 | { | 611 | { |
611 | field: 'description', | 612 | field: 'description', |
612 | label: '说明', | 613 | label: '说明', |
613 | - colProps: { span: 12 }, | 614 | + colProps: { span: 24 }, |
614 | component: 'InputTextArea', | 615 | component: 'InputTextArea', |
615 | componentProps: { | 616 | componentProps: { |
616 | maxLength: 255, | 617 | maxLength: 255, |
618 | + rows: 4, | ||
617 | placeholder: '请输入说明', | 619 | placeholder: '请输入说明', |
618 | }, | 620 | }, |
619 | }, | 621 | }, |
@@ -957,10 +959,11 @@ export const modeApiForm: FormSchema[] = [ | @@ -957,10 +959,11 @@ export const modeApiForm: FormSchema[] = [ | ||
957 | { | 959 | { |
958 | field: 'description', | 960 | field: 'description', |
959 | label: '说明', | 961 | label: '说明', |
960 | - colProps: { span: 12 }, | 962 | + colProps: { span: 24 }, |
961 | component: 'InputTextArea', | 963 | component: 'InputTextArea', |
962 | componentProps: { | 964 | componentProps: { |
963 | maxLength: 255, | 965 | maxLength: 255, |
966 | + rows: 4, | ||
964 | placeholder: '请输入说明', | 967 | placeholder: '请输入说明', |
965 | }, | 968 | }, |
966 | }, | 969 | }, |
@@ -9,7 +9,7 @@ import { scheduleOptions } from './formatData'; | @@ -9,7 +9,7 @@ import { scheduleOptions } from './formatData'; | ||
9 | import { copyTransFun } from '/@/utils/fnUtils'; | 9 | import { copyTransFun } from '/@/utils/fnUtils'; |
10 | import { numberAndNonegativeRule } from '/@/utils/rules'; | 10 | import { numberAndNonegativeRule } from '/@/utils/rules'; |
11 | import { findDictItemByCode } from '/@/api/system/dict'; | 11 | import { findDictItemByCode } from '/@/api/system/dict'; |
12 | -import { deviceProfile } from '/@/api/device/deviceManager'; | 12 | +import { deviceProfile, queryDeviceProfileBy } from '/@/api/device/deviceManager'; |
13 | import { getModelServices } from '/@/api/device/modelOfMatter'; | 13 | import { getModelServices } from '/@/api/device/modelOfMatter'; |
14 | import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel'; | 14 | import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel'; |
15 | import useCommonFun from '../hooks/useCommonFun'; | 15 | import useCommonFun from '../hooks/useCommonFun'; |
@@ -237,8 +237,9 @@ export const trigger_condition_schema: FormSchema[] = [ | @@ -237,8 +237,9 @@ export const trigger_condition_schema: FormSchema[] = [ | ||
237 | componentProps: ({ formActionType, formModel }) => { | 237 | componentProps: ({ formActionType, formModel }) => { |
238 | const { updateSchema, setFieldsValue } = formActionType; | 238 | const { updateSchema, setFieldsValue } = formActionType; |
239 | const deviceType = formModel['deviceType']; | 239 | const deviceType = formModel['deviceType']; |
240 | + | ||
240 | return { | 241 | return { |
241 | - api: deviceProfile, | 242 | + api: queryDeviceProfileBy, |
242 | params: { | 243 | params: { |
243 | deviceType, | 244 | deviceType, |
244 | }, | 245 | }, |
@@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
30 | 30 | ||
31 | const props = defineProps<{ | 31 | const props = defineProps<{ |
32 | record: DataBoardLayoutInfo; | 32 | record: DataBoardLayoutInfo; |
33 | + isEdit: boolean; | ||
33 | frontId?: FrontComponent; | 34 | frontId?: FrontComponent; |
34 | defaultConfig?: Partial<ComponentInfo>; | 35 | defaultConfig?: Partial<ComponentInfo>; |
35 | componentCategory?: FrontComponentCategory; | 36 | componentCategory?: FrontComponentCategory; |
@@ -296,6 +297,7 @@ | @@ -296,6 +297,7 @@ | ||
296 | <div class="pl-2 flex-auto"> | 297 | <div class="pl-2 flex-auto"> |
297 | <component | 298 | <component |
298 | :frontId="$props.frontId" | 299 | :frontId="$props.frontId" |
300 | + :isEdit="isEdit" | ||
299 | :is="dataSourceComponent" | 301 | :is="dataSourceComponent" |
300 | :ref="(el) => setFormEl(el, item.id)" | 302 | :ref="(el) => setFormEl(el, item.id)" |
301 | /> | 303 | /> |
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | 62 | ||
63 | const resetForm = () => { | 63 | const resetForm = () => { |
64 | isEdit.value = false; | 64 | isEdit.value = false; |
65 | - frontId.value = FrontComponent.TEXT_COMPONENT_1; | 65 | + frontId.value = undefined; |
66 | componentRecord.value = {} as unknown as DataBoardLayoutInfo; | 66 | componentRecord.value = {} as unknown as DataBoardLayoutInfo; |
67 | componentDefaultConfig.value = {}; | 67 | componentDefaultConfig.value = {}; |
68 | }; | 68 | }; |
@@ -153,6 +153,7 @@ | @@ -153,6 +153,7 @@ | ||
153 | <BasicConfiguration | 153 | <BasicConfiguration |
154 | ref="basicConfigurationEl" | 154 | ref="basicConfigurationEl" |
155 | :front-id="frontId" | 155 | :front-id="frontId" |
156 | + :isEdit="isEdit" | ||
156 | :record="componentRecord" | 157 | :record="componentRecord" |
157 | :defaultConfig="componentDefaultConfig" | 158 | :defaultConfig="componentDefaultConfig" |
158 | :componentCategory="getComponentCategory" | 159 | :componentCategory="getComponentCategory" |
@@ -9,14 +9,16 @@ | @@ -9,14 +9,16 @@ | ||
9 | 9 | ||
10 | const props = defineProps<{ | 10 | const props = defineProps<{ |
11 | frontId?: FrontComponent; | 11 | frontId?: FrontComponent; |
12 | + isEdit: boolean; | ||
12 | }>(); | 13 | }>(); |
13 | 14 | ||
14 | defineExpose({ formActionType: formEl }); | 15 | defineExpose({ formActionType: formEl }); |
15 | 16 | ||
16 | const getDataSchema = computed(() => { | 17 | const getDataSchema = computed(() => { |
17 | - const { frontId } = props; | 18 | + const { frontId, isEdit } = props; |
19 | + console.log({ frontId }); | ||
18 | if (!frontId) return []; | 20 | if (!frontId) return []; |
19 | - return dataSourceSchema(frontId); | 21 | + return dataSourceSchema(isEdit, frontId); |
20 | }); | 22 | }); |
21 | 23 | ||
22 | onMounted(() => { | 24 | onMounted(() => { |
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | import { FrontComponent } from '../../../const/const'; | 5 | import { FrontComponent } from '../../../const/const'; |
6 | 6 | ||
7 | defineProps<{ | 7 | defineProps<{ |
8 | + isEdit: boolean; | ||
8 | frontId?: FrontComponent; | 9 | frontId?: FrontComponent; |
9 | }>(); | 10 | }>(); |
10 | 11 | ||
@@ -38,7 +39,7 @@ | @@ -38,7 +39,7 @@ | ||
38 | <div class="w-full flex-1"> | 39 | <div class="w-full flex-1"> |
39 | <BasicForm | 40 | <BasicForm |
40 | :ref="(el) => setFormEl(el)" | 41 | :ref="(el) => setFormEl(el)" |
41 | - :schemas="dataSourceSchema($props.frontId)" | 42 | + :schemas="dataSourceSchema($props.isEdit, $props.frontId)" |
42 | class="w-full flex-1 data-source-form" | 43 | class="w-full flex-1 data-source-form" |
43 | :show-action-button-group="false" | 44 | :show-action-button-group="false" |
44 | :row-props="{ | 45 | :row-props="{ |
@@ -92,7 +92,7 @@ export const basicSchema: FormSchema[] = [ | @@ -92,7 +92,7 @@ export const basicSchema: FormSchema[] = [ | ||
92 | }, | 92 | }, |
93 | ]; | 93 | ]; |
94 | 94 | ||
95 | -export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | 95 | +export const dataSourceSchema = (isEdit: boolean, frontId?: FrontComponent): FormSchema[] => { |
96 | return [ | 96 | return [ |
97 | { | 97 | { |
98 | field: DataSourceField.IS_GATEWAY_DEVICE, | 98 | field: DataSourceField.IS_GATEWAY_DEVICE, |
@@ -117,6 +117,7 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | @@ -117,6 +117,7 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | ||
117 | component: 'ApiSelect', | 117 | component: 'ApiSelect', |
118 | label: '设备类型', | 118 | label: '设备类型', |
119 | colProps: { span: 8 }, | 119 | colProps: { span: 8 }, |
120 | + // defaultValue: DeviceTypeEnum.SENSOR, | ||
120 | componentProps: ({ formActionType }) => { | 121 | componentProps: ({ formActionType }) => { |
121 | const { setFieldsValue } = formActionType; | 122 | const { setFieldsValue } = formActionType; |
122 | return { | 123 | return { |
@@ -147,14 +148,13 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | @@ -147,14 +148,13 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | ||
147 | rules: [{ required: true, message: '产品为必填项' }], | 148 | rules: [{ required: true, message: '产品为必填项' }], |
148 | componentProps: ({ formActionType, formModel }) => { | 149 | componentProps: ({ formActionType, formModel }) => { |
149 | const { setFieldsValue } = formActionType; | 150 | const { setFieldsValue } = formActionType; |
150 | - const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID]; | ||
151 | const deviceType = formModel[DataSourceField.DEVICE_TYPE]; | 151 | const deviceType = formModel[DataSourceField.DEVICE_TYPE]; |
152 | - if (![deviceType, deviceProfileId].every(Boolean)) return {}; | ||
153 | return { | 152 | return { |
154 | api: async () => { | 153 | api: async () => { |
155 | if (!deviceType) return []; | 154 | if (!deviceType) return []; |
156 | const list = await getDeviceProfile(deviceType); | 155 | const list = await getDeviceProfile(deviceType); |
157 | - if (deviceProfileId) { | 156 | + if (isEdit) { |
157 | + const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID]; | ||
158 | const record = list.find((item) => item.id === deviceProfileId); | 158 | const record = list.find((item) => item.id === deviceProfileId); |
159 | setFieldsValue({ [DataSourceField.TRANSPORT_TYPE]: record?.transportType }); | 159 | setFieldsValue({ [DataSourceField.TRANSPORT_TYPE]: record?.transportType }); |
160 | } | 160 | } |
@@ -254,7 +254,7 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | @@ -254,7 +254,7 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | ||
254 | componentProps({ formModel }) { | 254 | componentProps({ formModel }) { |
255 | const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID]; | 255 | const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID]; |
256 | const transportType = formModel[DataSourceField.TRANSPORT_TYPE]; | 256 | const transportType = formModel[DataSourceField.TRANSPORT_TYPE]; |
257 | - if (![deviceProfileId, transportType].every(Boolean)) return {}; | 257 | + if (isEdit && ![deviceProfileId, transportType].every(Boolean)) return {}; |
258 | return { | 258 | return { |
259 | api: async () => { | 259 | api: async () => { |
260 | try { | 260 | try { |