新增不能对管理员账号进行删除
This commit is contained in:
parent
acc10fde4a
commit
283472b424
@ -150,7 +150,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
public IActionResult Remove(int userid = 0)
|
||||
{
|
||||
if (userid <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
|
||||
|
||||
if (userid == 1) return ToResponse(Infrastructure.ResultCode.FAIL, "不能删除管理员账号");
|
||||
int result = UserService.DeleteUser(userid);
|
||||
|
||||
return ToResponse(ToJson(result));
|
||||
|
||||
@ -111,7 +111,7 @@ namespace ZR.Repository.System
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除用户(物理删除)
|
||||
/// 删除用户(软删除)
|
||||
/// </summary>
|
||||
/// <param name="userid">用户id</param>
|
||||
/// <returns></returns>
|
||||
|
||||
@ -87,8 +87,8 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="160">
|
||||
<template slot-scope="scope" v-if="scope.row.userId !== 1 | scope.row.userName != 'admin'">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">删除
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']">重置
|
||||
</el-button>
|
||||
</template>
|
||||
@ -467,13 +467,10 @@ export default {
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
if(row.userId !== 1 | row.userName != 'admin'){
|
||||
this.msgError("不能对管理进行修改")
|
||||
return;
|
||||
}
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
const userId = row.userId || this.ids;
|
||||
|
||||
getUser(userId).then((response) => {
|
||||
// this.form = response.data.user;
|
||||
var data = response.data;
|
||||
@ -536,6 +533,10 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const userIds = row.userId || this.ids;
|
||||
if (userIds == 1 || row.userName == "admin") {
|
||||
this.msgError("不能对管理进行删除");
|
||||
return;
|
||||
}
|
||||
this.$confirm(
|
||||
'是否确认删除用户编号为"' + userIds + '"的数据项?',
|
||||
"警告",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user