refactor: 消息通知显示通知数
This commit is contained in:
parent
c25f2bb8f9
commit
97d989efb2
|
@ -82,6 +82,13 @@ import PerformanceReportNotification
|
|||
from "@/business/components/settings/organization/components/performance/PerformanceReportNotification";
|
||||
import ApiHomeNotification from "@/business/components/settings/organization/components/api/ApiHomeNotification";
|
||||
|
||||
let taskData = {
|
||||
jenkins: [],
|
||||
api: [],
|
||||
performance: [],
|
||||
track: [],
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "TaskNotification",
|
||||
components: {
|
||||
|
@ -143,18 +150,26 @@ export default {
|
|||
});
|
||||
},
|
||||
getNoticeSize(config) {
|
||||
switch (config.taskType) {
|
||||
switch (config.module) {
|
||||
case 'jenkins':
|
||||
this.jenkinsNoticeSize += config.size;
|
||||
taskData.jenkins = taskData.jenkins.filter(t => t.taskType !== config.taskType);
|
||||
taskData.jenkins = taskData.jenkins.concat(config.data);
|
||||
this.jenkinsNoticeSize = taskData.jenkins.length;
|
||||
break;
|
||||
case 'performance':
|
||||
this.performanceNoticeSize += config.size;
|
||||
taskData.performance = taskData.performance.filter(t => t.taskType !== config.taskType);
|
||||
taskData.performance = taskData.performance.concat(config.data);
|
||||
this.performanceNoticeSize = taskData.performance.length;
|
||||
break;
|
||||
case 'api':
|
||||
this.apiNoticeSize += config.size;
|
||||
taskData.api = taskData.api.filter(t => t.taskType !== config.taskType);
|
||||
taskData.api = taskData.api.concat(config.data);
|
||||
this.apiNoticeSize = taskData.api.length;
|
||||
break;
|
||||
case 'track':
|
||||
this.trackNoticeSize += config.size;
|
||||
taskData.track = taskData.track.filter(t => t.taskType !== config.taskType);
|
||||
taskData.track = taskData.track.concat(config.data);
|
||||
this.trackNoticeSize = taskData.track.length;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -206,7 +206,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'api', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'api', data: this.defectTask, taskType: TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -209,7 +209,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'api', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'api', data: this.defectTask, taskType:TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -207,7 +207,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'api', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {taskType: TASK_TYPE, module: 'api', data: this.defectTask});
|
||||
this.defectTask.forEach(task => {
|
||||
this.handleReceivers(task);
|
||||
});
|
||||
|
|
|
@ -204,7 +204,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'api', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'api', data: this.defectTask, taskType: TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -232,7 +232,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.jenkinsTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'jenkins', size: this.jenkinsTask.length});
|
||||
this.$emit("noticeSize", {module: 'jenkins', data: this.jenkinsTask, taskType:TASK_TYPE});
|
||||
});
|
||||
},
|
||||
handleEdit(index, data) {
|
||||
|
|
|
@ -204,7 +204,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'performance', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'performance', data: this.defectTask, taskType:TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -206,7 +206,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'performance', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'performance', data: this.defectTask, taskType: TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -208,7 +208,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'track', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'track', data: this.defectTask, taskType: TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -207,7 +207,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'track', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'track', data: this.defectTask, taskType: TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -216,7 +216,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.testCasePlanTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'track', size: this.testCasePlanTask.length});
|
||||
this.$emit("noticeSize", {module: 'track', data: this.testCasePlanTask, taskType: TASK_TYPE});
|
||||
this.testCasePlanTask.forEach(planTask => {
|
||||
this.handleTestPlanReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -215,7 +215,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.reviewTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'track', size: this.reviewTask.length});
|
||||
this.$emit("noticeSize", {module: 'track', data: this.reviewTask, taskType: TASK_TYPE});
|
||||
this.reviewTask.forEach(planTask => {
|
||||
this.handleReviewReceivers(planTask);
|
||||
});
|
||||
|
|
|
@ -207,7 +207,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'track', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'track', data: this.defectTask, taskType: TASK_TYPE});
|
||||
this.defectTask.forEach(task => {
|
||||
this.handleReceivers(task);
|
||||
});
|
||||
|
|
|
@ -205,7 +205,7 @@ export default {
|
|||
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
|
||||
this.defectTask = response.data;
|
||||
// 上报通知数
|
||||
this.$emit("noticeSize", {taskType: 'track', size: this.defectTask.length});
|
||||
this.$emit("noticeSize", {module: 'track', data: this.defectTask, taskType: TASK_TYPE});
|
||||
this.defectTask.forEach(planTask => {
|
||||
this.handleReceivers(planTask);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue