|
@@ -3,61 +3,95 @@
|
|
|
v-bind="$attrs"
|
|
v-bind="$attrs"
|
|
|
destroyOnClose
|
|
destroyOnClose
|
|
|
@register="registerDrawer"
|
|
@register="registerDrawer"
|
|
|
- :showFooter="true"
|
|
|
|
|
|
|
+ :showFooter="false"
|
|
|
width="800px"
|
|
width="800px"
|
|
|
>
|
|
>
|
|
|
- <BasicTable @register="registerTable" :columns="tokenColumns" :data-source="columnsSorce">
|
|
|
|
|
|
|
+ <BasicTable @register="registerTable" :columns="tokenColumns" @showOkBtn="false">
|
|
|
<template #toolbar>
|
|
<template #toolbar>
|
|
|
- <a-button type="primary" danger="true" @click="loginOut()">批量强退</a-button>
|
|
|
|
|
|
|
+ <Button type="primary" danger @click="loginOut()">批量强退</Button>
|
|
|
</template>
|
|
</template>
|
|
|
<template #headerTop>
|
|
<template #headerTop>
|
|
|
- <h1>设备管理列表</h1>
|
|
|
|
|
|
|
+ <h1>Token列表</h1>
|
|
|
</template>
|
|
</template>
|
|
|
- <template #tableTitle> 共{{ columnsSorce.length }}条数据 </template></BasicTable
|
|
|
|
|
|
|
+ <template #tableTitle> 共 {{ total }} 条数据 </template></BasicTable
|
|
|
>
|
|
>
|
|
|
</BasicDrawer>
|
|
</BasicDrawer>
|
|
|
</template>
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
|
import { BasicTable, useTable } from '/@/components/Table';
|
|
import { BasicTable, useTable } from '/@/components/Table';
|
|
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
|
+ import { Button } from '/@/components/Button';
|
|
|
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
|
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
|
|
- import { onlineForceLogout } from '/@/api/monitor/onlineApi';
|
|
|
|
|
|
|
+ import { onlineForceLogout, onlineListToken } from '/@/api/monitor/onlineApi';
|
|
|
import { tokenColumns } from './data';
|
|
import { tokenColumns } from './data';
|
|
|
- const columnsSorce = ref<any>([]);
|
|
|
|
|
|
|
+ import { useUserStore } from '/@/store/modules/user';
|
|
|
|
|
+
|
|
|
|
|
+ const { createConfirm, createMessage } = useMessage();
|
|
|
|
|
+ const userStore = useUserStore();
|
|
|
|
|
+ // const setTableList = ref<any>([]);
|
|
|
|
|
+ const sessionId = ref('');
|
|
|
|
|
+ const total = ref('');
|
|
|
const tokenList = ref<any>([]);
|
|
const tokenList = ref<any>([]);
|
|
|
|
|
+
|
|
|
const [registerDrawer] = useDrawerInner(async data => {
|
|
const [registerDrawer] = useDrawerInner(async data => {
|
|
|
// setDrawerProps({ confirmLoading: false });
|
|
// setDrawerProps({ confirmLoading: false });
|
|
|
- columnsSorce.value = [];
|
|
|
|
|
- console.log(data.record.tokenSessionList, '22222222');
|
|
|
|
|
- for (const i of data.record.tokenSessionList) {
|
|
|
|
|
- columnsSorce.value.push({
|
|
|
|
|
- loginDevice: i.os,
|
|
|
|
|
- indate: i.loginTime,
|
|
|
|
|
- tokenValues: i.tokenValue,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ sessionId.value = data.record.sessionId;
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
- const [registerTable, { getSelectRows }] = useTable({
|
|
|
|
|
|
|
+ //setTableData
|
|
|
|
|
+ const [registerTable, { getSelectRows, reload }] = useTable({
|
|
|
// title: '设备管理列表',
|
|
// title: '设备管理列表',
|
|
|
- rowKey: 'tokenValues',
|
|
|
|
|
- rowSelection: { type: 'checkbox' },
|
|
|
|
|
|
|
+ api: onlineListToken,
|
|
|
|
|
+ rowKey: 'tokenValue',
|
|
|
|
|
+ rowSelection: {
|
|
|
|
|
+ type: 'checkbox',
|
|
|
|
|
+ getCheckboxProps: record => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ disabled: record.tokenValue == userStore.getToken,
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
clickToRowSelect: true,
|
|
clickToRowSelect: true,
|
|
|
showIndexColumn: false,
|
|
showIndexColumn: false,
|
|
|
bordered: true,
|
|
bordered: true,
|
|
|
pagination: false,
|
|
pagination: false,
|
|
|
// showTableSetting: true,
|
|
// showTableSetting: true,
|
|
|
|
|
+ beforeFetch: handleBeforeFetch,
|
|
|
|
|
+ afterFetch: handleAfterFetch,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ function handleBeforeFetch(params) {
|
|
|
|
|
+ params.sessionId = sessionId.value;
|
|
|
|
|
+ params.loginType = 'login';
|
|
|
|
|
+ return params;
|
|
|
|
|
+ }
|
|
|
|
|
+ function handleAfterFetch(params) {
|
|
|
|
|
+ total.value = params.length;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
async function loginOut() {
|
|
async function loginOut() {
|
|
|
const rows = getSelectRows();
|
|
const rows = getSelectRows();
|
|
|
- console.log('rows', rows);
|
|
|
|
|
for (const i of rows) {
|
|
for (const i of rows) {
|
|
|
- console.log('i', i);
|
|
|
|
|
- tokenList.value.push(i.tokenValues);
|
|
|
|
|
|
|
+ tokenList.value.push(i.tokenValue);
|
|
|
}
|
|
}
|
|
|
console.log('tokenList', tokenList);
|
|
console.log('tokenList', tokenList);
|
|
|
- await onlineForceLogout({ tokenValues: tokenList.value, loginType: 'login' });
|
|
|
|
|
- tokenList.value = [];
|
|
|
|
|
|
|
+ if (rows.length) {
|
|
|
|
|
+ createConfirm({
|
|
|
|
|
+ content: '你确定要删除?',
|
|
|
|
|
+ iconType: 'warning',
|
|
|
|
|
+ onOk: async () => {
|
|
|
|
|
+ await onlineForceLogout({
|
|
|
|
|
+ tokenValues: tokenList.value,
|
|
|
|
|
+ loginType: 'login',
|
|
|
|
|
+ sessionId: sessionId.value,
|
|
|
|
|
+ });
|
|
|
|
|
+ await reload();
|
|
|
|
|
+ createMessage.success('删除成功!');
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ createMessage.warn('请选择');
|
|
|
|
|
+ }
|
|
|
|
|
+ await reload();
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|