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

const {secondState} = toRefs(useCronStore())

</script>

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