Commit c2cbd62e150c18cfe21d6087f900ae272ba047b4
1 parent
fe3c949f
feat: add up and down record jump online record page
Showing
2 changed files
with
29 additions
and
2 deletions
@@ -135,6 +135,11 @@ | @@ -135,6 +135,11 @@ | ||
135 | onClick: handleDispatchCustomer.bind(null, record), | 135 | onClick: handleDispatchCustomer.bind(null, record), |
136 | }, | 136 | }, |
137 | { | 137 | { |
138 | + label: '上下线记录', | ||
139 | + icon: 'ant-design:rise-outlined', | ||
140 | + onClick: handleUpAndDownRecord.bind(null, record), | ||
141 | + }, | ||
142 | + { | ||
138 | label: '删除', | 143 | label: '删除', |
139 | auth: 'api:yt:device:delete', | 144 | auth: 'api:yt:device:delete', |
140 | icon: 'ant-design:delete-outlined', | 145 | icon: 'ant-design:delete-outlined', |
@@ -193,6 +198,7 @@ | @@ -193,6 +198,7 @@ | ||
193 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | 198 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
194 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; | 199 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
195 | import { Authority } from '/@/components/Authority'; | 200 | import { Authority } from '/@/components/Authority'; |
201 | + import { useRouter } from 'vue-router'; | ||
196 | 202 | ||
197 | export default defineComponent({ | 203 | export default defineComponent({ |
198 | name: 'DeviceManagement', | 204 | name: 'DeviceManagement', |
@@ -215,6 +221,7 @@ | @@ -215,6 +221,7 @@ | ||
215 | setup(_) { | 221 | setup(_) { |
216 | const { createMessage } = useMessage(); | 222 | const { createMessage } = useMessage(); |
217 | const go = useGo(); | 223 | const go = useGo(); |
224 | + const ROUTER = useRouter(); | ||
218 | const immediateStatus = ref(false); | 225 | const immediateStatus = ref(false); |
219 | const searchInfo = reactive<Recordable>({}); | 226 | const searchInfo = reactive<Recordable>({}); |
220 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | 227 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
@@ -385,6 +392,13 @@ | @@ -385,6 +392,13 @@ | ||
385 | openGatewayDetailDrawer(true, data); | 392 | openGatewayDetailDrawer(true, data); |
386 | }; | 393 | }; |
387 | 394 | ||
395 | + const handleUpAndDownRecord = (record: Record<'name', string>) => { | ||
396 | + ROUTER.push({ | ||
397 | + path: '/operation/onlinerecord', | ||
398 | + query: { deviceName: record.name }, | ||
399 | + }); | ||
400 | + }; | ||
401 | + | ||
388 | return { | 402 | return { |
389 | registerTable, | 403 | registerTable, |
390 | handleCreate, | 404 | handleCreate, |
@@ -412,6 +426,7 @@ | @@ -412,6 +426,7 @@ | ||
412 | handleOpenTbDeviceDetail, | 426 | handleOpenTbDeviceDetail, |
413 | handleOpenGatewayDetail, | 427 | handleOpenGatewayDetail, |
414 | registerGatewayDetailDrawer, | 428 | registerGatewayDetailDrawer, |
429 | + handleUpAndDownRecord, | ||
415 | }; | 430 | }; |
416 | }, | 431 | }, |
417 | }); | 432 | }); |
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | </template> | 48 | </template> |
49 | 49 | ||
50 | <script lang="ts" setup> | 50 | <script lang="ts" setup> |
51 | - import { nextTick } from 'vue'; | 51 | + import { nextTick, onMounted } from 'vue'; |
52 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 52 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
53 | import { useDrawer } from '/@/components/Drawer'; | 53 | import { useDrawer } from '/@/components/Drawer'; |
54 | import OnlineRecordDrawer from './OnlineRecordDrawer.vue'; | 54 | import OnlineRecordDrawer from './OnlineRecordDrawer.vue'; |
@@ -58,9 +58,11 @@ | @@ -58,9 +58,11 @@ | ||
58 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 58 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
59 | import { Popconfirm } from 'ant-design-vue'; | 59 | import { Popconfirm } from 'ant-design-vue'; |
60 | import { Authority } from '/@/components/Authority'; | 60 | import { Authority } from '/@/components/Authority'; |
61 | + import { useRoute } from 'vue-router'; | ||
61 | 62 | ||
62 | - const [registerTable, { setProps, reload }] = useTable({ | 63 | + const [registerTable, { setProps, reload, getForm }] = useTable({ |
63 | title: '上下线记录', | 64 | title: '上下线记录', |
65 | + immediate: false, | ||
64 | api: deviceStateLogPage, | 66 | api: deviceStateLogPage, |
65 | columns, | 67 | columns, |
66 | showIndexColumn: false, | 68 | showIndexColumn: false, |
@@ -117,4 +119,14 @@ | @@ -117,4 +119,14 @@ | ||
117 | record, | 119 | record, |
118 | }); | 120 | }); |
119 | }; | 121 | }; |
122 | + const ROUTE = useRoute(); | ||
123 | + | ||
124 | + onMounted(async () => { | ||
125 | + const formActionType = getForm(); | ||
126 | + const params = ROUTE.query; | ||
127 | + if (params) { | ||
128 | + await formActionType.setFieldsValue(params); | ||
129 | + } | ||
130 | + await reload(); | ||
131 | + }); | ||
120 | </script> | 132 | </script> |