fix(测试计划): 第一次设置定时任务不自动开启状态

This commit is contained in:
limin-fit2 2022-03-01 18:03:49 +08:00 committed by 刘瑞斌
parent 52c5ae233b
commit 8b0a682514
3 changed files with 24 additions and 17 deletions

View File

@ -123,7 +123,7 @@ export default {
dialogVisible: false, dialogVisible: false,
schedule: { schedule: {
value: "", value: "",
enable: true enable: false
}, },
scheduleTaskType: "", scheduleTaskType: "",
testId: String, testId: String,
@ -227,7 +227,7 @@ export default {
} else { } else {
this.schedule = { this.schedule = {
value: '', value: '',
enable: true enable: false
}; };
} }
}); });
@ -235,6 +235,10 @@ export default {
crontabFill(value, resultList) { crontabFill(value, resultList) {
// //
this.form.cronValue = value; this.form.cronValue = value;
//
if (!this.schedule.id){
this.schedule.enable = true;
}
this.$refs.crontabResult.resultList = resultList; this.$refs.crontabResult.resultList = resultList;
this.$refs['from'].validate(); this.$refs['from'].validate();
}, },
@ -251,7 +255,6 @@ export default {
if (valid) { if (valid) {
this.intervalShortValidate(); this.intervalShortValidate();
let formCronValue = this.form.cronValue; let formCronValue = this.form.cronValue;
// this.schedule.enable = true;
this.schedule.value = formCronValue; this.schedule.value = formCronValue;
this.saveSchedule(); this.saveSchedule();
this.dialogVisible = false; this.dialogVisible = false;
@ -354,5 +357,7 @@ export default {
.el-form-item { .el-form-item {
margin-bottom: 10px; margin-bottom: 10px;
} }
>>> .el-form-item__error {
margin-left: 148px;
}
</style> </style>

View File

@ -31,13 +31,8 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.schedule_cron_title')" <el-form-item :label="$t('commons.schedule_cron_title')"
prop="cronValue"> prop="cronValue">
<el-row>
<el-col :span="18">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp" <el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
:placeholder="$t('schedule.please_input_cron_expression')"/> :placeholder="$t('schedule.please_input_cron_expression')"/>
</el-col>
</el-row>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog"> <el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
@ -189,6 +184,9 @@ export default {
} else if (!customValidate.pass) { } else if (!customValidate.pass) {
callback(new Error(customValidate.info)); callback(new Error(customValidate.info));
} else { } else {
if (!this.schedule.id){
this.schedule.enable = true;
}
callback(); callback();
} }
}; };
@ -199,7 +197,7 @@ export default {
dialogVisible: false, dialogVisible: false,
schedule: { schedule: {
value: "", value: "",
enable: true, enable: false,
}, },
scheduleTaskType: "", scheduleTaskType: "",
testId: String, testId: String,
@ -309,7 +307,7 @@ export default {
} else { } else {
this.schedule = { this.schedule = {
value: '', value: '',
enable: true enable: false
}; };
} }
}); });
@ -317,6 +315,10 @@ export default {
crontabFill(value, resultList) { crontabFill(value, resultList) {
// //
this.form.cronValue = value; this.form.cronValue = value;
//
if (!this.schedule.id){
this.schedule.enable = true;
}
this.$refs.crontabResult.resultList = resultList; this.$refs.crontabResult.resultList = resultList;
this.$refs['from'].validate(); this.$refs['from'].validate();
}, },
@ -333,7 +335,6 @@ export default {
if (valid) { if (valid) {
this.intervalShortValidate(); this.intervalShortValidate();
let formCronValue = this.form.cronValue; let formCronValue = this.form.cronValue;
// this.schedule.enable = true;
this.schedule.value = formCronValue; this.schedule.value = formCronValue;
this.saveSchedule(); this.saveSchedule();
this.dialogVisible = false; this.dialogVisible = false;
@ -433,7 +434,7 @@ export default {
<style scoped> <style scoped>
.inp { .inp {
width: 50%; width: 40%;
margin-right: 20px; margin-right: 20px;
} }
@ -449,4 +450,7 @@ export default {
.ms-mode-div { .ms-mode-div {
margin-top: 10px; margin-top: 10px;
} }
>>> .el-form-item__error {
margin-left: 148px;
}
</style> </style>

View File

@ -48,7 +48,6 @@
prop="createUser" prop="createUser"
:field="item" :field="item"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
sortable
:label="$t('commons.create_user')" :label="$t('commons.create_user')"
min-width="200px"> min-width="200px">
</ms-table-column> </ms-table-column>
@ -221,7 +220,6 @@
prop="passRate" prop="passRate"
:field="item" :field="item"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
sortable
:label="$t('commons.pass_rate')" :label="$t('commons.pass_rate')"
min-width="120px"> min-width="120px">
</ms-table-column> </ms-table-column>