Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
e3bdb8b207
@ -14,6 +14,11 @@
|
||||
|
||||
### 登录 ###
|
||||
账号:123456 密码:123456
|
||||
|
||||
### 友情链接 ###
|
||||
|
||||
**JAVA版本:https://gitee.com/wulon/mk-teamwork-server**
|
||||
|
||||
### 界面截图 ###
|
||||

|
||||
|
||||
|
@ -345,7 +345,7 @@ class Task extends CommonModel
|
||||
throw new Exception('父任务已完成,无法重做子任务', 4);
|
||||
}
|
||||
if ($task['hasUnDone']) {
|
||||
throw new Exception('子任务尚未全部完成,无法完成父任务', 5);
|
||||
throw new Exception('子任务尚未全部完成,无法完成父任务', 55);
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
|
@ -4,6 +4,7 @@ namespace app\common\Model;
|
||||
|
||||
use service\FileService;
|
||||
use service\RandomService;
|
||||
use service\ToolsService;
|
||||
use think\File;
|
||||
|
||||
/**
|
||||
@ -100,6 +101,32 @@ class TaskStages extends CommonModel
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function tasksTree($stageCode)
|
||||
{
|
||||
$taskModel = new Task();
|
||||
$list1 = $taskModel->where('stage_code', $stageCode)->where('done', 0)->where('deleted', 0)->order('sort asc,end_time desc, id asc')->select()->toArray();
|
||||
$list2 = $taskModel->where('stage_code', $stageCode)->where('done', 1)->where('deleted', 0)->order('sort asc,end_time desc, id asc')->select()->toArray();
|
||||
$list = array_merge($list1, $list2);
|
||||
if ($list) {
|
||||
foreach ($list as $key => &$item) {
|
||||
$item = $taskModel->read($item['code']);
|
||||
if ($item) {
|
||||
$item = $item->toArray();
|
||||
} else {
|
||||
$item = [];
|
||||
}
|
||||
if (empty($item['canRead'])) {
|
||||
array_splice($list, $key, 1);
|
||||
}
|
||||
$item['type'] = 'task';
|
||||
$item['tasks'] = [];
|
||||
}
|
||||
unset($item);
|
||||
}
|
||||
$list = ToolsService::arr2tree($list, 'code', 'pcode', 'tasks');
|
||||
return $list;
|
||||
}
|
||||
|
||||
/*public function tasks($stageCode, $deleted = 0, $done = -1)
|
||||
{
|
||||
$where = ['stage_code' => $stageCode, 'pcode' => '', 'deleted' => $deleted];
|
||||
|
@ -112,7 +112,7 @@ class Index extends BasicApi
|
||||
$sql = str_replace("`pms_", "`{$mysqlPrefix}", $sql);
|
||||
$pdo = new PDO("mysql:host={$mysqlHostname};port={$mysqlHostport}", $mysqlUsername, $mysqlPassword, array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb"
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4"
|
||||
));
|
||||
|
||||
//检测是否支持innodb存储引擎
|
||||
|
@ -94,6 +94,9 @@ class Task extends BasicApi
|
||||
$status = [0 => '普通', 1 => '紧急', 2 => '非常紧急'];
|
||||
if ($list['list']) {
|
||||
foreach ($list['list'] as &$task) {
|
||||
$taskInfo = \app\common\Model\Task::get($task['id']);
|
||||
$task['parentDone'] = $taskInfo['parentDone'];
|
||||
$task['hasUnDone'] = $taskInfo['hasUnDone'];
|
||||
$task['priText'] = $status[$task['pri']];
|
||||
$task['executor'] = Member::where(['code' => $task['assign_to']])->field('name,avatar')->find();
|
||||
$task['projectInfo'] = \app\common\Model\Project::where(['code' => $task['project_code']])->field('name,code')->find();
|
||||
|
@ -88,6 +88,24 @@ class TaskStages extends BasicApi
|
||||
$this->success('', $list);
|
||||
}
|
||||
|
||||
public function taskTree()
|
||||
{
|
||||
$where = [];
|
||||
$code = Request::post('projectCode');
|
||||
if (!$code) {
|
||||
$this->error("请选择一个项目");
|
||||
}
|
||||
$where[] = ['project_code', '=', $code];
|
||||
$list = $this->model->where($where)->select();
|
||||
if ($list) {
|
||||
foreach ($list as &$item) {
|
||||
$item['type'] = 'stage';
|
||||
$item['tasks'] = $this->model->tasksTree($item['code']);
|
||||
}
|
||||
}
|
||||
$this->success('', $list);
|
||||
}
|
||||
|
||||
public function sort(Request $request)
|
||||
{
|
||||
$data = $request::only('preCode,nextCode');
|
||||
|
BIN
favicon.ico
BIN
favicon.ico
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Loading…
x
Reference in New Issue
Block a user