mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-01 18:57:14 +08:00
refactor: 调整 eslint.config.js,优化代码格式
This commit is contained in:
@@ -53,8 +53,8 @@ export default defineComponent({
|
||||
props: useFormProps({
|
||||
defaultValue: '*',
|
||||
props: {
|
||||
week: { type: String, default: '?' }
|
||||
}
|
||||
week: { type: String, default: '?' },
|
||||
},
|
||||
}),
|
||||
emits: useFromEmits(),
|
||||
setup(props, context) {
|
||||
@@ -68,21 +68,21 @@ export default defineComponent({
|
||||
maxValue: 31,
|
||||
valueRange: { start: 1, end: 31 },
|
||||
valueLoop: { start: 1, interval: 1 },
|
||||
disabled: isDisabled
|
||||
disabled: isDisabled,
|
||||
})
|
||||
const typeWorkAttrs = computed(() => ({
|
||||
disabled: setup.type.value !== TypeEnum.work || props.disabled || isDisabled.value,
|
||||
...setup.inputNumberAttrs.value
|
||||
...setup.inputNumberAttrs.value,
|
||||
}))
|
||||
|
||||
watch(
|
||||
() => props.week,
|
||||
() => {
|
||||
setup.updateValue(isDisabled.value ? '?' : setup.computeValue.value)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
return { ...setup, typeWorkAttrs }
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -44,7 +44,7 @@ import { useFormProps, useFormSetup, useFromEmits } from './use-mixin'
|
||||
export default defineComponent({
|
||||
name: 'HourForm',
|
||||
props: useFormProps({
|
||||
defaultValue: '*'
|
||||
defaultValue: '*',
|
||||
}),
|
||||
emits: useFromEmits(),
|
||||
setup(props, context) {
|
||||
@@ -53,8 +53,8 @@ export default defineComponent({
|
||||
minValue: 0,
|
||||
maxValue: 23,
|
||||
valueRange: { start: 0, end: 23 },
|
||||
valueLoop: { start: 0, interval: 1 }
|
||||
valueLoop: { start: 0, interval: 1 },
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -44,7 +44,7 @@ import { useFormProps, useFormSetup, useFromEmits } from './use-mixin'
|
||||
export default defineComponent({
|
||||
name: 'MinuteForm',
|
||||
props: useFormProps({
|
||||
defaultValue: '*'
|
||||
defaultValue: '*',
|
||||
}),
|
||||
emits: useFromEmits(),
|
||||
setup(props, context) {
|
||||
@@ -53,8 +53,8 @@ export default defineComponent({
|
||||
minValue: 0,
|
||||
maxValue: 59,
|
||||
valueRange: { start: 0, end: 59 },
|
||||
valueLoop: { start: 0, interval: 1 }
|
||||
valueLoop: { start: 0, interval: 1 },
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -44,7 +44,7 @@ import { useFormProps, useFormSetup, useFromEmits } from './use-mixin'
|
||||
export default defineComponent({
|
||||
name: 'MonthForm',
|
||||
props: useFormProps({
|
||||
defaultValue: '*'
|
||||
defaultValue: '*',
|
||||
}),
|
||||
emits: useFromEmits(),
|
||||
setup(props, context) {
|
||||
@@ -53,8 +53,8 @@ export default defineComponent({
|
||||
minValue: 1,
|
||||
maxValue: 12,
|
||||
valueRange: { start: 1, end: 12 },
|
||||
valueLoop: { start: 1, interval: 1 }
|
||||
valueLoop: { start: 1, interval: 1 },
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -44,7 +44,7 @@ import { useFormProps, useFormSetup, useFromEmits } from './use-mixin'
|
||||
export default defineComponent({
|
||||
name: 'SecondForm',
|
||||
props: useFormProps({
|
||||
defaultValue: '*'
|
||||
defaultValue: '*',
|
||||
}),
|
||||
emits: useFromEmits(),
|
||||
setup(props, context) {
|
||||
@@ -53,8 +53,8 @@ export default defineComponent({
|
||||
minValue: 0,
|
||||
maxValue: 59,
|
||||
valueRange: { start: 0, end: 59 },
|
||||
valueLoop: { start: 0, interval: 1 }
|
||||
valueLoop: { start: 0, interval: 1 },
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,7 @@ export enum TypeEnum {
|
||||
loop = 'LOOP',
|
||||
work = 'WORK',
|
||||
last = 'LAST',
|
||||
specify = 'SPECIFY'
|
||||
specify = 'SPECIFY',
|
||||
}
|
||||
|
||||
// 周定义
|
||||
@@ -19,7 +19,7 @@ export const WEEK_MAP: any = {
|
||||
4: '周三',
|
||||
5: '周四',
|
||||
6: '周五',
|
||||
7: '周六'
|
||||
7: '周六',
|
||||
}
|
||||
|
||||
// use 公共 props
|
||||
@@ -28,13 +28,13 @@ export function useFormProps(options: any) {
|
||||
return {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: defaultValue
|
||||
default: defaultValue,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
...options?.props
|
||||
...options?.props,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ export function useFormSetup(props: any, context: any, options: any) {
|
||||
const beforeRadioAttrs = computed(() => ({
|
||||
class: ['choice'],
|
||||
disabled: props.disabled || unref(options.disabled),
|
||||
size: 'small'
|
||||
size: 'small',
|
||||
}))
|
||||
|
||||
// 输入框属性
|
||||
@@ -176,26 +176,26 @@ export function useFormSetup(props: any, context: any, options: any) {
|
||||
precision: 0,
|
||||
size: 'small',
|
||||
hideButton: true,
|
||||
class: 'w60'
|
||||
class: 'w60',
|
||||
}))
|
||||
|
||||
// 区间属性
|
||||
const typeRangeAttrs = computed(() => ({
|
||||
disabled: type.value !== TypeEnum.range || props.disabled || unref(options.disabled),
|
||||
...inputNumberAttrs.value
|
||||
...inputNumberAttrs.value,
|
||||
}))
|
||||
|
||||
// 间隔属性
|
||||
const typeLoopAttrs = computed(() => ({
|
||||
disabled: type.value !== TypeEnum.loop || props.disabled || unref(options.disabled),
|
||||
...inputNumberAttrs.value
|
||||
...inputNumberAttrs.value,
|
||||
}))
|
||||
|
||||
// 指定属性
|
||||
const typeSpecifyAttrs = computed(() => ({
|
||||
disabled: type.value !== TypeEnum.specify || props.disabled || unref(options.disabled),
|
||||
class: ['list-check-item'],
|
||||
size: 'small'
|
||||
size: 'small',
|
||||
}))
|
||||
|
||||
return {
|
||||
@@ -215,6 +215,6 @@ export function useFormSetup(props: any, context: any, options: any) {
|
||||
inputNumberAttrs,
|
||||
typeRangeAttrs,
|
||||
typeLoopAttrs,
|
||||
typeSpecifyAttrs
|
||||
typeSpecifyAttrs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ export default defineComponent({
|
||||
props: useFormProps({
|
||||
defaultValue: '?',
|
||||
props: {
|
||||
day: { type: String, default: '*' }
|
||||
}
|
||||
day: { type: String, default: '*' },
|
||||
},
|
||||
}),
|
||||
emits: useFromEmits(),
|
||||
setup(props, context) {
|
||||
@@ -66,7 +66,7 @@ export default defineComponent({
|
||||
// 0,7表示周日 1表示周一
|
||||
valueRange: { start: 1, end: 7 },
|
||||
valueLoop: { start: 2, interval: 1 },
|
||||
disabled: disabledChoice
|
||||
disabled: disabledChoice,
|
||||
})
|
||||
const weekOptions = computed(() => {
|
||||
const options: { label: string, value: number }[] = []
|
||||
@@ -74,7 +74,7 @@ export default defineComponent({
|
||||
const weekName: string = WEEK_MAP[weekKey]
|
||||
options.push({
|
||||
value: Number.parseInt(weekKey),
|
||||
label: weekName
|
||||
label: weekName,
|
||||
})
|
||||
}
|
||||
return options
|
||||
@@ -83,13 +83,13 @@ export default defineComponent({
|
||||
const typeRangeSelectAttrs = computed(() => ({
|
||||
disabled: setup.typeRangeAttrs.value.disabled,
|
||||
size: 'small',
|
||||
class: ['w80']
|
||||
class: ['w80'],
|
||||
}))
|
||||
|
||||
const typeLoopSelectAttrs = computed(() => ({
|
||||
disabled: setup.typeLoopAttrs.value.disabled,
|
||||
size: 'small',
|
||||
class: ['w80']
|
||||
class: ['w80'],
|
||||
}))
|
||||
|
||||
watch(() => props.day, () => {
|
||||
@@ -101,8 +101,8 @@ export default defineComponent({
|
||||
weekOptions,
|
||||
typeLoopSelectAttrs,
|
||||
typeRangeSelectAttrs,
|
||||
WEEK_MAP
|
||||
WEEK_MAP,
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -30,7 +30,7 @@ import { useFormProps, useFormSetup, useFromEmits } from './use-mixin'
|
||||
export default defineComponent({
|
||||
name: 'YearForm',
|
||||
props: useFormProps({
|
||||
defaultValue: '*'
|
||||
defaultValue: '*',
|
||||
}),
|
||||
emits: useFromEmits(),
|
||||
setup(props, context) {
|
||||
@@ -39,8 +39,8 @@ export default defineComponent({
|
||||
defaultValue: '*',
|
||||
minValue: 0,
|
||||
valueRange: { start: nowYear, end: nowYear + 100 },
|
||||
valueLoop: { start: nowYear, interval: 1 }
|
||||
valueLoop: { start: nowYear, interval: 1 },
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -95,9 +95,11 @@
|
||||
</a-col>
|
||||
<!-- 表达式 -->
|
||||
<a-col :span="16">
|
||||
<a-input v-model="cronInputs.cron"
|
||||
:placeholder="placeholder"
|
||||
@change="onInputCronChange">
|
||||
<a-input
|
||||
v-model="cronInputs.cron"
|
||||
:placeholder="placeholder"
|
||||
@change="onInputCronChange"
|
||||
>
|
||||
<template #prepend>
|
||||
<span class="allow-click">表达式</span>
|
||||
</template>
|
||||
@@ -135,7 +137,7 @@ const props = withDefaults(defineProps<Partial<CronPropType>>(), {
|
||||
disabled: false,
|
||||
hideSecond: false,
|
||||
hideYear: false,
|
||||
placeholder: '请输入 Cron 表达式'
|
||||
placeholder: '请输入 Cron 表达式',
|
||||
})
|
||||
const emit = defineEmits(['change', 'update:modelValue'])
|
||||
const activeKey = ref(props.hideSecond ? 'minute' : 'second')
|
||||
@@ -154,7 +156,7 @@ const cronInputs = reactive({
|
||||
month: '',
|
||||
week: '',
|
||||
year: '',
|
||||
cron: ''
|
||||
cron: '',
|
||||
})
|
||||
|
||||
const previewTimes = ref('执行预览')
|
||||
@@ -190,7 +192,7 @@ const calculateNextExecutionTimes = (corn: string = cronExpression.value) => {
|
||||
// 解析表达式
|
||||
const date = dateFormat(new Date())
|
||||
const iter = CronParser.parseExpression(parse, {
|
||||
currentDate: date
|
||||
currentDate: date,
|
||||
})
|
||||
const result: string[] = []
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
|
||||
Reference in New Issue
Block a user