春风项目四线(合箱线、总装线)
cl
2024-01-18 d18622be3bf4c48e9cf17bc4d3254245438ed272
提交 | 用户 | 时间
fd2207 1 <template>
2   <div class="app-container">
3     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
4       <el-form-item label="登录地址" prop="ipaddr">
5         <el-input
6           v-model="queryParams.ipaddr"
7           placeholder="请输入登录地址"
8           clearable
9           @keyup.enter.native="handleQuery"
10         />
11       </el-form-item>
12       <el-form-item label="用户名称" prop="userName">
13         <el-input
14           v-model="queryParams.userName"
15           placeholder="请输入用户名称"
16           clearable
17           @keyup.enter.native="handleQuery"
18         />
19       </el-form-item>
20       <el-form-item>
21         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
22         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
23       </el-form-item>
24
25     </el-form>
26     <el-table
27       v-loading="loading"
28       :data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)"
29       style="width: 100%;"
30     >
31       <el-table-column label="序号" type="index" align="center">
32         <template slot-scope="scope">
33           <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
34         </template>
35       </el-table-column>
36       <el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" />
37       <el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
38       <el-table-column label="部门名称" align="center" prop="deptName" />
39       <el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
40       <el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true" />
41       <el-table-column label="浏览器" align="center" prop="browser" />
42       <el-table-column label="操作系统" align="center" prop="os" />
43       <el-table-column label="登录时间" align="center" prop="loginTime" width="180">
44         <template slot-scope="scope">
45           <span>{{ parseTime(scope.row.loginTime) }}</span>
46         </template>
47       </el-table-column>
48       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
49         <template slot-scope="scope">
50           <el-button
51             size="mini"
52             type="text"
53             icon="el-icon-delete"
54             @click="handleForceLogout(scope.row)"
55             v-hasPermi="['monitor:online:forceLogout']"
56           >强退</el-button>
57         </template>
58       </el-table-column>
59     </el-table>
60
61     <pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
62   </div>
63 </template>
64
65 <script>
66 import { list, forceLogout } from "@/api/monitor/online";
67
68 export default {
69   name: "Online",
70   data() {
71     return {
72       // 遮罩层
73       loading: true,
74       // 总条数
75       total: 0,
76       // 表格数据
77       list: [],
78       pageNum: 1,
79       pageSize: 10,
80       // 查询参数
81       queryParams: {
82         ipaddr: undefined,
83         userName: undefined
84       }
85     };
86   },
87   created() {
88     this.getList();
89   },
90   methods: {
91     /** 查询登录日志列表 */
92     getList() {
93       this.loading = true;
94       list(this.queryParams).then(response => {
95         this.list = response.rows;
96         this.total = response.total;
97         this.loading = false;
98       });
99     },
100     /** 搜索按钮操作 */
101     handleQuery() {
102       this.pageNum = 1;
103       this.getList();
104     },
105     /** 重置按钮操作 */
106     resetQuery() {
107       this.resetForm("queryForm");
108       this.handleQuery();
109     },
110     /** 强退按钮操作 */
111     handleForceLogout(row) {
112       this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?').then(function() {
113         return forceLogout(row.tokenId);
114       }).then(() => {
115         this.getList();
116         this.$modal.msgSuccess("强退成功");
117       }).catch(() => {});
118     }
119   }
120 };
121 </script>
122