kuaifan пре 5 година
родитељ
комит
a9effc6b0e

+ 1 - 0
app/Http/Controllers/Api/ProjectController.php

@@ -1934,6 +1934,7 @@ class ProjectController extends Controller
         $task['overdue'] = Project::taskIsOverdue($task);
         $task['subtask'] = Base::string2array($task['subtask']);
         $task['follower'] = Base::string2array($task['follower']);
+        $task['projectTitle'] = $task['projectid'] > 0 ? DB::table('project_lists')->where('id', $task['projectid'])->value('title') : '';
         $task = array_merge($task, Users::username2basic($task['username']));
         return Base::retSuccess($message ?: '修改成功!', $task);
     }

+ 27 - 3
resources/assets/js/main/components/project/task/detail/detail.vue

@@ -4,9 +4,9 @@
             <div class="detail-left">
                 <div class="detail-title-box detail-icon">
                     <input v-model="detail.title" :disabled="!!loadData.title" type="text" maxlength="60" @keydown.enter="(e)=>{e.target.blur()}" @blur="handleTask('title')">
-                    <div class="subtitle">
-                        {{$L('项目名称:')}}
-                        <span>{{detail.projectTitle}}</span>
+                    <div v-if="detail.projectTitle && urlProjectid != detail.projectid" class="subtitle">
+                        {{$L('所属项目:')}}
+                        <span class="project-title" @click="openProject(detail.projectid)">{{detail.projectTitle}}</span>
                     </div>
                     <div class="subtitle">
                         <span class="z-nick"><UserView :username="detail.createuser"/></span>
@@ -133,6 +133,8 @@
 
                 visible: false,
 
+                urlProjectid: 0,
+
                 bakData: {},
                 loadData: {},
 
@@ -203,6 +205,9 @@
             };
         },
         mounted() {
+            let match = (window.location.pathname + "").match(/\/project\/panel\/(\d+)$/i);
+            this.urlProjectid = match ? match[1] : 0;
+            //
             this.$nextTick(() => {
                 let dom = this.$el;
                 if (parseInt(this.taskid) === 0) {
@@ -573,6 +578,18 @@
                         }
                     }
                 });
+            },
+
+            openProject(projectid) {
+                try {
+                    this.visible = false;
+                    $A.app.$router.push({
+                        name: 'project-panel',
+                        params: {projectid: projectid, statistics: '', other: {}}
+                    });
+                } catch (e) {
+                    this.visible = true;
+                }
             }
         }
     }
@@ -665,6 +682,13 @@
                         padding-top: 3px;
                         font-size: 12px;
                         color: #606266;
+                        .project-title {
+                            cursor: pointer;
+                            &:hover {
+                                color: #57a3f3;
+                                text-decoration: underline;
+                            }
+                        }
                     }
                     input {
                         margin: -10px 0 0 -8px;

+ 1 - 0
resources/lang/en/general.js

@@ -474,4 +474,5 @@ export default {
     "项目面板隐藏已完成的任务。": "The project panel hides completed tasks.",
     "确定要修改任务【%】的计划时间吗?<br/>开始时间:%<br/>结束时间:%": "Are you sure you want to change the scheduled time for task [%]? <br/> start time: %<br/> end time: %",
     "任务列表为空,请先添加任务。": "The task list is empty, please add the task first.",
+    "项目名称:": "Project name:",
 }