refactor: 发送站内通知, 页面修改

This commit is contained in:
Captain.B 2021-08-19 18:36:49 +08:00 committed by 刘瑞斌
parent fae8ff5f8c
commit 4453b0018a
12 changed files with 435 additions and 359 deletions

View File

@ -288,24 +288,37 @@ export default {
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CREATE":
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
case "UPDATE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (row.userIds.indexOf('FOLLOW_PEOPLE') < 0) {
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
break;
case "DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
if (i > -1) {
row.userIds.splice(i, 1);
}

View File

@ -206,7 +206,7 @@ export default {
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
this.defectTask = response.data;
//
this.$emit("noticeSize", {module: 'api', data: this.defectTask, taskType:TASK_TYPE});
this.$emit("noticeSize", {module: 'api', data: this.defectTask, taskType: TASK_TYPE});
this.defectTask.forEach(planTask => {
this.handleReceivers(planTask);
});
@ -291,15 +291,17 @@ export default {
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "UPDATE":
case "CASE_UPDATE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (row.userIds.indexOf('FOLLOW_PEOPLE') < 0) {
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
break;
@ -307,7 +309,7 @@ export default {
case "CASE_DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i > -1) {

View File

@ -289,12 +289,16 @@ export default {
},
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CLOSE_SCHEDULE":
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:
break;

View File

@ -285,12 +285,16 @@ export default {
},
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "DELETE":
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:
break;

View File

@ -201,7 +201,7 @@ export default {
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
this.defectTask = response.data;
//
this.$emit("noticeSize", {module: 'performance', data: this.defectTask, taskType:TASK_TYPE});
this.$emit("noticeSize", {module: 'performance', data: this.defectTask, taskType: TASK_TYPE});
this.defectTask.forEach(planTask => {
this.handleReceivers(planTask);
});
@ -285,12 +285,15 @@ export default {
},
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "DELETE":
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:
break;

View File

@ -288,24 +288,36 @@ export default {
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CREATE":
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
case "UPDATE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (row.userIds.indexOf('FOLLOW_PEOPLE') < 0) {
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
break;
case "DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
if (i > -1) {
row.userIds.splice(i, 1);
}

View File

@ -287,23 +287,40 @@ export default {
},
handleReceivers(row) {
let testPlanReceivers = JSON.parse(JSON.stringify(this.defectReceiverOptions));
let i = row.userIds.indexOf('PROCESSOR');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CREATE":
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
case "UPDATE":
case "STATUS_CHANGE":
testPlanReceivers.unshift({id: 'PROCESSOR', name: '处理人'});
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (row.userIds.indexOf('PROCESSOR') < 0) {
if (i < 0) {
row.userIds.unshift('PROCESSOR');
}
}
break;
case "DELETE":
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
default:
break;

View File

@ -289,25 +289,30 @@ export default {
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "UPDATE":
case "DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
break;
case "COMMENT":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
if (i > -1) {
row.userIds.splice(i, 1);
}

View File

@ -291,6 +291,7 @@ export default {
},
handleTestPlanReceivers(row) {
let testPlanReceivers = JSON.parse(JSON.stringify(this.testPlanReceiverOptions));
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CREATE":
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')});
@ -300,9 +301,11 @@ export default {
case "COMMENT":
case "COMPLETE":
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:
break;

View File

@ -289,31 +289,38 @@ export default {
},
handleReviewReceivers(row) {
let reviewReceiverOptions = JSON.parse(JSON.stringify(this.reviewReceiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CREATE":
reviewReceiverOptions.unshift({id: 'EXECUTOR', name: this.$t('test_track.review.reviewer')});
break;
case "UPDATE":
reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
case "DELETE":
reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
case "COMMENT":
reviewReceiverOptions.unshift({id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')});
break;
case "COMPLETE":
reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:
break;

View File

@ -289,12 +289,15 @@ export default {
},
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CLOSE_SCHEDULE":
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:
break;

View File

@ -285,12 +285,15 @@ export default {
},
handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "DELETE":
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:
break;