Showing
4 changed files
with
39 additions
and
18 deletions
| ... | ... | @@ -719,9 +719,6 @@ export const CommandSchemas = (transportType: TransportTypeEnum): FormSchema[] = |
| 719 | 719 | field: 'commandType', |
| 720 | 720 | component: 'RadioGroup', |
| 721 | 721 | label: '下发类型', |
| 722 | - colProps: { | |
| 723 | - span: 8, | |
| 724 | - }, | |
| 725 | 722 | defaultValue: 'OneWay', |
| 726 | 723 | componentProps: { |
| 727 | 724 | options: [ | ... | ... |
| ... | ... | @@ -25,9 +25,9 @@ |
| 25 | 25 | <TabPane key="7" tab="历史数据" v-if="deviceDetail?.deviceType !== 'GATEWAY'"> |
| 26 | 26 | <HistoryData :deviceDetail="deviceDetail" /> |
| 27 | 27 | </TabPane> --> |
| 28 | - <TabPane key="5" tab="命令下发" v-if="deviceDetail?.deviceType !== 'SENSOR'"> | |
| 28 | + <!-- <TabPane key="5" tab="命令下发" v-if="deviceDetail?.deviceType !== 'SENSOR'"> | |
| 29 | 29 | <CommandIssuance :deviceDetail="deviceDetail" /> |
| 30 | - </TabPane> | |
| 30 | + </TabPane> --> | |
| 31 | 31 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> |
| 32 | 32 | <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'"> |
| 33 | 33 | <ChildDevice |
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | /> |
| 37 | 37 | </TabPane> |
| 38 | 38 | <TabPane key="7" tab="命令下发记录"> |
| 39 | - <CommandRecord :fromId="deviceDetail?.tbDeviceId" /> | |
| 39 | + <CommandRecord :deviceDetail="deviceDetail" :fromId="deviceDetail?.tbDeviceId" /> | |
| 40 | 40 | </TabPane> |
| 41 | 41 | <!-- 网关设备并且场家是TBox --> |
| 42 | 42 | <TabPane |
| ... | ... | @@ -67,7 +67,6 @@ |
| 67 | 67 | import Alarm from '../tabs/Alarm.vue'; |
| 68 | 68 | import ChildDevice from '../tabs/ChildDevice.vue'; |
| 69 | 69 | import TBoxDetail from '../tabs/TBoxDetail.vue'; |
| 70 | - import CommandIssuance from '../tabs/CommandIssuance.vue'; | |
| 71 | 70 | import { CommandRecord } from '../tabs/commandRecord/index'; |
| 72 | 71 | import { getDeviceDetail } from '/@/api/device/deviceManager'; |
| 73 | 72 | // import HistoryData from '../tabs/HistoryData.vue'; |
| ... | ... | @@ -86,7 +85,6 @@ |
| 86 | 85 | // RealTimeData, |
| 87 | 86 | Alarm, |
| 88 | 87 | ChildDevice, |
| 89 | - CommandIssuance, | |
| 90 | 88 | TBoxDetail, |
| 91 | 89 | // HistoryData, |
| 92 | 90 | ModelOfMatter, | ... | ... |
| ... | ... | @@ -12,10 +12,10 @@ |
| 12 | 12 | </div> |
| 13 | 13 | </template> |
| 14 | 14 | </BasicForm> |
| 15 | - <div> | |
| 15 | + <Space class="w-full justify-end" justify="end"> | |
| 16 | 16 | <Button :disabled="disable" type="primary" @click="handleOk" class="mr-2">确定</Button> |
| 17 | 17 | <Button type="default" @click="handleCancel" class="mr-2">重置</Button> |
| 18 | - </div> | |
| 18 | + </Space> | |
| 19 | 19 | </div> |
| 20 | 20 | </div> |
| 21 | 21 | </template> |
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | import jsoneditor from 'jsoneditor'; |
| 30 | 30 | import 'jsoneditor/dist/jsoneditor.min.css'; |
| 31 | 31 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
| 32 | - import { Tooltip } from 'ant-design-vue'; | |
| 32 | + import { Space, Tooltip } from 'ant-design-vue'; | |
| 33 | 33 | import { DeviceRecord } from '/@/api/device/model/deviceModel'; |
| 34 | 34 | import { TransportTypeEnum } from '../../../profiles/components/TransportDescript/const'; |
| 35 | 35 | |
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | export default defineComponent({ |
| 45 | - components: { BasicForm, Button, QuestionCircleOutlined, Tooltip }, | |
| 45 | + components: { BasicForm, Button, QuestionCircleOutlined, Tooltip, Space }, | |
| 46 | 46 | props: { |
| 47 | 47 | deviceDetail: { |
| 48 | 48 | type: Object as PropType<DeviceRecord>, |
| ... | ... | @@ -56,7 +56,7 @@ |
| 56 | 56 | const disable = ref(false); |
| 57 | 57 | |
| 58 | 58 | const [registerForm, { getFieldsValue, validate, resetFields }] = useForm({ |
| 59 | - labelWidth: 100, | |
| 59 | + labelWidth: 120, | |
| 60 | 60 | schemas: CommandSchemas( |
| 61 | 61 | props.deviceDetail.deviceProfile.transportType as TransportTypeEnum |
| 62 | 62 | ), | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <BasicTable class="command-record-table" @register="registerTable"> |
| 3 | + <template #toolbar> | |
| 4 | + <Space> | |
| 5 | + <Button type="primary" @click="openModal(true)">命令下发</Button> | |
| 6 | + </Space> | |
| 7 | + </template> | |
| 3 | 8 | <template #recordContent="{ record }"> |
| 4 | - <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button> | |
| 9 | + <Button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </Button> | |
| 5 | 10 | </template> |
| 6 | 11 | <template #responseContent="{ record }"> |
| 7 | 12 | <div v-if="!record.request?.oneway"> |
| 8 | - <a-button v-if="record?.response === null" type="text" class="ml-2"> 未响应 </a-button> | |
| 9 | - <a-button v-else type="link" class="ml-2" @click="handleRecordResponseContent(record)"> | |
| 13 | + <Button v-if="record?.response === null" type="text" class="ml-2"> 未响应 </Button> | |
| 14 | + <Button v-else type="link" class="ml-2" @click="handleRecordResponseContent(record)"> | |
| 10 | 15 | 查看 |
| 11 | - </a-button> | |
| 16 | + </Button> | |
| 12 | 17 | </div> |
| 13 | 18 | <div v-else>--</div> |
| 14 | 19 | </template> |
| 15 | 20 | </BasicTable> |
| 21 | + | |
| 22 | + <BasicModal | |
| 23 | + @register="registerCommandIssuanceModal" | |
| 24 | + width="600px" | |
| 25 | + title="命令下发" | |
| 26 | + :showOkBtn="false" | |
| 27 | + cancelText="关闭" | |
| 28 | + footer="" | |
| 29 | + > | |
| 30 | + <CommandIssuance :deviceDetail="deviceDetail" /> | |
| 31 | + </BasicModal> | |
| 16 | 32 | </template> |
| 17 | 33 | <script lang="ts" setup> |
| 18 | 34 | import { h } from 'vue'; |
| 19 | 35 | import { configColumns, searchFormSchema } from './config'; |
| 20 | 36 | import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi'; |
| 21 | 37 | import { BasicTable, useTable } from '/@/components/Table'; |
| 22 | - import { Modal } from 'ant-design-vue'; | |
| 38 | + import { Button, Modal, Space } from 'ant-design-vue'; | |
| 23 | 39 | import { JsonPreview } from '/@/components/CodeEditor'; |
| 40 | + import { DeviceRecord } from '/@/api/device/model/deviceModel'; | |
| 41 | + import { BasicModal, useModal } from '/@/components/Modal'; | |
| 42 | + import CommandIssuance from '../CommandIssuance.vue'; | |
| 24 | 43 | |
| 25 | 44 | const props = defineProps({ |
| 26 | 45 | fromId: { |
| 27 | 46 | type: String, |
| 28 | 47 | default: '', |
| 29 | 48 | }, |
| 49 | + deviceDetail: { | |
| 50 | + type: Object as PropType<DeviceRecord>, | |
| 51 | + required: true, | |
| 52 | + }, | |
| 30 | 53 | }); |
| 54 | + | |
| 55 | + const [registerCommandIssuanceModal, { openModal }] = useModal(); | |
| 56 | + | |
| 31 | 57 | const [registerTable] = useTable({ |
| 32 | 58 | api: deviceCommandRecordGetQuery, |
| 33 | 59 | columns: configColumns, | ... | ... |