From b3541e975898e17a6cbc1a9ea776f3ec7e91d39a Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期六, 12 六月 2021 20:13:35 +0800
Subject: [PATCH] update 优化 使用 hutool 替换 ruoyi 自带工具类 解决部分方法过期与高版本JDK不兼容问题
---
ruoyi-ui/src/views/monitor/logininfor/index.vue | 376 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 238 insertions(+), 138 deletions(-)
diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue
index 7bc42aa..92baaa9 100644
--- a/ruoyi-ui/src/views/monitor/logininfor/index.vue
+++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue
@@ -1,138 +1,238 @@
-<template>
- <div class="app-container">
- <el-form :inline="true" label-width="68px">
- <el-form-item label="鐧诲綍鍦板潃">
- <el-input
- v-model="queryParams.ipaddr"
- placeholder="璇疯緭鍏ョ櫥褰曞湴鍧�"
- clearable
- style="width: 240px;"
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="鐢ㄦ埛鍚嶇О">
- <el-input
- v-model="queryParams.userName"
- placeholder="璇疯緭鍏ョ敤鎴峰悕绉�"
- clearable
- style="width: 240px;"
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="鐘舵��">
- <el-select
- v-model="queryParams.status"
- placeholder="鐧诲綍鐘舵��"
- clearable
- size="small"
- style="width: 240px"
- >
- <el-option
- v-for="dict in statusOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="鐧诲綍鏃堕棿">
- <el-date-picker
- v-model="dateRange"
- size="small"
- style="width: 240px"
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- ></el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
- </el-form-item>
- </el-form>
-
- <el-table v-loading="loading" :data="list" style="width: 100%;">
- <el-table-column label="璁块棶缂栧彿" align="center" prop="infoId" />
- <el-table-column label="鐢ㄦ埛鍚嶇О" align="center" prop="userName" />
- <el-table-column label="鐧诲綍鍦板潃" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" />
- <el-table-column label="鐧诲綍鍦扮偣" align="center" prop="loginLocation" />
- <el-table-column label="娴忚鍣�" align="center" prop="browser" />
- <el-table-column label="鎿嶄綔绯荤粺" align="center" prop="os" />
- <el-table-column label="鐧诲綍鐘舵��" align="center" prop="status" :formatter="statusFormat" />
- <el-table-column label="鎿嶄綔淇℃伅" align="center" prop="msg" />
- <el-table-column label="鐧诲綍鏃ユ湡" align="center" prop="loginTime" width="180">
- <template slot-scope="scope">
- <span>{{ dateFormat(scope.row.loginTime) }}</span>
- </template>
- </el-table-column>
- </el-table>
-
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
-</template>
-
-<script>
-import { list } from "@/api/monitor/logininfor";
-
-export default {
- data() {
- return {
- // 閬僵灞�
- loading: true,
- // 鎬绘潯鏁�
- total: 0,
- // 琛ㄦ牸鏁版嵁
- list: [],
- // 鐘舵�佹暟鎹瓧鍏�
- statusOptions: [],
- // 鏃ユ湡鑼冨洿
- dateRange: [],
- // 鏌ヨ鍙傛暟
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- ipaddr: undefined,
- userName: undefined,
- status: undefined
- }
- };
- },
- created() {
- this.getList();
- this.getDicts("sys_common_status").then(response => {
- this.statusOptions = response.data;
- });
- },
- methods: {
- /** 鏌ヨ鐧诲綍鏃ュ織鍒楄〃 */
- getList() {
- this.loading = true;
- list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
- this.list = response.rows;
- this.total = response.total;
- this.loading = false;
- }
- );
- },
- // 鐧诲綍鐘舵�佸瓧鍏哥炕璇�
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
- },
- /** 鎼滅储鎸夐挳鎿嶄綔 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- }
- }
-};
-</script>
-
+<template>
+ <div class="app-container">
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+ <el-form-item label="鐧诲綍鍦板潃" prop="ipaddr">
+ <el-input
+ v-model="queryParams.ipaddr"
+ placeholder="璇疯緭鍏ョ櫥褰曞湴鍧�"
+ clearable
+ style="width: 240px;"
+ size="small"
+ @keyup.enter.native="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="鐢ㄦ埛鍚嶇О" prop="userName">
+ <el-input
+ v-model="queryParams.userName"
+ placeholder="璇疯緭鍏ョ敤鎴峰悕绉�"
+ clearable
+ style="width: 240px;"
+ size="small"
+ @keyup.enter.native="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="鐘舵��" prop="status">
+ <el-select
+ v-model="queryParams.status"
+ placeholder="鐧诲綍鐘舵��"
+ clearable
+ size="small"
+ style="width: 240px"
+ >
+ <el-option
+ v-for="dict in statusOptions"
+ :key="dict.dictValue"
+ :label="dict.dictLabel"
+ :value="dict.dictValue"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鐧诲綍鏃堕棿">
+ <el-date-picker
+ v-model="dateRange"
+ size="small"
+ style="width: 240px"
+ value-format="yyyy-MM-dd"
+ type="daterange"
+ range-separator="-"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ ></el-date-picker>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
+
+ <el-row :gutter="10" class="mb8">
+ <el-col :span="1.5">
+ <el-button
+ type="danger"
+ plain
+ icon="el-icon-delete"
+ size="mini"
+ :disabled="multiple"
+ @click="handleDelete"
+ v-hasPermi="['monitor:logininfor:remove']"
+ >鍒犻櫎</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button
+ type="danger"
+ plain
+ icon="el-icon-delete"
+ size="mini"
+ @click="handleClean"
+ v-hasPermi="['monitor:logininfor:remove']"
+ >娓呯┖</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button
+ type="warning"
+ plain
+ icon="el-icon-download"
+ size="mini"
+ :loading="exportLoading"
+ @click="handleExport"
+ v-hasPermi="['monitor:logininfor:export']"
+ >瀵煎嚭</el-button>
+ </el-col>
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+ </el-row>
+
+ <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
+ <el-table-column type="selection" width="55" align="center" />
+ <el-table-column label="璁块棶缂栧彿" align="center" prop="infoId" />
+ <el-table-column label="鐢ㄦ埛鍚嶇О" align="center" prop="userName" />
+ <el-table-column label="鐧诲綍鍦板潃" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" />
+ <el-table-column label="鐧诲綍鍦扮偣" align="center" prop="loginLocation" :show-overflow-tooltip="true" />
+ <el-table-column label="娴忚鍣�" align="center" prop="browser" />
+ <el-table-column label="鎿嶄綔绯荤粺" align="center" prop="os" />
+ <el-table-column label="鐧诲綍鐘舵��" align="center" prop="status" :formatter="statusFormat" />
+ <el-table-column label="鎿嶄綔淇℃伅" align="center" prop="msg" />
+ <el-table-column label="鐧诲綍鏃ユ湡" align="center" prop="loginTime" width="180">
+ <template slot-scope="scope">
+ <span>{{ parseTime(scope.row.loginTime) }}</span>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <pagination
+ v-show="total>0"
+ :total="total"
+ :page.sync="queryParams.pageNum"
+ :limit.sync="queryParams.pageSize"
+ @pagination="getList"
+ />
+ </div>
+</template>
+
+<script>
+import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor";
+
+export default {
+ name: "Logininfor",
+ data() {
+ return {
+ // 閬僵灞�
+ loading: true,
+ // 瀵煎嚭閬僵灞�
+ exportLoading: false,
+ // 閫変腑鏁扮粍
+ ids: [],
+ // 闈炲涓鐢�
+ multiple: true,
+ // 鏄剧ず鎼滅储鏉′欢
+ showSearch: true,
+ // 鎬绘潯鏁�
+ total: 0,
+ // 琛ㄦ牸鏁版嵁
+ list: [],
+ // 鐘舵�佹暟鎹瓧鍏�
+ statusOptions: [],
+ // 鏃ユ湡鑼冨洿
+ dateRange: [],
+ // 鏌ヨ鍙傛暟
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ ipaddr: undefined,
+ userName: undefined,
+ status: undefined
+ }
+ };
+ },
+ created() {
+ this.getList();
+ this.getDicts("sys_common_status").then(response => {
+ this.statusOptions = response.data;
+ });
+ },
+ methods: {
+ /** 鏌ヨ鐧诲綍鏃ュ織鍒楄〃 */
+ getList() {
+ this.loading = true;
+ list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+ this.list = response.rows;
+ this.total = response.total;
+ this.loading = false;
+ }
+ );
+ },
+ // 鐧诲綍鐘舵�佸瓧鍏哥炕璇�
+ statusFormat(row, column) {
+ return this.selectDictLabel(this.statusOptions, row.status);
+ },
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ handleQuery() {
+ this.queryParams.pageNum = 1;
+ this.getList();
+ },
+ /** 閲嶇疆鎸夐挳鎿嶄綔 */
+ resetQuery() {
+ this.dateRange = [];
+ this.resetForm("queryForm");
+ this.handleQuery();
+ },
+ // 澶氶�夋閫変腑鏁版嵁
+ handleSelectionChange(selection) {
+ this.ids = selection.map(item => item.infoId)
+ this.multiple = !selection.length
+ },
+ /** 鍒犻櫎鎸夐挳鎿嶄綔 */
+ handleDelete(row) {
+ const infoIds = row.infoId || this.ids;
+ this.$confirm('鏄惁纭鍒犻櫎璁块棶缂栧彿涓�"' + infoIds + '"鐨勬暟鎹」?', "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }).then(function() {
+ return delLogininfor(infoIds);
+ }).then(() => {
+ this.getList();
+ this.msgSuccess("鍒犻櫎鎴愬姛");
+ }).catch(() => {});
+ },
+ /** 娓呯┖鎸夐挳鎿嶄綔 */
+ handleClean() {
+ this.$confirm('鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」?', "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }).then(function() {
+ return cleanLogininfor();
+ }).then(() => {
+ this.getList();
+ this.msgSuccess("娓呯┖鎴愬姛");
+ }).catch(() => {});
+ },
+ /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+ handleExport() {
+ const queryParams = this.queryParams;
+ this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }).then(() => {
+ this.exportLoading = true;
+ return exportLogininfor(queryParams);
+ }).then(response => {
+ this.download(response.msg);
+ this.exportLoading = false;
+ }).catch(() => {});
+ }
+ }
+};
+</script>
+
--
Gitblit v1.9.3