<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:value="auditForm.label">
          <div v-for="item in refuseReasonList" :key="item">
            <div style="padding-top: 12px">
              <el-radio :label="item"></el-radio>
            </div>
          </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:value="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>
    <template v-slot:footer>
      <span class="dialog-footer">
        <el-button @click="hideAuditForm">取 消</el-button>
        <el-button type="primary" @click="submitForm()">确 定</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script>
import { $on, $off, $once, $emit } from '../../../../utils/gogocodeTransfer'
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() {
      $emit(this, 'close')
    },
    submitForm() {
      let cMsg = this.auditForm.label
      if (cMsg == '其他') {
        cMsg = this.auditForm.desc
      }
      // if(!cMsg) {
      //   this.$message({
      //     type: "warning",
      //     message: '请填写拒绝原因或直接点击取消按钮'
      //   });
      //   return;
      // }
      // refuseReasonList
      this.hideAuditForm()
      $emit(this, 'checkInfo', cMsg)
    },
  },
  emits: ['checkInfo', 'close'],
}
</script>

<style lang="scss" scoped></style>
