Commit e5152262e1f15b31c69491b3007aecda47b89862
Merge branch 'fix/types-import-error' into 'main_dev'
fix: 修复项目运行时类型引入报错 See merge request yunteng/thingskit-front!636
Showing
4 changed files
with
14 additions
and
11 deletions
| @@ -6,6 +6,7 @@ import { DeviceCascadePickerValueType } from '../DevicePicker'; | @@ -6,6 +6,7 @@ import { DeviceCascadePickerValueType } from '../DevicePicker'; | ||
| 6 | import { TaskTargetEnum } from '../../config'; | 6 | import { TaskTargetEnum } from '../../config'; |
| 7 | import { TimeUnitEnum } from '/@/enums/toolEnum'; | 7 | import { TimeUnitEnum } from '/@/enums/toolEnum'; |
| 8 | import { ProductCascadePickerValueType } from '../ProductPicker'; | 8 | import { ProductCascadePickerValueType } from '../ProductPicker'; |
| 9 | +import { toRaw } from 'vue'; | ||
| 9 | 10 | ||
| 10 | export interface FormValueType extends Partial<Record<FormFieldsEnum, any>> { | 11 | export interface FormValueType extends Partial<Record<FormFieldsEnum, any>> { |
| 11 | [FormFieldsEnum.EXECUTE_TARGET_DATA]: DeviceCascadePickerValueType; | 12 | [FormFieldsEnum.EXECUTE_TARGET_DATA]: DeviceCascadePickerValueType; |
| @@ -123,6 +124,7 @@ export const parseData = (result: TaskRecordType): Required<FormValueType> => { | @@ -123,6 +124,7 @@ export const parseData = (result: TaskRecordType): Required<FormValueType> => { | ||
| 123 | TaskRecordType['executeTarget'] | 124 | TaskRecordType['executeTarget'] |
| 124 | >; | 125 | >; |
| 125 | const { type: executeTimeType, period, periodType, time, pollUnit } = executeTime; | 126 | const { type: executeTimeType, period, periodType, time, pollUnit } = executeTime; |
| 127 | + console.log(pushWay === PushWayEnum.MQTT ? JSON.stringify(rpcCommand, null, 2) : rpcCommand); | ||
| 126 | return { | 128 | return { |
| 127 | name, | 129 | name, |
| 128 | targetType, | 130 | targetType, |
| @@ -131,7 +133,7 @@ export const parseData = (result: TaskRecordType): Required<FormValueType> => { | @@ -131,7 +133,7 @@ export const parseData = (result: TaskRecordType): Required<FormValueType> => { | ||
| 131 | pushWay, | 133 | pushWay, |
| 132 | executeContentType, | 134 | executeContentType, |
| 133 | executeTargetData: { | 135 | executeTargetData: { |
| 134 | - deviceId: targetType === TaskTargetEnum.DEVICES ? data : [], | 136 | + deviceId: targetType === TaskTargetEnum.DEVICES ? toRaw(data) : [], |
| 135 | deviceProfileId, | 137 | deviceProfileId, |
| 136 | deviceType, | 138 | deviceType, |
| 137 | organizationId, | 139 | organizationId, |
| @@ -3,11 +3,9 @@ | @@ -3,11 +3,9 @@ | ||
| 3 | import { JSONEditor } from '/@/components/CodeEditor'; | 3 | import { JSONEditor } from '/@/components/CodeEditor'; |
| 4 | import { SettingOutlined } from '@ant-design/icons-vue'; | 4 | import { SettingOutlined } from '@ant-design/icons-vue'; |
| 5 | import { ModeEnum } from './index'; | 5 | import { ModeEnum } from './index'; |
| 6 | - import { computed } from '@vue/reactivity'; | ||
| 7 | import GenModbusCommandModal from './GenModbusCommandModal.vue'; | 6 | import GenModbusCommandModal from './GenModbusCommandModal.vue'; |
| 8 | import { useModal } from '/@/components/Modal'; | 7 | import { useModal } from '/@/components/Modal'; |
| 9 | - import { ref } from 'vue'; | ||
| 10 | - import { unref } from 'vue'; | 8 | + import { ref, unref } from 'vue'; |
| 11 | 9 | ||
| 12 | const props = withDefaults( | 10 | const props = withDefaults( |
| 13 | defineProps<{ | 11 | defineProps<{ |
| @@ -30,10 +28,6 @@ | @@ -30,10 +28,6 @@ | ||
| 30 | 28 | ||
| 31 | const [registerCreateTCPCommandModal, { openModal }] = useModal(); | 29 | const [registerCreateTCPCommandModal, { openModal }] = useModal(); |
| 32 | 30 | ||
| 33 | - const getJSONValue = computed(() => { | ||
| 34 | - return props.value; | ||
| 35 | - }); | ||
| 36 | - | ||
| 37 | const handleEmit = (value: any) => { | 31 | const handleEmit = (value: any) => { |
| 38 | emit('update:value', value); | 32 | emit('update:value', value); |
| 39 | openModal(false); | 33 | openModal(false); |
| @@ -63,7 +57,7 @@ | @@ -63,7 +57,7 @@ | ||
| 63 | <Input | 57 | <Input |
| 64 | v-if="mode === ModeEnum.NORMAL" | 58 | v-if="mode === ModeEnum.NORMAL" |
| 65 | ref="inputElRef" | 59 | ref="inputElRef" |
| 66 | - :value="getJSONValue" | 60 | + :value="value" |
| 67 | @change="handleEmit" | 61 | @change="handleEmit" |
| 68 | v-bind="inputProps" | 62 | v-bind="inputProps" |
| 69 | @focus="handleFocus" | 63 | @focus="handleFocus" |
| @@ -74,7 +68,7 @@ | @@ -74,7 +68,7 @@ | ||
| 74 | </Input> | 68 | </Input> |
| 75 | <JSONEditor | 69 | <JSONEditor |
| 76 | v-if="mode === ModeEnum.JSON" | 70 | v-if="mode === ModeEnum.JSON" |
| 77 | - :value="getJSONValue" | 71 | + :value="value" |
| 78 | @update:value="handleUpdateEditorValue" | 72 | @update:value="handleUpdateEditorValue" |
| 79 | /> | 73 | /> |
| 80 | <GenModbusCommandModal @register="registerCreateTCPCommandModal" @update:value="handleEmit" /> | 74 | <GenModbusCommandModal @register="registerCreateTCPCommandModal" @update:value="handleEmit" /> |
| @@ -13,7 +13,6 @@ | @@ -13,7 +13,6 @@ | ||
| 13 | import { reactive } from 'vue'; | 13 | import { reactive } from 'vue'; |
| 14 | import { ReloadOutlined } from '@ant-design/icons-vue'; | 14 | import { ReloadOutlined } from '@ant-design/icons-vue'; |
| 15 | import { DataActionModeEnum } from '/@/enums/toolEnum'; | 15 | import { DataActionModeEnum } from '/@/enums/toolEnum'; |
| 16 | - import { ModalParamsType } from '/#/utils'; | ||
| 17 | import { Authority } from '/@/components/Authority'; | 16 | import { Authority } from '/@/components/Authority'; |
| 18 | import { getBoundingClientRect } from '/@/utils/domUtils'; | 17 | import { getBoundingClientRect } from '/@/utils/domUtils'; |
| 19 | import { RunTaskModal } from './components/RunTaskModal'; | 18 | import { RunTaskModal } from './components/RunTaskModal'; |
| @@ -7,6 +7,8 @@ import type { | @@ -7,6 +7,8 @@ import type { | ||
| 7 | PropType as VuePropType, | 7 | PropType as VuePropType, |
| 8 | } from 'vue'; | 8 | } from 'vue'; |
| 9 | 9 | ||
| 10 | +import { DataActionModeEnum } from '/@/enums/toolEnum'; | ||
| 11 | + | ||
| 10 | declare global { | 12 | declare global { |
| 11 | const __APP_INFO__: { | 13 | const __APP_INFO__: { |
| 12 | pkg: { | 14 | pkg: { |
| @@ -17,6 +19,12 @@ declare global { | @@ -17,6 +19,12 @@ declare global { | ||
| 17 | }; | 19 | }; |
| 18 | lastBuildTime: string; | 20 | lastBuildTime: string; |
| 19 | }; | 21 | }; |
| 22 | + | ||
| 23 | + declare interface ModalParamsType<T = Recordable> { | ||
| 24 | + mode: DataActionModeEnum; | ||
| 25 | + record: T; | ||
| 26 | + [key: string]: any; | ||
| 27 | + } | ||
| 20 | // declare interface Window { | 28 | // declare interface Window { |
| 21 | // // Global vue app instance | 29 | // // Global vue app instance |
| 22 | // __APP__: App<Element>; | 30 | // __APP__: App<Element>; |