From f20a554bdb24e9dfde9dc6a69d78595944f61d15 Mon Sep 17 00:00:00 2001 From: mark <mark18340872469@163.com> Date: 星期二, 25 十月 2022 14:53:57 +0800 Subject: [PATCH] 设备管理 样式调整 --- src/components/subComponents/VueCron.vue | 112 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 61 insertions(+), 51 deletions(-) diff --git a/src/components/subComponents/VueCron.vue b/src/components/subComponents/VueCron.vue index 07dcc3c..180fc5f 100644 --- a/src/components/subComponents/VueCron.vue +++ b/src/components/subComponents/VueCron.vue @@ -1,7 +1,12 @@ <template> <div> - <b style="padding-right:30px;">瀹氭椂閲嶅惎:</b> - <el-select v-model="every" placeholder="璇烽�夋嫨" size="small" @change="changeEvery"> + <b style="padding-right: 30px">瀹氭椂閲嶅惎:</b> + <el-select + v-model="every" + placeholder="璇烽�夋嫨" + size="small" + @change="changeEvery" + > <el-option label="鍏抽棴" value="never"></el-option> <el-option label="姣忓ぉ" value="day"></el-option> <el-option label="姣忓懆" value="week"></el-option> @@ -16,7 +21,12 @@ style="margin-left: 20px" @change="updateExpression" > - <el-option v-for="item in days" :key="item.value" :label="item.label" :value="item.value"></el-option> + <el-option + v-for="item in days" + :key="item.value" + :label="item.label" + :value="item.value" + ></el-option> </el-select> <el-select @@ -39,7 +49,7 @@ <el-time-picker v-show="every !== 'never'" v-model="time" - :picker-options="{selectableRange: '00:00:00 - 23:59:59'}" + :picker-options="{ selectableRange: '00:00:00 - 23:59:59' }" value-format="HH:mm" format="HH:mm" placeholder="浠绘剰鏃堕棿鐐�" @@ -54,7 +64,8 @@ size="small" style="margin-left: 20px" @click="save" - >淇濆瓨</el-button> + >淇濆瓨</el-button + > </div> </template> @@ -64,21 +75,21 @@ props: ["expression"], computed: { days: () => { - let arr = [] + let arr = []; for (let i = 1; i < 32; i++) { arr.push({ label: i + "鏃�", - value: i + "" - }) + value: i + "", + }); } - return arr - } + return arr; + }, }, watch: { expression: function () { - this.resolveExp() - } + this.resolveExp(); + }, }, data() { return { @@ -90,13 +101,13 @@ hour: "*", day: "*", month: "*", - week: "*" + week: "*", }, - cronText: "" - } + cronText: "", + }; }, mounted() { - this.resolveExp() + this.resolveExp(); }, methods: { resolveExp() { @@ -106,22 +117,22 @@ let arr = this.expression.split(" "); if (arr.length >= 5) { //6 浣嶄互涓婃槸鍚堟硶琛ㄨ揪寮� - this.cronValueObj.min = arr[0] - this.cronValueObj.hour = arr[1] - this.cronValueObj.day = arr[2] + this.cronValueObj.min = arr[0]; + this.cronValueObj.hour = arr[1]; + this.cronValueObj.day = arr[2]; // this.cronValueObj.month = arr[3], - this.cronValueObj.month = "*" - this.cronValueObj.week = arr[4] + this.cronValueObj.month = "*"; + this.cronValueObj.week = arr[4]; } if (this.cronValueObj.week != "*") { - this.every = "week" + this.every = "week"; } else if (this.cronValueObj.day != "*") { - this.every = "month" + this.every = "month"; } else { - this.every = "day" + this.every = "day"; } - this.time = this.cronValueObj.hour + ":" + this.cronValueObj.min + this.time = this.cronValueObj.hour + ":" + this.cronValueObj.min; } else { //娌℃湁浼犲叆鐨勮〃杈惧紡 鍒欒繕鍘� this.clearCron(); @@ -130,45 +141,45 @@ changeEvery() { this.saveBtn = true; if (this.every === "never") { - this.cronText = "" - return + this.cronText = ""; + return; } if (this.every === "month") { - this.cronValueObj.week = "*" - this.cronValueObj.day = "1" + this.cronValueObj.week = "*"; + this.cronValueObj.day = "1"; if (!this.time.length) { - this.time = "00:00" + this.time = "00:00"; } } if (this.every === "week") { - this.cronValueObj.day = "*" - this.cronValueObj.week = "1" + this.cronValueObj.day = "*"; + this.cronValueObj.week = "1"; if (!this.time.length) { - this.time = "00:00" + this.time = "00:00"; } } if (this.every === "day") { - this.cronValueObj.day = "*" - this.cronValueObj.week = "*" + this.cronValueObj.day = "*"; + this.cronValueObj.week = "*"; } - this.updateExpression() + this.updateExpression(); }, updateExpression() { this.saveBtn = true; if (this.time.length) { let arr = this.time.split(":"); - this.cronValueObj.hour = arr[0] - this.cronValueObj.min = arr[1] + this.cronValueObj.hour = arr[0]; + this.cronValueObj.min = arr[1]; } - this.crontabValueString() + this.crontabValueString(); }, clearCron() { - this.cronValueObj.second = "*" - this.cronValueObj.min = "*" - this.cronValueObj.hour = "*" - this.cronValueObj.day = "*" - this.cronValueObj.month = "*" - this.cronValueObj.week = "*" + this.cronValueObj.second = "*"; + this.cronValueObj.min = "*"; + this.cronValueObj.hour = "*"; + this.cronValueObj.day = "*"; + this.cronValueObj.month = "*"; + this.cronValueObj.week = "*"; }, crontabValueString: function () { let obj = this.cronValueObj; @@ -181,14 +192,13 @@ " " + obj.month + " " + - obj.week + obj.week; }, save() { - debugger - this.$emit("update", this.cronText) - } - } -} + this.$emit("update", this.cronText); + }, + }, +}; </script> <style lang="scss"> -- Gitblit v1.8.0