From 284f47e76c16e1c7837cb74f96449072ad68ff9d Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期五, 15 十月 2021 16:19:51 +0800
Subject: [PATCH] update 代码生成 改为生成抽象实体
---
ruoyi-ui/src/views/monitor/logininfor/index.vue | 91 ++++++++++++++++++++-------------------------
1 files changed, 41 insertions(+), 50 deletions(-)
diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue
index c181267..5b11301 100644
--- a/ruoyi-ui/src/views/monitor/logininfor/index.vue
+++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue
@@ -30,10 +30,10 @@
style="width: 240px"
>
<el-option
- v-for="dict in statusOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
+ v-for="dict in dict.type.sys_common_status"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
/>
</el-select>
</el-form-item>
@@ -83,6 +83,7 @@
plain
icon="el-icon-download"
size="mini"
+ :loading="exportLoading"
@click="handleExport"
v-hasPermi="['monitor:logininfor:export']"
>瀵煎嚭</el-button>
@@ -90,17 +91,21 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
- <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
+ <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<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="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" />
<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="browser" :show-overflow-tooltip="true" />
<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="status">
+ <template slot-scope="scope">
+ <dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="鎿嶄綔淇℃伅" align="center" prop="msg" />
- <el-table-column label="鐧诲綍鏃ユ湡" align="center" prop="loginTime" width="180">
+ <el-table-column label="鐧诲綍鏃ユ湡" align="center" prop="loginTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>
@@ -118,14 +123,17 @@
</template>
<script>
-import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor";
+import { list, delLogininfor, cleanLogininfor } from "@/api/monitor/logininfor";
export default {
name: "Logininfor",
+ dicts: ['sys_common_status'],
data() {
return {
// 閬僵灞�
loading: true,
+ // 瀵煎嚭閬僵灞�
+ exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲涓鐢�
@@ -136,10 +144,10 @@
total: 0,
// 琛ㄦ牸鏁版嵁
list: [],
- // 鐘舵�佹暟鎹瓧鍏�
- statusOptions: [],
// 鏃ユ湡鑼冨洿
dateRange: [],
+ // 榛樿鎺掑簭
+ defaultSort: {prop: 'loginTime', order: 'descending'},
// 鏌ヨ鍙傛暟
queryParams: {
pageNum: 1,
@@ -152,9 +160,6 @@
},
created() {
this.getList();
- this.getDicts("sys_common_status").then(response => {
- this.statusOptions = response.data;
- });
},
methods: {
/** 鏌ヨ鐧诲綍鏃ュ織鍒楄〃 */
@@ -167,10 +172,6 @@
}
);
},
- // 鐧诲綍鐘舵�佸瓧鍏哥炕璇�
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
- },
/** 鎼滅储鎸夐挳鎿嶄綔 */
handleQuery() {
this.queryParams.pageNum = 1;
@@ -180,52 +181,42 @@
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
+ this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
this.handleQuery();
},
- // 澶氶�夋閫変腑鏁版嵁
+ /** 澶氶�夋閫変腑鏁版嵁 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.infoId)
this.multiple = !selection.length
},
+ /** 鎺掑簭瑙﹀彂浜嬩欢 */
+ handleSortChange(column, prop, order) {
+ this.queryParams.orderByColumn = column.prop;
+ this.queryParams.isAsc = column.order;
+ this.getList();
+ },
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
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("鍒犻櫎鎴愬姛");
- })
+ this.$modal.confirm('鏄惁纭鍒犻櫎璁块棶缂栧彿涓�"' + infoIds + '"鐨勬暟鎹」锛�').then(function() {
+ return delLogininfor(infoIds);
+ }).then(() => {
+ this.getList();
+ this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ }).catch(() => {});
},
/** 娓呯┖鎸夐挳鎿嶄綔 */
handleClean() {
- this.$confirm('鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」?', "璀﹀憡", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- }).then(function() {
- return cleanLogininfor();
- }).then(() => {
- this.getList();
- this.msgSuccess("娓呯┖鎴愬姛");
- })
+ this.$modal.confirm('鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」锛�').then(function() {
+ return cleanLogininfor();
+ }).then(() => {
+ this.getList();
+ this.$modal.msgSuccess("娓呯┖鎴愬姛");
+ }).catch(() => {});
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- }).then(function() {
- return exportLogininfor(queryParams);
- }).then(response => {
- this.download(response.msg);
- })
+ this.$download.excel('/monitor/logininfor/export', this.queryParams);
}
}
};
--
Gitblit v1.9.3