<template>
    <!-- 拒绝原因 暂时不做 -->
    <el-dialog
      title="拒绝原因"
      :visible="dialogVisible"
      @close="hideAuditForm"
      width="600px"
      center>
      <el-form ref="auditForm" :model="auditForm" label-width="120px">
        <el-form-item label="拒绝原因：">
          <el-radio-group v-model="auditForm.label">
            <div style="padding-top: 12px;">
              <el-radio :label="refuseReasonList[0]"></el-radio>
            </div>
            <div style="padding-top: 16px;">
              <el-radio :label="refuseReasonList[1]"></el-radio>
            </div>
            <div style="padding-top: 16px;">
              <el-radio label="其他"></el-radio>
            </div>
          </el-radio-group>
          <div v-if="auditForm.label == '其他'">
            <el-input type="textarea" v-model="auditForm.desc" maxlength="25" style="width: 310px;margin-top: 10px;"></el-input>
            <span class="word-num">{{(auditForm.desc).replace(/\s+/g,"").length}}/25</span>
          </div>

        </el-form-item>        
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="hideAuditForm">取 消</el-button>
        <el-button type="primary" @click="submitForm()">确 定</el-button>
      </span>
    </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      auditForm: {
        label: '',
        desc: ''
      }
    };
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    refuseReasonList: {
      type: Array,
      default: () => ['含有政治类、医疗健康、社会事件类不实信息', '含有欺诈，色情，诱导、违法犯罪非法字符']
    }
  },
  watch: {
    dialogVisible(newVal) {
      if(newVal) {
        this.auditForm.label = '';
        this.auditForm.desc = '';
      }
    }
  },  
  computed: {

  },
  mounted() {
    console.log(2222);
  },
  methods: {
    hideAuditForm() {
      this.$emit('close');
    },
    submitForm() {
      let cMsg = this.auditForm.label;
      if(cMsg == '其他') {
        cMsg = this.auditForm.desc;
      }
      // if(!cMsg) {
      //   this.$message({
      //     type: "warning",
      //     message: '请填写拒绝原因或直接点击取消按钮'
      //   });
      //   return;
      // }
      // refuseReasonList
      this.hideAuditForm();
      this.$emit('checkInfo', cMsg);
    }
  }
};
</script>
<style scoped lang="scss">
</style>
