add:其他任务提交创建审批,待审批列表

This commit is contained in:
chenbo 2023-09-15 17:00:52 +08:00
parent eed7b0f4eb
commit ee0ab0e013
4 changed files with 73 additions and 2 deletions

View File

@ -0,0 +1,14 @@
<?php
namespace app\adminapi\controller\approve;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\approve\ApproveLists;
class ApproveController extends BaseAdminController
{
public function lists()
{
return $this->dataLists(new ApproveLists());
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace app\adminapi\lists\approve;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\Approve;
class ApproveLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/08/31 11:08
*/
public function setSearch(): array
{
return [];
}
public function queryWhere()
{
$where = [];
// $where[] = ['check_admin_ids', '=', $this->adminId]; // todo 放开过滤条件,只有片区经理才能查看
return $where;
}
public function lists(): array
{
return Approve::where($this->searchWhere)
->where($this->queryWhere())
->with('task')
->field('*')
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
public function count(): int
{
return Approve::where($this->searchWhere)->count();
}
}

View File

@ -243,12 +243,13 @@ class TaskController extends BaseApiController
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
$approveModel->user_id = $this->userId; // 前台发起人用户id
$approveModel->task_id = $task['id']; // 前台发起人用户id
$approveModel->check_admin_id = $areaManagerId; // 前审批人ID 片区经理的admin_id
$approveModel->department_id = '0';
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
$approveModel->last_admin_id = $areaManagerId;
$approveModel->other_type = 6;
$approveModel->create_time = time();
$approveModel->update_time = time();
$approveModel->save();
if ($approveModel->id) {
Db::commit();

View File

@ -2,10 +2,19 @@
namespace app\common\model;
use app\common\model\dict\DictData;
use app\common\model\task\Task;
use think\model\concern\SoftDelete;
class Approve extends BaseModel
{
use SoftDelete;
protected $name = 'approve';
protected $deleteTime = 'delete_time';
public function task()
{
return $this->hasOne(Task::class, 'id', 'task_id');
}
}