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