<template>
  <div style="height:70vh;overflow:auto" class="app-content from-table font-line-space">
    <a-spin :spinning="loading" style="width: 100%;height: 100%;">
      <economy-info v-model="formData" v-if="formData.expertType == 2" />
      <div v-else>
        <technology-info v-if="formData.applyFunding >= 50" v-model="formData" />
        <div v-else>
          <a-row type="flex">
            <a-col :span="4" class="bg-gray">
              <div class="special-middle">
                <div>意见与建议</div>
              </div>
            </a-col>
            <a-col :span="20">
              <div class="special-middle">
                <div v-html="toTextarea(formData.remark)"></div>
              </div>
            </a-col>
          </a-row>
          <a-row type="flex">
            <a-col :span="4" class="bg-gray">
              <div class="special-middle">
                <div>评审结果</div>
              </div>
            </a-col>
            <a-col :span="20">
              <div class="special-middle">
                <div>
                  <a-tag :color="'#87d068'" v-if="formData.evaluationType==1">A类(通过)</a-tag>
                  <a-tag :color="'#2db7f5'" v-if="formData.evaluationType==2">B类(建议修改)</a-tag>
                  <a-tag :color="'#f50'" v-if="formData.evaluationType==3">C类(不通过)</a-tag>
                </div>
              </div>
            </a-col>
          </a-row>
        </div>
      </div>
    </a-spin>
  </div>
</template>

<script>
import economyInfo from '@/views/evaluation/components/economyInfo'
import technologyInfo from '@/views/evaluation/components/technologyInfo'
import { toTextarea } from '@/views/utils/common'
export default {
  name: "scoreView",
  components: {
    economyInfo, technologyInfo
  },
  props: {
    value: {
      type: String,
      default: () => {
        return null;
      },
    },
  },
  data () {
    return {
      formData: { id: null, projId: null, expertId: null, expertName: null, projectBasis: null, academicValue: null, innovation: null, researchPlan: null, expectedResults: null, totalScore: null, remark: null, projName: null, projNo: null, },
      loading: false,
    };
  },
  created () {
    this.getAssignExpertById()
  },
  methods: {
    getAssignExpertById () {
      if (!!this.value) {
        this.loading = true
        this.$api.projectAssign.getAssignExpertById({ id: this.value }).then(({ data = {} }) => {
          if (data) {
            this.formData = data
            this.loading = false
          } else
            this.$emit('close', 'error')
        }).catch(() => {
          this.$message.warn('500 Internal Server Error！')
          this.$emit('close', 'error')
        })
      }
    },
    toTextarea,
  },
};
</script>
