Commit e49c67640ac154aeebd3dbc9c729177a417f53fc

Authored by fengwotao
1 parent 99def793

feat:设备列表命令下发记录新增查询条件

1 -import { BasicColumn } from '/@/components/Table'; 1 +import { BasicColumn, FormSchema } from '/@/components/Table';
2 import moment from 'moment'; 2 import moment from 'moment';
3 import { Tag } from 'ant-design-vue'; 3 import { Tag } from 'ant-design-vue';
4 import { h } from 'vue'; 4 import { h } from 'vue';
@@ -18,9 +18,9 @@ export const configColumns: BasicColumn[] = [ @@ -18,9 +18,9 @@ export const configColumns: BasicColumn[] = [
18 return h( 18 return h(
19 Tag, 19 Tag,
20 { 20 {
21 - color: Number(text) === 0 ? 'blue' : 'green', 21 + color: Number(text) === 1 ? 'green' : 'blue',
22 }, 22 },
23 - () => (Number(text) === 0 ? '自定义' : '服务') 23 + () => (Number(text) === 1 ? '服务' : '自定义')
24 ); 24 );
25 }, 25 },
26 }, 26 },
@@ -51,27 +51,59 @@ export const configColumns: BasicColumn[] = [ @@ -51,27 +51,59 @@ export const configColumns: BasicColumn[] = [
51 ? '#00C9A7' 51 ? '#00C9A7'
52 : text == 'FAILED' 52 : text == 'FAILED'
53 ? 'red' 53 ? 'red'
54 - : 'green', 54 + : text == 'SUCCESSFUL'
  55 + ? 'green'
  56 + : 'red',
55 }, 57 },
56 () => record?.statusName 58 () => record?.statusName
57 ); 59 );
58 }, 60 },
59 }, 61 },
60 { 62 {
61 - title: '响应结果', 63 + title: '响应内容',
62 dataIndex: 'response111', 64 dataIndex: 'response111',
63 slots: { customRender: 'responseContent' }, 65 slots: { customRender: 'responseContent' },
64 }, 66 },
65 - // {  
66 - // title: '响应失败内容',  
67 - // dataIndex: 'response.error',  
68 - // format: (_, record) => {  
69 - // return record?.response === null ? '无' : record?.response?.error;  
70 - // },  
71 - // },  
72 { 67 {
73 title: '命令内容', 68 title: '命令内容',
74 dataIndex: 'request.body', 69 dataIndex: 'request.body',
75 slots: { customRender: 'recordContent' }, 70 slots: { customRender: 'recordContent' },
76 }, 71 },
77 ]; 72 ];
  73 +
  74 +export const searchFormSchema: FormSchema[] = [
  75 + {
  76 + field: 'status',
  77 + label: '命令状态',
  78 + component: 'Select',
  79 + colProps: { span: 6 },
  80 + componentProps: {
  81 + options: [
  82 + {
  83 + label: '队列中',
  84 + value: 'QUEUED',
  85 + },
  86 + {
  87 + label: '已发送',
  88 + value: 'SENT',
  89 + },
  90 + {
  91 + label: '发送成功',
  92 + value: 'DELIVERED',
  93 + },
  94 + ],
  95 + placeholder: '请选择命令状态',
  96 + },
  97 + },
  98 + {
  99 + field: 'sendTime',
  100 + label: '命令下发时间',
  101 + component: 'RangePicker',
  102 + componentProps: {
  103 + showTime: {
  104 + defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
  105 + },
  106 + },
  107 + colProps: { span: 6 },
  108 + },
  109 +];
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 </template> 15 </template>
16 <script lang="ts" setup> 16 <script lang="ts" setup>
17 import { h } from 'vue'; 17 import { h } from 'vue';
18 - import { configColumns } from './config'; 18 + import { configColumns, searchFormSchema } from './config';
19 import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi'; 19 import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi';
20 import { BasicTable, useTable } from '/@/components/Table'; 20 import { BasicTable, useTable } from '/@/components/Table';
21 import { Modal } from 'ant-design-vue'; 21 import { Modal } from 'ant-design-vue';
@@ -39,6 +39,12 @@ @@ -39,6 +39,12 @@
39 showTableSetting: true, 39 showTableSetting: true,
40 bordered: true, 40 bordered: true,
41 showIndexColumn: false, 41 showIndexColumn: false,
  42 + formConfig: {
  43 + labelWidth: 120,
  44 + schemas: searchFormSchema,
  45 + fieldMapToTime: [['sendTime', ['startTime', 'endTime'], 'x']],
  46 + },
  47 + useSearchForm: true,
42 }); 48 });
43 const commonModalInfo = (title, value) => { 49 const commonModalInfo = (title, value) => {
44 Modal.info({ 50 Modal.info({
@@ -55,7 +61,7 @@ @@ -55,7 +61,7 @@
55 }; 61 };
56 const handleRecordResponseContent = (record) => { 62 const handleRecordResponseContent = (record) => {
57 const jsonParams = record?.response; 63 const jsonParams = record?.response;
58 - commonModalInfo('响应结果', jsonParams); 64 + commonModalInfo('响应内容', jsonParams);
59 }; 65 };
60 </script> 66 </script>
61 67