<template>
  <div>
    <a-row>
      <a-col :span="24" style="border-top: 0px; text-align: center">
        <div class="main-title">
          <span>申报人才科研成绩</span>
        </div>
      </a-col>
    </a-row>
    <a-row type="flex" class="row_center">
      <a-col :span="24" class="bg-gray">
        <div>
          <span>1、主要科研成果获奖情况（按获奖时间顺序填写，含专利、新药证书等不超过15项。）</span>
        </div>
      </a-col>
    </a-row>
    <a-row type="flex" class="row_center">
      <a-col :span="2" class="bg-gray">
        <div class="special-middle">
          <div>序号</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>时间</div>
        </div>
      </a-col>
      <a-col :span="8" class="bg-gray">
        <div class="special-middle">
          <div>成果名称</div>
        </div>
      </a-col>
      <a-col :span="6" class="bg-gray">
        <div class="special-middle">
          <div>授奖部门及等级</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>本人排名</div>
        </div>
      </a-col>
    </a-row>
    <a-row v-for="(item, index) in gainList" :key="'gainList'+index" type="flex" class="row_center">
      <a-col :span="2">
        <div class="special-middle">{{ item.showIndex }}</div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainDate ? moment(item.gainDate).format('YYYY-MM-DD') : '' }}</div>
        </div>
      </a-col>
      <a-col :span="8">
        <div class="special-middle">
          <div>{{ item.gainName }}</div>
        </div>
      </a-col>
      <a-col :span="6">
        <div class="special-middle">
          <div>{{ item.gainDescription }}</div>
        </div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainRemark }}</div>
        </div>
      </a-col>
    </a-row>

    <a-row type="flex" class="row_center">
      <a-col :span="24" class="bg-gray">
        <div>
          <span>2、发表的主要科研论文（按时间顺序填写，不超过15篇，SCI论文等外文论文需提供影响因子证明（科技部门批准机构开具的证明））</span>
        </div>
      </a-col>
    </a-row>
    <a-row type="flex" class="row_center">
      <a-col :span="2" class="bg-gray">
        <div class="special-middle">
          <div>序号</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>时间</div>
        </div>
      </a-col>
      <a-col :span="8" class="bg-gray">
        <div class="special-middle">
          <div>论文名称</div>
        </div>
      </a-col>
      <a-col :span="6" class="bg-gray">
        <div class="special-middle">
          <div>发表刊物</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>本人排名</div>
        </div>
      </a-col>
    </a-row>
    <a-row v-for="(item, index) in thesisList" :key="'thesisList'+index" type="flex" class="row_center">
      <a-col :span="2">
        <div class="special-middle">{{ item.showIndex }}</div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainDate ? moment(item.gainDate).format('YYYY-MM-DD') : '' }}</div>
        </div>
      </a-col>
      <a-col :span="8">
        <div class="special-middle">
          <div>{{ item.gainName }}</div>
        </div>
      </a-col>
      <a-col :span="6">
        <div class="special-middle">
          <div>{{ item.gainDescription }}</div>
        </div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainRemark }}</div>
        </div>
      </a-col>
    </a-row>

    <a-row type="flex" class="row_center">
      <a-col :span="24" class="bg-gray">
        <div>
          <span>3、出版的专著和教材（按出版时间顺序填写，不超过15本。）</span>
        </div>
      </a-col>
    </a-row>
    <a-row type="flex" class="row_center">
      <a-col :span="2" class="bg-gray">
        <div class="special-middle">
          <div>序号</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>时间</div>
        </div>
      </a-col>
      <a-col :span="8" class="bg-gray">
        <div class="special-middle">
          <div>专著及教材</div>
        </div>
      </a-col>
      <a-col :span="6" class="bg-gray">
        <div class="special-middle">
          <div>出版社</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>本人排名</div>
        </div>
      </a-col>
    </a-row>
    <a-row v-for="(item, index) in appearList" :key="'appearList'+index" type="flex" class="row_center">
      <a-col :span="2">
        <div class="special-middle">{{ item.showIndex }}</div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainDate ? moment(item.gainDate).format('YYYY-MM-DD') : '' }}</div>
        </div>
      </a-col>
      <a-col :span="8">
        <div class="special-middle">
          <div>{{ item.gainName }}</div>
        </div>
      </a-col>
      <a-col :span="6">
        <div class="special-middle">
          <div>{{ item.gainDescription }}</div>
        </div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainRemark }}</div>
        </div>
      </a-col>
    </a-row>

    <a-row type="flex" class="row_center">
      <a-col :span="24" class="bg-gray">
        <div>
          <span>4、承担的课题（按立项时间顺序填写，不超过15项。）</span>
        </div>
      </a-col>
    </a-row>
    <a-row type="flex" class="row_center">
      <a-col :span="2" class="bg-gray">
        <div class="special-middle">
          <div>序号</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>时间</div>
        </div>
      </a-col>
      <a-col :span="8" class="bg-gray">
        <div class="special-middle">
          <div>课题名称</div>
        </div>
      </a-col>
      <a-col :span="6" class="bg-gray">
        <div class="special-middle">
          <div>项目来源</div>
        </div>
      </a-col>
      <a-col :span="4" class="bg-gray">
        <div class="special-middle">
          <div>本人排名</div>
        </div>
      </a-col>
    </a-row>
    <a-row v-for="(item, index) in courseList" :key="'courseList'+index" type="flex" class="row_center">
      <a-col :span="2">
        <div class="special-middle">{{ item.showIndex }}</div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainDate ? moment(item.gainDate).format('YYYY-MM-DD') : '' }}</div>
        </div>
      </a-col>
      <a-col :span="8">
        <div class="special-middle">
          <div>{{ item.gainName }}</div>
        </div>
      </a-col>
      <a-col :span="6">
        <div class="special-middle">
          <div>{{ item.gainDescription }}</div>
        </div>
      </a-col>
      <a-col :span="4">
        <div class="special-middle">
          <div>{{ item.gainRemark }}</div>
        </div>
      </a-col>
    </a-row>
  </div>
</template>

<script>
import moment from "moment"

const Gain = { id: null, talentId: null, gainType: 'dff44c90-ff10-11ef-b6cb-0c42a1380f01', gainDate: null, gainName: null, gainDescription: null, gainRemark: null, showIndex: null, }
const Thesis = { id: null, talentId: null, gainType: 'dff44c90-ff10-11ef-b6cb-0c42a1380f02', gainDate: null, gainName: null, gainDescription: null, gainRemark: null, showIndex: null, }
const Appear = { id: null, talentId: null, gainType: 'dff44c90-ff10-11ef-b6cb-0c42a1380f03', gainDate: null, gainName: null, gainDescription: null, gainRemark: null, showIndex: null, }
const Course = { id: null, talentId: null, gainType: 'dff44c90-ff10-11ef-b6cb-0c42a1380f04', gainDate: null, gainName: null, gainDescription: null, gainRemark: null, showIndex: null, }


export default {
  name: "scientificGainInfo",
  props: {
    scientificList: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  data() {
    return {
      gainList: [],
      thesisList: [],
      appearList: [],
      courseList: [],
    };
  },
  created() {
    
  },
  methods: {
    moment,
    InitData() {
      if (this.scientificList && this.scientificList.length > 0) {
        this.gainList = this.scientificList
          .filter(item => item.gainType === 'dff44c90-ff10-11ef-b6cb-0c42a1380f01')
          .sort((a, b) => a.showIndex - b.showIndex)
        if (this.gainList.length == 0) {
          this.gainList.push({ ...Gain })
        }

        this.thesisList = this.scientificList
          .filter(item => item.gainType === 'dff44c90-ff10-11ef-b6cb-0c42a1380f02')
          .sort((a, b) => a.showIndex - b.showIndex)
        if (this.thesisList.length == 0) {
          this.thesisList.push({ ...Thesis })
        }

        this.appearList = this.scientificList
          .filter(item => item.gainType === 'dff44c90-ff10-11ef-b6cb-0c42a1380f03')
          .sort((a, b) => a.showIndex - b.showIndex)
        if (this.appearList.length == 0) {
          this.appearList.push({ ...Appear })
        }

        this.courseList = this.scientificList
          .filter(item => item.gainType === 'dff44c90-ff10-11ef-b6cb-0c42a1380f04')
          .sort((a, b) => a.showIndex - b.showIndex)
        if (this.courseList.length == 0) {
          this.courseList.push({ ...Course })
        }
      }
    },
  },
  watch: {
    scientificList: {
      handler(scientificList) {
        if (!!scientificList) {
          this.InitData()
        } else {
          this.gainList.push({ ...Gain })
          this.thesisList.push({ ...Thesis })
          this.appearList.push({ ...Appear })
          this.courseList.push({ ...Course })
        }
      },
    },
  },
};
</script>