Commit 49198f160287abf342ea83448497be172d051604

Authored by xp.Huang
2 parents e9fd77dd 8de90830

Merge branch 'local_dev_ft' into 'main'

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

See merge request yunteng/thingskit-front!493
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,80 @@ export const configColumns: BasicColumn[] = [ @@ -51,27 +51,80 @@ 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 + {
  96 + label: '响应成功',
  97 + value: 'SUCCESSFUL',
  98 + },
  99 + {
  100 + label: '超时',
  101 + value: 'TIMEOUT',
  102 + },
  103 + {
  104 + label: '已过期',
  105 + value: 'EXPIRED',
  106 + },
  107 + {
  108 + label: '响应失败',
  109 + value: 'FAILED',
  110 + },
  111 + {
  112 + label: '已删除',
  113 + value: 'DELETED',
  114 + },
  115 + ],
  116 + placeholder: '请选择命令状态',
  117 + },
  118 + },
  119 + {
  120 + field: 'sendTime',
  121 + label: '命令下发时间',
  122 + component: 'RangePicker',
  123 + componentProps: {
  124 + showTime: {
  125 + defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
  126 + },
  127 + },
  128 + colProps: { span: 6 },
  129 + },
  130 +];
@@ -5,17 +5,18 @@ @@ -5,17 +5,18 @@
5 </template> 5 </template>
6 <template #responseContent="{ record }"> 6 <template #responseContent="{ record }">
7 <div v-if="!record.request?.oneway"> 7 <div v-if="!record.request?.oneway">
8 - <a-button v-if="record?.response === null" type="text" class="ml-2"> </a-button> 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)"> 9 <a-button v-else type="link" class="ml-2" @click="handleRecordResponseContent(record)">
10 查看 10 查看
11 </a-button> 11 </a-button>
12 </div> 12 </div>
  13 + <div v-else>--</div>
13 </template> 14 </template>
14 </BasicTable> 15 </BasicTable>
15 </template> 16 </template>
16 <script lang="ts" setup> 17 <script lang="ts" setup>
17 import { h } from 'vue'; 18 import { h } from 'vue';
18 - import { configColumns } from './config'; 19 + import { configColumns, searchFormSchema } from './config';
19 import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi'; 20 import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi';
20 import { BasicTable, useTable } from '/@/components/Table'; 21 import { BasicTable, useTable } from '/@/components/Table';
21 import { Modal } from 'ant-design-vue'; 22 import { Modal } from 'ant-design-vue';
@@ -39,6 +40,12 @@ @@ -39,6 +40,12 @@
39 showTableSetting: true, 40 showTableSetting: true,
40 bordered: true, 41 bordered: true,
41 showIndexColumn: false, 42 showIndexColumn: false,
  43 + formConfig: {
  44 + labelWidth: 120,
  45 + schemas: searchFormSchema,
  46 + fieldMapToTime: [['sendTime', ['startTime', 'endTime'], 'x']],
  47 + },
  48 + useSearchForm: true,
42 }); 49 });
43 const commonModalInfo = (title, value) => { 50 const commonModalInfo = (title, value) => {
44 Modal.info({ 51 Modal.info({
@@ -55,7 +62,7 @@ @@ -55,7 +62,7 @@
55 }; 62 };
56 const handleRecordResponseContent = (record) => { 63 const handleRecordResponseContent = (record) => {
57 const jsonParams = record?.response; 64 const jsonParams = record?.response;
58 - commonModalInfo('响应结果', jsonParams); 65 + commonModalInfo('响应内容', jsonParams);
59 }; 66 };
60 </script> 67 </script>
61 68