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,23 +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) {
row.userIds.unshift('CREATOR');
}
if (row.userIds.indexOf('FOLLOW_PEOPLE') < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
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) {
row.userIds.unshift('CREATOR');
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,11 +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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:

View File

@ -285,11 +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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:

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,11 +285,14 @@ 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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:

View File

@ -288,23 +288,35 @@ 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) {
row.userIds.unshift('CREATOR');
}
if (row.userIds.indexOf('FOLLOW_PEOPLE') < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
if (i > -1) {
row.userIds.splice(i, 1);

View File

@ -8,21 +8,21 @@
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="600"
trigger="click">
placement="right-end"
title="示例"
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
@ -33,11 +33,11 @@
<el-row>
<el-col :span="24">
<el-table
:data="defectTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
:data="defectTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
>
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
<template slot-scope="scope">
@ -45,10 +45,10 @@
@change="handleReceivers(scope.row)"
prop="event" :disabled="!scope.row.isSet">
<el-option
v-for="item in defectEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in defectEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -59,10 +59,10 @@
:placeholder="$t('commons.please_select')"
style="width: 100%;" :disabled="!row.isSet">
<el-option
v-for="item in row.defectReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
v-for="item in row.defectReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
@ -73,10 +73,10 @@
size="mini"
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -90,48 +90,48 @@
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
<template v-slot:default="scope">
<ms-tip-button
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
<ms-tip-button
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
<ms-tip-button
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,defectTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,defectTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
<ms-tip-button
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
<ms-tip-button
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
</template>
</el-table-column>
</el-table>
@ -169,17 +169,17 @@ export default {
return {
modes: ['text', 'html'],
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p>${creator}发起了一个缺陷:${issuesName},请跟进</p>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p>${creator}发起了一个缺陷:${issuesName},请跟进</p>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
robotTitle: "【任务通知】:${creator}发起了一个缺陷:${issuesName},请跟进",
defectTask: [{
taskType: "defectTask",
@ -287,22 +287,39 @@ 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) {
row.userIds.unshift('CREATOR');
}
if (row.userIds.indexOf('PROCESSOR') < 0) {
row.userIds.unshift('PROCESSOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
default:

View File

@ -8,21 +8,21 @@
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="600"
trigger="click">
placement="right-end"
title="示例"
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
@ -33,11 +33,11 @@
<el-row>
<el-col :span="24">
<el-table
:data="defectTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
:data="defectTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
>
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
<template slot-scope="scope">
@ -45,10 +45,10 @@
@change="handleReceivers(scope.row)"
prop="event" :disabled="!scope.row.isSet">
<el-option
v-for="item in eventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in eventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -59,10 +59,10 @@
:placeholder="$t('commons.please_select')"
style="width: 100%;" :disabled="!row.isSet">
<el-option
v-for="item in row.receiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
v-for="item in row.receiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
@ -73,10 +73,10 @@
size="mini"
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -90,48 +90,48 @@
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
<template v-slot:default="scope">
<ms-tip-button
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
<ms-tip-button
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
<ms-tip-button
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,defectTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,defectTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
<ms-tip-button
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
<ms-tip-button
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
</template>
</el-table-column>
</el-table>
@ -169,17 +169,17 @@ export default {
return {
modes: ['text', 'html'],
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p>${creator}创建了测试用例</p>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p>${creator}创建了测试用例</p>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
robotTitle: "【任务通知】:${creator}创建了测试用例",
defectTask: [{
taskType: "defectTask",
@ -289,24 +289,29 @@ 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) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
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) {
row.userIds.unshift('CREATOR');
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,8 +301,10 @@ export default {
case "COMMENT":
case "COMPLETE":
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:

View File

@ -8,20 +8,20 @@
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="600"
trigger="click">
placement="right-end"
title="示例"
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="600"
trigger="click">
placement="right-end"
title="示例"
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
@ -32,11 +32,11 @@
<el-row>
<el-col :span="24">
<el-table
:data="reviewTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
:data="reviewTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
>
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
<template slot-scope="scope">
@ -44,10 +44,10 @@
@change="handleReviewReceivers(scope.row)"
prop="event" :disabled="!scope.row.isSet">
<el-option
v-for="item in reviewTaskEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in reviewTaskEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -58,10 +58,10 @@
:placeholder="$t('commons.please_select')"
style="width: 100%;" :disabled="!row.isSet">
<el-option
v-for="item in row.reviewReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
v-for="item in row.reviewReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
@ -72,10 +72,10 @@
size="mini"
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -89,48 +89,48 @@
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
<template v-slot:default="scope">
<ms-tip-button
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
<ms-tip-button
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
<ms-tip-button
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,reviewTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,reviewTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
<ms-tip-button
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
<ms-tip-button
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
</template>
</el-table-column>
</el-table>
@ -168,25 +168,25 @@ export default {
return {
modes: ['text', 'html'],
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p style=\"text-align: left\">${creator} 创建的:<br>\n" +
" ${reviewName}待开始<br>\n" +
" 计划开始时间是:${start}<br>\n" +
" 计划结束时间为:${end}<br>\n" +
" 请跟进!/${status}<br>\n" +
" 点击下面链接进入评审页面进行审核</p>\n" +
" <a href=\"${url}/#/track/review/view/${id}\">${url}/#/track/review/view/${id}</a>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p style=\"text-align: left\">${creator} 创建的:<br>\n" +
" ${reviewName}待开始<br>\n" +
" 计划开始时间是:${start}<br>\n" +
" 计划结束时间为:${end}<br>\n" +
" 请跟进!/${status}<br>\n" +
" 点击下面链接进入评审页面进行审核</p>\n" +
" <a href=\"${url}/#/track/review/view/${id}\">${url}/#/track/review/view/${id}</a>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
robotTitle: "【任务通知】:${creator} 创建的:${reviewName}待开始,计划开始时间是:${start}," +
"计划结束时间是:${end}请跟进!/ ${status}!点击下面链接进入测试评审页面${url}/#/track/review/view/${id}",
"计划结束时间是:${end}请跟进!/ ${status}!点击下面链接进入测试评审页面${url}/#/track/review/view/${id}",
reviewTask: [{
taskType: "reviewTask",
event: "",
@ -289,21 +289,26 @@ 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) {
row.userIds.unshift('CREATOR');
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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
case "COMMENT":
@ -311,8 +316,10 @@ export default {
break;
case "COMPLETE":
reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.userIds.indexOf('CREATOR') < 0) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:

View File

@ -8,21 +8,21 @@
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="600"
trigger="click">
placement="right-end"
title="示例"
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
@ -33,11 +33,11 @@
<el-row>
<el-col :span="24">
<el-table
:data="defectTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
:data="defectTask"
class="tb-edit"
border
:cell-style="rowClass"
:header-cell-style="headClass"
>
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
<template slot-scope="scope">
@ -45,10 +45,10 @@
@change="handleReceivers(scope.row)"
prop="event" :disabled="!scope.row.isSet">
<el-option
v-for="item in eventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in eventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -59,10 +59,10 @@
:placeholder="$t('commons.please_select')"
style="width: 100%;" :disabled="!row.isSet">
<el-option
v-for="item in row.receiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
v-for="item in row.receiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
@ -73,10 +73,10 @@
size="mini"
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
@ -90,48 +90,48 @@
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
<template v-slot:default="scope">
<ms-tip-button
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
circle
type="success"
size="mini"
v-if="scope.row.isSet"
v-xpack
@click="handleTemplate(scope.$index,scope.row)"
:tip="$t('organization.message.template')"
icon="el-icon-tickets"/>
<ms-tip-button
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
circle
type="primary"
size="mini"
v-show="scope.row.isSet"
@click="handleAddTask(scope.$index,scope.row)"
:tip="$t('commons.add')"
icon="el-icon-check"/>
<ms-tip-button
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,defectTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
circle
size="mini"
v-show="scope.row.isSet"
@click="removeRowTask(scope.$index,defectTask)"
:tip="$t('commons.cancel')"
icon="el-icon-refresh-left"/>
<ms-tip-button
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
el-button
circle
type="primary"
size="mini"
icon="el-icon-edit"
v-show="!scope.row.isSet"
:tip="$t('commons.edit')"
@click="handleEditTask(scope.$index,scope.row)"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
<ms-tip-button
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
circle
type="danger"
icon="el-icon-delete"
size="mini"
v-show="!scope.row.isSet"
@click="deleteRowTask(scope.$index,scope.row)"
:tip="$t('commons.delete')"
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
</template>
</el-table-column>
</el-table>
@ -169,17 +169,17 @@ export default {
return {
modes: ['text', 'html'],
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p>${operator}关闭了定时任务</p>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p>${operator}关闭了定时任务</p>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
robotTitle: "【任务通知】:${operator}发起了一个缺陷:${name},请跟进",
defectTask: [{
taskType: "defectTask",
@ -289,11 +289,14 @@ 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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default:

View File

@ -285,11 +285,14 @@ 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) {
row.userIds.unshift('CREATOR');
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
}
break;
default: