增加管理员帐号的部门属性设置
This commit is contained in:
parent
8704871337
commit
dc4bbcb80f
@ -34,7 +34,7 @@ class AccountController extends BaseController {
|
||||
@permission('admin:save')
|
||||
@router('post /admin/save')
|
||||
async save(req) {
|
||||
const { id, username, password, roles, showname, sex, locked } = req.params
|
||||
const { id, username, password, roles, showname, sex, locked, department } = req.params
|
||||
let account
|
||||
if (id) {
|
||||
account = await Admin.findById(id)
|
||||
@ -60,6 +60,10 @@ class AccountController extends BaseController {
|
||||
}
|
||||
if (showname) account.showname = showname
|
||||
account.sex = sex || '0'
|
||||
// 管理员不需要设置部门属性
|
||||
if (ADMINS.indexOf(username) < 0) {
|
||||
account.department = department
|
||||
}
|
||||
if (locked != undefined) {
|
||||
if (locked) {
|
||||
if (ADMINS.indexOf(username) >= 0) {
|
||||
|
@ -87,6 +87,12 @@ class AdminClass extends FindOrCreate {
|
||||
public locked: boolean
|
||||
@prop()
|
||||
public lockTime: Date
|
||||
/**
|
||||
* 部门
|
||||
* @type {string}
|
||||
*/
|
||||
@prop()
|
||||
public department?: string
|
||||
|
||||
public static async findByName(this: ReturnModelType<typeof AdminClass>, username) {
|
||||
return this.findOne({ username, deleted: false }).exec()
|
||||
@ -122,7 +128,8 @@ class AdminClass extends FindOrCreate {
|
||||
createdBy: this.createdBy,
|
||||
introduction: this.introduction,
|
||||
locked: this.locked,
|
||||
comment: this.comment
|
||||
comment: this.comment,
|
||||
department: this.department
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user