Commit 948a2d8a77c1e00198524cf1b5d408b443af3651
Merge branch 'main_dev' into 'main'
Main dev See merge request yunteng/thingskit-front!1167
Showing
5 changed files
with
90 additions
and
24 deletions
1 | import { findDictItemByCode } from '/@/api/system/dict'; | 1 | import { findDictItemByCode } from '/@/api/system/dict'; |
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | import { DictEnum } from '/@/enums/dictEnum'; | 3 | import { DictEnum } from '/@/enums/dictEnum'; |
4 | +import { | ||
5 | + DataTypeEnum, | ||
6 | + RegisterActionTypeEnum, | ||
7 | + RegisterActionTypeNameEnum, | ||
8 | + RegisterDataTypeEnum, | ||
9 | +} from '/@/enums/objectModelEnum'; | ||
4 | 10 | ||
5 | export enum FormFieldsEnum { | 11 | export enum FormFieldsEnum { |
6 | REGISTER_ADDRESS = 'registerAddress', | 12 | REGISTER_ADDRESS = 'registerAddress', |
7 | DATA_TYPE = 'dataType', | 13 | DATA_TYPE = 'dataType', |
8 | ACTION_TYPE = 'actionType', | 14 | ACTION_TYPE = 'actionType', |
9 | ZOOM_FACTOR = 'zoomFactor', | 15 | ZOOM_FACTOR = 'zoomFactor', |
16 | + | ||
17 | + OBJECT_MODEL_TYPE = 'objectModelType', | ||
18 | +} | ||
19 | + | ||
20 | +function getActionTypeByObjectModelType(dataType: DataTypeEnum) { | ||
21 | + const list: Record<'label' | 'value', string>[] = []; | ||
22 | + if (dataType === DataTypeEnum.BOOL) { | ||
23 | + list.push({ label: RegisterActionTypeNameEnum.BOOL, value: RegisterActionTypeEnum.BOOL }); | ||
24 | + } else if (dataType === DataTypeEnum.NUMBER_INT) { | ||
25 | + list.push({ label: RegisterActionTypeNameEnum.INT, value: RegisterActionTypeEnum.INT }); | ||
26 | + } else if (dataType === DataTypeEnum.NUMBER_DOUBLE) { | ||
27 | + list.push({ label: RegisterActionTypeNameEnum.DOUBLE, value: RegisterActionTypeEnum.DOUBLE }); | ||
28 | + } else { | ||
29 | + list.push( | ||
30 | + ...Object.keys(RegisterActionTypeEnum).map((key) => ({ | ||
31 | + label: RegisterActionTypeNameEnum[key], | ||
32 | + value: RegisterActionTypeEnum[key], | ||
33 | + })) | ||
34 | + ); | ||
35 | + } | ||
36 | + | ||
37 | + return list; | ||
10 | } | 38 | } |
11 | 39 | ||
12 | export const formSchemas: FormSchema[] = [ | 40 | export const formSchemas: FormSchema[] = [ |
13 | { | 41 | { |
42 | + field: FormFieldsEnum.OBJECT_MODEL_TYPE, | ||
43 | + component: 'Input', | ||
44 | + label: '物模型数据类型', | ||
45 | + ifShow: false, | ||
46 | + }, | ||
47 | + { | ||
14 | field: FormFieldsEnum.REGISTER_ADDRESS, | 48 | field: FormFieldsEnum.REGISTER_ADDRESS, |
15 | component: 'RegisterAddressInput', | 49 | component: 'RegisterAddressInput', |
16 | label: '寄存器地址', | 50 | label: '寄存器地址', |
@@ -26,6 +60,7 @@ export const formSchemas: FormSchema[] = [ | @@ -26,6 +60,7 @@ export const formSchemas: FormSchema[] = [ | ||
26 | component: 'ApiSelect', | 60 | component: 'ApiSelect', |
27 | label: '数据格式', | 61 | label: '数据格式', |
28 | rules: [{ message: '请选择数据格式', required: true }], | 62 | rules: [{ message: '请选择数据格式', required: true }], |
63 | + defaultValue: RegisterDataTypeEnum.UN_SHORT, | ||
29 | componentProps: { | 64 | componentProps: { |
30 | api: findDictItemByCode, | 65 | api: findDictItemByCode, |
31 | params: { | 66 | params: { |
@@ -42,15 +77,13 @@ export const formSchemas: FormSchema[] = [ | @@ -42,15 +77,13 @@ export const formSchemas: FormSchema[] = [ | ||
42 | component: 'Select', | 77 | component: 'Select', |
43 | label: '操作类型', | 78 | label: '操作类型', |
44 | rules: [{ message: '请选择操作类型', required: true }], | 79 | rules: [{ message: '请选择操作类型', required: true }], |
45 | - componentProps: { | ||
46 | - options: [ | ||
47 | - { label: '05 写入单个线圈寄存器', value: '05' }, | ||
48 | - { label: '06 写入单个保持寄存器', value: '06' }, | ||
49 | - // { label: '0F 写入多个线圈状态', value: '0F' }, | ||
50 | - { label: '16 写入多个保持寄存器', value: '16' }, | ||
51 | - ], | ||
52 | - placeholder: '请选择操作类型', | ||
53 | - getPopupContainer: () => document.body, | 80 | + componentProps: ({ formModel }) => { |
81 | + const objectModelType = formModel[FormFieldsEnum.OBJECT_MODEL_TYPE]; | ||
82 | + return { | ||
83 | + options: getActionTypeByObjectModelType(objectModelType), | ||
84 | + placeholder: '请选择操作类型', | ||
85 | + getPopupContainer: () => document.body, | ||
86 | + }; | ||
54 | }, | 87 | }, |
55 | }, | 88 | }, |
56 | { | 89 | { |
@@ -59,6 +92,8 @@ export const formSchemas: FormSchema[] = [ | @@ -59,6 +92,8 @@ export const formSchemas: FormSchema[] = [ | ||
59 | label: '缩放因子', | 92 | label: '缩放因子', |
60 | helpMessage: ['缩放因子不能为0,默认为1'], | 93 | helpMessage: ['缩放因子不能为0,默认为1'], |
61 | defaultValue: 1, | 94 | defaultValue: 1, |
95 | + ifShow: ({ model }) => | ||
96 | + ![DataTypeEnum.BOOL, DataTypeEnum.STRING].includes(model[FormFieldsEnum.OBJECT_MODEL_TYPE]), | ||
62 | componentProps: { | 97 | componentProps: { |
63 | min: 1, | 98 | min: 1, |
64 | placeholder: '请输入缩放因子', | 99 | placeholder: '请输入缩放因子', |
@@ -22,13 +22,11 @@ | @@ -22,13 +22,11 @@ | ||
22 | 22 | ||
23 | const emit = defineEmits(['update:value']); | 23 | const emit = defineEmits(['update:value']); |
24 | 24 | ||
25 | - const [ | ||
26 | - registerForm, | ||
27 | - { setFieldsValue, getFieldsValue, setProps, validate, resetFields, updateSchema }, | ||
28 | - ] = useForm({ | ||
29 | - schemas: formSchemas, | ||
30 | - showActionButtonGroup: false, | ||
31 | - }); | 25 | + const [registerForm, { setFieldsValue, getFieldsValue, setProps, validate, resetFields }] = |
26 | + useForm({ | ||
27 | + schemas: formSchemas, | ||
28 | + showActionButtonGroup: false, | ||
29 | + }); | ||
32 | 30 | ||
33 | const handleClick = async () => { | 31 | const handleClick = async () => { |
34 | show.value = true; | 32 | show.value = true; |
@@ -41,6 +39,7 @@ | @@ -41,6 +39,7 @@ | ||
41 | const handleSubmit = async () => { | 39 | const handleSubmit = async () => { |
42 | await validate(); | 40 | await validate(); |
43 | const value = getFieldsValue(); | 41 | const value = getFieldsValue(); |
42 | + Reflect.deleteProperty(value, FormFieldsEnum.OBJECT_MODEL_TYPE); | ||
44 | emit('update:value', value); | 43 | emit('update:value', value); |
45 | show.value = false; | 44 | show.value = false; |
46 | }; | 45 | }; |
@@ -48,12 +47,7 @@ | @@ -48,12 +47,7 @@ | ||
48 | watch(show, async (value) => { | 47 | watch(show, async (value) => { |
49 | if (value) { | 48 | if (value) { |
50 | await nextTick(); | 49 | await nextTick(); |
51 | - updateSchema([ | ||
52 | - { | ||
53 | - field: FormFieldsEnum.ZOOM_FACTOR, | ||
54 | - ifShow: props.dataType == DataTypeEnum.BOOL ? false : true, | ||
55 | - }, | ||
56 | - ]); | 50 | + setFieldsValue({ [FormFieldsEnum.OBJECT_MODEL_TYPE]: props.dataType }); |
57 | } | 51 | } |
58 | }); | 52 | }); |
59 | 53 |
@@ -6,3 +6,23 @@ export enum DataTypeEnum { | @@ -6,3 +6,23 @@ export enum DataTypeEnum { | ||
6 | BOOL = 'BOOL', | 6 | BOOL = 'BOOL', |
7 | ENUM = 'ENUM', | 7 | ENUM = 'ENUM', |
8 | } | 8 | } |
9 | + | ||
10 | +export enum RegisterDataTypeEnum { | ||
11 | + UN_SHORT = 'unshort', | ||
12 | +} | ||
13 | + | ||
14 | +export enum RegisterDataTypeNameEnum { | ||
15 | + UN_SHORT = '16位有符号', | ||
16 | +} | ||
17 | + | ||
18 | +export enum RegisterActionTypeEnum { | ||
19 | + BOOL = '05', | ||
20 | + INT = '06', | ||
21 | + DOUBLE = '16', | ||
22 | +} | ||
23 | + | ||
24 | +export enum RegisterActionTypeNameEnum { | ||
25 | + BOOL = '05写入单个线圈寄存器', | ||
26 | + INT = '06写入单个保持寄存器', | ||
27 | + DOUBLE = '16写入多个保持寄存器', | ||
28 | +} |
@@ -91,7 +91,14 @@ | @@ -91,7 +91,14 @@ | ||
91 | import CameraDrawer from './CameraDrawer.vue'; | 91 | import CameraDrawer from './CameraDrawer.vue'; |
92 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | 92 | import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; |
93 | import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; | 93 | import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; |
94 | - import { searchFormSchema, columns, AccessMode, PageMode, CameraPermission } from './config.data'; | 94 | + import { |
95 | + searchFormSchema, | ||
96 | + columns, | ||
97 | + AccessMode, | ||
98 | + PageMode, | ||
99 | + CameraPermission, | ||
100 | + VideoPlatformEnum, | ||
101 | + } from './config.data'; | ||
95 | import VideoPreviewModal from './DialogPreviewVideo.vue'; | 102 | import VideoPreviewModal from './DialogPreviewVideo.vue'; |
96 | import { useModal } from '/@/components/Modal'; | 103 | import { useModal } from '/@/components/Modal'; |
97 | import { Authority } from '/@/components/Authority'; | 104 | import { Authority } from '/@/components/Authority'; |
@@ -182,7 +189,12 @@ | @@ -182,7 +189,12 @@ | ||
182 | handleSuccess(); | 189 | handleSuccess(); |
183 | }; | 190 | }; |
184 | const handleViewVideo = (record) => { | 191 | const handleViewVideo = (record) => { |
185 | - if (record.accessMode === AccessMode.ManuallyEnter) { | 192 | + const { videoPlatformDTO } = record; |
193 | + const { type } = videoPlatformDTO || {}; | ||
194 | + if ( | ||
195 | + record.accessMode === AccessMode.ManuallyEnter || | ||
196 | + (record.accessMode === AccessMode.Streaming && type === VideoPlatformEnum.FLUORITE) | ||
197 | + ) { | ||
186 | openModal(true, { | 198 | openModal(true, { |
187 | isUpdate: true, | 199 | isUpdate: true, |
188 | record, | 200 | record, |
@@ -21,6 +21,11 @@ export enum CameraPermission { | @@ -21,6 +21,11 @@ export enum CameraPermission { | ||
21 | DELETE = 'api:yt:video:delete', | 21 | DELETE = 'api:yt:video:delete', |
22 | } | 22 | } |
23 | 23 | ||
24 | +export enum VideoPlatformEnum { | ||
25 | + HAIKANG = 0, | ||
26 | + FLUORITE = 1, | ||
27 | +} | ||
28 | + | ||
24 | export enum AccessMode { | 29 | export enum AccessMode { |
25 | ManuallyEnter = 0, | 30 | ManuallyEnter = 0, |
26 | Streaming = 1, | 31 | Streaming = 1, |