<template>
  <div class="time-limit">
    <el-form-item prop="isLimitedTime" label="是否限时办理">
      <el-radio-group v-model="isLimitedTime">
        <el-radio label="1">是</el-radio>
        <el-radio label="2">否</el-radio>
      </el-radio-group>
    </el-form-item>
    <div v-show="isLimitedTime == '1'">
      <el-form-item prop="isLimitedTime" label="限时办理时间">
        <div  style="display:flex;">
          <div style="width:48%">
            <es-input-number
              v-model="limitedTimeDay"
              type="number"
              style="width:80%;margin-right:10px"
              :controls="false"
              @change="changeInfo"
              placeholder="请输入限时天数"
            />天
          </div>
          <div style="width:45%">
            <es-select
              style="width:80% !important;margin-right:10px"
              v-model="limitedTimeHour"
              placeholder="请选择限时时长"
              :data="options"
              @change="changeInfo"
            />时
          </div>
        </div>
      </el-form-item>
      <el-form-item prop="isLimitedTime" label="提前通知时间">
           <div  style="display:flex;">
          <div style="width:48%">
            <es-input-number
              v-model="advanceNoticeDay"
              type="number"
              style="width:80%;margin-right:10px"
              :controls="false"
              @change="changeInfo"
              placeholder="请输入提前通知天数"
            />天
          </div>
          <div style="width:45%">
            <es-select
              style="width:80% !important;margin-right:10px"
              v-model="advanceNoticeHour"
              @change="changeInfo"
              placeholder="请选择提前通知时长"
              :data="options"
            />时
          </div>
        </div> </el-form-item>
      <el-form-item prop="isLimitedTime" label="催办通知方式">
        <el-checkbox-group v-model="advanceNoticeType" @change="changeInfo">
          <el-checkbox
            v-for="item of $attrs.newsList"
            :key="item.cciValue"
            :label="item.cciValue"
          >
            {{ item.shortName }}
          </el-checkbox>
        </el-checkbox-group>
      </el-form-item>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TimeLimit',
  data() {
    return {
      isLimitedTime: '2', //是否限时办理
        limitedTimeDay: '',
        limitedTimeHour:'',
        advanceNoticeDay:'',
     advanceNoticeHour:'',
      advanceNoticeType: [], //催办通知方式
      options: [
        {
          value: '0',
          label: '0'
        },
        {
          value: '1',
          label: '1'
        },
        {
          value: '2',
          label: '2'
        },
        {
          value: '3',
          label: '3'
        },
        {
          value: '4',
          label: '4'
        },
        {
          value: '5',
          label: '5'
        },
        {
          value: '6',
          label: '6'
        },
        {
          value: '7',
          label: '7'
        },
        {
          value: '8',
          label: '8'
        },
        {
          value: '9',
          label: '9'
        },
        {
          value: '10',
          label: '10'
        },
        {
          value: '11',
          label: '11'
        },
        {
          value: '12',
          label: '12'
        },
        {
          value: '13',
          label: '13'
        },
        {
          value: '14',
          label: '14'
        },
        {
          value: '15',
          label: '15'
        },
        {
          value: '16',
          label: '16'
        },
        {
          value: '17',
          label: '17'
        },
        {
          value: '18',
          label: '18'
        },
        {
          value: '19',
          label: '19'
        },
        {
          value: '20',
          label: '20'
        },
        {
          value: '21',
          label: '21'
        },
        {
          value: '22',
          label: '22'
        },
        {
          value: '23',
          label: '23'
        }
      ]
    };
  },
  methods:{
    changeInfo(){
      const {isLimitedTime,limitedTimeDay,limitedTimeHour,advanceNoticeDay,advanceNoticeHour,advanceNoticeType} = this
      this.$emit('change',{isLimitedTime,limitedTimeDay,limitedTimeHour,advanceNoticeDay,advanceNoticeHour,advanceNoticeType:advanceNoticeType.join(',')})
    },
  }
};
</script>

<style></style>
