perf: 优化修改任务时间记录

This commit is contained in:
kuaifan 2022-02-17 19:11:23 +08:00
parent e5ddf5616a
commit 54e4ed27ae
2 changed files with 12 additions and 5 deletions

View File

@ -661,6 +661,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()) : '';
$this->start_at = null;
$this->end_at = null;
$times = $data['times'];
@ -724,7 +725,10 @@ class ProjectTask extends AbstractModel
}
});
}
$this->addLog("修改{任务}时间");
$newStringAt = $this->start_at ? ($oldAt[0]->toDateTimeString() . '~' . $oldAt[1]->toDateTimeString()) : '';
$this->addLog("修改{任务}时间", [
'change' => [$oldStringAt, $newStringAt]
]);
}
// 以下紧顶级任务可修改
if ($this->parent_id === 0) {
@ -794,6 +798,7 @@ class ProjectTask extends AbstractModel
}
// 优先级
$p = false;
$oldPName = $this->p_name;
if (Arr::exists($data, 'p_level') && $this->p_level != $data['p_level']) {
$this->p_level = intval($data['p_level']);
$p = true;
@ -807,7 +812,9 @@ class ProjectTask extends AbstractModel
$p = true;
}
if ($p) {
$this->addLog("修改{任务}优先级");
$this->addLog("修改{任务}优先级", [
'change' => [$oldPName, $this->p_name]
]);
}
}
$this->save();

View File

@ -171,10 +171,10 @@ export default {
if ($A.isArray(record.change)) {
let [before, now] = record.change
vNode.push(h('span', ': '))
if (before) {
vNode.push(h('span', `${before} => ${now}`))
if (before && before != now) {
vNode.push(h('span', `${before || '-'} => ${now || '-'}`))
} else {
vNode.push(h('span', now))
vNode.push(h('span', now || '-'))
}
}
if (record.userid) {