<template>
    <DialogLayout :visible="show" @onCancel="onCancel" width="600px" title="自定义评语设置" @onConfirm="onConfirm">
      <div class="gy-form" style="--fix:130px;">
        <div class="gy-form-item mb">
          <div class="gy-label middle">及格提示信息：</div>
          <el-input placeholder="请输入评语" v-model="form.successTips"></el-input>
        </div>
        <div class="gy-form-item mb">
          <div class="gy-label middle">不及格提示信息：</div>
          <el-input placeholder="请输入评语" v-model="form.failedTips"></el-input>
        </div>
        <div class="gy-form-item">
          <div class="gy-label middle">等待人工评卷信息：</div>
          <el-input placeholder="请输入评语" v-model="form.waitingTips"></el-input>
        </div>
      </div>
    </DialogLayout>
</template>

<script>
import '@/views/assessment-evaluation/utils/gyStyle.scss'
import DialogLayout from '@/components/layout/DialogLayout.vue'
export default {
  components: { DialogLayout },
  data: _ => ({
    show: false,
    initForm: null,
    form: {
      successTips: '',
      failedTips: '',
      waitingTips: ''
    }
  }),
  props: {
    value: {
      default: false
    },
    successTips: {
    },
    failedTips: {},
    waitingTips: {}
  },
  mounted () {
  },
  methods: {
    /**
     * 确认按钮按下回调
     */
    onConfirm () {
      this.$emit('update:successTips', this.form.successTips)
      this.$emit('update:failedTips', this.form.failedTips)
      this.$emit('update:waitingTips', this.form.waitingTips)
      this.show = false
    },
    /**
     * 取消按钮按下回调
     */
    onCancel () {
      this.show = false
    }
  },
  watch: {
    /**
     * 编辑考试时传入数据
     */
    value: {
      immediate: true,
      handler (nv) {
        this.show = nv
        if (nv) {
          this.form.successTips = this.successTips
          this.form.failedTips = this.failedTips
          this.form.waitingTips = this.waitingTips
        }
      }
    },
    show: {
      handler (nv) { this.$emit('input', nv) }
    }
  }
}
</script>

<style>

</style>
