From be7766b5f0dec84d537af9811e50f46ab3dfdb2a Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 08 八月 2022 10:03:56 +0800 Subject: [PATCH] update 同步ruoyi --- ruoyi-ui/src/views/monitor/logininfor/index.vue | 475 ++++++++++++++++++++++++++++++---------------------------- 1 files changed, 245 insertions(+), 230 deletions(-) diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index 8b0cdc4..c7776f5 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -1,230 +1,245 @@ -<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="cyan" 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" - 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" - 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" - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['system: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, - // 閫変腑鏁扮粍 - 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(function() {}); - }, - /** 娓呯┖鎸夐挳鎿嶄綔 */ - handleClean() { - this.$confirm('鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return cleanLogininfor(); - }).then(() => { - this.getList(); - this.msgSuccess("娓呯┖鎴愬姛"); - }).catch(function() {}); - }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return exportLogininfor(queryParams); - }).then(response => { - this.download(response.msg); - }).catch(function() {}); - } - } -}; -</script> - +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :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;" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐢ㄦ埛鍚嶇О" prop="userName"> + <el-input + v-model="queryParams.userName" + placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" + clearable + style="width: 240px;" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐘舵��" prop="status"> + <el-select + v-model="queryParams.status" + placeholder="鐧诲綍鐘舵��" + clearable + style="width: 240px" + > + <el-option + v-for="dict in dict.type.sys_common_status" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + <el-form-item label="鐧诲綍鏃堕棿"> + <el-date-picker + v-model="dateRange" + 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="primary" + plain + icon="el-icon-unlock" + size="mini" + :disabled="single" + @click="handleUnlock" + v-hasPermi="['monitor:logininfor:unlock']" + >瑙i攣</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['monitor:logininfor:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <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" :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" :show-overflow-tooltip="true" /> + <el-table-column label="鎿嶄綔绯荤粺" align="center" prop="os" /> + <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" sortable="custom" :sort-orders="['descending', 'ascending']" 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, unlockLogininfor } from "@/api/monitor/logininfor"; + +export default { + name: "Logininfor", + dicts: ['sys_common_status'], + data() { + return { + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 閫夋嫨鐢ㄦ埛鍚� + selectName: "", + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 琛ㄦ牸鏁版嵁 + list: [], + // 鏃ユ湡鑼冨洿 + dateRange: [], + // 榛樿鎺掑簭 + defaultSort: {prop: 'loginTime', order: 'descending'}, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + ipaddr: undefined, + userName: undefined, + status: undefined + } + }; + }, + created() { + this.getList(); + }, + 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; + } + ); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + 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.single = selection.length!=1 + this.multiple = !selection.length + this.selectName = selection.map(item => item.userName); + }, + /** 鎺掑簭瑙﹀彂浜嬩欢 */ + 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.$modal.confirm('鏄惁纭鍒犻櫎璁块棶缂栧彿涓�"' + infoIds + '"鐨勬暟鎹」锛�').then(function() { + return delLogininfor(infoIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 娓呯┖鎸夐挳鎿嶄綔 */ + handleClean() { + this.$modal.confirm('鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」锛�').then(function() { + return cleanLogininfor(); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("娓呯┖鎴愬姛"); + }).catch(() => {}); + }, + /** 瑙i攣鎸夐挳鎿嶄綔 */ + handleUnlock() { + const username = this.selectName; + this.$modal.confirm('鏄惁纭瑙i攣鐢ㄦ埛"' + username + '"鏁版嵁椤�?').then(function() { + return unlockLogininfor(username); + }).then(() => { + this.$modal.msgSuccess("鐢ㄦ埛" + username + "瑙i攣鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('monitor/logininfor/export', { + ...this.queryParams + }, `logininfor_${new Date().getTime()}.xlsx`) + } + } +}; +</script> + -- Gitblit v1.9.3