修改
This commit is contained in:
parent
ccddd6e122
commit
08e7dc4d33
@ -20,7 +20,7 @@ LayoutMap.set('IFRAME', Iframe);
|
||||
*/
|
||||
export const routerGenerator = (routerMap): any[] => {
|
||||
return routerMap.map((item) => {
|
||||
const names = /http(s)?:/.test(item.component)?item.component:item.path.replaceAll('/','')
|
||||
const names = item.target == 2 ? item.component : item.path.replaceAll('/', '');
|
||||
item.meta = {
|
||||
title:item.parentId==0 && item.children.length==0?'':item.name,
|
||||
icon:constantRouterIcon[item.icon2]|| null,
|
||||
@ -107,6 +107,7 @@ export const generatorDynamicRouter = (): Promise<RouteRecordRaw[]> => {
|
||||
adminMenus()
|
||||
.then((result) => {
|
||||
const routeList = routerGenerator(result)
|
||||
console.log(routeList)
|
||||
asyncImportRoute(routeList);
|
||||
resolve(routeList);
|
||||
})
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
import { h } from 'vue';
|
||||
|
||||
export const columns = [
|
||||
{
|
||||
title: '序号',
|
||||
render: (_, index) => {
|
||||
return `${index + 1}`
|
||||
},
|
||||
fixed: 'left',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '会话编号',
|
||||
key: 'tokenId',
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
title: '登录名称',
|
||||
key: 'username',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '部门名称',
|
||||
key: 'deptName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: 'IP地址',
|
||||
key: 'ipAddr',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '登录地点',
|
||||
key: 'loginLocation',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '浏览器',
|
||||
key: 'browser',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '操作系统',
|
||||
key: 'os',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '登录时间',
|
||||
key: 'loginTime',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
key: 'action',
|
||||
width: 100,
|
||||
},
|
||||
];
|
||||
@ -11,18 +11,6 @@
|
||||
<n-data-table :columns="columns" :style="{ minHeight: fwbHeight + 'px' }"
|
||||
:paginate-single-page="false"
|
||||
:data="onlineTableData.slice((pager.page - 1) * pager.size, pager.page * pager.size)">
|
||||
<!-- <template #bodyCell="{ column, record,index }">
|
||||
<template v-if="column.key === 'index'">
|
||||
{{index+1}}
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<n-space>
|
||||
<n-button type="danger" @click="handleDelete(record.tokenId)">
|
||||
强退
|
||||
</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</template> -->
|
||||
</n-data-table>
|
||||
<pagination style="justify-content: flex-end" class="mt-10 flex" v-model="pager" @change="loadTable" />
|
||||
</n-card>
|
||||
@ -30,12 +18,12 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { columns } from './columns';
|
||||
import { reactive, ref, onMounted,h} from 'vue';
|
||||
import { schemas } from './querySchemas';
|
||||
import { useForm } from '@/components/Form/index';
|
||||
import { getOnlineList, onlineOut } from '@/api/monitor/online';
|
||||
import { useMessage, useDialog } from 'naive-ui';
|
||||
import { TableAction } from '@/components/Table';
|
||||
const onlineTableData = ref([]);
|
||||
|
||||
/**
|
||||
@ -47,6 +35,74 @@ const formParams = reactive({
|
||||
});
|
||||
const message = useMessage();
|
||||
const dialog = useDialog()
|
||||
const columns = [
|
||||
{
|
||||
title: '序号',
|
||||
render: (_, index) => {
|
||||
return `${index + 1}`
|
||||
},
|
||||
fixed: 'left',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '会话编号',
|
||||
key: 'tokenId',
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
title: '登录名称',
|
||||
key: 'username',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '部门名称',
|
||||
key: 'deptName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: 'IP地址',
|
||||
key: 'ipAddr',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '登录地点',
|
||||
key: 'loginLocation',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '浏览器',
|
||||
key: 'browser',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '操作系统',
|
||||
key: 'os',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '登录时间',
|
||||
key: 'loginTime',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
key: 'action',
|
||||
width: 100,
|
||||
render(record) {
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{
|
||||
label: '强退',
|
||||
type: 'error',
|
||||
onClick: handleDelete.bind(null, record),
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
/**
|
||||
* 定义分页参数
|
||||
*/
|
||||
@ -106,15 +162,17 @@ function handleReset() {
|
||||
* @param id 参数
|
||||
*/
|
||||
async function handleDelete(id) {
|
||||
Modal.confirm({
|
||||
dialog.warning({
|
||||
title: '提示',
|
||||
content: '确定要强退?',
|
||||
onOk: async () => {
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await onlineOut(id);
|
||||
message.success('强退成功');
|
||||
loadTable();
|
||||
},
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user