1.项目支持开启自动更新进度信息
2.支持在看板中切换项目
3.任务工时支持先添加预估工时
4.子任务支持快速添加下一条
5.支持在当前任务中修改子任务执行者
6.优化修改头像功能
7.其他细节优化
'

Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
vilson 2019-09-02 16:07:35 +08:00
parent 0c8f59a8f2
commit 4bd4d7e717
9 changed files with 86 additions and 33 deletions

View File

@ -36,7 +36,7 @@ class Project extends CommonModel
$offset = ($page - 1) * $page;
$limit = $pageSize;
$prefix = config('database.prefix');
$sql = "select *,p.id as id,p.name as name,p.code as code from {$prefix}project as p join {$prefix}project_member as pm on p.code = pm.project_code where pm.member_code = '{$memberCode}' and p.organization_code = '$organizationCode' and p.deleted = {$deleted} and p.archive = {$archive} order by p.id desc";
$sql = "select *,p.id as id,p.name as name,p.code as code from {$prefix}project as p join {$prefix}project_member as pm on p.code = pm.project_code left join {$prefix}project_collection as pc on p.code = pc.project_code where pm.member_code = '{$memberCode}' and p.organization_code = '$organizationCode' and p.deleted = {$deleted} and p.archive = {$archive} order by pc.id desc, p.id desc";
$total = Db::query($sql);
$total = count($total);
$sql .= " limit {$offset},{$limit}";

View File

@ -347,6 +347,18 @@ class Task extends CommonModel
$result = self::update(['done' => $done], ['code' => $taskCode]);
//todo 添加任务动态,编辑权限检测
Db::commit();
$project = Project::where(['code' => $task['project_code']])->field('auto_update_schedule,schedule')->find();
if ($project['auto_update_schedule']) {
$taskCount = \app\common\Model\Task::where(['project_code' => $task['project_code']])->count('code');
if ($taskCount) {
$doneTaskCount = \app\common\Model\Task::where(['project_code' => $task['project_code'], 'done' => 1])->count('code');
$schedule = $doneTaskCount / $taskCount * 100;
$project->schedule = $schedule;
$project->save();
}
}
$projectAutoUpdateSchedule = 1;
} catch (Exception $e) {
Db::rollback();
throw new Exception($e->getMessage());

View File

@ -39,7 +39,9 @@ class TaskMember extends CommonModel
//已经是本人
return true;
}
self::update(['is_executor' => 0], ['task_code' => $taskCode]);
if ($isExecutor) {
self::update(['is_executor' => 0], ['task_code' => $taskCode]);
}
if ($memberCode) {
$hasJoined = self::where(['member_code' => $memberCode, 'task_code' => $taskCode])->find();
if ($hasJoined) {
@ -73,7 +75,6 @@ class TaskMember extends CommonModel
];
//todo 添加任务动态
$result = self::create($data);
if ($isExecutor) {
Task::update(['assign_to' => $memberCode], ['code' => $taskCode]);
if ($memberCode == $currentMember['code']) {

View File

@ -107,12 +107,12 @@ class Index extends BasicApi
*/
public function editPersonal()
{
$params = Request::only('mobile,mail,idcard,name,realname,avatar,id');
$params = Request::only('mobile,mail,idcard,name,realname,avatar,code');
$memberModel = new Member();
$result = $memberModel->_edit($params, ['id' => Request::post('id')]);
$result = $memberModel->_edit($params, ['code' => $params['code']]);
if (isset($params['avatar'])) {
$member = Member::get($params['id']);
MemberAccount::update(['avatar' => $params['avatar']], ['member_code' => $member['code']]);
// $member = Member::get($params['id']);
MemberAccount::update(['avatar' => $params['avatar']], ['member_code' => $params['code']]);
}
if ($result) {
$this->success('基本信息更新成功');
@ -179,6 +179,10 @@ class Index extends BasicApi
$accountModel = new MemberAccount();
try {
$file = $accountModel->uploadImg(Request::file('avatar'));
$code = Request::param('code');
$update = ['avatar' => $file['url']];
Member::update($update, ['code' => $code]);
MemberAccount::update($update, ['member_code' => $code]);
} catch (Exception $e) {
$this->error($e->getMessage(), $e->getCode());;
}

View File

@ -81,11 +81,11 @@ class Project extends BasicApi
continue;
}
$item['collected'] = false;
$item['collected'] = 0;
$item['owner_name'] = '-';
$collected = ProjectCollection::where(['project_code' => $item['code'], 'member_code' => $currentMember['code']])->field('id')->find();
if ($collected) {
$item['collected'] = true;
$item['collected'] = 1;
}
$owner = ProjectMember::where(['project_code' => $item['code'], 'is_owner' => 1])->field('member_code')->find();
@ -129,21 +129,18 @@ class Project extends BasicApi
$list = $this->model->getMemberProjects($member['code'], getCurrentOrganizationCode(), $deleted, $archive, Request::post('page'), Request::post('pageSize'));
if ($list['list']) {
foreach ($list['list'] as $key => &$item) {
$item['collected'] = false;
$item['owner_name'] = '-';
if (isset($item['project_code'])) {
$item['code'] = $item['project_code'];
$item = $this->model->where(['code' => $item['code']])->find();
}
$collected = ProjectCollection::where(['project_code' => $item['code'], 'member_code' => getCurrentMember()['code']])->field('id')->find();
if ($collected) {
$item['collected'] = true;
}
$item['collected'] = $collected ? 1 : 0;
$owner = ProjectMember::where(['project_code' => $item['code'], 'is_owner' => 1])->field('member_code')->find();
$member = Member::where(['code' => $owner['member_code']])->field('name')->find();
$item['owner_name'] = $member['name'];
}
unset($item);
}
$this->success('', $list);
}
@ -187,10 +184,10 @@ class Project extends BasicApi
if (!$project) {
$this->notFound();
}
$project['collected'] = false;
$project['collected'] = 0;
$collected = ProjectCollection::where(['project_code' => $project['code'], 'member_code' => getCurrentMember()['code']])->field('id')->find();
if ($collected) {
$project['collected'] = true;
$project['collected'] = 1;
}
$item['owner_name'] = '';
$item['owner_avatar'] = '';
@ -214,7 +211,7 @@ class Project extends BasicApi
*/
public function edit(Request $request)
{
$data = $request::only('name,description,cover,private,prefix,open_prefix,schedule,open_begin_time,open_task_private,task_board_theme,begin_time,end_time');
$data = $request::only('name,description,cover,private,prefix,open_prefix,schedule,open_begin_time,open_task_private,task_board_theme,begin_time,end_time,auto_update_schedule');
$code = $request::param('projectCode');
try {
$result = $this->model->edit($code, $data);
@ -297,7 +294,7 @@ class Project extends BasicApi
debug('begin');
$result = ProjectReport::setDayilyProejctReport();
debug('end');
logRecord(debug('begin','end') * 1000 . 'ms', 'setDayilyProejctReportSuccess');
logRecord(debug('begin', 'end') * 1000 . 'ms', 'setDayilyProejctReportSuccess');
echo 'success_at ' . nowTime();
}

View File

@ -5,6 +5,7 @@ namespace app\project\middleware;
use app\common\Model\Project;
use app\common\Model\ProjectMember;
use app\common\Model\Task;
use app\common\Model\TaskStages;
use think\Request;
/**
@ -25,7 +26,7 @@ class ProjectAuth
'Task/save',
'Task/taskDone',
'Task/assignTask',
// 'Task/sort',
'Task/sort',
'Task/edit',
'Task/recycle',
'Task/recovery',
@ -116,6 +117,15 @@ class ProjectAuth
$code = $task['project_code'];
}
}
if (!$code) {
$taskStageCode = \think\facade\Request::param('stageCode');
if ($taskStageCode) {
$taskStage = TaskStages::where(['code' => $taskStageCode])->find();
if ($taskStage) {
$code = $taskStage['project_code'];
}
}
}
return $code;
}

View File

@ -0,0 +1,29 @@
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `pearProject`.`pear_project` ADD COLUMN `auto_update_schedule` tinyint(1) NULL DEFAULT 0 COMMENT '自动更新项目进度' AFTER `end_time`;
ALTER TABLE `pearProject`.`pear_project_features` ADD INDEX `project_code`(`project_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_project_features` ADD INDEX `organization_code`(`organization_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_project_log` DROP INDEX `member_code`;
ALTER TABLE `pearProject`.`pear_project_log` ADD INDEX `source_code`(`source_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_project_version` ADD INDEX `organization_code`(`organization_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_project_version` ADD INDEX `features_code`(`features_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_project_version_log` ADD INDEX `project_code`(`project_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_project_version_log` ADD INDEX `features_code`(`features_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_task` ADD INDEX `stage_code`(`stage_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_task` ADD INDEX `project_code`(`project_code`) USING BTREE;
ALTER TABLE `pearProject`.`pear_task` ADD INDEX `pcode`(`pcode`) USING BTREE;
ALTER TABLE `pearProject`.`pear_task` ADD INDEX `sort`(`sort`) USING BTREE;
SET FOREIGN_KEY_CHECKS=1;

View File

@ -3,15 +3,15 @@
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50726
Source Server Version : 80012
Source Host : localhost:3306
Source Schema : pearproject
Target Server Type : MySQL
Target Server Version : 50726
Target Server Version : 80012
File Encoding : 65001
Date: 19/08/2019 10:02:58
Date: 02/09/2019 15:30:46
*/
SET NAMES utf8mb4;
@ -218,8 +218,8 @@ CREATE TABLE `pear_member` (
`dingtalk_unionid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉unionid',
`dingtalk_userid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉用户id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `username`(`account`) USING BTREE,
UNIQUE INDEX `code`(`code`) USING BTREE
UNIQUE INDEX `code`(`code`) USING BTREE,
INDEX `username`(`account`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 589 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Compact;
-- ----------------------------
@ -392,8 +392,8 @@ CREATE TABLE `pear_project` (
`begin_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目开始日期',
`end_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目截止日期',
PRIMARY KEY (`id`) USING BTREE,
INDEX `project`(`order`) USING BTREE,
UNIQUE INDEX `code`(`code`) USING BTREE
UNIQUE INDEX `code`(`code`) USING BTREE,
INDEX `project`(`order`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13043 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目表' ROW_FORMAT = Compact;
-- ----------------------------

View File

@ -3,15 +3,15 @@
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50726
Source Server Version : 80012
Source Host : localhost:3306
Source Schema : pearproject
Target Server Type : MySQL
Target Server Version : 50726
Target Server Version : 80012
File Encoding : 65001
Date: 19/08/2019 10:02:58
Date: 02/09/2019 15:30:46
*/
SET NAMES utf8mb4;
@ -218,8 +218,8 @@ CREATE TABLE `pear_member` (
`dingtalk_unionid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉unionid',
`dingtalk_userid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉用户id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `username`(`account`) USING BTREE,
UNIQUE INDEX `code`(`code`) USING BTREE
UNIQUE INDEX `code`(`code`) USING BTREE,
INDEX `username`(`account`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 589 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Compact;
-- ----------------------------
@ -392,8 +392,8 @@ CREATE TABLE `pear_project` (
`begin_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目开始日期',
`end_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目截止日期',
PRIMARY KEY (`id`) USING BTREE,
INDEX `project`(`order`) USING BTREE,
UNIQUE INDEX `code`(`code`) USING BTREE
UNIQUE INDEX `code`(`code`) USING BTREE,
INDEX `project`(`order`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13043 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目表' ROW_FORMAT = Compact;
-- ----------------------------