<template>
  <div>
    <xy-dialog ref="dialog" :width="50" :is-show.sync="isShow" :type="'form'" title="催缴通知"
      :form="form">
      <template v-slot:content>
        <div class="xy-table-item" style="padding:0">
          <div class="xy-table-item-label" style="font-weight: bold;">
            <span style="color: red;font-weight: bold;padding-right: 4px;"></span>发布内容：
          </div>
          <div class="xy-table-item-content" style="flex-grow:1;text-align: center;margin: 0 40px;">
              <div style="display:flex;justify-content: center;">
                <el-input v-model="form.content" type="textarea"></el-input>
              </div>
              <div>
                <el-button type="primary" style='margin:15px;' @click="submit">发送</el-button>
                <el-button type="primary" plain style='margin:15px;' @click="isShow=false">取消</el-button>
              </div>
          </div>
        </div>
      </template>

      <template v-slot:footerContent>
        <div></div>
      </template>

    </xy-dialog>

  </div>
</template>

<script>
  import {sendNotice} from "@/api/apply/index"
  export default {
    components: {

    },
    data() {
      return {
        isShow: false,
        course_id:'',
        type: 'add',
        selectids:[],
        form: {
          content: '',
        },
      }
    },
    created() {},
    methods: {
      submit() {
        if(this.base.isNull(this.form.content)){
          this.$message({
            type:"warning",
            message:'请填写发送内容'
          })
          return
        }
        sendNotice({
          course_id:this.course_id,
          ids:this.selectids.join(','),
          content:this.form.content
        }).then(res => {
          this.$message({
            type: 'success',
            message: '发送成功'
          })
          this.isShow = false
          this.$emit('refresh')
        })
      }
    },
    watch: {
      isShow(newVal) {
        if (newVal) {

        } else {
          this.selectids = []
          this.course_id = ''
          this.$refs['dialog'].reset()
        }
      },
    }

  }
</script>

<style scoped lang="scss">
  ::v-deep .content{
    flex-basis: 100%;
  }
</style>
