1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
| <template>
| <basicContainer >
| <avue-crud
| :option="option"
| :table-loading="pageF.loading"
| :data="tableData"
| :page="page"
| v-model="form"
| ref="crudRef"
| @search-change="searchChange"
| @search-reset="searchReset"
| @current-change="currentChange"
| @size-change="sizeChange"
| @on-load="onLoad"
| >
| <template #menu="scope">
| <el-button
| type="text"
| icon="Delete"
| @click="handleForceLogout(scope.row)"
| v-hasPermi="['monitor:online:forceLogout']"
| >强退</el-button>
| </template>
| </avue-crud>
| </basicContainer>
| </template>
| <script setup name="Online" lang="ts">
| import useCurrentInstance from "@/utils/useCurrentInstance";
| import {computed, reactive, ref, toRefs} from "vue";
| import {PageQueryInterface, PagesInterface} from "@/utils/globalInterface";
| import {usePagePlus} from "@/hooks/usePagePlus";
| import {forceLogout, list as initData} from "@/api/monitor/online";
|
| const {proxy} = useCurrentInstance();
|
| const crudRef = ref();
| const data = reactive({
| form: <any>{},
| queryParams: <any & PageQueryInterface>{},
| page: <PagesInterface>{
| pageSize: 10,
| total: 0,
| currentPage: 1,
| },
| selectionList:[]
| });
|
|
|
| const {queryParams,page, form, selectionList} = toRefs(data);
|
| const {
| tableData,pageF,rowSave,rowUpdate,rowDel,beforeOpen,searchChange,
| searchReset,selectionChange,onLoad,currentChange,sizeChange,handleDelete,handleExport,handleUpdate
| } = usePagePlus({
| form:form,
| queryParams:queryParams.value,
| idKey:'tokenId',
| page:page.value,
| getListApi:initData,
|
| })
|
| const option = ref({
| rowKey: 'tokenId',
| addBtn:false,
| editBtn:false,
| delBtn:false,
| viewBtn:false,
| selection:false,
| column: {
| tokenId: {label: '会话编号',overHidden:true,showOverflowTooltip:true},
| userName: {label: '登录名称'},
| deptName: {label: '所属部门'},
| ipaddr: {label: '主机'},
| loginLocation: {label: '登录地点'},
| os: {label: '操作系统'},
| browser: {label: '浏览器'},
| loginTime: {label: '登录时间',formatter:(row:any, value:any, column:any)=>{
| return proxy.parseTime(row.loginTime);
| }},
|
| }
| })
| /** 强退按钮操作 */
| function handleForceLogout(row:any) {
| proxy.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?').then(function () {
| return forceLogout(row.tokenId);
| }).then(() => {
| onLoad(page.value);
| proxy.$modal.msgSuccess("删除成功");
| }).catch(() => {});
| }
|
| </script>
|
|