refactor(任务中心): 任务统计优化只统计已经开始执行的任务
This commit is contained in:
parent
1f246034df
commit
71980b0ad1
|
@ -43,7 +43,7 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item :label="$t('test_track.report.list.trigger_mode')" prop="runMode">
|
<el-form-item :label="$t('test_track.report.list.trigger_mode')" prop="runMode">
|
||||||
<el-select size="mini" style="margin-right: 10px" v-model="condition.triggerMode" @change="init"
|
<el-select size="mini" style="margin-right: 10px" v-model="condition.triggerMode" @change="init(true)"
|
||||||
:disabled="isDebugHistory">
|
:disabled="isDebugHistory">
|
||||||
<el-option v-for="item in runMode" :key="item.id" :value="item.id" :label="item.label"/>
|
<el-option v-for="item in runMode" :key="item.id" :value="item.id" :label="item.label"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -51,7 +51,8 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item :label="$t('commons.status')" prop="status">
|
<el-form-item :label="$t('commons.status')" prop="status">
|
||||||
<el-select size="mini" style="margin-right: 10px" v-model="condition.executionStatus" @change="init"
|
<el-select size="mini" style="margin-right: 10px" v-model="condition.executionStatus"
|
||||||
|
@change="init(true)"
|
||||||
:disabled="isDebugHistory">
|
:disabled="isDebugHistory">
|
||||||
<el-option v-for="item in runStatus" :key="item.id" :value="item.id" :label="item.label"/>
|
<el-option v-for="item in runStatus" :key="item.id" :value="item.id" :label="item.label"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -62,7 +63,7 @@
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item :label="$t('commons.executor')" prop="status">
|
<el-form-item :label="$t('commons.executor')" prop="status">
|
||||||
<el-select v-model="condition.executor" :placeholder="$t('commons.executor')" filterable size="mini"
|
<el-select v-model="condition.executor" :placeholder="$t('commons.executor')" filterable size="mini"
|
||||||
style="margin-right: 10px" @change="init" :disabled="isDebugHistory">
|
style="margin-right: 10px" @change="init(true)" :disabled="isDebugHistory">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in maintainerOptions"
|
v-for="item in maintainerOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -81,13 +82,13 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<el-divider direction="horizontal" style="width: 100%"/>
|
<el-divider direction="horizontal" style="width: 100%"/>
|
||||||
<el-tabs v-model="activeName" @tab-click="init" v-loading="loading">
|
<el-tabs v-model="activeName" @tab-click="init(true)" v-loading="loading">
|
||||||
<el-tab-pane :name="tab.id" :label="tab.label" v-for="tab in tabs" :disabled="isDebugHistory">
|
<el-tab-pane :name="tab.id" :label="tab.label" v-for="tab in tabs" :disabled="isDebugHistory">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-badge class="ms-badge-item" v-if="showBadge(tab.id) > 0" :value="showBadge(tab.id)">
|
<el-badge class="ms-badge-item" v-if="showBadge(tab.id) > 0" :value="showBadge(tab.id)">
|
||||||
{{ tab.label }}
|
{{ tab.label }}
|
||||||
</el-badge>
|
</el-badge>
|
||||||
<span v-else>{{ tab.label }}</span>
|
<span style="font-size: 13px" v-else>{{ tab.label }}</span>
|
||||||
</span>
|
</span>
|
||||||
<task-center-item
|
<task-center-item
|
||||||
:task-data="taskData"
|
:task-data="taskData"
|
||||||
|
@ -141,7 +142,6 @@ export default {
|
||||||
loading: false,
|
loading: false,
|
||||||
taskData: [],
|
taskData: [],
|
||||||
response: {},
|
response: {},
|
||||||
initEnd: false,
|
|
||||||
visible: false,
|
visible: false,
|
||||||
showType: "",
|
showType: "",
|
||||||
runMode: [
|
runMode: [
|
||||||
|
@ -231,7 +231,7 @@ export default {
|
||||||
let request = {type: row.executionModule, reportId: row.id};
|
let request = {type: row.executionModule, reportId: row.id};
|
||||||
stopTask(request).then(response => {
|
stopTask(request).then(response => {
|
||||||
this.$success(this.$t('report.test_stop_success'));
|
this.$success(this.$t('report.test_stop_success'));
|
||||||
this.init();
|
this.init(true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let array = [];
|
let array = [];
|
||||||
|
@ -241,7 +241,7 @@ export default {
|
||||||
array.push({type: 'UI_SCENARIO', projectId: getCurrentProjectID(), userId: getCurrentUser().id});
|
array.push({type: 'UI_SCENARIO', projectId: getCurrentProjectID(), userId: getCurrentUser().id});
|
||||||
stopBatchTask(array).then(response => {
|
stopBatchTask(array).then(response => {
|
||||||
this.$success(this.$t('report.test_stop_success'));
|
this.$success(this.$t('report.test_stop_success'));
|
||||||
this.init();
|
this.init(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -266,13 +266,12 @@ export default {
|
||||||
onMessage(e) {
|
onMessage(e) {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.runningData = JSON.parse(e.data);
|
this.runningData = JSON.parse(e.data);
|
||||||
|
if (this.runningData) {
|
||||||
|
this.setActiveName();
|
||||||
|
}
|
||||||
this.runningTotal = this.runningData.total;
|
this.runningTotal = this.runningData.total;
|
||||||
this.initIndex++;
|
if (this.runningTotal > 0) {
|
||||||
if (this.taskVisible && this.initEnd) {
|
this.init(false);
|
||||||
setTimeout(() => {
|
|
||||||
this.initEnd = false;
|
|
||||||
this.init();
|
|
||||||
}, 3000);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClose(e) {
|
onClose(e) {
|
||||||
|
@ -280,7 +279,7 @@ export default {
|
||||||
showTaskCenter() {
|
showTaskCenter() {
|
||||||
this.getTaskRunning();
|
this.getTaskRunning();
|
||||||
this.getMaintainerOptions();
|
this.getMaintainerOptions();
|
||||||
this.init();
|
this.init(true);
|
||||||
this.taskVisible = true;
|
this.taskVisible = true;
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
@ -296,7 +295,6 @@ export default {
|
||||||
this.activeName = activeName;
|
this.activeName = activeName;
|
||||||
}
|
}
|
||||||
this.showTaskCenter();
|
this.showTaskCenter();
|
||||||
this.initIndex = 0;
|
|
||||||
},
|
},
|
||||||
getPercentage(status) {
|
getPercentage(status) {
|
||||||
if (status) {
|
if (status) {
|
||||||
|
@ -384,24 +382,20 @@ export default {
|
||||||
nextPage(currentPage, pageSize) {
|
nextPage(currentPage, pageSize) {
|
||||||
this.currentPage = currentPage;
|
this.currentPage = currentPage;
|
||||||
this.pageSize = pageSize;
|
this.pageSize = pageSize;
|
||||||
this.init();
|
this.init(true);
|
||||||
},
|
},
|
||||||
init() {
|
init(loading) {
|
||||||
if (this.showType === "CASE" || this.showType === "SCENARIO") {
|
if (this.showType === "CASE" || this.showType === "SCENARIO") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.condition.projectId = getCurrentProjectID();
|
this.condition.projectId = getCurrentProjectID();
|
||||||
this.condition.userId = getCurrentUser().id;
|
this.condition.userId = getCurrentUser().id;
|
||||||
if (this.runningData) {
|
|
||||||
this.setActiveName();
|
|
||||||
}
|
|
||||||
this.condition.activeName = this.activeName;
|
this.condition.activeName = this.activeName;
|
||||||
this.loading = true;
|
this.loading = loading;
|
||||||
this.result = getTaskList(this.condition, this.currentPage, this.pageSize)
|
this.result = getTaskList(this.condition, this.currentPage, this.pageSize)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.total = response.data.itemCount;
|
this.total = response.data.itemCount;
|
||||||
this.taskData = response.data.listObject;
|
this.taskData = response.data.listObject;
|
||||||
this.initEnd = true;
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -594,7 +588,7 @@ export default {
|
||||||
.ms-badge-item {
|
.ms-badge-item {
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
margin-right: 0px;
|
margin-right: 0px;
|
||||||
font-size: 12px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-badge__content.is-fixed) {
|
:deep(.el-badge__content.is-fixed) {
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
<if test="request.executor != null and request.executor != ''">
|
<if test="request.executor != null and request.executor != ''">
|
||||||
AND t.user_id = #{request.executor}
|
AND t.user_id = #{request.executor}
|
||||||
</if>
|
</if>
|
||||||
AND t.status IN ("running","starting","pending")
|
AND t.status IN ("running","starting")
|
||||||
) as scenarioTotal ,
|
) as scenarioTotal ,
|
||||||
<if test="request.hasLicense">
|
<if test="request.hasLicense">
|
||||||
(SELECT
|
(SELECT
|
||||||
|
@ -199,7 +199,7 @@
|
||||||
<if test="request.executor != null and request.executor != ''">
|
<if test="request.executor != null and request.executor != ''">
|
||||||
AND t.user_id = #{request.executor}
|
AND t.user_id = #{request.executor}
|
||||||
</if>
|
</if>
|
||||||
AND t.status IN ("running","starting","pending")
|
AND t.status IN ("running","starting")
|
||||||
),
|
),
|
||||||
</if>
|
</if>
|
||||||
(SELECT
|
(SELECT
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
<if test="request.executor != null and request.executor != ''">
|
<if test="request.executor != null and request.executor != ''">
|
||||||
AND t.user_id = #{request.executor}
|
AND t.user_id = #{request.executor}
|
||||||
</if>
|
</if>
|
||||||
AND t.status IN ("running","starting","pending")
|
AND t.status IN ("running","starting")
|
||||||
) as perfTotal
|
) as perfTotal
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue