<script lang="ts" setup>
import { useCronStore } from '@/pages/sys/task/cron/cron-store.ts'

const {minuteState} = toRefs(useCronStore())

</script>

<template>
  <ElRadioGroup v-model="minuteState.mode" class="select-panel">
    <ElRadio value="every">每分钟</ElRadio>
    <ElRadio value="period1">
      <span>周期，从</span>
      <ElInputNumber v-model="minuteState.period1.start" :controls="false" :max="58" :min="0" size="small"/>
      <span>分到</span>
      <ElInputNumber v-model="minuteState.period1.end" :controls="false" :max="59" :min="minuteState.period1.start" size="small"/>
      <span>分</span>
    </ElRadio>
    <ElRadio value="period2">
      <span>周期，从第</span>
      <ElInputNumber v-model="minuteState.period2.start" :controls="false" :max="59" :min="0" size="small"/>
      <span>分钟开始，每</span>
      <ElInputNumber v-model="minuteState.period2.end" :controls="false" :max="59" :min="0" size="small"/>
      <span>分钟执行一次</span>
    </ElRadio>
    <ElRadio value="specify">
      <div>指定</div>
      <ElCheckboxGroup v-model="minuteState.specify">
        <ElCheckbox v-for="i in 60" :key="'MinutePanel' + i" :label="(i-1)+''" :value="i-1"/>
      </ElCheckboxGroup>
    </ElRadio>
  </ElRadioGroup>
</template>

<style lang="stylus" scoped>
.select-panel {
  flex-direction column
  align-items start
  gap 10px
  width 100%;
  flex-wrap nowrap

  :deep(.el-input-number) {
    margin 0 10px
    width: 80px
  }

  :deep(.el-checkbox-group) {
    position absolute
    top 0
    left 60px
    display flex
    flex-wrap wrap
    gap 10px
    width 500px

    .el-checkbox {
      width 40px;
      margin 0
    }
  }
}
</style>
