mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 10:33:54 +00:00
perf: 支持管理自己创建的标签
This commit is contained in:
parent
074ccc8aab
commit
a15b29122e
@ -3032,11 +3032,14 @@ class ProjectController extends AbstractController
|
||||
'color' => $color,
|
||||
'userid' => $user->userid
|
||||
];
|
||||
$project = Project::userProject($projectId, true, $id > 0 ? true : null);
|
||||
$project = Project::userProject($projectId);
|
||||
if ($id > 0) {
|
||||
$tag = ProjectTag::where('id', $id)
|
||||
->where('project_id', $projectId)
|
||||
->first();
|
||||
if (!$project->owner && $tag->userid != $user->userid) {
|
||||
return Base::retError('没有权限修改标签');
|
||||
}
|
||||
if (!$tag) {
|
||||
return Base::retError('标签不存在或已被删除');
|
||||
}
|
||||
|
||||
@ -36,7 +36,6 @@ namespace App\Models;
|
||||
class ProjectTag extends AbstractModel
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
|
||||
@ -66,7 +66,8 @@
|
||||
<EDropdownItem command="delete" style="color:#f40">{{$L('删除项目')}}</EDropdownItem>
|
||||
</EDropdownMenu>
|
||||
<EDropdownMenu v-else slot="dropdown">
|
||||
<EDropdownItem command="log">{{$L('项目动态')}}</EDropdownItem>
|
||||
<EDropdownItem command="task_tag">{{$L('任务标签')}}</EDropdownItem>
|
||||
<EDropdownItem command="log" divided>{{$L('项目动态')}}</EDropdownItem>
|
||||
<EDropdownItem command="archived_task">{{$L('已归档任务')}}</EDropdownItem>
|
||||
<EDropdownItem command="deleted_task">{{$L('已删除任务')}}</EDropdownItem>
|
||||
<EDropdownItem command="exit" divided style="color:#f40">{{$L('退出项目')}}</EDropdownItem>
|
||||
|
||||
@ -72,6 +72,9 @@ export default {
|
||||
formRules: {
|
||||
name: [
|
||||
{ required: true, message: this.$L('请输入标签名称'), trigger: 'blur' }
|
||||
],
|
||||
color: [
|
||||
{ required: true, message: this.$L('请选择标签颜色'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
@ -28,12 +28,18 @@
|
||||
<div v-if="item.desc" class="tag-desc">{{ item.desc }}</div>
|
||||
</div>
|
||||
<div class="tag-actions">
|
||||
<Button @click="handleAdd(item)" type="primary">
|
||||
{{$L('编辑')}}
|
||||
</Button>
|
||||
<Button @click="handleDelete(item)" type="error">
|
||||
{{$L('删除')}}
|
||||
</Button>
|
||||
<div v-if="item.userid === userId || projectData.owner_userid === userId" class="tag-actions-btns">
|
||||
<Button @click="handleAdd(item)" type="primary">
|
||||
{{$L('编辑')}}
|
||||
</Button>
|
||||
<Button @click="handleDelete(item)" type="error">
|
||||
{{$L('删除')}}
|
||||
</Button>
|
||||
</div>
|
||||
<div class="tag-actions-owner">
|
||||
<UserAvatar v-if="item.userid !== userId" :title="$L('创建人')" :userid="item.userid" show-name :show-icon="false" :size="16"/>
|
||||
<span :title="$L('创建时间')">{{item.created_at}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -45,7 +51,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
import {mapState, mapGetters} from 'vuex'
|
||||
import Tags from "./tags.vue";
|
||||
import TaskTagAdd from "./add.vue";
|
||||
|
||||
@ -68,6 +74,7 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['projectData']),
|
||||
...mapState(['formOptions'])
|
||||
},
|
||||
created() {
|
||||
|
||||
4
resources/assets/sass/pages/common.scss
vendored
4
resources/assets/sass/pages/common.scss
vendored
@ -559,6 +559,10 @@ body {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ivu-color-picker {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
*[hidden="hidden"] {
|
||||
|
||||
@ -108,13 +108,16 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
padding: 16px 0;
|
||||
border-top: 1px solid #F4F4F5;
|
||||
.tag-contents {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-right: 8px;
|
||||
max-width: 100%;
|
||||
.tag-title {
|
||||
height: 22px;
|
||||
display: flex;
|
||||
@ -124,20 +127,40 @@
|
||||
.tag-desc {
|
||||
color: $primary-text-color;
|
||||
font-size: 13px;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
.tag-actions {
|
||||
flex-shrink: 0;
|
||||
> button {
|
||||
margin: 8px 0 8px 8px;
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
font-size: 13px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 8px;
|
||||
|
||||
> i {
|
||||
margin: 0 -2px;
|
||||
.tag-actions-btns {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
> button {
|
||||
margin: 0;
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
font-size: 13px;
|
||||
|
||||
> i {
|
||||
margin: 0 -2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tag-actions-owner {
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user