mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
Merge branch 'gzc-userTaskPermission' into pro
This commit is contained in:
commit
34c005001d
@ -30,6 +30,7 @@ use App\Models\ProjectTaskFile;
|
|||||||
use App\Models\ProjectTaskUser;
|
use App\Models\ProjectTaskUser;
|
||||||
use App\Models\WebSocketDialog;
|
use App\Models\WebSocketDialog;
|
||||||
use App\Exceptions\ApiException;
|
use App\Exceptions\ApiException;
|
||||||
|
use App\Models\ProjectPermission;
|
||||||
use App\Module\BillMultipleExport;
|
use App\Module\BillMultipleExport;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use App\Models\ProjectTaskFlowChange;
|
use App\Models\ProjectTaskFlowChange;
|
||||||
@ -575,6 +576,8 @@ class ProjectController extends AbstractController
|
|||||||
$project = Project::userProject($project_id);
|
$project = Project::userProject($project_id);
|
||||||
//
|
//
|
||||||
if ($only_column) {
|
if ($only_column) {
|
||||||
|
//
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_LIST_SORT);
|
||||||
// 排序列表
|
// 排序列表
|
||||||
$index = 0;
|
$index = 0;
|
||||||
foreach ($sort as $item) {
|
foreach ($sort as $item) {
|
||||||
@ -760,6 +763,8 @@ class ProjectController extends AbstractController
|
|||||||
// 项目
|
// 项目
|
||||||
$project = Project::userProject($project_id);
|
$project = Project::userProject($project_id);
|
||||||
//
|
//
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_LIST_ADD);
|
||||||
|
//
|
||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
return Base::retError('列表名称不能为空');
|
return Base::retError('列表名称不能为空');
|
||||||
}
|
}
|
||||||
@ -809,7 +814,9 @@ class ProjectController extends AbstractController
|
|||||||
return Base::retError('列表不存在');
|
return Base::retError('列表不存在');
|
||||||
}
|
}
|
||||||
// 项目
|
// 项目
|
||||||
Project::userProject($column->project_id);
|
$project = Project::userProject($column->project_id);
|
||||||
|
//
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_LIST_UPDATE);
|
||||||
//
|
//
|
||||||
if (Arr::exists($data, 'name') && $column->name != $data['name']) {
|
if (Arr::exists($data, 'name') && $column->name != $data['name']) {
|
||||||
$column->addLog("修改列表名称:{$column->name} => {$data['name']}");
|
$column->addLog("修改列表名称:{$column->name} => {$data['name']}");
|
||||||
@ -849,7 +856,9 @@ class ProjectController extends AbstractController
|
|||||||
return Base::retError('列表不存在');
|
return Base::retError('列表不存在');
|
||||||
}
|
}
|
||||||
// 项目
|
// 项目
|
||||||
Project::userProject($column->project_id, true, true);
|
$project = Project::userProject($column->project_id);
|
||||||
|
//
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_LIST_REMOVE);
|
||||||
//
|
//
|
||||||
$column->deleteColumn();
|
$column->deleteColumn();
|
||||||
return Base::retSuccess('删除成功', ['id' => $column->id]);
|
return Base::retSuccess('删除成功', ['id' => $column->id]);
|
||||||
@ -1507,7 +1516,7 @@ class ProjectController extends AbstractController
|
|||||||
$archived = Request::input('archived', 'no');
|
$archived = Request::input('archived', 'no');
|
||||||
//
|
//
|
||||||
$isArchived = str_replace(['all', 'yes', 'no'], [null, false, true], $archived);
|
$isArchived = str_replace(['all', 'yes', 'no'], [null, false, true], $archived);
|
||||||
$task = ProjectTask::userTask($task_id, $isArchived, true, false, ['taskUser', 'taskTag']);
|
$task = ProjectTask::userTask($task_id, $isArchived, true, ['taskUser', 'taskTag']);
|
||||||
// 项目可见性
|
// 项目可见性
|
||||||
$project_userid = ProjectUser::whereProjectId($task->project_id)->whereOwner(1)->value('userid'); // 项目负责人
|
$project_userid = ProjectUser::whereProjectId($task->project_id)->whereOwner(1)->value('userid'); // 项目负责人
|
||||||
if ($task->visibility != 1 && $user->userid != $project_userid) {
|
if ($task->visibility != 1 && $user->userid != $project_userid) {
|
||||||
@ -1603,7 +1612,9 @@ class ProjectController extends AbstractController
|
|||||||
return Base::retError('文件不存在或已被删除');
|
return Base::retError('文件不存在或已被删除');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($file->task_id, true, true, true);
|
$task = ProjectTask::userTask($file->task_id);
|
||||||
|
//
|
||||||
|
ProjectPermission::userTaskPermission(Project::userProject($task->project_id), ProjectPermission::TASK_UPDATE, $task);
|
||||||
//
|
//
|
||||||
$task->pushMsg('filedelete', $file);
|
$task->pushMsg('filedelete', $file);
|
||||||
$file->delete();
|
$file->delete();
|
||||||
@ -1732,6 +1743,8 @@ class ProjectController extends AbstractController
|
|||||||
$column_id = $data['column_id'];
|
$column_id = $data['column_id'];
|
||||||
// 项目
|
// 项目
|
||||||
$project = Project::userProject($project_id);
|
$project = Project::userProject($project_id);
|
||||||
|
//
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_ADD);
|
||||||
// 列表
|
// 列表
|
||||||
$column = null;
|
$column = null;
|
||||||
$newColumn = null;
|
$newColumn = null;
|
||||||
@ -1808,11 +1821,13 @@ class ProjectController extends AbstractController
|
|||||||
$task_id = intval(Request::input('task_id'));
|
$task_id = intval(Request::input('task_id'));
|
||||||
$name = Request::input('name');
|
$name = Request::input('name');
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($task_id, true, true, true);
|
$task = ProjectTask::userTask($task_id);
|
||||||
if ($task->complete_at) {
|
if ($task->complete_at) {
|
||||||
return Base::retError('主任务已完成无法添加子任务');
|
return Base::retError('主任务已完成无法添加子任务');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
ProjectPermission::userTaskPermission(Project::userProject($task->project_id), ProjectPermission::TASK_ADD);
|
||||||
|
//
|
||||||
$task = ProjectTask::addTask([
|
$task = ProjectTask::addTask([
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'parent_id' => $task->id,
|
'parent_id' => $task->id,
|
||||||
@ -1867,11 +1882,18 @@ class ProjectController extends AbstractController
|
|||||||
$param = Request::input();
|
$param = Request::input();
|
||||||
$task_id = intval($param['task_id']);
|
$task_id = intval($param['task_id']);
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($task_id, true, true, 2);
|
$task = ProjectTask::userTask($task_id);
|
||||||
|
//
|
||||||
|
$project = Project::userProject($task->project_id);
|
||||||
|
if (Arr::exists($param, 'flow_item_id')) {
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_STATUS, $task);
|
||||||
|
}else{
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_UPDATE, $task);
|
||||||
|
}
|
||||||
|
//
|
||||||
$taskUser = ProjectTaskUser::select(['userid', 'owner'])->whereTaskId($task_id)->get();
|
$taskUser = ProjectTaskUser::select(['userid', 'owner'])->whereTaskId($task_id)->get();
|
||||||
$owners = $taskUser->where('owner', 1)->pluck('userid')->toArray(); // 负责人
|
$owners = $taskUser->where('owner', 1)->pluck('userid')->toArray(); // 负责人
|
||||||
$assists = $taskUser->where('owner', 0)->pluck('userid')->toArray(); // 协助人
|
$assists = $taskUser->where('owner', 0)->pluck('userid')->toArray(); // 协助人
|
||||||
|
|
||||||
// 更新任务
|
// 更新任务
|
||||||
$updateMarking = [];
|
$updateMarking = [];
|
||||||
$task->updateTask($param, $updateMarking);
|
$task->updateTask($param, $updateMarking);
|
||||||
@ -2003,12 +2025,15 @@ class ProjectController extends AbstractController
|
|||||||
$task_id = intval(Request::input('task_id'));
|
$task_id = intval(Request::input('task_id'));
|
||||||
$type = Request::input('type', 'add');
|
$type = Request::input('type', 'add');
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($task_id, $type == 'add', true, true);
|
$task = ProjectTask::userTask($task_id, $type == 'add');
|
||||||
//
|
//
|
||||||
if ($task->parent_id > 0) {
|
if ($task->parent_id > 0) {
|
||||||
return Base::retError('子任务不支持此功能');
|
return Base::retError('子任务不支持此功能');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
$project = Project::userProject($task->project_id);
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_ARCHIVED, $task);
|
||||||
|
//
|
||||||
if ($type == 'recovery') {
|
if ($type == 'recovery') {
|
||||||
$task->archivedTask(null);
|
$task->archivedTask(null);
|
||||||
} elseif ($type == 'add') {
|
} elseif ($type == 'add') {
|
||||||
@ -2045,7 +2070,11 @@ class ProjectController extends AbstractController
|
|||||||
$task_id = intval(Request::input('task_id'));
|
$task_id = intval(Request::input('task_id'));
|
||||||
$type = Request::input('type', 'delete');
|
$type = Request::input('type', 'delete');
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($task_id, null, $type !== 'recovery', true);
|
$task = ProjectTask::userTask($task_id, null, $type !== 'recovery');
|
||||||
|
//
|
||||||
|
$project = Project::userProject($task->project_id);
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_REMOVE, $task);
|
||||||
|
//
|
||||||
if ($type == 'recovery') {
|
if ($type == 'recovery') {
|
||||||
$task->restoreTask();
|
$task->restoreTask();
|
||||||
return Base::retSuccess('操作成功', ['id' => $task->id]);
|
return Base::retSuccess('操作成功', ['id' => $task->id]);
|
||||||
@ -2080,7 +2109,7 @@ class ProjectController extends AbstractController
|
|||||||
return Base::retError('记录不存在');
|
return Base::retError('记录不存在');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($projectLog->task_id, true, true, true);
|
$task = ProjectTask::userTask($projectLog->task_id);
|
||||||
//
|
//
|
||||||
$record = $projectLog->record;
|
$record = $projectLog->record;
|
||||||
if ($record['flow'] && is_array($record['flow'])) {
|
if ($record['flow'] && is_array($record['flow'])) {
|
||||||
@ -2220,7 +2249,10 @@ class ProjectController extends AbstractController
|
|||||||
$project_id = intval(Request::input('project_id'));
|
$project_id = intval(Request::input('project_id'));
|
||||||
$column_id = intval(Request::input('column_id'));
|
$column_id = intval(Request::input('column_id'));
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($task_id, true, true, 2);
|
$task = ProjectTask::userTask($task_id);
|
||||||
|
//
|
||||||
|
$project = Project::userProject($task->project_id);
|
||||||
|
ProjectPermission::userTaskPermission($project, ProjectPermission::TASK_MOVE, $task);
|
||||||
//
|
//
|
||||||
if( $task->project_id == $project_id && $task->column_id == $column_id){
|
if( $task->project_id == $project_id && $task->column_id == $column_id){
|
||||||
return Base::retSuccess('移动成功', ['id' => $task_id]);
|
return Base::retSuccess('移动成功', ['id' => $task_id]);
|
||||||
@ -2411,4 +2443,74 @@ class ProjectController extends AbstractController
|
|||||||
'top_at' => $projectUser->top_at?->toDateTimeString(),
|
'top_at' => $projectUser->top_at?->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {get} api/project/permission 43. 获取项目权限设置
|
||||||
|
*
|
||||||
|
* @apiDescription 需要token身份
|
||||||
|
* @apiVersion 1.0.0
|
||||||
|
* @apiGroup project
|
||||||
|
* @apiName permission
|
||||||
|
*
|
||||||
|
* @apiParam {Number} project_id 项目ID
|
||||||
|
*
|
||||||
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
|
* @apiSuccess {Object} data 返回数据
|
||||||
|
*/
|
||||||
|
public function permission()
|
||||||
|
{
|
||||||
|
$user = User::auth();
|
||||||
|
$projectId = intval(Request::input('project_id'), 0);
|
||||||
|
$projectUser = ProjectUser::whereUserid($user->userid)->whereProjectId($projectId)->first();
|
||||||
|
if (!$projectUser) {
|
||||||
|
return Base::retError("项目不存在");
|
||||||
|
}
|
||||||
|
$projectPermission = ProjectPermission::initPermissions($projectId);
|
||||||
|
return Base::retSuccess("success", $projectPermission);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {get} api/project/permission/update 44. 项目权限设置
|
||||||
|
*
|
||||||
|
* @apiDescription 需要token身份
|
||||||
|
* @apiVersion 1.0.0
|
||||||
|
* @apiGroup project
|
||||||
|
* @apiName permission__update
|
||||||
|
*
|
||||||
|
* @apiParam {Number} project_id 项目ID
|
||||||
|
* @apiParam {Array} task_add 添加任务权限
|
||||||
|
* @apiParam {Array} task_update 修改任务权限
|
||||||
|
* @apiParam {Array} task_remove 删除任务权限
|
||||||
|
* @apiParam {Array} task_update_complete 标记完成权限
|
||||||
|
* @apiParam {Array} task_archived 归档任务权限
|
||||||
|
* @apiParam {Array} task_move 移动任务权限
|
||||||
|
*
|
||||||
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
|
* @apiSuccess {Object} data 返回数据
|
||||||
|
*/
|
||||||
|
public function permission__update()
|
||||||
|
{
|
||||||
|
$user = User::auth();
|
||||||
|
$projectId = intval(Request::input('project_id'), 0);
|
||||||
|
$projectUser = ProjectUser::whereUserid($user->userid)->whereProjectId($projectId)->first();
|
||||||
|
if (!$projectUser) {
|
||||||
|
return Base::retError("项目不存在");
|
||||||
|
}
|
||||||
|
$permissions = Request::only([
|
||||||
|
ProjectPermission::TASK_LIST_ADD,
|
||||||
|
ProjectPermission::TASK_LIST_UPDATE,
|
||||||
|
ProjectPermission::TASK_LIST_REMOVE,
|
||||||
|
ProjectPermission::TASK_LIST_SORT,
|
||||||
|
ProjectPermission::TASK_ADD,
|
||||||
|
ProjectPermission::TASK_UPDATE,
|
||||||
|
ProjectPermission::TASK_REMOVE,
|
||||||
|
ProjectPermission::TASK_STATUS,
|
||||||
|
ProjectPermission::TASK_ARCHIVED,
|
||||||
|
ProjectPermission::TASK_MOVE,
|
||||||
|
]);
|
||||||
|
$projectPermission = ProjectPermission::updatePermissions($projectId, Base::newArrayRecursive('intval', $permissions));
|
||||||
|
return Base::retSuccess("success", $projectPermission);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ use Request;
|
|||||||
* @property int|null $dialog_id 聊天会话ID
|
* @property int|null $dialog_id 聊天会话ID
|
||||||
* @property string|null $archived_at 归档时间
|
* @property string|null $archived_at 归档时间
|
||||||
* @property int|null $archived_userid 归档会员
|
* @property int|null $archived_userid 归档会员
|
||||||
|
* @property int|null $is_fixed 是否固定
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||||
@ -47,6 +48,7 @@ use Request;
|
|||||||
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDesc($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDesc($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDialogId($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDialogId($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Project whereId($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereIsFixed($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Project whereName($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereName($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Project wherePersonal($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|Project wherePersonal($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Project whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereUpdatedAt($value)
|
||||||
|
|||||||
202
app/Models/ProjectPermission.php
Normal file
202
app/Models/ProjectPermission.php
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Exceptions\ApiException;
|
||||||
|
use App\Module\Base;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Models\ProjectPermission
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int|null $project_id 项目ID
|
||||||
|
* @property string|null $permissions 权限
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \App\Models\Project|null $project
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission wherePermissions($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission whereProjectId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class ProjectPermission extends AbstractModel
|
||||||
|
{
|
||||||
|
|
||||||
|
const TASK_LIST_ADD = 'task_list_add'; // 添加列
|
||||||
|
const TASK_LIST_UPDATE = 'task_list_update'; // 修改列
|
||||||
|
const TASK_LIST_REMOVE = 'task_list_remove'; // 删除列
|
||||||
|
const TASK_LIST_SORT = 'task_list_sort'; // 列表排序
|
||||||
|
const TASK_ADD = 'task_add'; // 任务添加
|
||||||
|
const TASK_UPDATE = 'task_update'; // 任务更新
|
||||||
|
const TASK_STATUS = 'task_status'; // 任务状态
|
||||||
|
const TASK_REMOVE = 'task_remove'; // 任务删除
|
||||||
|
const TASK_ARCHIVED = 'task_archived'; // 任务归档
|
||||||
|
const TASK_MOVE = 'task_move'; // 任务移动
|
||||||
|
|
||||||
|
// 权限列表
|
||||||
|
const PERMISSIONS = [
|
||||||
|
'project_leader' => 1, // 项目负责人
|
||||||
|
'project_member' => 2, // 项目成员
|
||||||
|
'task_leader' => 3, // 任务负责人
|
||||||
|
'task_assist' => 4, // 任务协助人
|
||||||
|
];
|
||||||
|
|
||||||
|
// 权限描述
|
||||||
|
const PERMISSIONS_DESC = [
|
||||||
|
1 => "项目负责人",
|
||||||
|
2 => "项目成员",
|
||||||
|
3 => "任务负责人",
|
||||||
|
4 => "任务协助人",
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = ['project_id', 'permissions'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限
|
||||||
|
* @param $value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPermissionsAttribute($value)
|
||||||
|
{
|
||||||
|
return Base::json2array($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取权限值
|
||||||
|
*
|
||||||
|
* @param int $projectId
|
||||||
|
* @param string $key
|
||||||
|
* @return object|array
|
||||||
|
*/
|
||||||
|
public static function getPermission($projectId, $key = '')
|
||||||
|
{
|
||||||
|
$projectPermission = self::initPermissions($projectId);
|
||||||
|
$currentPermissions = $projectPermission->permissions;
|
||||||
|
if ($key) {
|
||||||
|
if (!isset($currentPermissions[$key])) {
|
||||||
|
throw new ApiException('项目权限设置不存在');
|
||||||
|
}
|
||||||
|
return $currentPermissions[$key];
|
||||||
|
}
|
||||||
|
return $projectPermission;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化项目权限
|
||||||
|
*
|
||||||
|
* @param int $projectId
|
||||||
|
* @return ProjectPermission
|
||||||
|
*/
|
||||||
|
public static function initPermissions($projectId)
|
||||||
|
{
|
||||||
|
$permissions = [
|
||||||
|
self::TASK_LIST_ADD => $projectTaskList = [self::PERMISSIONS['project_leader'], self::PERMISSIONS['project_member']],
|
||||||
|
self::TASK_LIST_UPDATE => $projectTaskList,
|
||||||
|
self::TASK_LIST_REMOVE => [self::PERMISSIONS['project_leader']],
|
||||||
|
self::TASK_LIST_SORT => $projectTaskList,
|
||||||
|
self::TASK_ADD => $projectTaskList,
|
||||||
|
self::TASK_UPDATE => $taskUpdate = [self::PERMISSIONS['project_leader'], self::PERMISSIONS['task_leader'], self::PERMISSIONS['task_assist']],
|
||||||
|
self::TASK_STATUS => [self::PERMISSIONS['project_leader'], self::PERMISSIONS['task_leader']],
|
||||||
|
self::TASK_REMOVE => $taskUpdate,
|
||||||
|
self::TASK_ARCHIVED => $taskUpdate,
|
||||||
|
self::TASK_MOVE => $taskUpdate
|
||||||
|
];
|
||||||
|
return self::firstOrCreate(
|
||||||
|
['project_id' => $projectId],
|
||||||
|
['permissions' => Base::array2json($permissions)]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新项目权限
|
||||||
|
*
|
||||||
|
* @param int $projectId
|
||||||
|
* @param array $permissions
|
||||||
|
* @return ProjectPermission
|
||||||
|
*/
|
||||||
|
public static function updatePermissions($projectId, $newPermissions)
|
||||||
|
{
|
||||||
|
$projectPermission = self::initPermissions($projectId);
|
||||||
|
$currentPermissions = $projectPermission->permissions;
|
||||||
|
$mergedPermissions = empty($newPermissions) ? $currentPermissions : array_merge($currentPermissions, $newPermissions);
|
||||||
|
|
||||||
|
$projectPermission->permissions = Base::array2json($mergedPermissions);
|
||||||
|
$projectPermission->save();
|
||||||
|
|
||||||
|
return $projectPermission;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查用户是否有执行特定动作的权限
|
||||||
|
* @param string $action 动作名称
|
||||||
|
* @param Project $project 项目实例
|
||||||
|
* @param ProjectTask $task 任务实例
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function userTaskPermission(Project $project, $action, ProjectTask $task = null)
|
||||||
|
{
|
||||||
|
$userid = User::userid();
|
||||||
|
$permissions = self::getPermission($project->id, $action);
|
||||||
|
switch ($action) {
|
||||||
|
// 任务添加,任务更新, 任务状态, 任务删除, 任务完成, 任务归档, 任务移动
|
||||||
|
case self::TASK_LIST_ADD:
|
||||||
|
case self::TASK_LIST_UPDATE:
|
||||||
|
case self::TASK_LIST_REMOVE:
|
||||||
|
case self::TASK_LIST_SORT:
|
||||||
|
case self::TASK_ADD:
|
||||||
|
case self::TASK_UPDATE:
|
||||||
|
case self::TASK_STATUS:
|
||||||
|
case self::TASK_REMOVE:
|
||||||
|
case self::TASK_ARCHIVED:
|
||||||
|
case self::TASK_MOVE:
|
||||||
|
$verify = false;
|
||||||
|
// 项目负责人
|
||||||
|
if (in_array(self::PERMISSIONS['project_leader'], $permissions)) {
|
||||||
|
if ($project->owner) {
|
||||||
|
$verify = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 项目成员
|
||||||
|
if (!$verify && in_array(self::PERMISSIONS['project_member'], $permissions)) {
|
||||||
|
$user = ProjectUser::whereProjectId($project->id)->whereUserid(intval($userid))->first();
|
||||||
|
if (!empty($user)) {
|
||||||
|
$verify = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 任务负责人
|
||||||
|
if (!$verify && $task && in_array(self::PERMISSIONS['task_leader'], $permissions)) {
|
||||||
|
if ($task->isOwner()) {
|
||||||
|
$verify = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 任务协助人
|
||||||
|
if (!$verify && $task && in_array(self::PERMISSIONS['task_assist'], $permissions)) {
|
||||||
|
if ($task->isAssister()) {
|
||||||
|
$verify = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!$verify) {
|
||||||
|
$desc = [];
|
||||||
|
rsort($permissions);
|
||||||
|
foreach ($permissions as $permission) {
|
||||||
|
$desc[] = self::PERMISSIONS_DESC[$permission];
|
||||||
|
}
|
||||||
|
$desc = array_reverse($desc);
|
||||||
|
throw new ApiException(sprintf("仅限%s操作", implode('、', $desc)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -32,7 +32,8 @@ use Request;
|
|||||||
* @property int|null $archived_follow 跟随项目归档(项目取消归档时任务也取消归档)
|
* @property int|null $archived_follow 跟随项目归档(项目取消归档时任务也取消归档)
|
||||||
* @property string|null $complete_at 完成时间
|
* @property string|null $complete_at 完成时间
|
||||||
* @property int|null $userid 创建人
|
* @property int|null $userid 创建人
|
||||||
* @property int|null $is_all_visible 是否所有人可见
|
* @property int|null $visibility 任务可见性:1-项目人员 2-任务人员 3-指定成员
|
||||||
|
* @property int|null $is_default 是否默认任务
|
||||||
* @property int|null $p_level 优先级
|
* @property int|null $p_level 优先级
|
||||||
* @property string|null $p_name 优先级名称
|
* @property string|null $p_name 优先级名称
|
||||||
* @property string|null $p_color 优先级颜色
|
* @property string|null $p_color 优先级颜色
|
||||||
@ -81,7 +82,7 @@ use Request;
|
|||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereFlowItemId($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereFlowItemId($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereFlowItemName($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereFlowItemName($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereId($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereId($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereIsAllVisible($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereIsDefault($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereLoop($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereLoop($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereLoopAt($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereLoopAt($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereName($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereName($value)
|
||||||
@ -94,6 +95,7 @@ use Request;
|
|||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereStartAt($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereStartAt($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereUserid($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereUserid($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereVisibility($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask withTrashed()
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask withTrashed()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask withoutTrashed()
|
* @method static \Illuminate\Database\Eloquent\Builder|ProjectTask withoutTrashed()
|
||||||
* @mixin \Eloquent
|
* @mixin \Eloquent
|
||||||
@ -549,15 +551,12 @@ class ProjectTask extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function updateTask($data, &$updateMarking = [])
|
public function updateTask($data, &$updateMarking = [])
|
||||||
{
|
{
|
||||||
|
//
|
||||||
AbstractModel::transaction(function () use ($data, &$updateMarking) {
|
AbstractModel::transaction(function () use ($data, &$updateMarking) {
|
||||||
// 主任务
|
// 主任务
|
||||||
$mainTask = $this->parent_id > 0 ? self::find($this->parent_id) : null;
|
$mainTask = $this->parent_id > 0 ? self::find($this->parent_id) : null;
|
||||||
// 工作流
|
// 工作流
|
||||||
if (Arr::exists($data, 'flow_item_id')) {
|
if (Arr::exists($data, 'flow_item_id')) {
|
||||||
$isProjectOwner = $this->useridInTheProject(User::userid()) === 2;
|
|
||||||
if (!$isProjectOwner && !$this->isOwner()) {
|
|
||||||
throw new ApiException('仅限项目或任务负责人修改任务状态');
|
|
||||||
}
|
|
||||||
if ($this->flow_item_id == $data['flow_item_id']) {
|
if ($this->flow_item_id == $data['flow_item_id']) {
|
||||||
throw new ApiException('任务状态未发生改变');
|
throw new ApiException('任务状态未发生改变');
|
||||||
}
|
}
|
||||||
@ -578,6 +577,7 @@ class ProjectTask extends AbstractModel
|
|||||||
throw new ApiException("当前状态[{$currentFlowItem->name}]不可流转到[{$newFlowItem->name}]");
|
throw new ApiException("当前状态[{$currentFlowItem->name}]不可流转到[{$newFlowItem->name}]");
|
||||||
}
|
}
|
||||||
if ($currentFlowItem->userlimit) {
|
if ($currentFlowItem->userlimit) {
|
||||||
|
$isProjectOwner = $this->useridInTheProject(User::userid()) === 2;
|
||||||
if (!$isProjectOwner && !in_array(User::userid(), $currentFlowItem->userids)) {
|
if (!$isProjectOwner && !in_array(User::userid(), $currentFlowItem->userids)) {
|
||||||
throw new ApiException("当前状态[{$currentFlowItem->name}]仅限状态负责人或项目负责人修改");
|
throw new ApiException("当前状态[{$currentFlowItem->name}]仅限状态负责人或项目负责人修改");
|
||||||
}
|
}
|
||||||
@ -1728,14 +1728,10 @@ class ProjectTask extends AbstractModel
|
|||||||
* @param int $task_id
|
* @param int $task_id
|
||||||
* @param bool $archived true:仅限未归档, false:仅限已归档, null:不限制
|
* @param bool $archived true:仅限未归档, false:仅限已归档, null:不限制
|
||||||
* @param bool $trashed true:仅限未删除, false:仅限已删除, null:不限制
|
* @param bool $trashed true:仅限未删除, false:仅限已删除, null:不限制
|
||||||
* @param int|bool $permission
|
|
||||||
* - 0|false 限制:项目成员、任务成员、任务群聊成员(任务成员 = 任务创建人+任务协助人+任务负责人)
|
|
||||||
* - 1|true 限制:项目负责人、任务成员
|
|
||||||
* - 2 已有负责人才限制true (子任务时如果是主任务负责人也可以)
|
|
||||||
* @param array $with
|
* @param array $with
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public static function userTask($task_id, $archived = true, $trashed = true, $permission = false, $with = [])
|
public static function userTask($task_id, $archived = true, $trashed = true, $with = [])
|
||||||
{
|
{
|
||||||
$builder = self::with($with)->allData()->where("project_tasks.id", intval($task_id));
|
$builder = self::with($with)->allData()->where("project_tasks.id", intval($task_id));
|
||||||
if ($trashed === false) {
|
if ($trashed === false) {
|
||||||
@ -1758,7 +1754,7 @@ class ProjectTask extends AbstractModel
|
|||||||
try {
|
try {
|
||||||
$project = Project::userProject($task->project_id);
|
$project = Project::userProject($task->project_id);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
if ($task->owner !== null || (!$permission && $task->permission(4))) {
|
if ($task->owner !== null || $task->permission(4)) {
|
||||||
$project = Project::find($task->project_id);
|
$project = Project::find($task->project_id);
|
||||||
if (empty($project)) {
|
if (empty($project)) {
|
||||||
throw new ApiException('项目不存在或已被删除', [ 'task_id' => $task_id ], -4002);
|
throw new ApiException('项目不存在或已被删除', [ 'task_id' => $task_id ], -4002);
|
||||||
@ -1768,13 +1764,6 @@ class ProjectTask extends AbstractModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if ($permission >= 2) {
|
|
||||||
$permission = $task->hasOwner() ? 1 : 0;
|
|
||||||
}
|
|
||||||
if ($permission && !$project->owner && !$task->permission(3)) {
|
|
||||||
throw new ApiException('仅限项目负责人、任务负责人、协助人员或任务创建者操作');
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return $task;
|
return $task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -687,6 +687,22 @@ class Base
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归处理数组
|
||||||
|
*
|
||||||
|
* @param string $callback 如:'intval'、'trim'、'addslashes'、'stripslashes'、'htmlspecialchars'
|
||||||
|
* @param array $array
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function newArrayRecursive($callback, $array)
|
||||||
|
{
|
||||||
|
$func = function ($item) use (&$func, &$callback) {
|
||||||
|
return is_array($item) ? array_map($func, $item) : call_user_func($callback, $item);
|
||||||
|
};
|
||||||
|
|
||||||
|
return array_map($func, $array);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重MD5加密
|
* 重MD5加密
|
||||||
* @param $text
|
* @param $text
|
||||||
|
|||||||
@ -1405,3 +1405,15 @@ APP推送
|
|||||||
首页
|
首页
|
||||||
无相关数据
|
无相关数据
|
||||||
当前环境
|
当前环境
|
||||||
|
|
||||||
|
权限设置
|
||||||
|
任务列权限
|
||||||
|
添加列
|
||||||
|
修改列
|
||||||
|
删除列
|
||||||
|
排序列
|
||||||
|
任务权限
|
||||||
|
修改任务
|
||||||
|
修改状态
|
||||||
|
移动任务
|
||||||
|
任务协助人
|
||||||
|
|||||||
@ -18522,5 +18522,126 @@
|
|||||||
"de": "Es liegen keine daten vor.",
|
"de": "Es liegen keine daten vor.",
|
||||||
"fr": "Aucune donnée disponible",
|
"fr": "Aucune donnée disponible",
|
||||||
"id": "Tidak ada data yang relevan"
|
"id": "Tidak ada data yang relevan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "权限设置",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "權限設置",
|
||||||
|
"en": "Permission setting",
|
||||||
|
"ko": "권한 설정",
|
||||||
|
"ja": "権限設定です",
|
||||||
|
"de": "Berechtigungen festlegen",
|
||||||
|
"fr": "Paramètres des droits",
|
||||||
|
"id": "Pengaturan hak akses"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "任务列权限",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "任務列權限",
|
||||||
|
"en": "Task bar permission",
|
||||||
|
"ko": "작업 칸 권한",
|
||||||
|
"ja": "任務列権限",
|
||||||
|
"de": "Aufgabenliste zugriff auf",
|
||||||
|
"fr": "Autorisations de colonne de tâche",
|
||||||
|
"id": "Izin kolom tugas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "添加列",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "添加列",
|
||||||
|
"en": "Add column",
|
||||||
|
"ko": "칸 추가",
|
||||||
|
"ja": "列を追加します",
|
||||||
|
"de": "Geben sie zu.",
|
||||||
|
"fr": "Ajouter une colonne",
|
||||||
|
"id": "Tambahkan kolom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "修改列",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "修改列",
|
||||||
|
"en": "Modified column",
|
||||||
|
"ko": "칸 수정하기",
|
||||||
|
"ja": "修正列です",
|
||||||
|
"de": "Ich repariere sie.",
|
||||||
|
"fr": "Modifier une colonne",
|
||||||
|
"id": "Merevisi kolom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "删除列",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "刪除列",
|
||||||
|
"en": "Delete column",
|
||||||
|
"ko": "칸 삭제",
|
||||||
|
"ja": "列を削除します",
|
||||||
|
"de": "Spalte löschen",
|
||||||
|
"fr": "Supprimer une colonne",
|
||||||
|
"id": "Hapus kolom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "排序列",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "排序列",
|
||||||
|
"en": "Sequencing",
|
||||||
|
"ko": "서열을 정하다",
|
||||||
|
"ja": "序列をつけます。",
|
||||||
|
"de": "Reihen aufstellen.",
|
||||||
|
"fr": "Séquence de rangées",
|
||||||
|
"id": "Urutan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "修改任务",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "修改任務",
|
||||||
|
"en": "Modify task",
|
||||||
|
"ko": "작업 변경",
|
||||||
|
"ja": "タスクを修正します",
|
||||||
|
"de": "Die mission ändern.",
|
||||||
|
"fr": "Modifier une tâche",
|
||||||
|
"id": "Memodifikasi tugas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "修改状态",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "修改狀態",
|
||||||
|
"en": "Modified state",
|
||||||
|
"ko": "상태 수정",
|
||||||
|
"ja": "状態を修正します",
|
||||||
|
"de": "Ändern.",
|
||||||
|
"fr": "Modifier le statut",
|
||||||
|
"id": "Memodifikasi status"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "移动任务",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "移動任務",
|
||||||
|
"en": "Mobile task",
|
||||||
|
"ko": "작업 이동",
|
||||||
|
"ja": "移動ミッションです",
|
||||||
|
"de": "Mobile mission?",
|
||||||
|
"fr": "Déplacer la tâche",
|
||||||
|
"id": "Tugas bergerak"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "任务协助人",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "任務協助人",
|
||||||
|
"en": "Mission helper",
|
||||||
|
"ko": "임무 협조자",
|
||||||
|
"ja": "任務協力者です",
|
||||||
|
"de": "Entbindungen für die mission",
|
||||||
|
"fr": "Collaboration en mission",
|
||||||
|
"id": "Kolaborasi tugas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "任务权限",
|
||||||
|
"zh": "",
|
||||||
|
"zh-CHT": "任務權限",
|
||||||
|
"en": "Task authority",
|
||||||
|
"ko": "작업 권한",
|
||||||
|
"ja": "任務権限です",
|
||||||
|
"de": "Auftrag autorisiert.",
|
||||||
|
"fr": "Autorisations de tâches",
|
||||||
|
"id": "Hak akses tugas"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
2
public/language/web/de.js
vendored
2
public/language/web/de.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/en.js
vendored
2
public/language/web/en.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/fr.js
vendored
2
public/language/web/fr.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/id.js
vendored
2
public/language/web/id.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/ja.js
vendored
2
public/language/web/ja.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/key.js
vendored
2
public/language/web/key.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/ko.js
vendored
2
public/language/web/ko.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/zh-CHT.js
vendored
2
public/language/web/zh-CHT.js
vendored
File diff suppressed because one or more lines are too long
2
public/language/web/zh.js
vendored
2
public/language/web/zh.js
vendored
@ -1 +1 @@
|
|||||||
if(typeof window.LANGUAGE_DATA==="undefined")window.LANGUAGE_DATA={};window.LANGUAGE_DATA["zh"]=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]
|
if(typeof window.LANGUAGE_DATA==="undefined")window.LANGUAGE_DATA={};window.LANGUAGE_DATA["zh"]=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]
|
||||||
@ -347,9 +347,8 @@
|
|||||||
<DrawerOverlay
|
<DrawerOverlay
|
||||||
v-model="permissionShow"
|
v-model="permissionShow"
|
||||||
placement="right"
|
placement="right"
|
||||||
:beforeClose="workflowBeforeClose"
|
|
||||||
:size="650">
|
:size="650">
|
||||||
<ProjectPermission ref="permission" v-if="permissionShow" :project-id="projectId"/>
|
<ProjectPermission ref="permission" v-if="permissionShow" @close="()=>{ this.permissionShow = false }" :project-id="projectId"/>
|
||||||
</DrawerOverlay>
|
</DrawerOverlay>
|
||||||
|
|
||||||
<!--成员管理-->
|
<!--成员管理-->
|
||||||
|
|||||||
@ -4,61 +4,91 @@
|
|||||||
{{$L('权限设置')}}
|
{{$L('权限设置')}}
|
||||||
<div class="title-icon">
|
<div class="title-icon">
|
||||||
<Loading v-if="loadIng > 0"/>
|
<Loading v-if="loadIng > 0"/>
|
||||||
<Icon v-else type="ios-refresh" @click="getData"/>
|
<Icon v-else type="ios-refresh" @click="getData()"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="permission-content">
|
<div class="permission-content">
|
||||||
|
<Form :model="formData" label-width="90" label-position="right">
|
||||||
<Form :model="formData" label-width="100" label-position="right">
|
<!-- 项目权限 -->
|
||||||
|
<div class="project-permission-title" >{{$L('任务列权限')}}:</div>
|
||||||
|
<FormItem :label="$L('添加列')">
|
||||||
|
<CheckboxGroup v-model="formData.task_list_add">
|
||||||
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
|
</CheckboxGroup>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem :label="$L('修改列')">
|
||||||
|
<CheckboxGroup v-model="formData.task_list_update">
|
||||||
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
|
</CheckboxGroup>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem :label="$L('删除列')">
|
||||||
|
<CheckboxGroup v-model="formData.task_list_remove">
|
||||||
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
|
</CheckboxGroup>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem :label="$L('排序列')">
|
||||||
|
<CheckboxGroup v-model="formData.task_list_sort">
|
||||||
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
|
</CheckboxGroup>
|
||||||
|
</FormItem>
|
||||||
<!-- 任务权限 -->
|
<!-- 任务权限 -->
|
||||||
<div class="project-permission-title" >{{$L('任务权限')}}:</div>
|
<div class="project-permission-title" >{{$L('任务权限')}}:</div>
|
||||||
<FormItem :label="$L('添加任务')">
|
<FormItem :label="$L('添加任务')">
|
||||||
<CheckboxGroup v-model="formData.task_add">
|
<CheckboxGroup v-model="formData.task_add">
|
||||||
<Checkbox :label="$L('项目负责人')" :value="1" disabled></Checkbox>
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('项目成员')" :value="3"></Checkbox>
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
</CheckboxGroup>
|
</CheckboxGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('修改任务')">
|
<FormItem :label="$L('修改任务')">
|
||||||
<CheckboxGroup v-model="formData.task_edit">
|
<CheckboxGroup v-model="formData.task_update">
|
||||||
<Checkbox :label="$L('项目负责人')" :value="1" disabled></Checkbox>
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('任务负责人')" :value="2"></Checkbox>
|
<Checkbox :label="3">{{ $L('任务负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('项目成员')" :value="3"></Checkbox>
|
<Checkbox :label="4">{{ $L('任务协助人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
</CheckboxGroup>
|
</CheckboxGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('标记完成')">
|
<FormItem :label="$L('修改状态')">
|
||||||
<CheckboxGroup v-model="formData.task_mark_complete">
|
<CheckboxGroup v-model="formData.task_status">
|
||||||
<Checkbox :label="$L('项目负责人')" :value="1" disabled></Checkbox>
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('任务负责人')" :value="2"></Checkbox>
|
<Checkbox :label="3">{{ $L('任务负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('项目成员')" :value="3"></Checkbox>
|
<Checkbox :label="4">{{ $L('任务协助人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
</CheckboxGroup>
|
</CheckboxGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('归档任务')">
|
<FormItem :label="$L('归档任务')">
|
||||||
<CheckboxGroup v-model="formData.task_archiving">
|
<CheckboxGroup v-model="formData.task_archived">
|
||||||
<Checkbox :label="$L('项目负责人')" :value="1" disabled></Checkbox>
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('任务负责人')" :value="2"></Checkbox>
|
<Checkbox :label="3">{{ $L('任务负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('项目成员')" :value="3"></Checkbox>
|
<Checkbox :label="4">{{ $L('任务协助人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
</CheckboxGroup>
|
</CheckboxGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('删除任务')">
|
<FormItem :label="$L('删除任务')">
|
||||||
<CheckboxGroup v-model="formData.task_delete">
|
<CheckboxGroup v-model="formData.task_remove">
|
||||||
<Checkbox :label="$L('项目负责人')" :value="1" disabled></Checkbox>
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('任务负责人')" :value="2"></Checkbox>
|
<Checkbox :label="3">{{ $L('任务负责人') }}</Checkbox>
|
||||||
<Checkbox :label="$L('项目成员')" :value="3"></Checkbox>
|
<Checkbox :label="4">{{ $L('任务协助人') }}</Checkbox>
|
||||||
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
</CheckboxGroup>
|
</CheckboxGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<!-- 面板显示 -->
|
<FormItem :label="$L('移动任务')">
|
||||||
<div class="project-permission-title" >{{$L('面板显示')}}:</div>
|
<CheckboxGroup v-model="formData.task_move">
|
||||||
<FormItem :label="$L('显示已完成')">
|
<Checkbox :label="1" disabled>{{ $L('项目负责人') }}</Checkbox>
|
||||||
<RadioGroup v-model="formData.panel_display">
|
<Checkbox :label="3">{{ $L('任务负责人') }}</Checkbox>
|
||||||
<Radio :label="$L('默认显示')" :value="1" ></Radio>
|
<Checkbox :label="4">{{ $L('任务协助人') }}</Checkbox>
|
||||||
<Radio :label="$L('默认不显示')" :value="0"></Radio>
|
<Checkbox :label="2">{{ $L('项目成员') }}</Checkbox>
|
||||||
</RadioGroup>
|
</CheckboxGroup>
|
||||||
<div class="form-placeholder">{{ $L('项目面板默认显示已完成的任务') }}</div>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div slot="footer" class="project-permission-footer">
|
||||||
|
<Button type="default" @click="onClose()">{{$L('取消')}}</Button>
|
||||||
|
<Button type="primary" @click="updateData()" :loading="loadIng > 0">{{$L('修改')}}</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -74,13 +104,15 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
loadIng: 0,
|
||||||
formData: {
|
formData: {
|
||||||
task_add: [1,3],
|
project_task_list: [],
|
||||||
task_edit: [1],
|
task_add: [],
|
||||||
task_mark_complete: [1],
|
task_update: [],
|
||||||
task_archiving: [1],
|
task_status: [],
|
||||||
task_delete: [1],
|
task_archived: [],
|
||||||
panel_display: 0
|
task_remove: [],
|
||||||
|
task_move: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -105,17 +137,12 @@ export default {
|
|||||||
getData() {
|
getData() {
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'project/flow/list',
|
url: 'project/permission',
|
||||||
data: {
|
data: {
|
||||||
project_id: this.projectId,
|
project_id: this.projectId,
|
||||||
},
|
},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
// this.list = data.map(item => {
|
this.formData = data.permissions;
|
||||||
// item.project_flow_bak = JSON.stringify(item.project_flow_item)
|
|
||||||
// return item;
|
|
||||||
// });
|
|
||||||
// this.openIndex = this.list.length === 1 ? ("index_" + this.list[0].id) : ""
|
|
||||||
// this.$nextTick(this.syncScroller);
|
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
@ -123,6 +150,28 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateData() {
|
||||||
|
this.loadIng++;
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'project/permission/update',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
project_id: this.projectId,
|
||||||
|
...this.formData
|
||||||
|
},
|
||||||
|
}).then(({data}) => {
|
||||||
|
this.formData = data.permissions;
|
||||||
|
this.$Message.success(this.$L('修改成功'));
|
||||||
|
}).catch(({msg}) => {
|
||||||
|
$A.modalError(msg);
|
||||||
|
}).finally(_ => {
|
||||||
|
this.loadIng--;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
this.$emit('close')
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
// style="font-weight: bold;line-height: 40px;"
|
|
||||||
padding: 20px 20px 24px;
|
padding: 20px 20px 24px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -33,6 +32,7 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.project-permission-title{
|
.project-permission-title{
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@ -49,4 +49,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.project-permission-footer{
|
||||||
|
flex-shrink: 0;
|
||||||
|
position: static;
|
||||||
|
padding: 16px 26px;
|
||||||
|
border-top: 1px solid #F4F4F5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
button {
|
||||||
|
min-width: 120px;
|
||||||
|
height: 38px;
|
||||||
|
line-height: 36px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
body.window-portrait {
|
||||||
|
.project-permission {
|
||||||
|
.project-permission-footer{
|
||||||
|
button {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user