mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-03 02:57:09 +08:00
fix: 修复任务日志日期查询部分错误
This commit is contained in:
@@ -1,151 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="1">
|
|
||||||
日,允许的通配符[, - * ? / L W]
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="2">
|
|
||||||
不指定
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="3">
|
|
||||||
周期从
|
|
||||||
<a-input-number v-model="cycle01" :min="1" :max="30" /> -
|
|
||||||
<a-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 2" :max="31" /> 日
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="4">
|
|
||||||
从
|
|
||||||
<a-input-number v-model="average01" :min="1" :max="30" /> 号开始,每
|
|
||||||
<a-input-number v-model="average02" :min="1" :max="31 - average01 || 1" /> 日执行一次
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="5">
|
|
||||||
每月
|
|
||||||
<a-input-number v-model="workday" :min="1" :max="31" /> 号最近的那个工作日
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="6">
|
|
||||||
本月最后一天
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="7">
|
|
||||||
指定
|
|
||||||
<a-select v-model="checkboxList" clearable placeholder="可多选" multiple style="width:100%">
|
|
||||||
<a-option v-for="item in 31" :key="item" :value="item">{{ item }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed, ref, watch } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
check: {
|
|
||||||
type: Function,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
modelValue: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
cron: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
|
||||||
|
|
||||||
const radioValue = ref(1)
|
|
||||||
const workday = ref(1)
|
|
||||||
const cycle01 = ref(1)
|
|
||||||
const cycle02 = ref(2)
|
|
||||||
const average01 = ref(1)
|
|
||||||
const average02 = ref(1)
|
|
||||||
const checkboxList = ref([])
|
|
||||||
|
|
||||||
const cycleTotal = computed(() => {
|
|
||||||
const cycle01Val = props.check(cycle01.value, 1, 30)
|
|
||||||
const cycle02Val = props.check(cycle02.value, cycle01Val ? cycle01Val + 1 : 2, 31, 31)
|
|
||||||
return `${cycle01Val}-${cycle02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const averageTotal = computed(() => {
|
|
||||||
const average01Val = props.check(average01.value, 1, 30)
|
|
||||||
const average02Val = props.check(average02.value, 1, 31 - average01Val || 0)
|
|
||||||
return `${average01Val}/${average02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const workdayCheck = computed(() => {
|
|
||||||
const workdayVal = props.check(workday.value, 1, 31)
|
|
||||||
return workdayVal
|
|
||||||
})
|
|
||||||
|
|
||||||
const checkboxString = computed(() => {
|
|
||||||
const str = checkboxList.value.join()
|
|
||||||
return str === '' ? '*' : str
|
|
||||||
})
|
|
||||||
|
|
||||||
const emitUpdate = (value) => {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(radioValue, () => {
|
|
||||||
if (radioValue.value !== 2 && props.cron.week !== '?') {
|
|
||||||
props.cron.week = '?'
|
|
||||||
}
|
|
||||||
switch (radioValue.value) {
|
|
||||||
case 1:
|
|
||||||
emitUpdate('*')
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
emitUpdate('?')
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
break
|
|
||||||
case 5:
|
|
||||||
emitUpdate(`${workdayCheck.value}W`)
|
|
||||||
break
|
|
||||||
case 6:
|
|
||||||
emitUpdate('L')
|
|
||||||
break
|
|
||||||
case 7:
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(cycleTotal, () => {
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(averageTotal, () => {
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(workdayCheck, () => {
|
|
||||||
emitUpdate(`${workdayCheck.value}W`)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(checkboxString, () => {
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="1">
|
|
||||||
*
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="2">
|
|
||||||
周期从
|
|
||||||
<a-input-number v-model="cycle01" :min="0" :max="58" />
|
|
||||||
-
|
|
||||||
<a-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1" :max="59" />
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="3">
|
|
||||||
从
|
|
||||||
<a-input-number v-model="average01" :min="0" :max="58" />
|
|
||||||
开始,每
|
|
||||||
<a-input-number v-model="average02" :min="1" :max="59 - average01 || 0" />
|
|
||||||
执行一次
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="4">
|
|
||||||
指定
|
|
||||||
<a-select v-model="checkboxList" clearable placeholder="可多选" multiple style="width:100%">
|
|
||||||
<a-option v-for="item in 60" :key="item" :value="item - 1">{{ item - 1 }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed, ref, watch } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
check: {
|
|
||||||
type: Function,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
modelValue: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
|
||||||
|
|
||||||
const radioValue = ref(1)
|
|
||||||
const cycle01 = ref(0)
|
|
||||||
const cycle02 = ref(1)
|
|
||||||
const average01 = ref(0)
|
|
||||||
const average02 = ref(1)
|
|
||||||
const checkboxList = ref([])
|
|
||||||
|
|
||||||
const cycleTotal = computed(() => {
|
|
||||||
const cycle01Val = props.check(cycle01.value, 0, 58)
|
|
||||||
const cycle02Val = props.check(cycle02.value, cycle01Val ? cycle01Val + 1 : 1, 59)
|
|
||||||
return `${cycle01Val}-${cycle02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const averageTotal = computed(() => {
|
|
||||||
const average01Val = props.check(average01.value, 0, 58)
|
|
||||||
const average02Val = props.check(average02.value, 1, 59 - average01Val || 0)
|
|
||||||
return `${average01Val}/${average02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const checkboxString = computed(() => {
|
|
||||||
const str = checkboxList.value.join()
|
|
||||||
return str === '' ? '*' : str
|
|
||||||
})
|
|
||||||
|
|
||||||
const emitUpdate = (value) => {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(radioValue, () => {
|
|
||||||
switch (radioValue.value) {
|
|
||||||
case 1:
|
|
||||||
emitUpdate('*')
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(cycleTotal, () => {
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(averageTotal, () => {
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(checkboxString, () => {
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-tabs default-active-key="1" type="card">
|
|
||||||
<a-tab-pane key="1" tab="秒">
|
|
||||||
<CrontabField v-model="cron.second" :check="checkNumber" />
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="2" tab="分">
|
|
||||||
<CrontabField v-model="cron.minute" :check="checkNumber" />
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="3" tab="时">
|
|
||||||
<CrontabField v-model="cron.hour" :check="checkNumber" />
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="4" tab="日">
|
|
||||||
<CrontabDay v-model="cron.day" :check="checkNumber" :cron="cron" />
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="5" tab="月">
|
|
||||||
<CrontabMonth v-model="cron.month" :check="checkNumber" />
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="6" tab="星期">
|
|
||||||
<CrontabWeek v-model="cron.week" :check="checkNumber" :cron="cron" />
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="7" tab="年">
|
|
||||||
<CrontabYear v-model="cron.year" :check="checkNumber" />
|
|
||||||
</a-tab-pane>
|
|
||||||
</a-tabs>
|
|
||||||
|
|
||||||
<div class="cron-result">
|
|
||||||
<p>Cron 表达式:</p>
|
|
||||||
<code class="cron-expression">{{ cronExpression }}</code>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="cronExpression">
|
|
||||||
<!-- <button @click="parseCronExpression">解析表达式</button> -->
|
|
||||||
<button @click="generateCronExpression">生成表达式</button>
|
|
||||||
</div>
|
|
||||||
<div v-if="parsedCron">
|
|
||||||
<p>解析结果:</p>
|
|
||||||
<pre>{{ parsedCron }}</pre>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed, ref } from 'vue'
|
|
||||||
import CrontabField from './CrontabField.vue' // Import the CrontabField component
|
|
||||||
import CrontabDay from './CrontabDay.vue' // Import the CrontabDay component
|
|
||||||
import CrontabMonth from './CrontabMonth.vue' // Import the CrontabMonth component
|
|
||||||
import CrontabWeek from './CrontabWeek.vue' // Import the CrontabWeek component
|
|
||||||
import CrontabYear from './CrontabYear.vue' // Import the CrontabYear component
|
|
||||||
|
|
||||||
const cron = ref({
|
|
||||||
second: '*',
|
|
||||||
minute: '*',
|
|
||||||
hour: '*',
|
|
||||||
day: '*',
|
|
||||||
month: '*',
|
|
||||||
week: '?',
|
|
||||||
year: '*'
|
|
||||||
})
|
|
||||||
|
|
||||||
const cronExpression = computed(() => {
|
|
||||||
return `${cron.value.second} ${cron.value.minute} ${cron.value.hour} ${cron.value.day} ${cron.value.month} ${cron.value.week} ${cron.value.year}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const parsedCron = ref(null)
|
|
||||||
|
|
||||||
const checkNumber = (value, min, max, defaultValue = null) => {
|
|
||||||
if (value === '' || value === undefined || value === null || Number.isNaN(value)) {
|
|
||||||
return defaultValue
|
|
||||||
}
|
|
||||||
if (value < min) {
|
|
||||||
return min
|
|
||||||
}
|
|
||||||
if (value > max) {
|
|
||||||
return max
|
|
||||||
}
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
const parseCronExpression = () => {
|
|
||||||
// 使用第三方库或自定义函数解析 Cron 表达式
|
|
||||||
// 例如:
|
|
||||||
const parsed = parseCron(cronExpression.value) // 替换为实际解析函数
|
|
||||||
parsedCron.value = parsed
|
|
||||||
}
|
|
||||||
|
|
||||||
const generateCronExpression = () => {
|
|
||||||
// 使用自定义函数根据选项生成 Cron 表达式
|
|
||||||
// 例如:
|
|
||||||
const generatedExpression = generateCronFromOptions(cron.value) // 替换为实际生成函数
|
|
||||||
cron.value = generatedExpression
|
|
||||||
}
|
|
||||||
|
|
||||||
// // 解析 Cron 表达式的函数
|
|
||||||
// function parseCron(expression) {
|
|
||||||
// // ... 解析逻辑
|
|
||||||
// // 返回解析后的结果,例如一个包含各个字段信息的数组或对象
|
|
||||||
// return {
|
|
||||||
// second: '0-59',
|
|
||||||
// minute: '0-59',
|
|
||||||
// hour: '0-23',
|
|
||||||
// day: '1-31',
|
|
||||||
// month: '1-12',
|
|
||||||
// week: '0-6',
|
|
||||||
// year: '*'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 根据选项生成 Cron 表达式的函数
|
|
||||||
function generateCronFromOptions(options) {
|
|
||||||
// ... 生成逻辑
|
|
||||||
// 返回生成的 Cron 表达式字符串
|
|
||||||
return `${options.second} ${options.minute} ${options.hour} ${options.day} ${options.month} ${options.week} ${options.year}`
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.cron-generator {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1rem;
|
|
||||||
margin: 0; /* Remove default margin */
|
|
||||||
padding: 0; /* Remove default padding */
|
|
||||||
}
|
|
||||||
|
|
||||||
.cron-section {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cron-result {
|
|
||||||
margin-top: 2rem;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 1rem;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cron-expression {
|
|
||||||
display: block;
|
|
||||||
font-family: monospace;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-modal :visible="visible" width="600">
|
|
||||||
<CrontabGenerator />
|
|
||||||
</a-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// const props = defineProps<CrontabType>()
|
|
||||||
const visible = ref<boolean>(true)
|
|
||||||
// interface CrontabType {
|
|
||||||
// visible: boolean
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="1">
|
|
||||||
月,允许的通配符[, - * /]
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="2">
|
|
||||||
周期从
|
|
||||||
<a-input-number v-model="cycle01" :min="1" :max="11" /> -
|
|
||||||
<a-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 2" :max="12" /> 月
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="3">
|
|
||||||
从
|
|
||||||
<a-input-number v-model="average01" :min="1" :max="11" /> 月开始,每
|
|
||||||
<a-input-number v-model="average02" :min="1" :max="12 - average01 || 0" /> 月执行一次
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="4">
|
|
||||||
指定
|
|
||||||
<a-select v-model="checkboxList" clearable placeholder="可多选" multiple style="width:100%">
|
|
||||||
<a-option v-for="item in 12" :key="item" :value="item">{{ item }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed, ref, watch } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
check: {
|
|
||||||
type: Function,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
modelValue: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
|
||||||
|
|
||||||
const radioValue = ref(1)
|
|
||||||
const cycle01 = ref(1)
|
|
||||||
const cycle02 = ref(2)
|
|
||||||
const average01 = ref(1)
|
|
||||||
const average02 = ref(1)
|
|
||||||
const checkboxList = ref([])
|
|
||||||
|
|
||||||
const cycleTotal = computed(() => {
|
|
||||||
const cycle01Val = props.check(cycle01.value, 1, 11)
|
|
||||||
const cycle02Val = props.check(cycle02.value, cycle01Val ? cycle01Val + 1 : 2, 12)
|
|
||||||
return `${cycle01Val}-${cycle02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const averageTotal = computed(() => {
|
|
||||||
const average01Val = props.check(average01.value, 1, 11)
|
|
||||||
const average02Val = props.check(average02.value, 1, 12 - average01Val || 0)
|
|
||||||
return `${average01Val}/${average02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const checkboxString = computed(() => {
|
|
||||||
const str = checkboxList.value.join()
|
|
||||||
return str === '' ? '*' : str
|
|
||||||
})
|
|
||||||
|
|
||||||
const emitUpdate = (value) => {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(radioValue, () => {
|
|
||||||
switch (radioValue.value) {
|
|
||||||
case 1:
|
|
||||||
emitUpdate('*')
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(cycleTotal, () => {
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(averageTotal, () => {
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(checkboxString, () => {
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="1">
|
|
||||||
?
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="2">
|
|
||||||
指定
|
|
||||||
<a-select v-model="checkboxList" clearable placeholder="可多选" multiple style="width:100%">
|
|
||||||
<a-option v-for="item in 7" :key="item" :value="item - 1">{{ item === 0 ? '日' : item }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="3">
|
|
||||||
周期从
|
|
||||||
<a-select v-model="cycle01" clearable placeholder="起始星期" style="width:100%">
|
|
||||||
<a-option v-for="item in 7" :key="item" :value="item - 1">{{ item === 0 ? '日' : item }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
-
|
|
||||||
<a-select v-model="cycle02" clearable placeholder="结束星期" style="width:100%">
|
|
||||||
<a-option v-for="item in 7" :key="item" :value="item - 1">{{ item === 0 ? '日' : item }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="4">
|
|
||||||
每月
|
|
||||||
<a-select v-model="weekDay" clearable placeholder="星期" style="width:100%">
|
|
||||||
<a-option v-for="item in 7" :key="item" :value="item - 1">{{ item === 0 ? '日' : item }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
的第
|
|
||||||
<a-input-number v-model="weekNum" :min="1" :max="5" />
|
|
||||||
个工作日
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed, ref, watch } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
check: {
|
|
||||||
type: Function,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
modelValue: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
cron: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
|
||||||
|
|
||||||
const radioValue = ref(1)
|
|
||||||
const checkboxList = ref([])
|
|
||||||
const cycle01 = ref(0)
|
|
||||||
const cycle02 = ref(0)
|
|
||||||
const weekDay = ref(0)
|
|
||||||
const weekNum = ref(1)
|
|
||||||
|
|
||||||
const checkboxString = computed(() => {
|
|
||||||
const str = checkboxList.value.join()
|
|
||||||
return str === '' ? '?' : str
|
|
||||||
})
|
|
||||||
|
|
||||||
const cycleTotal = computed(() => {
|
|
||||||
const cycle01Val = props.check(cycle01.value, 0, 6)
|
|
||||||
const cycle02Val = props.check(cycle02.value, cycle01Val ? cycle01Val + 1 : 1, 6)
|
|
||||||
return `${cycle01Val}-${cycle02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const weekDayCheck = computed(() => {
|
|
||||||
const weekDayVal = props.check(weekDay.value, 0, 6)
|
|
||||||
return weekDayVal
|
|
||||||
})
|
|
||||||
|
|
||||||
const emitUpdate = (value) => {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(radioValue, () => {
|
|
||||||
if (radioValue.value !== 1 && props.cron.day !== '?') {
|
|
||||||
props.cron.day = '?'
|
|
||||||
}
|
|
||||||
switch (radioValue.value) {
|
|
||||||
case 1:
|
|
||||||
emitUpdate('?')
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
emitUpdate(`${weekDayCheck.value}#${weekNum.value}`)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(checkboxString, () => {
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(cycleTotal, () => {
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(weekDayCheck, () => {
|
|
||||||
emitUpdate(`${weekDayCheck.value}#${weekNum.value}`)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="1">
|
|
||||||
*
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="2">
|
|
||||||
周期从
|
|
||||||
<a-input-number v-model="cycle01" :min="1970" :max="2099" /> -
|
|
||||||
<a-input-number v-model="cycle02" :min="cycle01 ? cycle01 + 1 : 1971" :max="2099" /> 年
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="3">
|
|
||||||
从
|
|
||||||
<a-input-number v-model="average01" :min="1970" :max="2098" /> 年开始,每
|
|
||||||
<a-input-number v-model="average02" :min="1" :max="2099 - average01 || 0" /> 年执行一次
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item>
|
|
||||||
<a-radio v-model="radioValue" :label="4">
|
|
||||||
指定
|
|
||||||
<a-select v-model="checkboxList" clearable placeholder="可多选" multiple style="width:100%">
|
|
||||||
<a-option v-for="item in 130" :key="item" :value="item + 1970">{{ item + 1970 }}</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-radio>
|
|
||||||
</a-form-item>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed, ref, watch } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
check: {
|
|
||||||
type: Function,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
modelValue: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
|
||||||
|
|
||||||
const radioValue = ref(1)
|
|
||||||
const cycle01 = ref(1970)
|
|
||||||
const cycle02 = ref(1971)
|
|
||||||
const average01 = ref(1970)
|
|
||||||
const average02 = ref(1)
|
|
||||||
const checkboxList = ref([])
|
|
||||||
|
|
||||||
const cycleTotal = computed(() => {
|
|
||||||
const cycle01Val = props.check(cycle01.value, 1970, 2099)
|
|
||||||
const cycle02Val = props.check(cycle02.value, cycle01Val ? cycle01Val + 1 : 1971, 2099)
|
|
||||||
return `${cycle01Val}-${cycle02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const averageTotal = computed(() => {
|
|
||||||
const average01Val = props.check(average01.value, 1970, 2098)
|
|
||||||
const average02Val = props.check(average02.value, 1, 2099 - average01Val || 0)
|
|
||||||
return `${average01Val}/${average02Val}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const checkboxString = computed(() => {
|
|
||||||
const str = checkboxList.value.join()
|
|
||||||
return str === '' ? '*' : str
|
|
||||||
})
|
|
||||||
|
|
||||||
const emitUpdate = (value) => {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(radioValue, () => {
|
|
||||||
switch (radioValue.value) {
|
|
||||||
case 1:
|
|
||||||
emitUpdate('*')
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(cycleTotal, () => {
|
|
||||||
emitUpdate(cycleTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(averageTotal, () => {
|
|
||||||
emitUpdate(averageTotal.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(checkboxString, () => {
|
|
||||||
emitUpdate(checkboxString.value)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
:shortcuts="shortcuts"
|
:shortcuts="shortcuts"
|
||||||
shortcuts-position="left"
|
shortcuts-position="left"
|
||||||
style="height: 32px"
|
style="height: 32px"
|
||||||
|
:allow-clear="allowClear"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -27,6 +28,10 @@ defineProps({
|
|||||||
placeholder: {
|
placeholder: {
|
||||||
type: Array as PropType<string[]>,
|
type: Array as PropType<string[]>,
|
||||||
default: (): string[] => ['开始时间', '结束时间']
|
default: (): string[] => ['开始时间', '结束时间']
|
||||||
|
},
|
||||||
|
allowClear: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
@change="search"
|
@change="search"
|
||||||
/>
|
/>
|
||||||
<DateRangePicker v-model="queryForm.datetimeRange" @change="search" />
|
<DateRangePicker v-model="queryForm.datetimeRange" :allow-clear="false" @change="search" />
|
||||||
<a-button @click="reset">重置</a-button>
|
<a-button @click="reset">重置</a-button>
|
||||||
</template>
|
</template>
|
||||||
<template #taskBatchStatus="{ record }">
|
<template #taskBatchStatus="{ record }">
|
||||||
@@ -125,7 +125,10 @@ const getGroupList = async () => {
|
|||||||
// 重置
|
// 重置
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
queryForm.taskBatchStatus = undefined
|
queryForm.taskBatchStatus = undefined
|
||||||
queryForm.datetimeRange = undefined
|
queryForm.datetimeRange = [
|
||||||
|
dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
]
|
||||||
search()
|
search()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user