<template>
  <el-dialog v-model="visible" width="30%" :lock-scroll="false">
    <el-card class="box-card" style="margin-bottom: 10px">
      <template #header>
        <div class="card-header">
          <el-text class="mx-1" size="large">下次执行时间</el-text>
        </div>
      </template>
      <div v-for="(item, i) in nextTimeArray" :key="i" class="text item">{{ i + 1 }}.{{ item }}</div>
    </el-card>
  </el-dialog>
</template>
<script setup="JobInfoNextTime" lang="ts">
import { queryNextTime } from '@/api/xxljob/info';

const { proxy } = getCurrentInstance();
const visible = ref(false);
const loading = ref(false);
const nextTimeArray = ref([]);

const show = async (row) => {
  visible.value = true;
  loading.value = true;
  await initShow(row);
};

const initShow = async (row) => {
  let params = {
    scheduleType: row.scheduleType,
    scheduleConf: row.scheduleConf
  };

  const res = await queryNextTime(params);
  if (res.code == 200) {
    nextTimeArray.value = res.data;
  }
  loading.value = false;
};

defineExpose({
  show
});

</script>

<style scoped lang="scss">

</style>
