|
@@ -16,10 +16,11 @@
|
|
|
namespace app\user\controller;
|
|
|
|
|
|
use app\common\constant\CommonConstant;
|
|
|
+use app\common\model\Department;
|
|
|
use library\Controller;
|
|
|
|
|
|
/**
|
|
|
- * 用户
|
|
|
+ * 员工
|
|
|
*/
|
|
|
class Member extends Controller
|
|
|
{
|
|
@@ -30,7 +31,7 @@ class Member extends Controller
|
|
|
protected $table = 'StoreMember';
|
|
|
|
|
|
/**
|
|
|
- * 用户列表
|
|
|
+ * 列表
|
|
|
* @auth true
|
|
|
* @menu true
|
|
|
* @throws \think\Exception
|
|
@@ -41,13 +42,18 @@ class Member extends Controller
|
|
|
public function index()
|
|
|
{
|
|
|
$status = input('status');
|
|
|
+ $signature_status = input('signature_status');
|
|
|
$this->get_status_list = CommonConstant::get_status_list();
|
|
|
- $this->title = '用户列表';
|
|
|
+ $this->get_signature_status_list = CommonConstant::get_signature_status_list();
|
|
|
+ $this->title = '员工列表';
|
|
|
$query = $this->_query($this->table)
|
|
|
->where('is_deleted', CommonConstant::IS_DELETED_0)
|
|
|
->when(array_key_exists($status, $this->get_status_list), function ($query) use ($status) {
|
|
|
$query->where('status', $status);
|
|
|
})
|
|
|
+ ->when(array_key_exists($signature_status, $this->get_signature_status_list), function ($query) use ($signature_status) {
|
|
|
+ $query->where('signature_status', $signature_status);
|
|
|
+ })
|
|
|
->like('name,mobile');
|
|
|
$query->page();
|
|
|
}
|
|
@@ -59,7 +65,16 @@ class Member extends Controller
|
|
|
*/
|
|
|
protected function _index_page_filter(&$data)
|
|
|
{
|
|
|
+ $department_list = Department::column('dept_id,name');
|
|
|
foreach ($data as &$value) {
|
|
|
+ $department_ids = explode(',',$value['department']);
|
|
|
+ $department = '';
|
|
|
+ foreach ($department_ids as $val){
|
|
|
+ if(array_key_exists($val,$department_list)){
|
|
|
+ $department .= $department_list[$val].',';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $value['department_text'] = $department;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -69,7 +84,7 @@ class Member extends Controller
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 编辑用户
|
|
|
+ * 编辑
|
|
|
* @auth true
|
|
|
* @throws \think\Exception
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
@@ -79,12 +94,12 @@ class Member extends Controller
|
|
|
*/
|
|
|
public function edit()
|
|
|
{
|
|
|
- $this->title = '编辑用户';
|
|
|
+ $this->title = '编辑';
|
|
|
$this->_form($this->table, 'form');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 启用用户
|
|
|
+ * 启用
|
|
|
* @auth true
|
|
|
* @throws \think\Exception
|
|
|
* @throws \think\exception\PDOException
|
|
@@ -96,14 +111,31 @@ class Member extends Controller
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 禁用用户
|
|
|
+ * 禁用
|
|
|
* @auth true
|
|
|
* @throws \think\Exception
|
|
|
* @throws \think\exception\PDOException
|
|
|
*/
|
|
|
public function forbid()
|
|
|
{
|
|
|
+ $this->applyCsrfToken();
|
|
|
$this->_save($this->table, ['status' => CommonConstant::STATUS_FROZEN]);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 审核签名
|
|
|
+ * @auth true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function signature_status()
|
|
|
+ {
|
|
|
+ $signature_status = input('signature_status');
|
|
|
+ if(!array_key_exists($signature_status,CommonConstant::get_signature_status_list())){
|
|
|
+ $this->controller->error('审核状态参数错误');
|
|
|
+ }
|
|
|
+ $this->applyCsrfToken();
|
|
|
+ $this->_save($this->table, ['signature_status' => $signature_status]);
|
|
|
+ }
|
|
|
+
|
|
|
}
|