<template>
  <div class="assess">
    <el-form ref="ruleForm" :model="ruleForm" label-position="top" :rules="rules" class="rule-form-orange">
      <el-form-item label="收入评级" prop="name">
        <el-input v-model="detailsInfo.revenueRating" disabled placeholder="请输入收入评级" />
      </el-form-item>
      <!-- <el-form-item label="评估意见" prop="evaluationOpinions">
        <el-input v-model="ruleForm.evaluationOpinions" :disabled="disabled" placeholder="请输入评估意见" />
      </el-form-item> -->
      <el-form-item label="是否准入" prop="name">
        <el-input v-model="detailsInfo.admitted" disabled placeholder="请输入是否准入" />
      </el-form-item>
      <el-form-item label="得分" prop="name">
        <el-input v-model="detailsInfo.score" disabled placeholder="请输入得分" />
      </el-form-item>
      <el-form-item label="授信额度" prop="name">
        <el-input v-model="detailsInfo.creditLimit" disabled placeholder="请输入授信额度">
          <template slot="append">万元</template>
        </el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    detailsInfo: {
      type: Object,
      default: () => {
        return {
          revenueRating: '',
          admitted: '',
          score: '',
          creditLimit: '',
          guaranteeEnterpriseResult: ''
        }
      }
    }
  },
  data() {
    return {
      ruleForm: {
        evaluationOpinions: ''
      },
      rules: {
        evaluationOpinions: [
          { required: true, message: '请选择审批结论', trigger: 'change' }
        ]
      }
    }
  },
  watch: {
    detailsInfo: {
      handler(newV) {
        if (newV === undefined || newV.evaluationOpinions === undefined) return
        this.ruleForm.evaluationOpinions = JSON.parse(JSON.stringify(newV.evaluationOpinions))
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    getParams(type) {
      return new Promise((resolve, reject) => {
        if (type === 'temp') {
          resolve(this.ruleForm)
        } else {
          this.$refs.ruleForm.validate(valid => {
            if (valid) {
              resolve(this.ruleForm)
            } else {
              reject()
              return false
            }
          })
        }
      })
    }
  }

}
</script>

<style lang="scss" scoped>
.assess {

}
</style>
