perf: 添加项目任务标签功能

This commit is contained in:
kuaifan 2024-12-08 17:25:23 +08:00
parent 8e108e2d38
commit 42234be5cf
3 changed files with 29 additions and 3 deletions

View File

@ -2864,7 +2864,7 @@ class ProjectController extends AbstractController
/**
* @api {post} api/project/tag/save 51. 保存标签
*
* @apiDescription 需要token身份限:项目负责人
* @apiDescription 需要token身份修改:项目负责人;添加:项目所有成员
* @apiVersion 1.0.0
* @apiGroup project
* @apiName tag__save
@ -2887,7 +2887,6 @@ class ProjectController extends AbstractController
if (!$projectId) {
return Base::retError('参数错误');
}
Project::userProject($projectId, true, true);
//
$id = intval(Request::input('id', 0));
$name = trim(Request::input('name', ''));
@ -2906,6 +2905,7 @@ class ProjectController extends AbstractController
'color' => $color,
'userid' => $user->userid
];
$project = Project::userProject($projectId, true, $id > 0 ? true : null);
if ($id > 0) {
$tag = ProjectTag::where('id', $id)
->where('project_id', $projectId)
@ -2920,6 +2920,7 @@ class ProjectController extends AbstractController
return Base::retError('每个项目最多添加20个标签');
}
$tag = ProjectTag::create($data);
$project->addLog("添加标签【" . $tag->name . "");
}
return Base::retSuccess('保存成功', $tag);
}

View File

@ -43,10 +43,11 @@
<script>
import ProjectLogDetail from "./ProjectLogDetail";
import TaskTag from "./ProjectTaskTag/tags.vue";
export default {
name: "ProjectLog",
components: {ProjectLogDetail},
components: {ProjectLogDetail, TaskTag},
props: {
projectId: {
type: Number,
@ -193,6 +194,17 @@ export default {
vNode.push(h('span', {class:'change-value'}, now || '-'))
}
}
if ($A.isArray(record.tags)) {
vNode.push(h('span', {
class: 'change-tags'
}, [
h('TaskTag', {
props: {
tags: record.tags
}
})
]))
}
if ($A.isJson(record.link)) {
const {title, url} = record.link
vNode.push(h('span', ': '))

View File

@ -143,6 +143,19 @@
}
}
}
.change-tags {
display: inline-block;
margin-left: 6px;
.tags-box {
gap: 6px;
> li {
height: 20px;
padding: 0 8px;
font-size: 12px;
}
}
}
}
.log-operation {