diff --git a/src/views/system/UserList.vue b/src/views/system/UserList.vue index d3ead49..f05abb4 100644 --- a/src/views/system/UserList.vue +++ b/src/views/system/UserList.vue @@ -86,7 +86,7 @@
- {{ $t('user.addUser') }} + {{ $t('user.addUser') }} {{ $t('export') }} @@ -126,6 +126,8 @@ :pagination="ipagination" :loading="loading" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + :operationList="operationList" + @operationClick="operationClick" @change="handleTableChange"> - -
@@ -212,6 +171,7 @@ import UserRecycleBinModal from './modules/UserRecycleBinModal' import JTable from '@/components/jero/JTable' import JSearchSelectTag from '@/components/dict/JSearchSelectTag' import UploadHandStampModal from './modules/UploadHandStampModal' +import { isHasPermission } from '../../utils/hasPermission' export default { name: 'UserList', @@ -336,7 +296,66 @@ export default { exportXlsUrl: '/sys/user/exportXls', importExcelUrl: 'sys/user/importExcel', getSysCategoryTree: '/sys/sysDepart/queryTreeList' // 获取组织机构树 - } + }, + operationList: [ + // 编辑 + { + text: this.$t('edit'), + clickEvent: 'handleEdit', + has: 'user:edit' + }, + // 详情 + { + text: this.$t('details'), + clickEvent: 'handleDetail', + has: '', + show: (record) => { + return this.isDev + } + }, + // 密码 + { + text: this.$t('user.password'), + clickEvent: 'handleChangePassword', + has: '', + show: (record) => { + return this.isDev + } + }, + // 删除 + { + text: this.$t('delete'), + clickEvent: 'handleDelete', + has: 'sys:user:sel' + }, + // 冻结 + { + text: this.$t('user.frozen'), + clickEvent: 'handleFrozen', + has: 'user:edit', + show: (record) => { + return this.isDev && (record.status + '') === '1' + } + }, + // 解冻 + { + text: this.$t('user.thaw'), + clickEvent: 'handleFrozen', + has: 'user:edit', + show: (record) => { + return this.isDev && (record.status + '') === '2' + } + }, + // 上传手写章 + { + text: this.$t('user.uploadHandStamp'), + clickEvent: 'handleUploadHandStamp', + has: 'user:uploadHandStamp', + show: (record) => { + return false + } + } + ] } }, computed: { @@ -349,6 +368,7 @@ export default { this.initRoleList() }, methods: { + isHasPermission, getAvatarView: function (avatar) { return getFileAccessHttpUrl(avatar) }, @@ -399,6 +419,19 @@ export default { this.batchFrozen('1') } }, + operationClick (operation, record) { + if (operation.clickEvent === 'handleDelete') { + this.handleDelete(record.id) + } else if (operation.clickEvent === 'handleChangePassword') { + this.handleChangePassword(record.username) + } else if (operation.text === this.$t('user.frozen')) { + this.handleFrozen(record.id, 2, record.username) + } else if (operation.text === this.$t('user.thaw')) { + this.handleFrozen(record.id, 1, record.username) + } else { + this[operation.clickEvent](record) + } + }, handleFrozen: function (id, status, username) { const that = this if (username === 'admin') {