优化项目日志
This commit is contained in:
parent
75a12fc6f5
commit
cebcc26baf
@ -1749,17 +1749,17 @@ class ProjectController extends AbstractController
|
|||||||
$project_id = intval(Request::input('project_id'));
|
$project_id = intval(Request::input('project_id'));
|
||||||
$task_id = intval(Request::input('task_id'));
|
$task_id = intval(Request::input('task_id'));
|
||||||
//
|
//
|
||||||
$builder = ProjectLog::with(['projectTask:id,name']);
|
$builder = ProjectLog::select(["*"]);
|
||||||
if ($task_id > 0) {
|
if ($task_id > 0) {
|
||||||
$task = ProjectTask::userTask($task_id);
|
$task = ProjectTask::userTask($task_id);
|
||||||
$builder->whereTaskId($task->id);
|
$builder->whereTaskId($task->id);
|
||||||
} else {
|
} else {
|
||||||
$project = Project::userProject($project_id);
|
$project = Project::userProject($project_id);
|
||||||
$builder->whereProjectId($project->id);
|
$builder->with(['projectTask:id,parent_id,name'])->whereProjectId($project->id);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$list = $builder->orderByDesc('created_at')->paginate(Base::getPaginate(100, 20));
|
$list = $builder->orderByDesc('created_at')->paginate(Base::getPaginate(100, 20));
|
||||||
$list->transform(function (ProjectLog $log) {
|
$list->transform(function (ProjectLog $log) use ($task_id) {
|
||||||
$timestamp = Carbon::parse($log->created_at)->timestamp;
|
$timestamp = Carbon::parse($log->created_at)->timestamp;
|
||||||
$log->time = [
|
$log->time = [
|
||||||
'ymd' => date(date("Y", $timestamp) == date("Y", Base::time()) ? "m-d" : "Y-m-d", $timestamp),
|
'ymd' => date(date("Y", $timestamp) == date("Y", Base::time()) ? "m-d" : "Y-m-d", $timestamp),
|
||||||
|
@ -14,13 +14,18 @@
|
|||||||
<div class="avatar-name auto">{{$L('系统')}}</div>
|
<div class="avatar-name auto">{{$L('系统')}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="log in itemB.lists" class="log-summary">
|
<template v-for="log in itemB.lists">
|
||||||
|
<div class="log-summary">
|
||||||
<ProjectLogDetail :render="logDetail" :item="log"/>
|
<ProjectLogDetail :render="logDetail" :item="log"/>
|
||||||
<span v-if="operationList(log).length > 0" class="log-operation">
|
<span v-if="operationList(log).length > 0" class="log-operation">
|
||||||
<Button v-for="(op, oi) in operationList(log)" :key="oi" size="small" @click="onOperation(op)">{{op.button}}</Button>
|
<Button v-for="(op, oi) in operationList(log)" :key="oi" size="small" @click="onOperation(op)">{{op.button}}</Button>
|
||||||
</span>
|
</span>
|
||||||
<span class="log-time">{{log.time.ymd}} {{log.time.segment}} {{log.time.hi}}</span>
|
<span class="log-time">{{log.time.ymd}} {{log.time.segment}} {{log.time.hi}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="log.project_task" class="log-task">
|
||||||
|
<em @click="openTask(log.project_task)">{{$L('关联任务')}}: {{log.project_task.name}}</em>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</TimelineItem>
|
</TimelineItem>
|
||||||
</Timeline>
|
</Timeline>
|
||||||
</div>
|
</div>
|
||||||
@ -241,6 +246,10 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
openTask(task) {
|
||||||
|
this.$store.dispatch("openTask", task)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,31 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.log-task {
|
||||||
|
margin-left: 12px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
opacity: 0.8;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
> em {
|
||||||
|
display: inline-block;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 0 4px;
|
||||||
|
line-height: 18px;
|
||||||
|
height: 18px;
|
||||||
|
max-width: 100%;
|
||||||
|
background: #f1f1f1;
|
||||||
|
color: #9f9f9f;
|
||||||
|
border-radius: 5px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user