[update] 用户管理客户环境放开新增编辑删除

This commit is contained in:
lideqin
2024-07-31 13:36:38 +08:00
parent 8bc3d4d030
commit 8301963a8b
+78 -45
View File
@@ -86,7 +86,7 @@
<!-- 操作按钮区域 -->
<div class="table-operator" style="border-top: 5px">
<a-button v-if="isDev" @click="handleAdd" type="primary" icon="plus">{{ $t('user.addUser') }}</a-button>
<a-button @click="handleAdd" type="primary" icon="plus">{{ $t('user.addUser') }}</a-button>
<a-button type="primary" ghost icon="upload" @click="handleExportXls($t('user.userInformation'), '.xls')">{{ $t('export') }}</a-button>
<!--<a-button v-if="isDev" type="primary" ghost icon="hdd" @click="recycleBinVisible=true">{{ $t('recycleBin') }}</a-button>-->
<!--<a-button v-if="isDev" type="primary" ghost icon="hdd" @click="roleAssignment">{{ $t('user.roleAllocation') }}</a-button>-->
@@ -126,6 +126,8 @@
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
:operationList="operationList"
@operationClick="operationClick"
@change="handleTableChange">
<template v-slot:avatarslot="{text, record}">
@@ -134,49 +136,6 @@
</div>
</template>
<template v-slot:action="{text, record}" v-if="isDev">
<a @click="handleEdit(record)" v-has="'user:edit'">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">
<a-icon type="more" class="operate-icon-btn operate-icon-more" />
</a>
<a-menu slot="overlay">
<a-menu-item>
<a href="javascript:" @click="handleDetail(record)">{{ $t('details') }}</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:" @click="handleChangePassword(record.username)">{{ $t('user.password') }}</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm :title="$t('areYouSure')" @confirm="() => handleDelete(record.id)">
<a>{{ $t('delete') }}</a>
</a-popconfirm>
</a-menu-item>
<a-menu-item v-if="(record.status + '')==='1'" v-has="'user:edit'">
<a-popconfirm :title="$t('user.freezePassword')" @confirm="() => handleFrozen(record.id,2,record.username)">
<a>{{ $t('user.frozen') }}</a>
</a-popconfirm>
</a-menu-item>
<a-menu-item v-if="(record.status + '')==='2'" v-has="'user:edit'">
<a-popconfirm :title="$t('user.youThaw')" @confirm="() => handleFrozen(record.id,1,record.username)">
<a>{{ $t('user.thaw') }}</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
<template v-slot:action="{text, record}" v-else>
<a href="javascript:" @click="handleDetail(record)">{{ $t('details') }}</a>
<a-divider type="vertical" v-has="'user:uploadHandStamp'" />
<a @click="handleUploadHandStamp(record)" v-has="'user:uploadHandStamp'">{{ $t('user.uploadHandStamp') }}</a>
</template>
</j-table>
</div>
<!-- table区域-end -->
@@ -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') {