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

View File

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