<template>
  <Dialog
    :is-dialog-exist="isDialog"
    :title="dialogTitle"
    :dialog-style="dialogStyle"
    @close-dialog="handleClose"
  >
    <el-container>
      <el-main>
        <el-form
          ref="formData"
          :model="formData"
          label-width="auto"
        >
          <el-form-item label="书源">
            <el-checkbox-group v-model="formData.checkList">
              <el-checkbox
                v-for="(item, index) in 5"
                :key="index"
                label="选中且禁用"
                style="min-width: 100px"
              />
            </el-checkbox-group>
          </el-form-item>
          <el-form-item
            v-if="dialogTitle === '定时采集书籍'"
            label="更新时间"
          >
            <el-radio-group v-model="formData.radio">
              <el-radio :label="3">
                每日定时
              </el-radio>
              <el-radio :label="6">
                每周定时
              </el-radio>
              <el-radio :label="9">
                每月定时
              </el-radio>
            </el-radio-group>
            <div style="margin-top: 10px">
              <el-select
                v-model="formData.name"
                :placeholder="formData.radio === 3 ? '每日定时' : formData.radio === 6 ? '每周定时' : '每月定时'"
                size="mini"
                style="width: 40%"
              >
                <template slot="suffix">
                  <i class="el-icon-date" />
                </template>
                <el-option
                  label="区域一"
                  value="shanghai"
                />
                <el-option
                  label="区域二"
                  value="beijing"
                />
              </el-select>
            </div>
          </el-form-item>
        </el-form>
      </el-main>
      <el-footer>
        <el-button type="primary">
          {{ dialogTitle === '定时采集书籍' ? '提交' : '开始采集' }}
        </el-button>
        <el-button @click="handleClose">
          取消
        </el-button>
      </el-footer>
    </el-container>
  </Dialog>
</template>

<script>
import Dialog from '@/components/Dialog/index'

export default {
  components: { Dialog },
  props: {
    isDialog: {
      type: Boolean,
      default: false
    },
    // 弹窗标题
    dialogTitle: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      // dialog样式
      dialogStyle: {
        '--dialog-width': '1000px',
        '--dialog-height': '455px',
        '--title-height': '51px'
      },
      formData: {
        name: '',
        checkList: [],
        radio: 3
      }
    }
  },
  methods: {
    handleClose() {
      this.$emit('handle-close')
    }
  }
}
</script>

<style lang="scss" scoped>
  .el-container{
    width: 100%;
    height: 100%;
    .el-main{
      width: 100%;
      height: 90%;
      padding: 2% 20% 0;
    }
    .el-footer{
      width: 100%;
      height: 10%;
      display: flex;
      justify-content: center;
      align-items: center;
      box-shadow: 0 5px 10px #000000;
    }
  }
</style>
