优化项目日志
This commit is contained in:
parent
75a12fc6f5
commit
cebcc26baf
@ -1749,17 +1749,17 @@ class ProjectController extends AbstractController
|
||||
$project_id = intval(Request::input('project_id'));
|
||||
$task_id = intval(Request::input('task_id'));
|
||||
//
|
||||
$builder = ProjectLog::with(['projectTask:id,name']);
|
||||
$builder = ProjectLog::select(["*"]);
|
||||
if ($task_id > 0) {
|
||||
$task = ProjectTask::userTask($task_id);
|
||||
$builder->whereTaskId($task->id);
|
||||
} else {
|
||||
$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->transform(function (ProjectLog $log) {
|
||||
$list->transform(function (ProjectLog $log) use ($task_id) {
|
||||
$timestamp = Carbon::parse($log->created_at)->timestamp;
|
||||
$log->time = [
|
||||
'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>
|
||||
</div>
|
||||
<div v-for="log in itemB.lists" class="log-summary">
|
||||
<ProjectLogDetail :render="logDetail" :item="log"/>
|
||||
<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>
|
||||
</span>
|
||||
<span class="log-time">{{log.time.ymd}} {{log.time.segment}} {{log.time.hi}}</span>
|
||||
</div>
|
||||
<template v-for="log in itemB.lists">
|
||||
<div class="log-summary">
|
||||
<ProjectLogDetail :render="logDetail" :item="log"/>
|
||||
<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>
|
||||
</span>
|
||||
<span class="log-time">{{log.time.ymd}} {{log.time.segment}} {{log.time.hi}}</span>
|
||||
</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>
|
||||
</Timeline>
|
||||
</div>
|
||||
@ -241,6 +246,10 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
openTask(task) {
|
||||
this.$store.dispatch("openTask", task)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +160,31 @@
|
||||
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