<template>
  <div>
    <!-- <a-form-model ref="form" :model="value" :rules="rules" class="from-table font-line-space"> -->
    <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>{{ value.projName }}</div>
        </div>
      </a-col>
    </a-row>
    <a-row type="flex" style="border-bottom:0;" class="none-bottom">
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>申报单位</div>
        </div>
      </a-col>
      <a-col :span="8">
        <div class="special-middle">
          <div>{{ value.appUnitName  }}</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>项目申请人</div>
        </div>
      </a-col>
      <a-col :span="8">
        <div class="special-middle">
          <div>{{ value.appPersonName  }}</div>
        </div>
      </a-col>
    </a-row>
    <table class="tab-content" style="width: 100%">
      <tr>
        <th>序号</th>
        <th>内容</th>
        <th>指标</th>
        <th>评分内容</th>
        <th>指标值</th>
        <th>分值</th>
        <th>评估评审标准</th>
        <th>打分</th>
      </tr>
      <tr v-for="(item,index) in fromList" :key="'tr1'+index">
        <td :rowspan="item.row1" v-if="item.row1>0">{{item.showIndex}}</td>
        <td :rowspan="item.row1" v-if="item.row1>0">{{ item.title1 }}</td>
        <td :rowspan="item.row2" v-if="item.row2>0">{{ item.title2  }}</td>
        <td :rowspan="item.row3" v-if="item.row3>0">{{ item.title3  }}</td>
        <td style="text-align: center;">{{ item.title }}</td>
        <td style="text-align: center;">{{ item.score }}</td>
        <td>{{ item.meaning }}</td>
        <td style="text-align: center;" :rowspan="item.row3" v-if="item.row3>0">
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==1">
            <a-input-number v-model="value.score1" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==2">
            <a-input-number v-model="value.score2" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==3">
            <a-input-number v-model="value.score3" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==4">
            <a-input-number v-model="value.score4" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==5">
            <a-input-number v-model="value.score5" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==6">
            <a-input-number v-model="value.score6" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==7">
            <a-input-number v-model="value.score7" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==8">
            <a-input-number v-model="value.score8" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==9">
            <a-input-number v-model="value.score9" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==10">
            <a-input-number v-model="value.score10" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==11">
            <a-input-number v-model="value.score11" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==12">
            <a-input-number v-model="value.score12" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==13">
            <a-input-number v-model="value.score13" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==14">
            <a-input-number v-model="value.score14" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==15">
            <a-input-number v-model="value.score15" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==16">
            <a-input-number v-model="value.score16" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==17">
            <a-input-number v-model="value.score17" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==18">
            <a-input-number v-model="value.score18" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
          <a-form-model-item :prop="'score' + item.order" v-if="item.order==19">
            <a-input-number v-model="value.score19" :min="0" :max="item.max" style="width: 60%" />
          </a-form-model-item>
        </td>
      </tr>
      <tr>
        <td>5</td>
        <td>附加项</td>
        <td>审计或科技计划项目检验情况</td>
        <td>申报单位所承担科技计划项目在接受审计中期评估、“双随机一公开”等工作中的情况。</td>
        <td colspan="3">未发现问题，则该指标不适用;发现问题的，每涉及一个项目扣3分<br /><span style="color: red;">(注：本项填写0或负数)</span></td>
        <td style="text-align: center;">
          <a-form-model-item :prop="'additionalScore'">
            <a-input-number v-model="value.additionalScore" :max="0" :step="-3" style="width: 60%" />
          </a-form-model-item>
        </td>
      </tr>
      <tr>
        <td style="text-align: center;" colspan="7">总得分</td>
        <td style="text-align: center;">
          {{Count()}}
        </td>
      </tr>
      <tr>
        <td colspan="4" style="text-align: right;">项目申报财政支持金额（万元）</td>
        <td colspan="4" style="text-align: left;"> {{ value.applyFunding}}</td>
      </tr>
      <tr>
        <td colspan="4" style="text-align: right;">项目预算评审建议财政支持金额（万元）</td>
        <td colspan="4" style="text-align: left;">
          <a-form-model-item :prop="'recommendFunding'">
            <a-input-number v-model="value.recommendFunding" :min="0" style="width:100px" />
          </a-form-model-item>
        </td>
      </tr>
      <tr>
        <td colspan="4" style="text-align: right;">意见与建议</td>
        <td colspan="4" style="text-align: left;">
          <a-form-model-item prop="remark">
            <a-textarea placeholder="评审意见" v-model="value.remark" :maxLength="1000" style="width: 80%; height: 120px; margin-top: 6px" />
          </a-form-model-item>
        </td>
      </tr>
      <tr>
        <td colspan="4" class="bg-title" style="text-align: right;">评审结果</td>
        <td colspan="4">
          <a-form-model-item prop="evaluationType">
            <a-radio-group v-model="value.evaluationType" disabled>
              <a-radio :value="1">{{ evaluationTypeA }}</a-radio>
              <a-radio :value="2">{{ evaluationTypeB }}</a-radio>
              <a-radio :value="3">{{ evaluationTypeC }}</a-radio>
            </a-radio-group>
          </a-form-model-item>
        </td>
      </tr>
    </table>
    <!-- </a-form-model> -->
  </div>
</template>

<script>
import { standardList } from '@/views/evaluation/components/config'
import { getEvaluationType } from "@/views/utils/common"
export default {
  name: "economy",
  components: {},
  props: {
    value: {
      type: Object,
      default () {
        return null;
      },
    },
  },
  data () {
    return {
      fromList: standardList,
      w: {
        score1: null,
        score2: null,
        score3: null,
        score4: null,
        score5: null,
        score6: null,
        score7: null,
        score8: null,
        score9: null,
        score10: null,
        score11: null,
        score12: null,
        score13: null,
        score14: null,
        score15: null,
        score16: null,
        score17: null,
        score18: null,
        score19: null,
        additionalScore: null,
        totalScore: null,
        applyFunding: null,
        recommendFunding: null,
        remark: null,
        evaluationType: null,
      },
      rules: {
        score1: { required: true, message: "*", trigger: "blur" },
        score2: { required: true, message: "*", trigger: "blur" },
        score3: { required: true, message: "*", trigger: "blur" },
        score4: { required: true, message: "*", trigger: "blur" },
        score5: { required: true, message: "*", trigger: "blur" },
        score6: { required: true, message: "*", trigger: "blur" },
        score7: { required: true, message: "*", trigger: "blur" },
        score8: { required: true, message: "*", trigger: "blur" },
        score9: { required: true, message: "*", trigger: "blur" },
        score10: { required: true, message: "*", trigger: "blur" },
        score11: { required: true, message: "*", trigger: "blur" },
        score12: { required: true, message: "*", trigger: "blur" },
        score13: { required: true, message: "*", trigger: "blur" },
        score14: { required: true, message: "*", trigger: "blur" },
        score15: { required: true, message: "*", trigger: "blur" },
        score16: { required: true, message: "*", trigger: "blur" },
        score17: { required: true, message: "*", trigger: "blur" },
        score18: { required: true, message: "*", trigger: "blur" },
        score19: { required: true, message: "*", trigger: "blur" },
        additionalScore: { required: true, message: "*", trigger: "blur" },
        recommendFunding: { required: true, message: "*", trigger: "blur" },
        remark: { required: true, message: "*", trigger: "blur" },
        evaluationType: { required: true, message: "*", trigger: "change" },
      },
    };
  },
  computed: {
    evaluationTypeA () {
      return getEvaluationType(0)
    },
    evaluationTypeB () {
      return getEvaluationType(1)
    },
    evaluationTypeC () {
      return getEvaluationType(2)
    },
  },
  created () {

  },
  methods: {
    Count () {
      var s = 0.0;
      for (var i = 1; i <= 19; i++) {
        if (this.value['score' + i]) {
          s += parseFloat(this.value['score' + i])
        }
      }
      if (!!this.value.additionalScore) {
        s += parseFloat(this.value.additionalScore)
      }
      s = s.toFixed(1) * 10 / 10
      this.value.totalScore = s
      this.determineType()
      return s
    },
    determineType () {
      if (this.value.totalScore >= 80)
        this.value.evaluationType = 1
      else if (this.value.totalScore < 80 && this.value.totalScore >= 60)
        this.value.evaluationType = 2
      else
        this.value.evaluationType = 3
    },
  },
};
</script>
<style scoped lang="less">
.app-content {
  table {
    table-layout: fixed;
    width: 100%;
    border: 1;
    border-collapse: collapse;
  }
  table tr td,
  th {
    border: 1px solid #e8e8e8;
    padding: 6px 6px;
    color: rgba(0, 0, 0, 0.65);
  }
  table tr th {
    text-align: center;
  }
  table tr {
    th:first-child {
      width: 4%;
    }
    th:nth-child(2) {
      width: 6%;
    }
    th:nth-child(3) {
      width: 8%;
    }
    th:nth-child(4) {
      width: 18%;
    }
    th:nth-child(5) {
      width: 6%;
    }
    th:nth-child(6) {
      width: 6%;
    }
    th:nth-child(7) {
      width: 40%;
    }
  }
  table {
    ::v-deep .ant-row {
      border: 0 !important;
    }
    ::v-deep .ant-row .ant-col {
      border: 0 !important;
      min-height: 30px !important;
    }
    ::v-deep .ant-form-item-control {
      line-height: 30px !important;
    }
    ::v-deep .ant-form-item {
      margin: 0 !important;
    }
    ::v-deep .ant-input-number {
      height: 30px !important;
    }
    ::v-deep .ant-input-number-input {
      height: 30px !important;
    }
  }
}
.none-bottom {
  ::v-deep .ant-col {
    border-bottom: 0 !important;
  }
}
</style>
ant-tabs