refactor: 消息设置页面重构

This commit is contained in:
Captain.B 2020-12-03 16:27:10 +08:00
parent 3ebec6a84a
commit 882c1d3b17
6 changed files with 145 additions and 146 deletions

View File

@ -31,7 +31,8 @@
</el-dialog>
</el-tab-pane>
<el-tab-pane :label="$t('schedule.task_notification')" name="second">
<schedule-task-notification :is-tester-permission="isTesterPermission" :test-id="testId" :schedule-receiver-options="scheduleReceiverOptions"></schedule-task-notification>
<schedule-task-notification :is-tester-permission="isTesterPermission" :test-id="testId"
:schedule-receiver-options="scheduleReceiverOptions"/>
</el-tab-pane>
</el-tabs>
</div>
@ -40,13 +41,12 @@
</template>
<script>
import {getCurrentUser} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser, getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import Crontab from "../cron/Crontab";
import CrontabResult from "../cron/CrontabResult";
import {cronValidate} from "@/common/js/cron";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import ScheduleTaskNotification from "../../settings/organization/components/ScheduleTaskNotification";
import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils";
function defaultCustomValidate() {
return {pass: true};
}

View File

@ -11,7 +11,7 @@
<el-row>
<el-col :span="24">
<el-table
:data="form.defectTask"
:data="defectTask"
class="tb-edit"
border
:cell-style="rowClass"
@ -76,7 +76,7 @@
<el-button
size="mini"
v-show="scope.row.isSet"
@click.native.prevent="removeRowTask(scope.$index,form.defectTask)"
@click.native.prevent="removeRowTask(scope.$index,defectTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
@ -113,7 +113,6 @@ export default {
},
data() {
return {
form: {
defectTask: [{
taskType: "defectTask",
event: "",
@ -124,7 +123,6 @@ export default {
identification: "",
isReadOnly: false,
}],
},
defectEventOptions: [
{value: 'CREATE', label: this.$t('commons.create')},
],
@ -141,7 +139,7 @@ export default {
methods: {
initForm() {
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
this.form.defectTask = response.data;
this.defectTask = response.data;
})
},
handleEdit(index, data) {
@ -169,7 +167,7 @@ export default {
Task.isSet = true;
Task.identification = '';
Task.taskType = TASK_TYPE
this.form.defectTask.push(Task)
this.defectTask.push(Task)
},
handleAddTask(index, data) {

View File

@ -11,7 +11,7 @@
<el-row>
<el-col :span="24">
<el-table
:data="form.jenkinsTask"
:data="jenkinsTask"
class="tb-edit"
border
:cell-style="rowClass"
@ -78,7 +78,7 @@
<el-button
size="mini"
v-show="scope.row.isSet"
@click.native.prevent="removeRowTask(scope.$index,form.jenkinsTask)"
@click.native.prevent="removeRowTask(scope.$index,jenkinsTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
@ -115,7 +115,6 @@ export default {
},
data() {
return {
form: {
jenkinsTask: [{
taskType: "jenkinsTask",
event: "",
@ -126,7 +125,6 @@ export default {
identification: "",
isReadOnly: false,
}],
},
jenkinsEventOptions: [
{value: 'EXECUTE_SUCCESSFUL', label: this.$t('schedule.event_success')},
{value: 'EXECUTE_FAILED', label: this.$t('schedule.event_failed')}
@ -144,7 +142,7 @@ export default {
methods: {
initForm() {
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
this.form.jenkinsTask = response.data;
this.jenkinsTask = response.data;
})
},
handleEdit(index, data) {
@ -163,7 +161,7 @@ export default {
Task.isSet = true;
Task.identification = '';
Task.taskType = TASK_TYPE
this.form.jenkinsTask.push(Task)
this.jenkinsTask.push(Task)
},
handleAddTask(index, data) {
if (data.event && data.userIds.length > 0 && data.type) {

View File

@ -2,7 +2,8 @@
<div>
<el-row>
<el-col :span="10">
<el-button :disabled="!isTesterPermission" icon="el-icon-circle-plus-outline" plain size="mini" @click="handleAddTaskModel('scheduleTask')">
<el-button :disabled="!isTesterPermission" icon="el-icon-circle-plus-outline" plain size="mini"
@click="handleAddTaskModel">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
@ -10,7 +11,7 @@
<el-row>
<el-col :span="24">
<el-table
:data="form.scheduleTask"
:data="scheduleTask"
class="tb-edit"
border
size="mini"
@ -77,7 +78,7 @@
size="mini"
v-show="scope.row.isSet"
:disabled="!isTesterPermission"
@click.native.prevent="removeRowTask(scope.$index,form.scheduleTask)"
@click.native.prevent="removeRowTask(scope.$index,scheduleTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
@ -86,7 +87,8 @@
v-show="!scope.row.isSet"
:disabled="!isTesterPermission"
@click="handleEditTask(scope.$index,scope.row)"
>{{ $t('commons.edit') }}</el-button>
>{{ $t('commons.edit') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
@ -117,7 +119,7 @@ export default {
},
data() {
return {
form: {
scheduleTask: [{
taskType: "scheduleTask",
event: "",
@ -129,7 +131,6 @@ export default {
isReadOnly: false,
testId: this.testId,
}],
},
scheduleEventOptions: [
{value: 'EXECUTE_SUCCESSFUL', label: this.$t('schedule.event_success')},
{value: 'EXECUTE_FAILED', label: this.$t('schedule.event_failed')}
@ -148,7 +149,7 @@ export default {
initForm() {
this.result = this.$get('/notice/search/message/' + this.testId, response => {
// console.log(response.data);
this.form.scheduleTask = response.data;
this.scheduleTask = response.data;
})
},
handleEdit(index, data) {
@ -158,7 +159,7 @@ export default {
data.webhook = '';
}
},
handleAddTaskModel(type) {
handleAddTaskModel() {
let Task = {};
Task.event = [];
Task.userIds = [];
@ -166,11 +167,9 @@ export default {
Task.webhook = '';
Task.isSet = true;
Task.identification = '';
if (type === 'scheduleTask') {
Task.taskType = 'SCHEDULE_TASK';
Task.testId = this.testId;
this.form.scheduleTask.push(Task);
}
this.scheduleTask.push(Task);
},
handleEditTask(index, data) {
data.isSet = true;

View File

@ -11,7 +11,7 @@
<el-row>
<el-col :span="24">
<el-table
:data="form.testCasePlanTask"
:data="testCasePlanTask"
class="tb-edit"
border
:cell-style="rowClass"
@ -76,7 +76,7 @@
<el-button
size="mini"
v-show="scope.row.isSet"
@click.native.prevent="removeRowTask(scope.$index,form.testCasePlanTask)"
@click.native.prevent="removeRowTask(scope.$index,testCasePlanTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
@ -114,7 +114,6 @@ export default {
},
data() {
return {
form: {
testCasePlanTask: [{
taskType: "testPlanTask",
event: "",
@ -125,7 +124,6 @@ export default {
identification: "",
isReadOnly: false,
}],
},
otherEventOptions: [
{value: 'CREATE', label: this.$t('commons.create')},
{value: 'UPDATE', label: this.$t('commons.update')},
@ -138,14 +136,11 @@ export default {
],
};
},
activated() {
this.initForm()
},
methods: {
initForm() {
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
this.form.testCasePlanTask = response.data;
this.form.testCasePlanTask.forEach(planTask => {
this.testCasePlanTask = response.data;
this.testCasePlanTask.forEach(planTask => {
this.handleTestPlanReceivers(planTask);
});
})
@ -175,7 +170,7 @@ export default {
Task.isSet = true;
Task.identification = '';
Task.taskType = TASK_TYPE
this.form.testCasePlanTask.push(Task)
this.testCasePlanTask.push(Task)
},
handleAddTask(index, data) {
@ -236,6 +231,13 @@ export default {
}
row.testPlanReceiverOptions = testPlanReceivers;
},
},
watch: {
testPlanReceiverOptions(value) {
if (value && value.length > 0) {
this.initForm();
}
}
}
}
</script>

View File

@ -11,7 +11,7 @@
<el-row>
<el-col :span="24">
<el-table
:data="form.reviewTask"
:data="reviewTask"
class="tb-edit"
border
:cell-style="rowClass"
@ -77,7 +77,7 @@
<el-button
size="mini"
v-show="scope.row.isSet"
@click.native.prevent="removeRowTask(scope.$index,form.reviewTask)"
@click.native.prevent="removeRowTask(scope.$index,reviewTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
@ -114,7 +114,6 @@ export default {
},
data() {
return {
form: {
reviewTask: [{
taskType: "reviewTask",
event: "",
@ -125,7 +124,6 @@ export default {
identification: "",
isReadOnly: false,
}],
},
reviewTaskEventOptions: [
{value: 'CREATE', label: this.$t('commons.create')},
{value: 'UPDATE', label: this.$t('commons.update')},
@ -139,14 +137,11 @@ export default {
],
};
},
activated() {
this.initForm()
},
methods: {
initForm() {
this.result = this.$get('/notice/search/message/type/' + TASK_TYPE, response => {
this.form.reviewTask = response.data;
this.form.reviewTask.forEach(planTask => {
this.reviewTask = response.data;
this.reviewTask.forEach(planTask => {
this.handleReviewReceivers(planTask);
});
})
@ -176,7 +171,7 @@ export default {
Task.isSet = true;
Task.identification = '';
Task.taskType = TASK_TYPE
this.form.reviewTask.push(Task)
this.reviewTask.push(Task)
},
handleAddTask(index, data) {
@ -242,6 +237,13 @@ export default {
}
row.reviewReceiverOptions = reviewReceiverOptions;
}
},
watch: {
reviewReceiverOptions(value) {
if (value && value.length > 0) {
this.initForm();
}
}
}
}
</script>