Commit 0f3e7dee1cd0d2beee2dfb66364022ff8c40b976

Authored by ww
1 parent 24fb4a58

perf: 设备命令下发放入命令下发记录中

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