| | |
| | | <div class="scheduled-task-content" v-loading="loading"> |
| | | <div class="content-left"> |
| | | <div class="content-left-date"> |
| | | <TimePicker v-model="timeValue" /> |
| | | <TimePicker v-model="timeValue" :disabled="type === 1" /> |
| | | <!-- 创建的情况 --> |
| | | <div class="date-btn" v-if="type === 0"> |
| | | <div |
| | |
| | | <input |
| | | v-model.trim="taskName" |
| | | type="text" |
| | | :disabled="isInpDisabled" |
| | | :disabled="isInpDisabled || type === 1" |
| | | class="stereotyped-writing-input" |
| | | placeholder="请输入自定义内容" |
| | | /> |
| | |
| | | }; |
| | | |
| | | const onStereotypedWritingClick = (item: TaskItem) => { |
| | | if (type.value === 1) return; |
| | | if (taskName.value === item.value) { |
| | | taskName.value = ""; |
| | | isInpDisabled.value = false; |
| | |
| | | }; |
| | | |
| | | const onAddMinutesClick = (item: DateItem) => { |
| | | if (type.value === 1) return; |
| | | detaCheck.value = item.value; |
| | | timeValue.value = addMinutes(timeValue.value, item.value); |
| | | }; |
| | |
| | | <template> |
| | | <div class="time-picker"> |
| | | <div class="picker-column" ref="hourRef" @scroll="onScroll('hour')"> |
| | | <div class="picker-column" ref="hourRef" @scroll="onScroll('hour')" :class="disabled ? 'disabled' : ''"> |
| | | <div |
| | | v-for="(h, index) in loopHours" |
| | | :key="index" |
| | |
| | | </div> |
| | | </div> |
| | | <span class="colon">:</span> |
| | | <div class="picker-column" ref="minuteRef" @scroll="onScroll('minute')"> |
| | | <div class="picker-column" ref="minuteRef" @scroll="onScroll('minute')" :class="disabled ? 'disabled' : ''"> |
| | | <div |
| | | v-for="(m, index) in loopMinutes" |
| | | :key="index" |
| | |
| | | <script setup lang="ts"> |
| | | import { ref, watch, onMounted, nextTick } from "vue"; |
| | | |
| | | const props = defineProps<{ modelValue: string }>(); |
| | | const props = defineProps<{ modelValue: string, disabled: boolean }>(); |
| | | const emit = defineEmits(["update:modelValue"]); |
| | | |
| | | const hours = Array.from({ length: 24 }, (_, i) => i); |
| | |
| | | ); |
| | | |
| | | function onScroll(type: "hour" | "minute") { |
| | | if (props.disabled) return; |
| | | if (isProgrammaticScroll[type]) { |
| | | // 程序滚动,忽略,避免死循环 |
| | | isProgrammaticScroll[type] = false; |
| | |
| | | &::-webkit-scrollbar { |
| | | display: none; /* Chrome Safari */ |
| | | } |
| | | &.disabled{ |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .picker-item { |
| | | height: 0.26rem; |