优化:商户&酒道馆管理后台 - 员工编辑添加是否为管理员编辑

This commit is contained in:
wuhui_zzw 2024-03-06 15:40:34 +08:00
parent b47600bc9d
commit b2d957fbca
3 changed files with 17 additions and 3 deletions

View File

@ -106,7 +106,8 @@ class StoreServiceRepository extends BaseRepository
"status","customer","is_goods","is_verify","notify",'phone',"is_user","staff_manage",'qr_code_show','online_payment','product_exchange'
]
];
}else if($merchantType == 1){
}
else if($merchantType == 1){
$adminRule = [
Elm::switches('is_verify', '核销权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('product_exchange', '商品兑换码', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
@ -134,6 +135,13 @@ class StoreServiceRepository extends BaseRepository
Elm::frameImage('uid', '用户', '/' . $prefix . '/setting/userList?field=uid&type=1')->prop('srcKey', 'src')->width('1000px')->height('600px')->appendValidate(Iview::validateObject()->message('请选择用户')->required())->modal(['modal' => false]),
Elm::frameImage('avatar', '员工头像', '/' . $prefix . '/setting/uploadPicture?field=avatar&type=1')->width('1000px')->height('600px')->props(['footer' => false])->modal(['modal' => false]),
Elm::input('nickname', '员工昵称')->required(),
Elm::switches('is_manage', '是否为管理员', 0)->activeValue(1)->inactiveValue(0)->inactiveText('不是')->activeText('是')->appendRule('suffix',[
'type' => 'div',
'style' => ['color' => '#999999'],
'domProps' => [
'innerHTML' => '只能同时存在一个管理员账号,新账号将会覆盖旧账号!',
]
]),
Elm::input('account', '员工账号')->required(),
$pwd, $confirm_pwd,
Elm::switches('is_open', '账号状态', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8)->control([$filed]),
@ -379,6 +387,10 @@ class StoreServiceRepository extends BaseRepository
// 数据修改
if ($data['pwd']) $data['pwd'] = password_hash($data['pwd'], PASSWORD_BCRYPT);
else unset($data['pwd']);
// 如果存在管理员 删除其他管理员
if($data['is_manage']){
StoreService::update(['is_manage'=>0],['mer_id'=> $data['mer_id']]);
}
return $this->dao->update($id, $data);
}

View File

@ -116,7 +116,8 @@ class Service extends BaseController{
'qr_code_show',
'online_payment',
'product_exchange',
'purchase_permission'
'purchase_permission',
'is_manage'
]);
if(is_array(json_decode($data['uid'], true))) $data['uid'] = json_decode($data['uid'], true);
// 是否编辑

View File

@ -111,7 +111,8 @@ class StoreService extends BaseController
'qr_code_show',
'online_payment',
'product_exchange',
'purchase_permission'
'purchase_permission',
'is_manage'
]);
if ($isUpdate) {
$validate->update();