diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php
index 273ba2da5..fdc7a39e0 100644
--- a/app/Models/ProjectTask.php
+++ b/app/Models/ProjectTask.php
@@ -769,6 +769,7 @@ class ProjectTask extends AbstractModel
if (Arr::exists($data, 'times')) {
$oldAt = [Carbon::parse($this->start_at), Carbon::parse($this->end_at)];
$oldStringAt = $this->start_at ? ($oldAt[0]->toDateTimeString() . '~' . $oldAt[1]->toDateTimeString()) : '';
+ $clearSubTaskTime = false;
$this->start_at = null;
$this->end_at = null;
$times = $data['times'];
@@ -802,6 +803,7 @@ class ProjectTask extends AbstractModel
// 清空子任务时间(子任务时间等于主任务时间)
$this->start_at = $mainTask->start_at;
$this->end_at = $mainTask->end_at;
+ $clearSubTaskTime = true;
}
}
if ($this->parent_id == 0) {
@@ -832,7 +834,7 @@ class ProjectTask extends AbstractModel
}
});
}
- $newStringAt = $this->start_at ? ($this->start_at->toDateTimeString() . '~' . $this->end_at->toDateTimeString()) : '';
+ $newStringAt = $this->start_at && !$clearSubTaskTime ? ($this->start_at->toDateTimeString() . '~' . $this->end_at->toDateTimeString()) : '';
$newDesc = $desc ? "(备注:{$desc})" : "";
$this->addLog("修改{任务}时间" . $newDesc, [
'change' => [$oldStringAt, $newStringAt]
@@ -1426,7 +1428,11 @@ class ProjectTask extends AbstractModel
'detail' => $detail,
];
if ($this->parent_id) {
- $record['subtitle'] = $this->name;
+ $record['subtask'] = [
+ 'id' => $this->id,
+ 'parent_id' => $this->parent_id,
+ 'name' => $this->name,
+ ];
}
if ($record) {
$array['record'] = $record;
diff --git a/resources/assets/js/pages/manage/components/ProjectLog.vue b/resources/assets/js/pages/manage/components/ProjectLog.vue
index fd0d94f01..f43ca6b79 100644
--- a/resources/assets/js/pages/manage/components/ProjectLog.vue
+++ b/resources/assets/js/pages/manage/components/ProjectLog.vue
@@ -25,6 +25,10 @@
{{$L('关联任务')}}: {{log.project_task.name}}
+
+ {{$L('关联子任务')}}: {{log.record.subtask.name}}
+
+
@@ -159,6 +163,15 @@ export default {
this.getLists();
},
+ /**
+ * 是否有子任务
+ * @param record
+ * @returns {boolean}
+ */
+ hasRecordSubtask(record) {
+ return $A.isJson(record) && $A.isJson(record.subtask)
+ },
+
/**
* 日志详情
* @param h
@@ -305,6 +318,28 @@ export default {
openTask(task) {
this.$store.dispatch("openTask", task)
+ },
+
+ posSubTask(subtask) {
+ const el = this.$parent.$refs[`subTask_${subtask.id}`]
+ if (el && el[0]) {
+ const $e = el[0].$el
+ if ($e.classList.contains("common-shake")) {
+ return
+ }
+ $A.scrollIntoViewIfNeeded($e)
+ requestAnimationFrame(_ => {
+ $e.classList.add("common-shake")
+ setTimeout(_ => {
+ $e.classList.remove("common-shake")
+ }, 600)
+ })
+ } else {
+ if (subtask.parent_id == this.taskId) {
+ return
+ }
+ this.$store.dispatch("openTask", subtask)
+ }
}
}
}
diff --git a/resources/assets/sass/pages/components/project-log.scss b/resources/assets/sass/pages/components/project-log.scss
index f2d43b5a3..ecc44e0f7 100644
--- a/resources/assets/sass/pages/components/project-log.scss
+++ b/resources/assets/sass/pages/components/project-log.scss
@@ -126,6 +126,11 @@
}
}
+ .subtitle-value {
+ padding-left: 12px;
+ color: rgba(0, 0, 0, .36);
+ }
+
.detail-user {
display: inline-block;
vertical-align: top;
@@ -157,16 +162,9 @@
}
.log-task {
+ display: flex;
margin-left: 12px;
- margin-bottom: 6px;
- opacity: 0.6;
- cursor: pointer;
- &:hover {
- opacity: 1;
- > em {
- color: $primary-color;
- }
- }
+ padding-bottom: 4px;
> em {
display: inline-block;
font-style: normal;
@@ -179,8 +177,18 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ cursor: pointer;
+ opacity: 0.6;
+ &:hover {
+ opacity: 1;
+ color: $primary-color;
+ }
}
}
+ .log-bottom {
+ width: 100%;
+ height: 6px;
+ }
}
}
}