Commit 0cf43924cb2cf733d2248cf627f73cdc88f3818a

Authored by fengwotao
1 parent 30d4645c

pref:设备命令记录,保留响应结果

@@ -62,13 +62,13 @@ export const configColumns: BasicColumn[] = [ @@ -62,13 +62,13 @@ export const configColumns: BasicColumn[] = [
62 dataIndex: 'response111', 62 dataIndex: 'response111',
63 slots: { customRender: 'responseContent' }, 63 slots: { customRender: 'responseContent' },
64 }, 64 },
65 - {  
66 - title: '响应失败内容',  
67 - dataIndex: 'response.error',  
68 - format: (_, record) => {  
69 - return record?.response === null ? '无' : record?.response?.error;  
70 - },  
71 - }, 65 + // {
  66 + // title: '响应失败内容',
  67 + // dataIndex: 'response.error',
  68 + // format: (_, record) => {
  69 + // return record?.response === null ? '无' : record?.response?.error;
  70 + // },
  71 + // },
72 { 72 {
73 title: '命令内容', 73 title: '命令内容',
74 dataIndex: 'request.body', 74 dataIndex: 'request.body',
@@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
5 <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button> 5 <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button>
6 </template> 6 </template>
7 <template #responseContent="{ record }"> 7 <template #responseContent="{ record }">
8 - <Tag  
9 - v-if="!record.request?.oneway"  
10 - :color="record.request?.response?.status === 'SUCCESS' ? 'green' : 'red'"  
11 - >{{ record.request?.response?.status === 'SUCCESS' ? '成功' : '失败' }}</Tag  
12 - > 8 + <div v-if="!record.request?.oneway">
  9 + <a-button type="link" class="ml-2" @click="handleRecordResponseContent(record)">
  10 + 查看
  11 + </a-button>
  12 + </div>
13 </template> 13 </template>
14 </BasicTable> 14 </BasicTable>
15 </div> 15 </div>
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 import { configColumns } from './config'; 19 import { configColumns } from './config';
20 import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi'; 20 import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi';
21 import { BasicTable, useTable } from '/@/components/Table'; 21 import { BasicTable, useTable } from '/@/components/Table';
22 - import { Modal, Tag } from 'ant-design-vue'; 22 + import { Modal } from 'ant-design-vue';
23 import { JsonPreview } from '/@/components/CodeEditor'; 23 import { JsonPreview } from '/@/components/CodeEditor';
24 24
25 const props = defineProps({ 25 const props = defineProps({
@@ -54,4 +54,9 @@ @@ -54,4 +54,9 @@
54 const jsonParams = JSON.parse(record?.request?.body?.params); 54 const jsonParams = JSON.parse(record?.request?.body?.params);
55 commonModalInfo('命令下发内容', jsonParams?.params ? jsonParams?.params : jsonParams); 55 commonModalInfo('命令下发内容', jsonParams?.params ? jsonParams?.params : jsonParams);
56 }; 56 };
  57 + const handleRecordResponseContent = (record) => {
  58 + if (!record?.response) return;
  59 + const jsonParams = record?.response;
  60 + commonModalInfo('响应结果', jsonParams);
  61 + };
57 </script> 62 </script>