fix: 测试计划 编辑错误 (#1393)

This commit is contained in:
Coooder-X 2021-02-04 16:01:07 +08:00 committed by GitHub
parent b96c602842
commit c3941b0c8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -37,15 +37,15 @@
<plan-status-table-item :value="scope.row.status"/>
</span>
<el-dropdown-menu slot="dropdown" chang>
<el-dropdown-item :disabled="!isTestManagerOrTestUser" :command="{id: scope.row.id, status: 'Prepare'}">
<el-dropdown-item :disabled="!isTestManagerOrTestUser" :command="{item: scope.row, status: 'Prepare'}">
{{ $t('test_track.plan.plan_status_prepare') }}
</el-dropdown-item>
<el-dropdown-item :disabled="!isTestManagerOrTestUser"
:command="{id: scope.row.id, status: 'Underway'}">
:command="{item: scope.row, status: 'Underway'}">
{{ $t('test_track.plan.plan_status_running') }}
</el-dropdown-item>
<el-dropdown-item :disabled="!isTestManagerOrTestUser"
:command="{id: scope.row.id, status: 'Completed'}">
:command="{item: scope.row, status: 'Completed'}">
{{ $t('test_track.plan.plan_status_completed') }}
</el-dropdown-item>
</el-dropdown-menu>
@ -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;
}
}