| 
1
 | 
 
 | 
-<template>
 | 
| 
2
 | 
 
 | 
-  <div style="background-color: #f0f2f5">
 | 
| 
3
 | 
 
 | 
-    <BasicTable @register="registerTable">
 | 
| 
4
 | 
 
 | 
-      <template #recordContent="{ record }">
 | 
| 
5
 | 
 
 | 
-        <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button>
 | 
| 
6
 | 
 
 | 
-      </template>
 | 
| 
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
 | 
 
 | 
-        >
 | 
| 
13
 | 
 
 | 
-      </template>
 | 
| 
14
 | 
 
 | 
-    </BasicTable>
 | 
| 
15
 | 
 
 | 
-  </div>
 | 
| 
16
 | 
 
 | 
-</template>
 | 
| 
17
 | 
 
 | 
-<script lang="ts" setup>
 | 
| 
18
 | 
 
 | 
-  import { h } from 'vue';
 | 
| 
19
 | 
 
 | 
-  import { configColumns } from './config';
 | 
| 
20
 | 
 
 | 
-  import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi';
 | 
| 
21
 | 
 
 | 
-  import { BasicTable, useTable } from '/@/components/Table';
 | 
| 
22
 | 
 
 | 
-  import { Modal, Tag } from 'ant-design-vue';
 | 
| 
23
 | 
 
 | 
-  import { JsonPreview } from '/@/components/CodeEditor';
 | 
| 
24
 | 
 
 | 
-
 | 
| 
25
 | 
 
 | 
-  const props = defineProps({
 | 
| 
26
 | 
 
 | 
-    fromId: {
 | 
| 
27
 | 
 
 | 
-      type: String,
 | 
| 
28
 | 
 
 | 
-      default: '',
 | 
| 
29
 | 
 
 | 
-    },
 | 
| 
30
 | 
 
 | 
-  });
 | 
| 
31
 | 
 
 | 
-  const [registerTable] = useTable({
 | 
| 
32
 | 
 
 | 
-    api: deviceCommandRecordGetQuery,
 | 
| 
33
 | 
 
 | 
-    columns: configColumns,
 | 
| 
34
 | 
 
 | 
-    beforeFetch: (params) => {
 | 
| 
35
 | 
 
 | 
-      return {
 | 
| 
36
 | 
 
 | 
-        ...params,
 | 
| 
37
 | 
 
 | 
-        tbDeviceId: props.fromId,
 | 
| 
38
 | 
 
 | 
-      };
 | 
| 
39
 | 
 
 | 
-    },
 | 
| 
40
 | 
 
 | 
-    showTableSetting: true,
 | 
| 
41
 | 
 
 | 
-    bordered: true,
 | 
| 
42
 | 
 
 | 
-    showIndexColumn: false,
 | 
| 
43
 | 
 
 | 
-  });
 | 
| 
44
 | 
 
 | 
-  const commonModalInfo = (title, value) => {
 | 
| 
45
 | 
 
 | 
-    Modal.info({
 | 
| 
46
 | 
 
 | 
-      title,
 | 
| 
47
 | 
 
 | 
-      width: 600,
 | 
| 
48
 | 
 
 | 
-      content: h(JsonPreview, { data: value }),
 | 
| 
49
 | 
 
 | 
-    });
 | 
| 
50
 | 
 
 | 
-  };
 | 
| 
51
 | 
 
 | 
-  const handleRecordContent = (record) => {
 | 
| 
52
 | 
 
 | 
-    if (!record?.request?.body?.params) return;
 | 
| 
53
 | 
 
 | 
-    //如果是正常格式则返回params,否则输入什么内容则显示什么内容
 | 
| 
54
 | 
 
 | 
-    const jsonParams = JSON.parse(record?.request?.body?.params);
 | 
| 
55
 | 
 
 | 
-    commonModalInfo('命令下发内容', jsonParams?.params ? jsonParams?.params : jsonParams);
 | 
| 
56
 | 
 
 | 
-  };
 | 
| 
57
 | 
 
 | 
-</script> | 
| 
 
 | 
1
 | 
+<template>
 | 
| 
 
 | 
2
 | 
+  <BasicTable class="command-record-table" @register="registerTable">
 | 
| 
 
 | 
3
 | 
+    <template #recordContent="{ record }">
 | 
| 
 
 | 
4
 | 
+      <a-button type="link" class="ml-2" @click="handleRecordContent(record)"> 查看 </a-button>
 | 
| 
 
 | 
5
 | 
+    </template>
 | 
| 
 
 | 
6
 | 
+    <template #responseContent="{ record }">
 | 
| 
 
 | 
7
 | 
+      <Tag
 | 
| 
 
 | 
8
 | 
+        v-if="!record.request?.oneway"
 | 
| 
 
 | 
9
 | 
+        :color="record.request?.response?.status === 'SUCCESS' ? 'green' : 'red'"
 | 
| 
 
 | 
10
 | 
+        >{{ record.request?.response?.status === 'SUCCESS' ? '成功' : '失败' }}</Tag
 | 
| 
 
 | 
11
 | 
+      >
 | 
| 
 
 | 
12
 | 
+    </template>
 | 
| 
 
 | 
13
 | 
+  </BasicTable>
 | 
| 
 
 | 
14
 | 
+</template>
 | 
| 
 
 | 
15
 | 
+<script lang="ts" setup>
 | 
| 
 
 | 
16
 | 
+  import { h } from 'vue';
 | 
| 
 
 | 
17
 | 
+  import { configColumns } from './config';
 | 
| 
 
 | 
18
 | 
+  import { deviceCommandRecordGetQuery } from '/@/api/device/deviceConfigApi';
 | 
| 
 
 | 
19
 | 
+  import { BasicTable, useTable } from '/@/components/Table';
 | 
| 
 
 | 
20
 | 
+  import { Modal, Tag } from 'ant-design-vue';
 | 
| 
 
 | 
21
 | 
+  import { JsonPreview } from '/@/components/CodeEditor';
 | 
| 
 
 | 
22
 | 
+
 | 
| 
 
 | 
23
 | 
+  const props = defineProps({
 | 
| 
 
 | 
24
 | 
+    fromId: {
 | 
| 
 
 | 
25
 | 
+      type: String,
 | 
| 
 
 | 
26
 | 
+      default: '',
 | 
| 
 
 | 
27
 | 
+    },
 | 
| 
 
 | 
28
 | 
+  });
 | 
| 
 
 | 
29
 | 
+  const [registerTable] = useTable({
 | 
| 
 
 | 
30
 | 
+    api: deviceCommandRecordGetQuery,
 | 
| 
 
 | 
31
 | 
+    columns: configColumns,
 | 
| 
 
 | 
32
 | 
+    beforeFetch: (params) => {
 | 
| 
 
 | 
33
 | 
+      return {
 | 
| 
 
 | 
34
 | 
+        ...params,
 | 
| 
 
 | 
35
 | 
+        tbDeviceId: props.fromId,
 | 
| 
 
 | 
36
 | 
+      };
 | 
| 
 
 | 
37
 | 
+    },
 | 
| 
 
 | 
38
 | 
+    showTableSetting: true,
 | 
| 
 
 | 
39
 | 
+    bordered: true,
 | 
| 
 
 | 
40
 | 
+    showIndexColumn: false,
 | 
| 
 
 | 
41
 | 
+  });
 | 
| 
 
 | 
42
 | 
+  const commonModalInfo = (title, value) => {
 | 
| 
 
 | 
43
 | 
+    Modal.info({
 | 
| 
 
 | 
44
 | 
+      title,
 | 
| 
 
 | 
45
 | 
+      width: 600,
 | 
| 
 
 | 
46
 | 
+      content: h(JsonPreview, { data: value }),
 | 
| 
 
 | 
47
 | 
+    });
 | 
| 
 
 | 
48
 | 
+  };
 | 
| 
 
 | 
49
 | 
+  const handleRecordContent = (record) => {
 | 
| 
 
 | 
50
 | 
+    if (!record?.request?.body?.params) return;
 | 
| 
 
 | 
51
 | 
+    //如果是正常格式则返回params,否则输入什么内容则显示什么内容
 | 
| 
 
 | 
52
 | 
+    const jsonParams = JSON.parse(record?.request?.body?.params);
 | 
| 
 
 | 
53
 | 
+    commonModalInfo('命令下发内容', jsonParams?.params ? jsonParams?.params : jsonParams);
 | 
| 
 
 | 
54
 | 
+  };
 | 
| 
 
 | 
55
 | 
+</script>
 | 
| 
 
 | 
56
 | 
+
 | 
| 
 
 | 
57
 | 
+<style lang="less" scoped>
 | 
| 
 
 | 
58
 | 
+  .command-record-table {
 | 
| 
 
 | 
59
 | 
+    background-color: #f0f2f5;
 | 
| 
 
 | 
60
 | 
+    padding: 16px;
 | 
| 
 
 | 
61
 | 
+  }
 | 
| 
 
 | 
62
 | 
+</style> | 
...
 | 
...
 | 
 |