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) { handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions)); let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE'); let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) { 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 "UPDATE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')}); receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); 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'); row.userIds.unshift('CREATOR');
} }
if (row.userIds.indexOf('FOLLOW_PEOPLE') < 0) { if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE'); row.userIds.unshift('FOLLOW_PEOPLE');
} }
}
break; break;
case "DELETE": case "DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')}); receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); 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'); row.userIds.unshift('CREATOR');
} }
}
if (i > -1) { if (i > -1) {
row.userIds.splice(i, 1); row.userIds.splice(i, 1);
} }

View File

@ -291,15 +291,17 @@ export default {
handleReceivers(row) { handleReceivers(row) {
let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions)); let receiverOptions = JSON.parse(JSON.stringify(this.receiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE'); let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) { switch (row.event) {
case "UPDATE": case "UPDATE":
case "CASE_UPDATE": case "CASE_UPDATE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')}); receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) { if (i2 < 0) {
row.userIds.unshift('CREATOR'); row.userIds.unshift('CREATOR');
} }
if (row.userIds.indexOf('FOLLOW_PEOPLE') < 0) { if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE'); row.userIds.unshift('FOLLOW_PEOPLE');
} }
break; break;
@ -307,7 +309,7 @@ export default {
case "CASE_DELETE": case "CASE_DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')}); receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); receiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) { if (i2 < 0) {
row.userIds.unshift('CREATOR'); row.userIds.unshift('CREATOR');
} }
if (i > -1) { if (i > -1) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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