任务安排-添加任务时选择任务创建模板,自动填充表单

This commit is contained in:
chenbo 2023-12-18 15:33:26 +08:00
parent 26c6108281
commit 5f3e46b4a2
2 changed files with 44 additions and 0 deletions

View File

@ -104,5 +104,17 @@ class CreateTaskTemplateController extends BaseAdminController
return $this->data($result);
}
public function taskTypeList()
{
$taskRoleId = $this->request->param('task_role_id');
$result = CreateTaskTemplateLogic::taskTypeList($taskRoleId);
return $this->data($result);
}
public function selectList()
{
$list = CreateTaskTemplateLogic::getList();
return $this->data($list);
}
}

View File

@ -15,6 +15,7 @@
namespace app\adminapi\logic\create_task_template;
use app\adminapi\logic\ConfigLogic;
use app\common\model\create_task_template\CreateTaskTemplate;
use app\common\logic\BaseLogic;
use think\facade\Db;
@ -135,4 +136,35 @@ class CreateTaskTemplateLogic extends BaseLogic
{
return CreateTaskTemplate::findOrEmpty($params['id'])->toArray();
}
public static function taskTypeList($taskRoleId=0)
{
$type = '';
switch ($taskRoleId) {
case 1:
$type = 'town_task_type_master';
case 2:
$type = 'town_task_type_marketing_director';
case 3:
$type = 'town_task_type';
case 4:
$type = 'village_task_type';
case 5:
$type = 'task_type';
}
if ($type) {
$data = ConfigLogic::getDictByType($type);
return $data;
} else {
return [];
}
}
public static function getList()
{
return CreateTaskTemplate::field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'extend', 'recharge', 'content'])
->order(['id' => 'desc'])
->select()
->toArray();
}
}