refactor: 优化定时任务页面

This commit is contained in:
AgAngle 2020-07-19 16:17:16 +08:00
parent f9723d6da7
commit e24ab7a2ad
10 changed files with 48 additions and 42 deletions

View File

@ -17,6 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
JmeterProperties.class
})
@EnableScheduling
//@PropertySource(value = {"file:c:\\opt\\metersphere\\conf\\metersphere.properties"}, encoding = "UTF-8", ignoreResourceNotFound = true)
@PropertySource(value = {"file:/opt/metersphere/conf/metersphere.properties"}, encoding = "UTF-8", ignoreResourceNotFound = true)
public class Application {
public static void main(String[] args) {

View File

@ -3,12 +3,14 @@
<div id="app">
<el-form :model="form" :rules="rules" ref="from">
<el-form-item
:placeholder="$t('schedule.please_input_cron_expression')"
prop="cronValue">
<el-input v-model="form.cronValue" placeholder class="inp"/>
<el-button type="primary" @click="showCronDialog">{{$t('schedule.generate_expression')}}</el-button>
<el-input v-model="form.cronValue" class="inp" :placeholder="$t('schedule.please_input_cron_expression')"/>
<!-- <el-button type="primary" @click="showCronDialog">{{$t('schedule.generate_expression')}}</el-button>-->
<el-button type="primary" @click="saveCron">{{$t('commons.save')}}</el-button>
</el-form-item>
<el-form-item>
<el-link type="primary" @click="showCronDialog">{{$t('schedule.generate_expression')}}</el-link>
</el-form-item>
<crontab-result :ex="form.cronValue" ref="crontabResult" />
</el-form>
<el-dialog :title="$t('schedule.generate_expression')" :visible.sync="showCron" :modal="false">
@ -124,4 +126,8 @@
margin-right: 20px;
}
.el-form-item {
margin-bottom: 10px;
}
</style>

View File

@ -154,19 +154,19 @@ export default {
computed: {
//
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 1, 31)
this.cycle02 = this.checkNum(this.cycle02, 1, 31)
this.checkNum(this.cycle01, 1, 31)
this.checkNum(this.cycle02, 1, 31)
return this.cycle01 + '-' + this.cycle02;
},
//
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 1, 31)
this.average02 = this.checkNum(this.average02, 1, 31)
this.checkNum(this.average01, 1, 31)
this.checkNum(this.average02, 1, 31)
return this.average01 + '/' + this.average02;
},
//
workdayCheck: function () {
this.workday = this.checkNum(this.workday, 1, 31)
this.checkNum(this.workday, 1, 31)
return this.workday;
},
// checkbox

View File

@ -102,14 +102,14 @@ export default {
computed: {
//
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 0, 23)
this.cycle02 = this.checkNum(this.cycle02, 0, 23)
this.checkNum(this.cycle01, 0, 23)
this.checkNum(this.cycle02, 0, 23)
return this.cycle01 + '-' + this.cycle02;
},
//
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 0, 23)
this.average02 = this.checkNum(this.average02, 1, 23)
this.checkNum(this.average01, 0, 23)
this.checkNum(this.average02, 1, 23)
return this.average01 + '/' + this.average02;
},
// checkbox

View File

@ -9,15 +9,15 @@
<el-form-item>
<el-radio v-model='radioValue' :label="2">
{{$t('schedule.cron.period')}} {{$t('schedule.cron.from')}}
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
<el-input-number v-model='cycle02' :min="0" :max="60" /> {{$t('schedule.cron.minutes')}}
<el-input-number v-model='cycle01' :min="0" :max="59" /> -
<el-input-number v-model='cycle02' :min="0" :max="59" /> {{$t('schedule.cron.minutes')}}
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model='radioValue' :label="3">
{{$t('schedule.cron.from')}}
<el-input-number v-model='average01' :min="0" :max="60" /> {{$t('schedule.cron.minutes')}}{{$t('schedule.cron.start')}}{{$t('schedule.cron.every')}}
<el-input-number v-model='average01' :min="0" :max="59" /> {{$t('schedule.cron.minutes')}}{{$t('schedule.cron.start')}}{{$t('schedule.cron.every')}}
<el-input-number v-model='average02' :min="0" :max="60" /> {{$t('schedule.cron.minutes')}}{{$t('schedule.cron.execute_once')}}
</el-radio>
</el-form-item>
@ -100,14 +100,14 @@ export default {
computed: {
//
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 0, 59)
this.cycle02 = this.checkNum(this.cycle02, 0, 59)
this.checkNum(this.cycle01, 0, 59)
this.checkNum(this.cycle02, 0, 59)
return this.cycle01 + '-' + this.cycle02;
},
//
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 0, 59)
this.average02 = this.checkNum(this.average02, 1, 59)
this.checkNum(this.average01, 0, 59)
this.checkNum(this.average02, 1, 59)
return this.average01 + '/' + this.average02;
},
// checkbox

View File

@ -108,14 +108,14 @@ export default {
computed: {
//
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 1, 12)
this.cycle02 = this.checkNum(this.cycle02, 1, 12)
this.checkNum(this.cycle01, 1, 12)
this.checkNum(this.cycle02, 1, 12)
return this.cycle01 + '-' + this.cycle02;
},
//
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 1, 12)
this.average02 = this.checkNum(this.average02, 1, 12)
this.checkNum(this.average01, 1, 12)
this.checkNum(this.average02, 1, 12)
return this.average01 + '/' + this.average02;
},
// checkbox

View File

@ -586,7 +586,7 @@ export default {
.popup-result {
box-sizing: border-box;
line-height: 24px;
margin: 25px auto;
margin: 10px auto;
padding: 15px 10px 10px;
border: 1px solid #ccc;
position: relative;

View File

@ -9,15 +9,15 @@
<el-form-item>
<el-radio v-model='radioValue' :label="2">
{{$t('schedule.cron.period')}} {{$t('schedule.cron.from')}}
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
<el-input-number v-model='cycle02' :min="0" :max="60" /> {{$t('schedule.cron.seconds')}}
<el-input-number v-model='cycle01' :min="0" :max="59" /> -
<el-input-number v-model='cycle02' :min="0" :max="59" /> {{$t('schedule.cron.seconds')}}
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model='radioValue' :label="3">
{{$t('schedule.cron.from')}}
<el-input-number v-model='average01' :min="0" :max="60" /> {{$t('schedule.cron.seconds')}}{{$t('schedule.cron.start')}}{{$t('schedule.cron.every')}}
<el-input-number v-model='average01' :min="0" :max="59" /> {{$t('schedule.cron.seconds')}}{{$t('schedule.cron.start')}}{{$t('schedule.cron.every')}}
<el-input-number v-model='average02' :min="0" :max="60" /> {{$t('schedule.cron.seconds')}}{{$t('schedule.cron.execute_once')}}
</el-radio>
</el-form-item>
@ -113,14 +113,14 @@
computed: {
//
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 0, 59);
this.cycle02 = this.checkNum(this.cycle02, 0, 59);
this.checkNum(this.cycle01, 0, 59);
this.checkNum(this.cycle02, 0, 59);
return this.cycle01 + '-' + this.cycle02;
},
//
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 0, 59)
this.average02 = this.checkNum(this.average02, 1, 59)
this.checkNum(this.average01, 0, 59)
this.checkNum(this.average02, 1, 59)
return this.average01 + '/' + this.average02;
},
// checkbox

View File

@ -58,8 +58,7 @@ export default {
average01: 1,
average02: 1,
checkboxList: [],
weekList: [
this.$t('commons.weeks_1'),
weekList: [this.$t('commons.weeks_1'),
this.$t('commons.weeks_2'),
this.$t('commons.weeks_3'),
this.$t('commons.weeks_4'),
@ -150,19 +149,19 @@ export default {
computed: {
//
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 1, 7)
this.cycle02 = this.checkNum(this.cycle02, 1, 7)
this.checkNum(this.cycle01, 1, 7)
this.checkNum(this.cycle02, 1, 7)
return this.cycle01 + '-' + this.cycle02;
},
//
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 1, 4)
this.average02 = this.checkNum(this.average02, 1, 7)
this.checkNum(this.average01, 1, 4)
this.checkNum(this.average02, 1, 7)
return this.average01 + '#' + this.average02;
},
//
weekdayCheck: function () {
this.weekday = this.checkNum(this.weekday, 1, 7)
this.checkNum(this.weekday, 1, 7)
return this.weekday;
},
// checkbox

View File

@ -120,14 +120,14 @@ export default {
computed: {
//
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100)
this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101)
this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100)
this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101)
return this.cycle01 + '-' + this.cycle02;
},
//
averageTotal: function () {
this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100)
this.average02 = this.checkNum(this.average02, 1, 10)
this.checkNum(this.average01, this.fullYear, this.fullYear + 100)
this.checkNum(this.average02, 1, 10)
return this.average01 + '/' + this.average02;
},
// checkbox