|
@@ -4,7 +4,9 @@
|
|
|
namespace app\bug\controller;
|
|
|
|
|
|
|
|
|
-use think\App;use think\facade\Validate;
|
|
|
+use app\bug\model\WorkAction;
|
|
|
+use app\bug\model\WorkTemplate;use think\App;
|
|
|
+use think\facade\Validate;
|
|
|
class Work extends Base{
|
|
|
public function __construct(App $app) {
|
|
|
parent::__construct($app);
|
|
@@ -58,7 +60,16 @@ class Work extends Base{
|
|
|
$add = $info->delete();
|
|
|
return $add ? success('删除成功'):error('删除失败');
|
|
|
}
|
|
|
-
|
|
|
+ //岗位模板新建
|
|
|
+ public function list(){
|
|
|
+ $param=$this->request->param(['work_name'=>'','belong'=>'','level'=>''],'post','trim');
|
|
|
+ $where=[];
|
|
|
+ if($param['level']!='')$where[]=['level','=',$param['level']];
|
|
|
+ if($param['belong']!='')$where[]=['belong','=',$param['belong']];
|
|
|
+ if($param['work_name']!='')$where[]=['work_name','like',"%{$param['work_name']}%"];
|
|
|
+ $list =$this->model->where($where)->order('id desc')->paginate(['list_rows'=>$param['size'],'page'=>$param['page']]);
|
|
|
+ return success('获取成功',['list'=>$list->items(),'count'=>$list->total()]);
|
|
|
+ }
|
|
|
//岗位模板新建
|
|
|
public function status(){
|
|
|
$param=$this->request->param(['id'=>'','sttaus'=>''],'post','trim');
|
|
@@ -74,4 +85,101 @@ class Work extends Base{
|
|
|
$add = $info->save();
|
|
|
return $add ? success("{$status}成功"):error("{$status}失败");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function WorkActionCreate(){
|
|
|
+ $param=$this->request->param([
|
|
|
+ 'belong_action'=>'',
|
|
|
+ 'menu_id'=>'',
|
|
|
+ 'belong'=>0,
|
|
|
+ 'action_name'=>''],'post','trim');
|
|
|
+ $valid =Validate::rule([
|
|
|
+ 'belong_action|系统功能集合'=>'require|array',
|
|
|
+ 'menu_id|菜单页面Id'=>'require|number',
|
|
|
+ 'belong|系统归属'=>'number|in:0,1,2,3',
|
|
|
+ 'action_name|功能名称'=>'require|max:255',
|
|
|
+ ]);
|
|
|
+ if($valid->check($param)==false)return error($valid->getError());
|
|
|
+ $data = [
|
|
|
+ 'action_name'=>$param['action_name'],
|
|
|
+ 'belong'=>$param['belong'],
|
|
|
+ 'menu_id'=>$param['menu_id'],
|
|
|
+ 'belong_action'=>$param['belong_action'],
|
|
|
+ 'apply_id'=>$this->uid,
|
|
|
+ 'apply_name'=>$this->uname,
|
|
|
+ ];
|
|
|
+ $add = WorkAction::create($data);
|
|
|
+ return $add ? success('岗位功能创建成功'):error('岗位功能创建失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function WorkActionSave(){
|
|
|
+ $param=$this->request->param([
|
|
|
+ "id"=>"",
|
|
|
+ 'belong_action'=>'',
|
|
|
+ 'menu_id'=>'',
|
|
|
+ 'belong'=>0,
|
|
|
+ 'action_name'=>''],'post','trim');
|
|
|
+ $valid =Validate::rule([
|
|
|
+ 'id|岗位功能ID'=>'require|number',
|
|
|
+ 'belong_action|系统功能集合'=>'require|array',
|
|
|
+ 'menu_id|菜单页面Id'=>'require|number',
|
|
|
+ 'belong|系统归属'=>'number|in:0,1,2,3',
|
|
|
+ 'action_name|岗位功能名称'=>'require|max:255',
|
|
|
+ ]);
|
|
|
+ if($valid->check($param)==false)return error($valid->getError());
|
|
|
+ $info= WorkAction::where(["id"=>$param['id']])->findOrEmpty();
|
|
|
+ if($info->isEmpty())return error("数据为找到");
|
|
|
+ $info->action_name=$param['action_name'];
|
|
|
+ $info->belong=$param['belong'];
|
|
|
+ $info->menu_id=$param['menu_id'];
|
|
|
+ $info->belong_action=$param['belong_action'];
|
|
|
+ $add = $info->save();
|
|
|
+ return $add ? success('岗位功能修改成功'):error('岗位功能修改失败');
|
|
|
+ }
|
|
|
+ public function WorkActionDelete(){
|
|
|
+ $id=$this->request->post('id/d');
|
|
|
+ $info = WorkAction::where(['id'=>$id])->findOrEmpty();
|
|
|
+ if($info->isEmpty()) error('未找到数据');
|
|
|
+ $add = $info->delete();
|
|
|
+ return $add ? success('删除成功'):error('删除失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function WorkActionInfo(){
|
|
|
+ $id=$this->request->post('id/d');
|
|
|
+ $info = WorkAction::where(['id'=>$id])->findOrEmpty();
|
|
|
+ if($info->isEmpty()) error('未找到数据');
|
|
|
+ return success('获取成功',$info);
|
|
|
+ }
|
|
|
+ public function WorkActionList(){
|
|
|
+ $param=$this->request->param(['menu_id'=>'','belong'=>0,'action_name'=>'',"page"=>1,"size"=>15],'post','trim');
|
|
|
+ $where=[];
|
|
|
+ if($param['menu_id']!="")$where[]=["menu_id","=",$param['menu_id']];
|
|
|
+ if($param['belong']!="")$where[]=["belong","=",$param['belong']];
|
|
|
+ if($param['action_name']!="")$where[]=["action_name","like","%{$param['action_name']}%"];
|
|
|
+ $list = WorkAction::where($where)->order("id desc")->paginate(["list_rows"=>$param['size'],"page"=>$param['page']]);
|
|
|
+ return success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function WorkTemplateSave(){
|
|
|
+ $param=$this->request->param(["work_id"=>"","action"=>[],"process_action"=>[]],"post","trim");
|
|
|
+ $valid =Validate::rule([
|
|
|
+ 'work_id|岗位ID'=>'require|number',
|
|
|
+ 'action|岗位功能集合'=>'require|array',
|
|
|
+ 'process_action|流程节点'=>'array',
|
|
|
+ ]);
|
|
|
+ if($valid->check($param)==false)return error($valid->getError());
|
|
|
+ $info= WorkTemplate::where(['work_id'=>$param['work_id']])->findOrEmpty();
|
|
|
+ $info->work_id=$param['work_id'];
|
|
|
+ $info->action=$param['action'];
|
|
|
+ $info->process_action=$param['process_action'];
|
|
|
+ $add = $info->save();
|
|
|
+ return $add ? success('岗位模板修改成功'):error('岗位模板修改失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function WorkTemplateInfo(){
|
|
|
+ $work_id=$this->request->post('work_id/d');
|
|
|
+ $info= WorkTemplate::where(['work_id'=>$work_id])->findOrEmpty();
|
|
|
+ if($info->isEmpty()) error('未找到数据');
|
|
|
+ return success('获取成功',$info);
|
|
|
+ }
|
|
|
}
|