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 | 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 | 143 | label: '删除', |
| 139 | 144 | auth: 'api:yt:device:delete', |
| 140 | 145 | icon: 'ant-design:delete-outlined', |
| ... | ... | @@ -193,6 +198,7 @@ |
| 193 | 198 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
| 194 | 199 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
| 195 | 200 | import { Authority } from '/@/components/Authority'; |
| 201 | + import { useRouter } from 'vue-router'; | |
| 196 | 202 | |
| 197 | 203 | export default defineComponent({ |
| 198 | 204 | name: 'DeviceManagement', |
| ... | ... | @@ -215,6 +221,7 @@ |
| 215 | 221 | setup(_) { |
| 216 | 222 | const { createMessage } = useMessage(); |
| 217 | 223 | const go = useGo(); |
| 224 | + const ROUTER = useRouter(); | |
| 218 | 225 | const immediateStatus = ref(false); |
| 219 | 226 | const searchInfo = reactive<Recordable>({}); |
| 220 | 227 | const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); |
| ... | ... | @@ -385,6 +392,13 @@ |
| 385 | 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 | 402 | return { |
| 389 | 403 | registerTable, |
| 390 | 404 | handleCreate, |
| ... | ... | @@ -412,6 +426,7 @@ |
| 412 | 426 | handleOpenTbDeviceDetail, |
| 413 | 427 | handleOpenGatewayDetail, |
| 414 | 428 | registerGatewayDetailDrawer, |
| 429 | + handleUpAndDownRecord, | |
| 415 | 430 | }; |
| 416 | 431 | }, |
| 417 | 432 | }); | ... | ... |
| ... | ... | @@ -48,7 +48,7 @@ |
| 48 | 48 | </template> |
| 49 | 49 | |
| 50 | 50 | <script lang="ts" setup> |
| 51 | - import { nextTick } from 'vue'; | |
| 51 | + import { nextTick, onMounted } from 'vue'; | |
| 52 | 52 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 53 | 53 | import { useDrawer } from '/@/components/Drawer'; |
| 54 | 54 | import OnlineRecordDrawer from './OnlineRecordDrawer.vue'; |
| ... | ... | @@ -58,9 +58,11 @@ |
| 58 | 58 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
| 59 | 59 | import { Popconfirm } from 'ant-design-vue'; |
| 60 | 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 | 64 | title: '上下线记录', |
| 65 | + immediate: false, | |
| 64 | 66 | api: deviceStateLogPage, |
| 65 | 67 | columns, |
| 66 | 68 | showIndexColumn: false, |
| ... | ... | @@ -117,4 +119,14 @@ |
| 117 | 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 | 132 | </script> | ... | ... |