From f566c39026d0141b2b7516b12b3bae90cc16cd13 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 03 九月 2021 10:55:58 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev --- ruoyi-ui/src/views/tool/gen/index.vue | 2 ruoyi-ui/src/views/system/role/index.vue | 2 ruoyi-ui/src/components/Crontab/mouth.vue | 128 +++ ruoyi-ui/src/components/Crontab/second.vue | 133 +++ ruoyi-ui/src/assets/styles/ruoyi.scss | 9 ruoyi-ui/src/components/Crontab/hour.vue | 122 +++ ruoyi-ui/src/views/monitor/job/index.vue | 50 + ruoyi-ui/src/components/Crontab/day.vue | 179 +++++ ruoyi-ui/src/components/Crontab/week.vue | 167 ++++ ruoyi-ui/src/views/system/dict/index.vue | 2 ruoyi-ui/src/components/Crontab/index.vue | 425 ++++++++++++ ruoyi-ui/src/components/Crontab/min.vue | 120 +++ ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml | 3 ruoyi-ui/src/components/Crontab/year.vue | 144 ++++ ruoyi-ui/src/components/Crontab/result.vue | 566 ++++++++++++++++ 15 files changed, 2,035 insertions(+), 17 deletions(-) diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index c752c5c..1f7aa48 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -130,6 +130,7 @@ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� --> AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') </if> + order by create_time desc </select> <select id="selectDbTableListByNames" resultMap="GenTableResult"> @@ -162,7 +163,7 @@ LEFT JOIN gen_table_column c ON t.table_id = c.table_id where t.table_name = #{tableName} order by c.sort </select> - + <select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult"> SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss index c4b4365..bb12cb7 100644 --- a/ruoyi-ui/src/assets/styles/ruoyi.scss +++ b/ruoyi-ui/src/assets/styles/ruoyi.scss @@ -60,10 +60,17 @@ color: inherit; } -.el-dialog:not(.is-fullscreen){ +.el-dialog:not(.is-fullscreen) { margin-top: 6vh !important; } +.el-dialog .el-dialog__body { + overflow: auto; + overflow-x: hidden; + max-height: 70vh; + padding: 10px 20px 0; +} + .el-table { .el-table__header-wrapper, .el-table__fixed-header-wrapper { th { diff --git a/ruoyi-ui/src/components/Crontab/day.vue b/ruoyi-ui/src/components/Crontab/day.vue new file mode 100644 index 0000000..7f0a3d2 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/day.vue @@ -0,0 +1,179 @@ +<template> + <el-form size="small"> + <el-form-item> + <el-radio v-model='radioValue' :label="1"> + 鏃ワ紝鍏佽鐨勯�氶厤绗, - * / L M] + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="2"> + 涓嶆寚瀹� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="3"> + 鍛ㄦ湡浠� + <el-input-number v-model='cycle01' :min="0" :max="31" /> - + <el-input-number v-model='cycle02' :min="0" :max="31" /> 鏃� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="4"> + 浠� + <el-input-number v-model='average01' :min="0" :max="31" /> 鍙峰紑濮嬶紝姣� + <el-input-number v-model='average02' :min="0" :max="31" /> 鏃ユ墽琛屼竴娆� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="5"> + 姣忔湀 + <el-input-number v-model='workday' :min="0" :max="31" /> 鍙锋渶杩戠殑閭d釜宸ヤ綔鏃� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="6"> + 鏈湀鏈�鍚庝竴澶� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="7"> + 鎸囧畾 + <el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple style="width:100%"> + <el-option v-for="item in 31" :key="item" :value="item">{{item}}</el-option> + </el-select> + </el-radio> + </el-form-item> + </el-form> +</template> + +<script> +export default { + data() { + return { + radioValue: 1, + workday: 1, + cycle01: 1, + cycle02: 2, + average01: 1, + average02: 1, + checkboxList: [], + checkNum: this.$options.propsData.check + } + }, + name: 'crontab-day', + props: ['check', 'cron'], + methods: { + // 鍗曢�夋寜閽�煎彉鍖栨椂 + radioChange() { + ('day rachange'); + if (this.radioValue === 1) { + this.$emit('update', 'day', '*', 'day'); + this.$emit('update', 'week', '?', 'day'); + this.$emit('update', 'mouth', '*', 'day'); + } else { + if (this.cron.hour === '*') { + this.$emit('update', 'hour', '0', 'day'); + } + if (this.cron.min === '*') { + this.$emit('update', 'min', '0', 'day'); + } + if (this.cron.second === '*') { + this.$emit('update', 'second', '0', 'day'); + } + } + + switch (this.radioValue) { + case 2: + this.$emit('update', 'day', '?'); + break; + case 3: + this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02); + break; + case 4: + this.$emit('update', 'day', this.average01 + '/' + this.average02); + break; + case 5: + this.$emit('update', 'day', this.workday + 'W'); + break; + case 6: + this.$emit('update', 'day', 'L'); + break; + case 7: + this.$emit('update', 'day', this.checkboxString); + break; + } + ('day rachange end'); + }, + // 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂 + cycleChange() { + if (this.radioValue == '3') { + this.$emit('update', 'day', this.cycleTotal); + } + }, + // 骞冲潎涓や釜鍊煎彉鍖栨椂 + averageChange() { + if (this.radioValue == '4') { + this.$emit('update', 'day', this.averageTotal); + } + }, + // 鏈�杩戝伐浣滄棩鍊煎彉鍖栨椂 + workdayChange() { + if (this.radioValue == '5') { + this.$emit('update', 'day', this.workday + 'W'); + } + }, + // checkbox鍊煎彉鍖栨椂 + checkboxChange() { + if (this.radioValue == '7') { + this.$emit('update', 'day', this.checkboxString); + } + }, + // 鐖剁粍浠朵紶閫掔殑week鍙戠敓鍙樺寲瑙﹀彂 + weekChange() { + //鍒ゆ柇week鍊间笌day涓嶈兘鍚屾椂涓衡��?鈥� + if (this.cron.week == '?' && this.radioValue == '2') { + this.radioValue = '1'; + } else if (this.cron.week !== '?' && this.radioValue != '2') { + this.radioValue = '2'; + } + }, + }, + watch: { + "radioValue": "radioChange", + 'cycleTotal': 'cycleChange', + 'averageTotal': 'averageChange', + 'workdayCheck': 'workdayChange', + 'checkboxString': 'checkboxChange', + }, + computed: { + // 璁$畻涓や釜鍛ㄦ湡鍊� + cycleTotal: function () { + this.cycle01 = this.checkNum(this.cycle01, 1, 31) + this.cycle02 = 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) + return this.average01 + '/' + this.average02; + }, + // 璁$畻宸ヤ綔鏃ユ牸寮� + workdayCheck: function () { + this.workday = this.checkNum(this.workday, 1, 31) + return this.workday; + }, + // 璁$畻鍕鹃�夌殑checkbox鍊煎悎闆� + checkboxString: function () { + let str = this.checkboxList.join(); + return str == '' ? '*' : str; + } + } +} +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/hour.vue b/ruoyi-ui/src/components/Crontab/hour.vue new file mode 100644 index 0000000..5a1e146 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/hour.vue @@ -0,0 +1,122 @@ +<template> + <el-form size="small"> + <el-form-item> + <el-radio v-model='radioValue' :label="1"> + 灏忔椂锛屽厑璁哥殑閫氶厤绗, - * /] + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="2"> + 鍛ㄦ湡浠� + <el-input-number v-model='cycle01' :min="0" :max="60" /> - + <el-input-number v-model='cycle02' :min="0" :max="60" /> 灏忔椂 + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="3"> + 浠� + <el-input-number v-model='average01' :min="0" :max="60" /> 灏忔椂寮�濮嬶紝姣� + <el-input-number v-model='average02' :min="0" :max="60" /> 灏忔椂鎵ц涓�娆� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="4"> + 鎸囧畾 + <el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple style="width:100%"> + <el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option> + </el-select> + </el-radio> + </el-form-item> + </el-form> +</template> + +<script> +export default { + data() { + return { + radioValue: 1, + cycle01: 0, + cycle02: 1, + average01: 0, + average02: 1, + checkboxList: [], + checkNum: this.$options.propsData.check + } + }, + name: 'crontab-hour', + props: ['check', 'cron'], + methods: { + // 鍗曢�夋寜閽�煎彉鍖栨椂 + radioChange() { + if (this.radioValue === 1) { + this.$emit('update', 'hour', '*', 'hour'); + this.$emit('update', 'day', '*', 'hour'); + } else { + if (this.cron.min === '*') { + this.$emit('update', 'min', '0', 'hour'); + } + if (this.cron.second === '*') { + this.$emit('update', 'second', '0', 'hour'); + } + } + switch (this.radioValue) { + case 2: + this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02); + break; + case 3: + this.$emit('update', 'hour', this.average01 + '/' + this.average02); + break; + case 4: + this.$emit('update', 'hour', this.checkboxString); + break; + } + }, + // 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂 + cycleChange() { + if (this.radioValue == '2') { + this.$emit('update', 'hour', this.cycleTotal); + } + }, + // 骞冲潎涓や釜鍊煎彉鍖栨椂 + averageChange() { + if (this.radioValue == '3') { + this.$emit('update', 'hour', this.averageTotal); + } + }, + // checkbox鍊煎彉鍖栨椂 + checkboxChange() { + if (this.radioValue == '4') { + this.$emit('update', 'hour', this.checkboxString); + } + } + }, + watch: { + "radioValue": "radioChange", + 'cycleTotal': 'cycleChange', + 'averageTotal': 'averageChange', + 'checkboxString': 'checkboxChange' + }, + computed: { + // 璁$畻涓や釜鍛ㄦ湡鍊� + cycleTotal: function () { + this.cycle01 = this.checkNum(this.cycle01, 0, 23) + this.cycle02 = 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) + return this.average01 + '/' + this.average02; + }, + // 璁$畻鍕鹃�夌殑checkbox鍊煎悎闆� + checkboxString: function () { + let str = this.checkboxList.join(); + return str == '' ? '*' : str; + } + } +} +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/index.vue b/ruoyi-ui/src/components/Crontab/index.vue new file mode 100644 index 0000000..c1d08f6 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/index.vue @@ -0,0 +1,425 @@ +<template> + <div> + <el-tabs type="border-card"> + <el-tab-pane label="绉�" v-if="shouldHide('second')"> + <CrontabSecond @update="updateContabValue" :check="checkNumber" ref="cronsecond" /> + </el-tab-pane> + + <el-tab-pane label="鍒嗛挓" v-if="shouldHide('min')"> + <CrontabMin + @update="updateContabValue" + :check="checkNumber" + :cron="contabValueObj" + ref="cronmin" + /> + </el-tab-pane> + + <el-tab-pane label="灏忔椂" v-if="shouldHide('hour')"> + <CrontabHour + @update="updateContabValue" + :check="checkNumber" + :cron="contabValueObj" + ref="cronhour" + /> + </el-tab-pane> + + <el-tab-pane label="鏃�" v-if="shouldHide('day')"> + <CrontabDay + @update="updateContabValue" + :check="checkNumber" + :cron="contabValueObj" + ref="cronday" + /> + </el-tab-pane> + + <el-tab-pane label="鏈�" v-if="shouldHide('mouth')"> + <CrontabMouth + @update="updateContabValue" + :check="checkNumber" + :cron="contabValueObj" + ref="cronmouth" + /> + </el-tab-pane> + + <el-tab-pane label="鍛�" v-if="shouldHide('week')"> + <CrontabWeek + @update="updateContabValue" + :check="checkNumber" + :cron="contabValueObj" + ref="cronweek" + /> + </el-tab-pane> + + <el-tab-pane label="骞�" v-if="shouldHide('year')"> + <CrontabYear + @update="updateContabValue" + :check="checkNumber" + :cron="contabValueObj" + ref="cronyear" + /> + </el-tab-pane> + </el-tabs> + + <div class="popup-main"> + <div class="popup-result"> + <p class="title">鏃堕棿琛ㄨ揪寮�</p> + <table> + <thead> + <th v-for="item of tabTitles" width="40" :key="item">{{item}}</th> + <th>Cron 琛ㄨ揪寮�</th> + </thead> + <tbody> + <td> + <span>{{contabValueObj.second}}</span> + </td> + <td> + <span>{{contabValueObj.min}}</span> + </td> + <td> + <span>{{contabValueObj.hour}}</span> + </td> + <td> + <span>{{contabValueObj.day}}</span> + </td> + <td> + <span>{{contabValueObj.mouth}}</span> + </td> + <td> + <span>{{contabValueObj.week}}</span> + </td> + <td> + <span>{{contabValueObj.year}}</span> + </td> + <td> + <span>{{contabValueString}}</span> + </td> + </tbody> + </table> + </div> + <CrontabResult :ex="contabValueString"></CrontabResult> + + <div class="pop_btn"> + <el-button size="small" type="primary" @click="submitFill">纭畾</el-button> + <el-button size="small" type="warning" @click="clearCron">閲嶇疆</el-button> + <el-button size="small" @click="hidePopup">鍙栨秷</el-button> + </div> + </div> + </div> +</template> + +<script> +import CrontabSecond from "./second.vue"; +import CrontabMin from "./min.vue"; +import CrontabHour from "./hour.vue"; +import CrontabDay from "./day.vue"; +import CrontabMouth from "./mouth.vue"; +import CrontabWeek from "./week.vue"; +import CrontabYear from "./year.vue"; +import CrontabResult from "./result.vue"; + +export default { + data() { + return { + tabTitles: ["绉�", "鍒嗛挓", "灏忔椂", "鏃�", "鏈�", "鍛�", "骞�"], + tabActive: 0, + myindex: 0, + contabValueObj: { + second: "*", + min: "*", + hour: "*", + day: "*", + mouth: "*", + week: "?", + year: "", + }, + }; + }, + name: "vcrontab", + props: ["expression", "hideComponent"], + methods: { + shouldHide(key) { + if (this.hideComponent && this.hideComponent.includes(key)) return false; + return true; + }, + resolveExp() { + //鍙嶈В鏋� 琛ㄨ揪寮� + if (this.expression) { + let arr = this.expression.split(" "); + if (arr.length >= 6) { + //6 浣嶄互涓婃槸鍚堟硶琛ㄨ揪寮� + let obj = { + second: arr[0], + min: arr[1], + hour: arr[2], + day: arr[3], + mouth: arr[4], + week: arr[5], + year: arr[6] ? arr[6] : "", + }; + this.contabValueObj = { + ...obj, + }; + for (let i in obj) { + if (obj[i]) this.changeRadio(i, obj[i]); + } + } + } else { + //娌℃湁浼犲叆鐨勮〃杈惧紡 鍒欒繕鍘� + this.clearCron(); + } + }, + // tab鍒囨崲鍊� + tabCheck(index) { + this.tabActive = index; + }, + // 鐢卞瓙缁勪欢瑙﹀彂锛屾洿鏀硅〃杈惧紡缁勬垚鐨勫瓧娈靛�� + updateContabValue(name, value, from) { + "updateContabValue", name, value, from; + this.contabValueObj[name] = value; + if (from && from !== name) { + console.log(`鏉ヨ嚜缁勪欢 ${from} 鏀瑰彉浜� ${name} ${value}`); + this.changeRadio(name, value); + } + }, + //璧嬪�煎埌缁勪欢 + changeRadio(name, value) { + let arr = ["second", "min", "hour", "mouth"], + refName = "cron" + name, + insVlaue; + + if (!this.$refs[refName]) return; + + if (arr.includes(name)) { + if (value === "*") { + insVlaue = 1; + } else if (value.indexOf("-") > -1) { + let indexArr = value.split("-"); + isNaN(indexArr[0]) + ? (this.$refs[refName].cycle01 = 0) + : (this.$refs[refName].cycle01 = indexArr[0]); + this.$refs[refName].cycle02 = indexArr[1]; + insVlaue = 2; + } else if (value.indexOf("/") > -1) { + let indexArr = value.split("/"); + isNaN(indexArr[0]) + ? (this.$refs[refName].average01 = 0) + : (this.$refs[refName].average01 = indexArr[0]); + this.$refs[refName].average02 = indexArr[1]; + insVlaue = 3; + } else { + insVlaue = 4; + this.$refs[refName].checkboxList = value.split(","); + } + } else if (name == "day") { + if (value === "*") { + insVlaue = 1; + } else if (value == "?") { + insVlaue = 2; + } else if (value.indexOf("-") > -1) { + let indexArr = value.split("-"); + isNaN(indexArr[0]) + ? (this.$refs[refName].cycle01 = 0) + : (this.$refs[refName].cycle01 = indexArr[0]); + this.$refs[refName].cycle02 = indexArr[1]; + insVlaue = 3; + } else if (value.indexOf("/") > -1) { + let indexArr = value.split("/"); + isNaN(indexArr[0]) + ? (this.$refs[refName].average01 = 0) + : (this.$refs[refName].average01 = indexArr[0]); + this.$refs[refName].average02 = indexArr[1]; + insVlaue = 4; + } else if (value.indexOf("W") > -1) { + let indexArr = value.split("W"); + isNaN(indexArr[0]) + ? (this.$refs[refName].workday = 0) + : (this.$refs[refName].workday = indexArr[0]); + insVlaue = 5; + } else if (value === "L") { + insVlaue = 6; + } else { + this.$refs[refName].checkboxList = value.split(","); + insVlaue = 7; + } + } else if (name == "week") { + if (value === "*") { + insVlaue = 1; + } else if (value == "?") { + insVlaue = 2; + } else if (value.indexOf("-") > -1) { + let indexArr = value.split("-"); + isNaN(indexArr[0]) + ? (this.$refs[refName].cycle01 = 0) + : (this.$refs[refName].cycle01 = indexArr[0]); + this.$refs[refName].cycle02 = indexArr[1]; + insVlaue = 3; + } else if (value.indexOf("#") > -1) { + let indexArr = value.split("#"); + isNaN(indexArr[0]) + ? (this.$refs[refName].average01 = 1) + : (this.$refs[refName].average01 = indexArr[0]); + this.$refs[refName].average02 = indexArr[1]; + insVlaue = 4; + } else if (value.indexOf("L") > -1) { + let indexArr = value.split("L"); + isNaN(indexArr[0]) + ? (this.$refs[refName].weekday = 1) + : (this.$refs[refName].weekday = indexArr[0]); + insVlaue = 5; + } else { + this.$refs[refName].checkboxList = value.split(","); + insVlaue = 7; + } + } else if (name == "year") { + if (value == "") { + insVlaue = 1; + } else if (value == "*") { + insVlaue = 2; + } else if (value.indexOf("-") > -1) { + insVlaue = 3; + } else if (value.indexOf("/") > -1) { + insVlaue = 4; + } else { + this.$refs[refName].checkboxList = value.split(","); + insVlaue = 5; + } + } + this.$refs[refName].radioValue = insVlaue; + }, + // 琛ㄥ崟閫夐」鐨勫瓙缁勪欢鏍¢獙鏁板瓧鏍煎紡锛堥�氳繃-props浼犻�掞級 + checkNumber(value, minLimit, maxLimit) { + //妫�鏌ュ繀椤讳负鏁存暟 + value = Math.floor(value); + if (value < minLimit) { + value = minLimit; + } else if (value > maxLimit) { + value = maxLimit; + } + return value; + }, + // 闅愯棌寮圭獥 + hidePopup() { + this.$emit("hide"); + }, + // 濉厖琛ㄨ揪寮� + submitFill() { + this.$emit("fill", this.contabValueString); + this.hidePopup(); + }, + clearCron() { + // 杩樺師閫夋嫨椤� + ("鍑嗗杩樺師"); + this.contabValueObj = { + second: "*", + min: "*", + hour: "*", + day: "*", + mouth: "*", + week: "?", + year: "", + }; + for (let j in this.contabValueObj) { + this.changeRadio(j, this.contabValueObj[j]); + } + }, + }, + computed: { + contabValueString: function() { + let obj = this.contabValueObj; + let str = + obj.second + + " " + + obj.min + + " " + + obj.hour + + " " + + obj.day + + " " + + obj.mouth + + " " + + obj.week + + (obj.year == "" ? "" : " " + obj.year); + return str; + }, + }, + components: { + CrontabSecond, + CrontabMin, + CrontabHour, + CrontabDay, + CrontabMouth, + CrontabWeek, + CrontabYear, + CrontabResult, + }, + watch: { + expression: "resolveExp", + hideComponent(value) { + // 闅愯棌閮ㄥ垎缁勪欢 + }, + }, + mounted: function() { + this.resolveExp(); + }, +}; +</script> +<style scoped> +.pop_btn { + text-align: center; + margin-top: 20px; +} +.popup-main { + position: relative; + margin: 10px auto; + background: #fff; + border-radius: 5px; + font-size: 12px; + overflow: hidden; +} +.popup-title { + overflow: hidden; + line-height: 34px; + padding-top: 6px; + background: #f2f2f2; +} +.popup-result { + box-sizing: border-box; + line-height: 24px; + margin: 25px auto; + padding: 15px 10px 10px; + border: 1px solid #ccc; + position: relative; +} +.popup-result .title { + position: absolute; + top: -28px; + left: 50%; + width: 140px; + font-size: 14px; + margin-left: -70px; + text-align: center; + line-height: 30px; + background: #fff; +} +.popup-result table { + text-align: center; + width: 100%; + margin: 0 auto; +} +.popup-result table span { + display: block; + width: 100%; + font-family: arial; + line-height: 30px; + height: 30px; + white-space: nowrap; + overflow: hidden; + border: 1px solid #e8e8e8; +} +.popup-result-scroll { + font-size: 12px; + line-height: 24px; + height: 10em; + overflow-y: auto; +} +</style> diff --git a/ruoyi-ui/src/components/Crontab/min.vue b/ruoyi-ui/src/components/Crontab/min.vue new file mode 100644 index 0000000..980c4e7 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/min.vue @@ -0,0 +1,120 @@ +<template> + <el-form size="small"> + <el-form-item> + <el-radio v-model='radioValue' :label="1"> + 鍒嗛挓锛屽厑璁哥殑閫氶厤绗, - * /] + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="2"> + 鍛ㄦ湡浠� + <el-input-number v-model='cycle01' :min="0" :max="60" /> - + <el-input-number v-model='cycle02' :min="0" :max="60" /> 鍒嗛挓 + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="3"> + 浠� + <el-input-number v-model='average01' :min="0" :max="60" /> 鍒嗛挓寮�濮嬶紝姣� + <el-input-number v-model='average02' :min="0" :max="60" /> 鍒嗛挓鎵ц涓�娆� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="4"> + 鎸囧畾 + <el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple style="width:100%"> + <el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option> + </el-select> + </el-radio> + </el-form-item> + </el-form> + +</template> + +<script> +export default { + data() { + return { + radioValue: 1, + cycle01: 1, + cycle02: 2, + average01: 0, + average02: 1, + checkboxList: [], + checkNum: this.$options.propsData.check + } + }, + name: 'crontab-min', + props: ['check', 'cron'], + methods: { + // 鍗曢�夋寜閽�煎彉鍖栨椂 + radioChange() { + if (this.radioValue !== 1 && this.cron.second === '*') { + this.$emit('update', 'second', '0', 'min'); + } + switch (this.radioValue) { + case 1: + this.$emit('update', 'min', '*', 'min'); + this.$emit('update', 'hour', '*', 'min'); + break; + case 2: + this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min'); + break; + case 3: + this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min'); + break; + case 4: + this.$emit('update', 'min', this.checkboxString, 'min'); + break; + } + }, + // 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂 + cycleChange() { + if (this.radioValue == '2') { + this.$emit('update', 'min', this.cycleTotal, 'min'); + } + }, + // 骞冲潎涓や釜鍊煎彉鍖栨椂 + averageChange() { + if (this.radioValue == '3') { + this.$emit('update', 'min', this.averageTotal, 'min'); + } + }, + // checkbox鍊煎彉鍖栨椂 + checkboxChange() { + if (this.radioValue == '4') { + this.$emit('update', 'min', this.checkboxString, 'min'); + } + }, + + }, + watch: { + "radioValue": "radioChange", + 'cycleTotal': 'cycleChange', + 'averageTotal': 'averageChange', + 'checkboxString': 'checkboxChange', + }, + computed: { + // 璁$畻涓や釜鍛ㄦ湡鍊� + cycleTotal: function () { + this.cycle01 = this.checkNum(this.cycle01, 0, 59) + this.cycle02 = 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) + return this.average01 + '/' + this.average02; + }, + // 璁$畻鍕鹃�夌殑checkbox鍊煎悎闆� + checkboxString: function () { + let str = this.checkboxList.join(); + return str == '' ? '*' : str; + } + } +} +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/mouth.vue b/ruoyi-ui/src/components/Crontab/mouth.vue new file mode 100644 index 0000000..4e2c8a7 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/mouth.vue @@ -0,0 +1,128 @@ +<template> + <el-form size='small'> + <el-form-item> + <el-radio v-model='radioValue' :label="1"> + 鏈堬紝鍏佽鐨勯�氶厤绗, - * /] + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="2"> + 鍛ㄦ湡浠� + <el-input-number v-model='cycle01' :min="1" :max="12" /> - + <el-input-number v-model='cycle02' :min="1" :max="12" /> 鏈� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="3"> + 浠� + <el-input-number v-model='average01' :min="1" :max="12" /> 鏈堝紑濮嬶紝姣� + <el-input-number v-model='average02' :min="1" :max="12" /> 鏈堟湀鎵ц涓�娆� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="4"> + 鎸囧畾 + <el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple style="width:100%"> + <el-option v-for="item in 12" :key="item" :value="item">{{item}}</el-option> + </el-select> + </el-radio> + </el-form-item> + </el-form> +</template> + +<script> +export default { + data() { + return { + radioValue: 1, + cycle01: 1, + cycle02: 2, + average01: 1, + average02: 1, + checkboxList: [], + checkNum: this.check + } + }, + name: 'crontab-mouth', + props: ['check', 'cron'], + methods: { + // 鍗曢�夋寜閽�煎彉鍖栨椂 + radioChange() { + if (this.radioValue === 1) { + this.$emit('update', 'mouth', '*'); + this.$emit('update', 'year', '*'); + } else { + if (this.cron.day === '*') { + this.$emit('update', 'day', '0', 'mouth'); + } + if (this.cron.hour === '*') { + this.$emit('update', 'hour', '0', 'mouth'); + } + if (this.cron.min === '*') { + this.$emit('update', 'min', '0', 'mouth'); + } + if (this.cron.second === '*') { + this.$emit('update', 'second', '0', 'mouth'); + } + } + switch (this.radioValue) { + case 2: + this.$emit('update', 'mouth', this.cycle01 + '-' + this.cycle02); + break; + case 3: + this.$emit('update', 'mouth', this.average01 + '/' + this.average02); + break; + case 4: + this.$emit('update', 'mouth', this.checkboxString); + break; + } + }, + // 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂 + cycleChange() { + if (this.radioValue == '2') { + this.$emit('update', 'mouth', this.cycleTotal); + } + }, + // 骞冲潎涓や釜鍊煎彉鍖栨椂 + averageChange() { + if (this.radioValue == '3') { + this.$emit('update', 'mouth', this.averageTotal); + } + }, + // checkbox鍊煎彉鍖栨椂 + checkboxChange() { + if (this.radioValue == '4') { + this.$emit('update', 'mouth', this.checkboxString); + } + } + }, + watch: { + "radioValue": "radioChange", + 'cycleTotal': 'cycleChange', + 'averageTotal': 'averageChange', + 'checkboxString': 'checkboxChange' + }, + computed: { + // 璁$畻涓や釜鍛ㄦ湡鍊� + cycleTotal: function () { + this.cycle01 = this.checkNum(this.cycle01, 1, 12) + this.cycle02 = 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) + return this.average01 + '/' + this.average02; + }, + // 璁$畻鍕鹃�夌殑checkbox鍊煎悎闆� + checkboxString: function () { + let str = this.checkboxList.join(); + return str == '' ? '*' : str; + } + } +} +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/result.vue b/ruoyi-ui/src/components/Crontab/result.vue new file mode 100644 index 0000000..3b9b6c8 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/result.vue @@ -0,0 +1,566 @@ +<template> + <div class="popup-result"> + <p class="title">鏈�杩�5娆¤繍琛屾椂闂�</p> + <ul class="popup-result-scroll"> + <template v-if='isShow'> + <li v-for='item in resultList' :key="item">{{item}}</li> + </template> + <li v-else>璁$畻缁撴灉涓�...</li> + </ul> + </div> +</template> + +<script> +export default { + data() { + return { + dayRule: '', + dayRuleSup: '', + dateArr: [], + resultList: [], + isShow: false + } + }, + name: 'crontab-result', + methods: { + // 琛ㄨ揪寮忓�煎彉鍖栨椂锛屽紑濮嬪幓璁$畻缁撴灉 + expressionChange() { + + // 璁$畻寮�濮�-闅愯棌缁撴灉 + this.isShow = false; + // 鑾峰彇瑙勫垯鏁扮粍[0绉掋��1鍒嗐��2鏃躲��3鏃ャ��4鏈堛��5鏄熸湡銆�6骞碷 + let ruleArr = this.$options.propsData.ex.split(' '); + // 鐢ㄤ簬璁板綍杩涘叆寰幆鐨勬鏁� + let nums = 0; + // 鐢ㄤ簬鏆傛椂瀛樼鍙锋椂闂磋鍒欑粨鏋滅殑鏁扮粍 + let resultArr = []; + // 鑾峰彇褰撳墠鏃堕棿绮剧‘鑷砙骞淬�佹湀銆佹棩銆佹椂銆佸垎銆佺] + let nTime = new Date(); + let nYear = nTime.getFullYear(); + let nMouth = nTime.getMonth() + 1; + let nDay = nTime.getDate(); + let nHour = nTime.getHours(); + let nMin = nTime.getMinutes(); + let nSecond = nTime.getSeconds(); + // 鏍规嵁瑙勫垯鑾峰彇鍒拌繎100骞村彲鑳藉勾鏁扮粍銆佹湀鏁扮粍绛夌瓑 + this.getSecondArr(ruleArr[0]); + this.getMinArr(ruleArr[1]); + this.getHourArr(ruleArr[2]); + this.getDayArr(ruleArr[3]); + this.getMouthArr(ruleArr[4]); + this.getWeekArr(ruleArr[5]); + this.getYearArr(ruleArr[6], nYear); + // 灏嗚幏鍙栧埌鐨勬暟缁勮祴鍊�-鏂逛究浣跨敤 + let sDate = this.dateArr[0]; + let mDate = this.dateArr[1]; + let hDate = this.dateArr[2]; + let DDate = this.dateArr[3]; + let MDate = this.dateArr[4]; + let YDate = this.dateArr[5]; + // 鑾峰彇褰撳墠鏃堕棿鍦ㄦ暟缁勪腑鐨勭储寮� + let sIdx = this.getIndex(sDate, nSecond); + let mIdx = this.getIndex(mDate, nMin); + let hIdx = this.getIndex(hDate, nHour); + let DIdx = this.getIndex(DDate, nDay); + let MIdx = this.getIndex(MDate, nMouth); + let YIdx = this.getIndex(YDate, nYear); + // 閲嶇疆鏈堟棩鏃跺垎绉掔殑鍑芥暟(鍚庨潰鐢ㄧ殑姣旇緝澶�) + const resetSecond = function () { + sIdx = 0; + nSecond = sDate[sIdx] + } + const resetMin = function () { + mIdx = 0; + nMin = mDate[mIdx] + resetSecond(); + } + const resetHour = function () { + hIdx = 0; + nHour = hDate[hIdx] + resetMin(); + } + const resetDay = function () { + DIdx = 0; + nDay = DDate[DIdx] + resetHour(); + } + const resetMouth = function () { + MIdx = 0; + nMouth = MDate[MIdx] + resetDay(); + } + // 濡傛灉褰撳墠骞翠唤涓嶄负鏁扮粍涓綋鍓嶅�� + if (nYear !== YDate[YIdx]) { + resetMouth(); + } + // 濡傛灉褰撳墠鏈堜唤涓嶄负鏁扮粍涓綋鍓嶅�� + if (nMouth !== MDate[MIdx]) { + resetDay(); + } + // 濡傛灉褰撳墠鈥滄棩鈥濅笉涓烘暟缁勪腑褰撳墠鍊� + if (nDay !== DDate[DIdx]) { + resetHour(); + } + // 濡傛灉褰撳墠鈥滄椂鈥濅笉涓烘暟缁勪腑褰撳墠鍊� + if (nHour !== hDate[hIdx]) { + resetMin(); + } + // 濡傛灉褰撳墠鈥滃垎鈥濅笉涓烘暟缁勪腑褰撳墠鍊� + if (nMin !== mDate[mIdx]) { + resetSecond(); + } + + // 寰幆骞翠唤鏁扮粍 + goYear: for (let Yi = YIdx; Yi < YDate.length; Yi++) { + let YY = YDate[Yi]; + // 濡傛灉鍒拌揪鏈�澶у�兼椂 + if (nMouth > MDate[MDate.length - 1]) { + resetMouth(); + continue; + } + // 寰幆鏈堜唤鏁扮粍 + goMouth: for (let Mi = MIdx; Mi < MDate.length; Mi++) { + // 璧嬪�笺�佹柟渚垮悗闈㈣繍绠� + let MM = MDate[Mi]; + MM = MM < 10 ? '0' + MM : MM; + // 濡傛灉鍒拌揪鏈�澶у�兼椂 + if (nDay > DDate[DDate.length - 1]) { + resetDay(); + if (Mi == MDate.length - 1) { + resetMouth(); + continue goYear; + } + continue; + } + // 寰幆鏃ユ湡鏁扮粍 + goDay: for (let Di = DIdx; Di < DDate.length; Di++) { + // 璧嬪�笺�佹柟渚垮悗闈㈣繍绠� + let DD = DDate[Di]; + let thisDD = DD < 10 ? '0' + DD : DD; + + // 濡傛灉鍒拌揪鏈�澶у�兼椂 + if (nHour > hDate[hDate.length - 1]) { + resetHour(); + if (Di == DDate.length - 1) { + resetDay(); + if (Mi == MDate.length - 1) { + resetMouth(); + continue goYear; + } + continue goMouth; + } + continue; + } + + // 鍒ゆ柇鏃ユ湡鐨勫悎娉曟�э紝涓嶅悎娉曠殑璇濅篃鏄烦鍑哄綋鍓嶅惊鐜� + if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true && this.dayRule !== 'workDay' && this.dayRule !== 'lastWeek' && this.dayRule !== 'lastDay') { + resetDay(); + continue goMouth; + } + // 濡傛灉鏃ユ湡瑙勫垯涓湁鍊兼椂 + if (this.dayRule == 'lastDay') { + //濡傛灉涓嶆槸鍚堟硶鏃ユ湡鍒欓渶瑕佸皢鍓嶅皢鏃ユ湡璋冨埌鍚堟硶鏃ユ湡鍗虫湀鏈渶鍚庝竴澶� + + if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { + while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { + DD--; + + thisDD = DD < 10 ? '0' + DD : DD; + } + } + } else if (this.dayRule == 'workDay') { + //鏍¢獙骞惰皟鏁村鏋滄槸2鏈�30鍙疯繖绉嶆棩鏈熶紶杩涙潵鏃堕渶璋冩暣鑷虫甯告湀搴� + if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { + while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { + DD--; + thisDD = DD < 10 ? '0' + DD : DD; + } + } + // 鑾峰彇杈惧埌鏉′欢鐨勬棩鏈熸槸鏄熸湡X + let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); + // 褰撴槦鏈熸棩鏃� + if (thisWeek == 0) { + //鍏堟壘涓嬩竴涓棩锛屽苟鍒ゆ柇鏄惁涓烘湀搴� + DD++; + thisDD = DD < 10 ? '0' + DD : DD; + //鍒ゆ柇涓嬩竴鏃ュ凡缁忎笉鏄悎娉曟棩鏈� + if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { + DD -= 3; + } + } else if (thisWeek == 6) { + //褰撴槦鏈�6鏃跺彧闇�鍒ゆ柇涓嶆槸1鍙峰氨鍙繘琛屾搷浣� + if (this.dayRuleSup !== 1) { + DD--; + } else { + DD += 2; + } + } + } else if (this.dayRule == 'weekDay') { + //濡傛灉鎸囧畾浜嗘槸鏄熸湡鍑� + //鑾峰彇褰撳墠鏃ユ湡鏄睘浜庢槦鏈熷嚑 + let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); + //鏍¢獙褰撳墠鏄熸湡鏄惁鍦ㄦ槦鏈熸睜锛坉ayRuleSup锛変腑 + if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) { + // 濡傛灉鍒拌揪鏈�澶у�兼椂 + if (Di == DDate.length - 1) { + resetDay(); + if (Mi == MDate.length - 1) { + resetMouth(); + continue goYear; + } + continue goMouth; + } + continue; + } + } else if (this.dayRule == 'assWeek') { + //濡傛灉鎸囧畾浜嗘槸绗嚑鍛ㄧ殑鏄熸湡鍑� + //鑾峰彇姣忔湀1鍙锋槸灞炰簬鏄熸湡鍑� + let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); + if (this.dayRuleSup[1] >= thisWeek) { + DD = (this.dayRuleSup[0] - 1) * 7 + this.dayRuleSup[1] - thisWeek + 1; + } else { + DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1; + } + } else if (this.dayRule == 'lastWeek') { + //濡傛灉鎸囧畾浜嗘瘡鏈堟渶鍚庝竴涓槦鏈熷嚑 + //鏍¢獙骞惰皟鏁村鏋滄槸2鏈�30鍙疯繖绉嶆棩鏈熶紶杩涙潵鏃堕渶璋冩暣鑷虫甯告湀搴� + if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { + while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { + DD--; + thisDD = DD < 10 ? '0' + DD : DD; + } + } + //鑾峰彇鏈堟湯鏈�鍚庝竴澶╂槸鏄熸湡鍑� + let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); + //鎵惧埌瑕佹眰涓渶杩戠殑閭d釜鏄熸湡鍑� + if (this.dayRuleSup < thisWeek) { + DD -= thisWeek - this.dayRuleSup; + } else if (this.dayRuleSup > thisWeek) { + DD -= 7 - (this.dayRuleSup - thisWeek) + } + } + // 鍒ゆ柇鏃堕棿鍊兼槸鍚﹀皬浜�10缃崲鎴愨��05鈥濊繖绉嶆牸寮� + DD = DD < 10 ? '0' + DD : DD; + + // 寰幆鈥滄椂鈥濇暟缁� + goHour: for (let hi = hIdx; hi < hDate.length; hi++) { + let hh = hDate[hi] < 10 ? '0' + hDate[hi] : hDate[hi] + + // 濡傛灉鍒拌揪鏈�澶у�兼椂 + if (nMin > mDate[mDate.length - 1]) { + resetMin(); + if (hi == hDate.length - 1) { + resetHour(); + if (Di == DDate.length - 1) { + resetDay(); + if (Mi == MDate.length - 1) { + resetMouth(); + continue goYear; + } + continue goMouth; + } + continue goDay; + } + continue; + } + // 寰幆"鍒�"鏁扮粍 + goMin: for (let mi = mIdx; mi < mDate.length; mi++) { + let mm = mDate[mi] < 10 ? '0' + mDate[mi] : mDate[mi]; + + // 濡傛灉鍒拌揪鏈�澶у�兼椂 + if (nSecond > sDate[sDate.length - 1]) { + resetSecond(); + if (mi == mDate.length - 1) { + resetMin(); + if (hi == hDate.length - 1) { + resetHour(); + if (Di == DDate.length - 1) { + resetDay(); + if (Mi == MDate.length - 1) { + resetMouth(); + continue goYear; + } + continue goMouth; + } + continue goDay; + } + continue goHour; + } + continue; + } + // 寰幆"绉�"鏁扮粍 + goSecond: for (let si = sIdx; si <= sDate.length - 1; si++) { + let ss = sDate[si] < 10 ? '0' + sDate[si] : sDate[si]; + // 娣诲姞褰撳墠鏃堕棿锛堟椂闂村悎娉曟�у湪鏃ユ湡寰幆鏃跺凡缁忓垽鏂級 + if (MM !== '00' && DD !== '00') { + resultArr.push(YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss) + nums++; + } + //濡傛灉鏉℃暟婊′簡灏遍��鍑哄惊鐜� + if (nums == 5) break goYear; + //濡傛灉鍒拌揪鏈�澶у�兼椂 + if (si == sDate.length - 1) { + resetSecond(); + if (mi == mDate.length - 1) { + resetMin(); + if (hi == hDate.length - 1) { + resetHour(); + if (Di == DDate.length - 1) { + resetDay(); + if (Mi == MDate.length - 1) { + resetMouth(); + continue goYear; + } + continue goMouth; + } + continue goDay; + } + continue goHour; + } + continue goMin; + } + } //goSecond + } //goMin + }//goHour + }//goDay + }//goMouth + } + // 鍒ゆ柇100骞村唴鐨勭粨鏋滄潯鏁� + if (resultArr.length == 0) { + this.resultList = ['娌℃湁杈惧埌鏉′欢鐨勭粨鏋滐紒']; + } else { + this.resultList = resultArr; + if (resultArr.length !== 5) { + this.resultList.push('鏈�杩�100骞村唴鍙湁涓婇潰' + resultArr.length + '鏉$粨鏋滐紒') + } + } + // 璁$畻瀹屾垚-鏄剧ず缁撴灉 + this.isShow = true; + + + }, + //鐢ㄤ簬璁$畻鏌愪綅鏁板瓧鍦ㄦ暟缁勪腑鐨勭储寮� + getIndex(arr, value) { + if (value <= arr[0] || value > arr[arr.length - 1]) { + return 0; + } else { + for (let i = 0; i < arr.length - 1; i++) { + if (value > arr[i] && value <= arr[i + 1]) { + return i + 1; + } + } + } + }, + // 鑾峰彇"骞�"鏁扮粍 + getYearArr(rule, year) { + this.dateArr[5] = this.getOrderArr(year, year + 100); + if (rule !== undefined) { + if (rule.indexOf('-') >= 0) { + this.dateArr[5] = this.getCycleArr(rule, year + 100, false) + } else if (rule.indexOf('/') >= 0) { + this.dateArr[5] = this.getAverageArr(rule, year + 100) + } else if (rule !== '*') { + this.dateArr[5] = this.getAssignArr(rule) + } + } + }, + // 鑾峰彇"鏈�"鏁扮粍 + getMouthArr(rule) { + this.dateArr[4] = this.getOrderArr(1, 12); + if (rule.indexOf('-') >= 0) { + this.dateArr[4] = this.getCycleArr(rule, 12, false) + } else if (rule.indexOf('/') >= 0) { + this.dateArr[4] = this.getAverageArr(rule, 12) + } else if (rule !== '*') { + this.dateArr[4] = this.getAssignArr(rule) + } + }, + // 鑾峰彇"鏃�"鏁扮粍-涓昏涓烘棩鏈熻鍒� + getWeekArr(rule) { + //鍙湁褰撴棩鏈熻鍒欑殑涓や釜鍊煎潎涓衡�溾�濇椂鍒欒〃杈炬棩鏈熸槸鏈夐�夐」鐨� + if (this.dayRule == '' && this.dayRuleSup == '') { + if (rule.indexOf('-') >= 0) { + this.dayRule = 'weekDay'; + this.dayRuleSup = this.getCycleArr(rule, 7, false) + } else if (rule.indexOf('#') >= 0) { + this.dayRule = 'assWeek'; + let matchRule = rule.match(/[0-9]{1}/g); + this.dayRuleSup = [Number(matchRule[0]), Number(matchRule[1])]; + this.dateArr[3] = [1]; + if (this.dayRuleSup[1] == 7) { + this.dayRuleSup[1] = 0; + } + } else if (rule.indexOf('L') >= 0) { + this.dayRule = 'lastWeek'; + this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]); + this.dateArr[3] = [31]; + if (this.dayRuleSup == 7) { + this.dayRuleSup = 0; + } + } else if (rule !== '*' && rule !== '?') { + this.dayRule = 'weekDay'; + this.dayRuleSup = this.getAssignArr(rule) + } + //濡傛灉weekDay鏃跺皢7璋冩暣涓�0銆恮eek鍊�0鍗虫槸鏄熸湡鏃ャ�� + if (this.dayRule == 'weekDay') { + for (let i = 0; i < this.dayRuleSup.length; i++) { + if (this.dayRuleSup[i] == 7) { + this.dayRuleSup[i] = 0; + } + } + } + } + }, + // 鑾峰彇"鏃�"鏁扮粍-灏戦噺涓烘棩鏈熻鍒� + getDayArr(rule) { + this.dateArr[3] = this.getOrderArr(1, 31); + this.dayRule = ''; + this.dayRuleSup = ''; + if (rule.indexOf('-') >= 0) { + this.dateArr[3] = this.getCycleArr(rule, 31, false) + this.dayRuleSup = 'null'; + } else if (rule.indexOf('/') >= 0) { + this.dateArr[3] = this.getAverageArr(rule, 31) + this.dayRuleSup = 'null'; + } else if (rule.indexOf('W') >= 0) { + this.dayRule = 'workDay'; + this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]); + this.dateArr[3] = [this.dayRuleSup]; + } else if (rule.indexOf('L') >= 0) { + this.dayRule = 'lastDay'; + this.dayRuleSup = 'null'; + this.dateArr[3] = [31]; + } else if (rule !== '*' && rule !== '?') { + this.dateArr[3] = this.getAssignArr(rule) + this.dayRuleSup = 'null'; + } else if (rule == '*') { + this.dayRuleSup = 'null'; + } + }, + // 鑾峰彇"鏃�"鏁扮粍 + getHourArr(rule) { + this.dateArr[2] = this.getOrderArr(0, 23); + if (rule.indexOf('-') >= 0) { + this.dateArr[2] = this.getCycleArr(rule, 24, true) + } else if (rule.indexOf('/') >= 0) { + this.dateArr[2] = this.getAverageArr(rule, 23) + } else if (rule !== '*') { + this.dateArr[2] = this.getAssignArr(rule) + } + }, + // 鑾峰彇"鍒�"鏁扮粍 + getMinArr(rule) { + this.dateArr[1] = this.getOrderArr(0, 59); + if (rule.indexOf('-') >= 0) { + this.dateArr[1] = this.getCycleArr(rule, 60, true) + } else if (rule.indexOf('/') >= 0) { + this.dateArr[1] = this.getAverageArr(rule, 59) + } else if (rule !== '*') { + this.dateArr[1] = this.getAssignArr(rule) + } + }, + // 鑾峰彇"绉�"鏁扮粍 + getSecondArr(rule) { + this.dateArr[0] = this.getOrderArr(0, 59); + if (rule.indexOf('-') >= 0) { + this.dateArr[0] = this.getCycleArr(rule, 60, true) + } else if (rule.indexOf('/') >= 0) { + this.dateArr[0] = this.getAverageArr(rule, 59) + } else if (rule !== '*') { + this.dateArr[0] = this.getAssignArr(rule) + } + }, + // 鏍规嵁浼犺繘鏉ョ殑min-max杩斿洖涓�涓『搴忕殑鏁扮粍 + getOrderArr(min, max) { + let arr = []; + for (let i = min; i <= max; i++) { + arr.push(i); + } + return arr; + }, + // 鏍规嵁瑙勫垯涓寚瀹氱殑闆舵暎鍊艰繑鍥炰竴涓暟缁� + getAssignArr(rule) { + let arr = []; + let assiginArr = rule.split(','); + for (let i = 0; i < assiginArr.length; i++) { + arr[i] = Number(assiginArr[i]) + } + arr.sort(this.compare) + return arr; + }, + // 鏍规嵁涓�瀹氱畻鏈鍒欒绠楄繑鍥炰竴涓暟缁� + getAverageArr(rule, limit) { + let arr = []; + let agArr = rule.split('/'); + let min = Number(agArr[0]); + let step = Number(agArr[1]); + while (min <= limit) { + arr.push(min); + min += step; + } + return arr; + }, + // 鏍规嵁瑙勫垯杩斿洖涓�涓叿鏈夊懆鏈熸�х殑鏁扮粍 + getCycleArr(rule, limit, status) { + //status--琛ㄧず鏄惁浠�0寮�濮嬶紙鍒欎粠1寮�濮嬶級 + let arr = []; + let cycleArr = rule.split('-'); + let min = Number(cycleArr[0]); + let max = Number(cycleArr[1]); + if (min > max) { + max += limit; + } + for (let i = min; i <= max; i++) { + let add = 0; + if (status == false && i % limit == 0) { + add = limit; + } + arr.push(Math.round(i % limit + add)) + } + arr.sort(this.compare) + return arr; + }, + //姣旇緝鏁板瓧澶у皬锛堢敤浜嶢rray.sort锛� + compare(value1, value2) { + if (value2 - value1 > 0) { + return -1; + } else { + return 1; + } + }, + // 鏍煎紡鍖栨棩鏈熸牸寮忓锛�2017-9-19 18:04:33 + formatDate(value, type) { + // 璁$畻鏃ユ湡鐩稿叧鍊� + let time = typeof value == 'number' ? new Date(value) : value; + let Y = time.getFullYear(); + let M = time.getMonth() + 1; + let D = time.getDate(); + let h = time.getHours(); + let m = time.getMinutes(); + let s = time.getSeconds(); + let week = time.getDay(); + // 濡傛灉浼犻�掍簡type鐨勮瘽 + if (type == undefined) { + return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s); + } else if (type == 'week') { + return week; + } + }, + // 妫�鏌ユ棩鏈熸槸鍚﹀瓨鍦� + checkDate(value) { + let time = new Date(value); + let format = this.formatDate(time) + return value == format ? true : false; + } + }, + watch: { + 'ex': 'expressionChange' + }, + props: ['ex'], + mounted: function () { + // 鍒濆鍖� 鑾峰彇涓�娆$粨鏋� + this.expressionChange(); + } +} + +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/second.vue b/ruoyi-ui/src/components/Crontab/second.vue new file mode 100644 index 0000000..20a8eb3 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/second.vue @@ -0,0 +1,133 @@ +<template> + <el-form size="small"> + <el-form-item> + <el-radio v-model='radioValue' :label="1"> + 绉掞紝鍏佽鐨勯�氶厤绗, - * /] + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="2"> + 鍛ㄦ湡浠� + <el-input-number v-model='cycle01' :min="0" :max="60" /> - + <el-input-number v-model='cycle02' :min="0" :max="60" /> 绉� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="3"> + 浠� + <el-input-number v-model='average01' :min="0" :max="60" /> 绉掑紑濮嬶紝姣� + <el-input-number v-model='average02' :min="0" :max="60" /> 绉掓墽琛屼竴娆� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="4"> + 鎸囧畾 + <el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple style="width:100%"> + <el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option> + </el-select> + </el-radio> + </el-form-item> + </el-form> +</template> + +<script> +export default { + data() { + return { + radioValue: 1, + cycle01: 1, + cycle02: 2, + average01: 0, + average02: 1, + checkboxList: [], + checkNum: this.$options.propsData.check + } + }, + name: 'crontab-second', + props: ['check', 'radioParent'], + methods: { + // 鍗曢�夋寜閽�煎彉鍖栨椂 + radioChange() { + switch (this.radioValue) { + case 1: + this.$emit('update', 'second', '*', 'second'); + this.$emit('update', 'min', '*', 'second'); + break; + case 2: + this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02); + break; + case 3: + this.$emit('update', 'second', this.average01 + '/' + this.average02); + break; + case 4: + this.$emit('update', 'second', this.checkboxString); + break; + } + }, + // 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂 + cycleChange() { + if (this.radioValue == '2') { + this.$emit('update', 'second', this.cycleTotal); + } + }, + // 骞冲潎涓や釜鍊煎彉鍖栨椂 + averageChange() { + if (this.radioValue == '3') { + this.$emit('update', 'second', this.averageTotal); + } + }, + // checkbox鍊煎彉鍖栨椂 + checkboxChange() { + if (this.radioValue == '4') { + this.$emit('update', 'second', this.checkboxString); + } + }, + othChange() { + //鍙嶈В鏋� + let ins = this.cron.second + ('鍙嶈В鏋� second', ins); + if (ins === '*') { + this.radioValue = 1; + } else if (ins.indexOf('-') > -1) { + this.radioValue = 2 + } else if (ins.indexOf('/') > -1) { + this.radioValue = 3 + } else { + this.radioValue = 4 + this.checkboxList = ins.split(',') + } + } + }, + watch: { + "radioValue": "radioChange", + 'cycleTotal': 'cycleChange', + 'averageTotal': 'averageChange', + 'checkboxString': 'checkboxChange', + radioParent() { + this.radioValue = this.radioParent + } + }, + computed: { + // 璁$畻涓や釜鍛ㄦ湡鍊� + cycleTotal: function () { + this.cycle01 = this.checkNum(this.cycle01, 0, 59) + this.cycle02 = 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) + return this.average01 + '/' + this.average02; + }, + // 璁$畻鍕鹃�夌殑checkbox鍊煎悎闆� + checkboxString: function () { + let str = this.checkboxList.join(); + return str == '' ? '*' : str; + } + } +} +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/week.vue b/ruoyi-ui/src/components/Crontab/week.vue new file mode 100644 index 0000000..8a7cb6b --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/week.vue @@ -0,0 +1,167 @@ +<template> + <el-form size='small'> + <el-form-item> + <el-radio v-model='radioValue' :label="1"> + 鍛紝鍏佽鐨勯�氶厤绗, - * / L #] + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="2"> + 涓嶆寚瀹� + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="3"> + 鍛ㄦ湡浠庢槦鏈� + <el-input-number v-model='cycle01' :min="1" :max="7" /> - + <el-input-number v-model='cycle02' :min="1" :max="7" /> + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="4"> + 绗� + <el-input-number v-model='average01' :min="1" :max="4" /> 鍛ㄧ殑鏄熸湡 + <el-input-number v-model='average02' :min="1" :max="7" /> + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="5"> + 鏈湀鏈�鍚庝竴涓槦鏈� + <el-input-number v-model='weekday' :min="1" :max="7" /> + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio v-model='radioValue' :label="6"> + 鎸囧畾 + <el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple style="width:100%"> + <el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{item}}</el-option> + </el-select> + </el-radio> + </el-form-item> + + </el-form> +</template> + +<script> +export default { + data() { + return { + radioValue: 2, + weekday: 1, + cycle01: 1, + cycle02: 2, + average01: 1, + average02: 1, + checkboxList: [], + weekList: ['鍛ㄤ竴', '鍛ㄤ簩', '鍛ㄤ笁', '鍛ㄥ洓', '鍛ㄤ簲', '鍛ㄥ叚', '鍛ㄦ棩'], + checkNum: this.$options.propsData.check + } + }, + name: 'crontab-week', + props: ['check', 'cron'], + methods: { + // 鍗曢�夋寜閽�煎彉鍖栨椂 + radioChange() { + if (this.radioValue === 1) { + this.$emit('update', 'week', '*'); + this.$emit('update', 'year', '*'); + } else { + if (this.cron.mouth === '*') { + this.$emit('update', 'mouth', '0', 'week'); + } + if (this.cron.day === '*') { + this.$emit('update', 'day', '0', 'week'); + } + if (this.cron.hour === '*') { + this.$emit('update', 'hour', '0', 'week'); + } + if (this.cron.min === '*') { + this.$emit('update', 'min', '0', 'week'); + } + if (this.cron.second === '*') { + this.$emit('update', 'second', '0', 'week'); + } + } + switch (this.radioValue) { + case 2: + this.$emit('update', 'week', '?'); + break; + case 3: + this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02); + break; + case 4: + this.$emit('update', 'week', this.average01 + '#' + this.average02); + break; + case 5: + this.$emit('update', 'week', this.weekday + 'L'); + break; + case 6: + this.$emit('update', 'week', this.checkboxString); + break; + } + }, + // 鏍规嵁浜掓枼浜嬩欢锛屾洿鏀箁adio鐨勫�� + + // 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂 + cycleChange() { + if (this.radioValue == '3') { + this.$emit('update', 'week', this.cycleTotal); + } + }, + // 骞冲潎涓や釜鍊煎彉鍖栨椂 + averageChange() { + if (this.radioValue == '4') { + this.$emit('update', 'week', this.averageTotal); + } + }, + // 鏈�杩戝伐浣滄棩鍊煎彉鍖栨椂 + weekdayChange() { + if (this.radioValue == '5') { + this.$emit('update', 'week', this.weekday + 'L'); + } + }, + // checkbox鍊煎彉鍖栨椂 + checkboxChange() { + if (this.radioValue == '6') { + this.$emit('update', 'week', this.checkboxString); + } + }, + }, + watch: { + "radioValue": "radioChange", + 'cycleTotal': 'cycleChange', + 'averageTotal': 'averageChange', + 'weekdayCheck': 'weekdayChange', + 'checkboxString': 'checkboxChange', + }, + computed: { + // 璁$畻涓や釜鍛ㄦ湡鍊� + cycleTotal: function () { + this.cycle01 = this.checkNum(this.cycle01, 1, 7) + this.cycle02 = 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) + return this.average01 + '#' + this.average02; + }, + // 鏈�杩戠殑宸ヤ綔鏃ワ紙鏍煎紡锛� + weekdayCheck: function () { + this.weekday = this.checkNum(this.weekday, 1, 7) + return this.weekday; + }, + // 璁$畻鍕鹃�夌殑checkbox鍊煎悎闆� + checkboxString: function () { + let str = this.checkboxList.join(); + return str == '' ? '*' : str; + } + } +} +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/year.vue b/ruoyi-ui/src/components/Crontab/year.vue new file mode 100644 index 0000000..02bcac3 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/year.vue @@ -0,0 +1,144 @@ +<template> + <el-form size="small"> + <el-form-item> + <el-radio :label="1" v-model='radioValue'> + 涓嶅~锛屽厑璁哥殑閫氶厤绗, - * /] + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio :label="2" v-model='radioValue'> + 姣忓勾 + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio :label="3" v-model='radioValue'> + 鍛ㄦ湡浠� + <el-input-number v-model='cycle01' :min='fullYear' /> - + <el-input-number v-model='cycle02' :min='fullYear' /> + </el-radio> + </el-form-item> + + <el-form-item> + <el-radio :label="4" v-model='radioValue'> + 浠� + <el-input-number v-model='average01' :min='fullYear' /> 骞村紑濮嬶紝姣� + <el-input-number v-model='average02' :min='fullYear' /> 骞存墽琛屼竴娆� + </el-radio> + + </el-form-item> + + <el-form-item> + <el-radio :label="5" v-model='radioValue'> + 鎸囧畾 + <el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple> + <el-option v-for="item in 9" :key="item" :value="item - 1 + fullYear" :label="item -1 + fullYear" /> + </el-select> + </el-radio> + </el-form-item> + </el-form> +</template> + +<script> +export default { + data() { + return { + fullYear: 0, + radioValue: 1, + cycle01: 0, + cycle02: 0, + average01: 0, + average02: 1, + checkboxList: [], + checkNum: this.$options.propsData.check + } + }, + name: 'crontab-year', + props: ['check', 'mouth', 'cron'], + methods: { + // 鍗曢�夋寜閽�煎彉鍖栨椂 + radioChange() { + if (this.cron.mouth === '*') { + this.$emit('update', 'mouth', '0', 'year'); + } + if (this.cron.day === '*') { + this.$emit('update', 'day', '0', 'year'); + } + if (this.cron.hour === '*') { + this.$emit('update', 'hour', '0', 'year'); + } + if (this.cron.min === '*') { + this.$emit('update', 'min', '0', 'year'); + } + if (this.cron.second === '*') { + this.$emit('update', 'second', '0', 'year'); + } + switch (this.radioValue) { + case 1: + this.$emit('update', 'year', ''); + break; + case 2: + this.$emit('update', 'year', '*'); + break; + case 3: + this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02); + break; + case 4: + this.$emit('update', 'year', this.average01 + '/' + this.average02); + break; + case 5: + this.$emit('update', 'year', this.checkboxString); + break; + } + }, + // 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂 + cycleChange() { + if (this.radioValue == '3') { + this.$emit('update', 'year', this.cycleTotal); + } + }, + // 骞冲潎涓や釜鍊煎彉鍖栨椂 + averageChange() { + if (this.radioValue == '4') { + this.$emit('update', 'year', this.averageTotal); + } + }, + // checkbox鍊煎彉鍖栨椂 + checkboxChange() { + if (this.radioValue == '5') { + this.$emit('update', 'year', this.checkboxString); + } + } + }, + watch: { + "radioValue": "radioChange", + 'cycleTotal': 'cycleChange', + 'averageTotal': 'averageChange', + 'checkboxString': 'checkboxChange' + }, + 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) + 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) + return this.average01 + '/' + this.average02; + }, + // 璁$畻鍕鹃�夌殑checkbox鍊煎悎闆� + checkboxString: function () { + let str = this.checkboxList.join(); + return str; + } + }, + mounted: function () { + // 浠呰幏鍙栧綋鍓嶅勾浠� + this.fullYear = Number(new Date().getFullYear()); + } +} +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 6256804..03425f7 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -156,7 +156,7 @@ /> <!-- 娣诲姞鎴栦慨鏀瑰畾鏃朵换鍔″璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> + <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-row> <el-col :span="12"> @@ -192,17 +192,16 @@ <el-input v-model="form.invokeTarget" placeholder="璇疯緭鍏ヨ皟鐢ㄧ洰鏍囧瓧绗︿覆" /> </el-form-item> </el-col> - <el-col :span="12"> + <el-col :span="24"> <el-form-item label="cron琛ㄨ揪寮�" prop="cronExpression"> - <el-input v-model="form.cronExpression" placeholder="璇疯緭鍏ron鎵ц琛ㄨ揪寮�" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鏄惁骞跺彂" prop="concurrent"> - <el-radio-group v-model="form.concurrent" size="small"> - <el-radio-button label="0">鍏佽</el-radio-button> - <el-radio-button label="1">绂佹</el-radio-button> - </el-radio-group> + <el-input v-model="form.cronExpression" placeholder="璇疯緭鍏ron鎵ц琛ㄨ揪寮�"> + <template slot="append"> + <el-button type="primary" @click="handleShowCron"> + 鐢熸垚琛ㄨ揪寮� + <i class="el-icon-time el-icon--right"></i> + </el-button> + </template> + </el-input> </el-form-item> </el-col> <el-col :span="24"> @@ -214,7 +213,15 @@ </el-radio-group> </el-form-item> </el-col> - <el-col :span="24"> + <el-col :span="12"> + <el-form-item label="鏄惁骞跺彂" prop="concurrent"> + <el-radio-group v-model="form.concurrent" size="small"> + <el-radio-button label="0">鍏佽</el-radio-button> + <el-radio-button label="1">绂佹</el-radio-button> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> <el-form-item label="鐘舵��"> <el-radio-group v-model="form.status"> <el-radio @@ -231,6 +238,10 @@ <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> </div> + </el-dialog> + + <el-dialog title="Cron琛ㄨ揪寮忕敓鎴愬櫒" :visible.sync="openCron"> + <crontab @hide="openCron=false" @fill="crontabFill" :expression="expression"></crontab> </el-dialog> <!-- 浠诲姟鏃ュ織璇︾粏 --> @@ -285,8 +296,10 @@ <script> import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"; +import Crontab from '@/components/Crontab' export default { + components: { Crontab }, name: "Job", data() { return { @@ -312,6 +325,10 @@ open: false, // 鏄惁鏄剧ず璇︾粏寮瑰嚭灞� openView: false, + // 鏄惁鏄剧ずCron琛ㄨ揪寮忓脊鍑哄眰 + openCron: false, + // 浼犲叆鐨勮〃杈惧紡 + expression: "", // 浠诲姟缁勫悕瀛楀吀 jobGroupOptions: [], // 鐘舵�佸瓧鍏� @@ -448,6 +465,15 @@ this.openView = true; }); }, + /** cron琛ㄨ揪寮忔寜閽搷浣� */ + handleShowCron() { + this.expression = this.form.cronExpression; + this.openCron = true; + }, + /** 纭畾鍚庡洖浼犲�� */ + crontabFill(value) { + this.form.cronExpression = value; + }, /** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */ handleJobLog(row) { const jobId = row.jobId || 0; diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index b4ac1da..0bce088 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -356,4 +356,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index 59880bd..b86bc55 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -629,4 +629,4 @@ } } }; -</script> +</script> \ No newline at end of file diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index 1b69e21..b1cd1a0 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -337,4 +337,4 @@ } } }; -</script> +</script> \ No newline at end of file -- Gitblit v1.9.3