From c3941b0c8d07584f2ba83a9ce7ad8421caa85d78 Mon Sep 17 00:00:00 2001 From: Coooder-X <55648333+Coooder-X@users.noreply.github.com> Date: Thu, 4 Feb 2021 16:01:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=20?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=94=99=E8=AF=AF=20(#1393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/plan/components/TestPlanList.vue | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index a633eeeb8f..f6cab53407 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -37,15 +37,15 @@ - + {{ $t('test_track.plan.plan_status_prepare') }} + :command="{item: scope.row, status: 'Underway'}"> {{ $t('test_track.plan.plan_status_running') }} + :command="{item: scope.row, status: 'Completed'}"> {{ $t('test_track.plan.plan_status_completed') }} @@ -257,20 +257,25 @@ export default { this.$emit('testPlanEdit', testPlan); }, statusChange(param) { + console.log(this.tableData); + let oldStatus = param.item.status; + let newStatus = param.status; + param = param.item; + param.status = newStatus; this.$post('/test/plan/edit', param, () => { for (let i = 0; i < this.tableData.length; i++) { if (this.tableData[i].id == param.id) { // 手动修改当前状态后,前端结束时间先用当前时间,等刷新后变成后台数据(相等) - if (this.tableData[i].status !== "Completed" && param.status === "Completed") { - this.tableData[i].actualEndTime = new Date(); + if (oldStatus !== "Completed" && newStatus === "Completed") { + this.tableData[i].actualEndTime = Date.now(); } // 非完成->已完成,结束时间=null - else if (this.tableData[i].status !== "Underway" && param.status === "Underway") { - this.tableData[i].actualStartTime = new Date(); + else if (oldStatus !== "Underway" && newStatus === "Underway") { + this.tableData[i].actualStartTime = Date.now(); this.tableData[i].actualEndTime = ""; } // 非进行中->进行中,结束时间=null - else if (this.tableData[i].status !== "Prepare" && param.status === "Prepare") { + else if (oldStatus !== "Prepare" && newStatus === "Prepare") { this.tableData[i].actualStartTime = this.tableData[i].actualEndTime = ""; } // 非未开始->未开始,结束时间=null - this.tableData[i].status = param.status; + this.tableData[i].status = newStatus; break; } }