|
|
@@ -0,0 +1,265 @@
|
|
|
+<template>
|
|
|
+ <div v-loading="loading">
|
|
|
+ <div class="white-box">
|
|
|
+ <div class="filter-box">
|
|
|
+ <filter-user
|
|
|
+ :filter-types.sync="filterTypes"
|
|
|
+ :filter-btn-name="$t('Administrator.filterBtnName')"
|
|
|
+ @select-value="handleFilterUser"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <el-table :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" :selectable="checkSelectable" />
|
|
|
+ <el-table-column :label="$t('Administrator.loginAccount')" prop="ADMIN_NAME" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag type="" size="small" class="no-border">{{ scope.row.ADMIN_NAME }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.name')" prop="REAL_NAME" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.REAL_NAME }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.remark')" prop="REMARK" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.REMARK }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.role')" prop="ROLE_NAME" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag type="warning" size="small" class="no-border">{{ scope.row.ROLE_NAME }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.isEnable')" prop="IS_ENABLE">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="(scope.row.IS_ENABLE==1?'success':'danger')">
|
|
|
+ <template v-if="scope.row.IS_ENABLE==1">
|
|
|
+ {{ $t('common.yes') }}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ {{ $t('common.no') }}
|
|
|
+ </template>
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.loginTimes')" prop="LOGIN_NUMS">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.LOGIN_NUMS }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.lastLoginIp')" prop="LAST_LOGIN_IP" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.LAST_LOGIN_IP }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.lastLoginAt')" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ tool.formatDate(scope.row.LAST_LOGIN_AT) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.bindIp')" width="250">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.BIND_IP }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.creatUser')" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.CREATE_ADMIN_NAME }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.creatAt')" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ tool.formatDate(scope.row.CREATED_AT) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.updateUser')" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.UPDATE_ADMIN_NAME }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('Administrator.updateAt')" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ tool.formatDate(scope.row.UPDATED_AT) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column fixed="right" :label="$t('table.actions')" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-dropdown v-if="scope.row.DONT_DEL!=='1'&&(permission.hasPermission(`admin/edit`)||permission.hasPermission(`admin/admin-delete`))" size="small" trigger="click" @command="handleRow" @click.stop="">
|
|
|
+ <el-button type="primary" size="small">
|
|
|
+ {{ $t('common.action') }}<i class="el-icon-arrow-down el-icon--right" />
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item v-if="permission.hasPermission(`admin/edit`)" :command="`edit|${scope.row.ID}`">{{ $t('common.edit') }}</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-if="permission.hasPermission(`admin/admin-delete`)" :command="`delete|${scope.row.ID}`">{{ $t('common.delete') }}</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="white-box-footer">
|
|
|
+ <el-dropdown v-if="permission.hasPermission(`admin/admin-delete`)" size="small" trigger="click" @command="handleMuliDel">
|
|
|
+ <el-button type="primary" size="small">
|
|
|
+ {{ $t('Administrator.selectData') }}
|
|
|
+ <!--所选数据--><i class="el-icon-arrow-down el-icon--right" />
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="delete">{{ $t('common.delete') }}</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ <el-button v-show="permission.hasPermission(`admin/add`)" type="primary" size="small" icon="el-icon-plus" @click="handleAdd">{{ $t('Administrator.addAdmin') }}</el-button>
|
|
|
+ <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { adminList, adminDelete } from '@/api/filter'
|
|
|
+import tool from '@/utils/tool'
|
|
|
+import FilterUser from '@/components/FilterUser'
|
|
|
+import permission from '@/utils/permission'
|
|
|
+import Pagination from '@/components/Pagination'
|
|
|
+import filterHelper from '@/utils/filterHelper'
|
|
|
+export default {
|
|
|
+ name: 'DecLevel',
|
|
|
+ components: { FilterUser, Pagination },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tableData: null,
|
|
|
+ loading: true,
|
|
|
+ multipleSelection: [],
|
|
|
+ currentPage: 1,
|
|
|
+ totalPages: 1,
|
|
|
+ totalCount: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ tool: tool,
|
|
|
+ permission: permission,
|
|
|
+ filterData: null,
|
|
|
+ filterTypes: {
|
|
|
+ 'ADMIN_NAME': { isUserTable: false, name: this.$t('Administrator.loginAccount') },
|
|
|
+ 'REAL_NAME': { isUserTable: false, name: this.$t('Administrator.name') },
|
|
|
+ 'REMARK': { isUserTable: false, name: this.$t('Administrator.remark') },
|
|
|
+ 'ROLE_NAME': { isUserTable: false, name: this.$t('Administrator.role') },
|
|
|
+ 'IS_ENABLE': { isUserTable: false, name: this.$t('Administrator.isEnable'), other: 'yesOrNo' },
|
|
|
+ 'LOGIN_NUMS': { isUserTable: false, name: this.$t('Administrator.loginTimes') },
|
|
|
+ 'LAST_LOGIN_IP': { isUserTable: false, name: this.$t('Administrator.lastLoginIp') },
|
|
|
+ 'LAST_LOGIN_AT': { isUserTable: false, name: this.$t('Administrator.lastLoginAt'), other: 'date' },
|
|
|
+ 'BIND_IP': { isUserTable: false, name: this.$t('Administrator.bindIp') },
|
|
|
+ 'CREATE_ADMIN_NAME': { isUserTable: false, name: this.$t('Administrator.creatUser') },
|
|
|
+ 'CREATED_AT': { isUserTable: false, name: this.$t('Administrator.creatAt'), other: 'date' },
|
|
|
+ 'UPDATE_ADMIN_NAME': { isUserTable: false, name: this.$t('Administrator.updateUser') },
|
|
|
+ 'UPDATED_AT': { isUserTable: false, name: this.$t('Administrator.updateAt'), other: 'date' }
|
|
|
+ },
|
|
|
+ filterModel: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ checkSelectable(row) {
|
|
|
+ return row.DONT_DEL !== '1'
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val
|
|
|
+ },
|
|
|
+ handleCurrentChange(page) {
|
|
|
+ this.getData(page, this.pageSize)
|
|
|
+ },
|
|
|
+ handleSizeChange(pageSize) {
|
|
|
+ this.getData(this.currentPage, pageSize)
|
|
|
+ },
|
|
|
+ handleRow(command) {
|
|
|
+ const re = command.split('|')
|
|
|
+ this.handleCommand(re[0], re[1])
|
|
|
+ },
|
|
|
+ handleMuliDel(command) {
|
|
|
+ if (command === 'delete') {
|
|
|
+ this.delData(this)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.$router.push({ path: `/admin/add` })
|
|
|
+ },
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.$router.push({ path: `/admin/edit/${row.ID}` })
|
|
|
+ },
|
|
|
+ handleCommand(command, id) {
|
|
|
+ if (command === 'edit') {
|
|
|
+ this.$router.push({ path: `/admin/edit/${id}` })
|
|
|
+ } else if (command === 'delete') {
|
|
|
+ this.delData(this, id)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleFilterUser(filterData) {
|
|
|
+ filterHelper.handleFilterUser(this, filterData)
|
|
|
+ },
|
|
|
+ handleFilter() {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ getData(page, pageSize) {
|
|
|
+ const filterData = this.filterModel
|
|
|
+ const vueObj = this
|
|
|
+ const paramsData = Object.assign({
|
|
|
+ page: (page === null || page == undefined) ? 1 : page,
|
|
|
+ pageSize: (pageSize === null || pageSize == undefined) ? vueObj.pageSize : pageSize
|
|
|
+ }, filterData)
|
|
|
+ adminList(paramsData).then(response => {
|
|
|
+ vueObj.tableData = response.data.list
|
|
|
+ vueObj.currentPage = page
|
|
|
+ vueObj.totalPages = parseInt(response.data.totalPages)
|
|
|
+ vueObj.totalCount = parseInt(response.data.totalCount)
|
|
|
+ vueObj.pageSize = pageSize
|
|
|
+ this.loading = false
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('err=============' + err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ delData(obj, id = null) {
|
|
|
+ obj.$confirm(this.$t('Administrator.delNotice'), this.$t('common.hint'), {
|
|
|
+ confirmButtonText: this.$t('common.confirm'), // 确定
|
|
|
+ cancelButtonText: this.$t('common.cancel'), // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const selectedIds = []
|
|
|
+ if (id === null) {
|
|
|
+ for (const val of obj.multipleSelection) {
|
|
|
+ selectedIds.push(val.ID)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedIds.push(id)
|
|
|
+ }
|
|
|
+ return adminDelete({
|
|
|
+ selected: selectedIds
|
|
|
+ }).then(response => {
|
|
|
+ obj.$message({
|
|
|
+ message: response.data,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ obj.getData()
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('err---------' + err)
|
|
|
+ })
|
|
|
+ // return network.postData(`admin/admin-delete`, {
|
|
|
+ // selected: selectedIds
|
|
|
+ // })
|
|
|
+ }).then(response => {
|
|
|
+ obj.$message({
|
|
|
+ message: response.data,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ obj.getData()
|
|
|
+ }).catch(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+ <style scoped>
|
|
|
+
|
|
|
+ </style>
|