<template>
  <div id="list">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one" v-if="type == '1'">
          <el-col :span="24" class="oneList" v-for="(item, index) in list" :key="index">
            <el-col :span="24" class="top">
              <el-col :span="20" class="company textOver">
                {{ item.company }}
              </el-col>
              <el-col :span="4" class="date">
                {{ getDate(item.meta) }}
              </el-col>
            </el-col>
            <el-col :span="24" class="other">
              <el-col :span="12" class="text">
                申请类型:<span>{{ item.type }}</span>
              </el-col>
            </el-col>
          </el-col>
        </el-col>
        <el-col :span="24" class="two" v-else-if="type == '2'">
          <el-col :span="24" class="twoList" v-for="(item, index) in list" :key="index">
            <el-col :span="24" class="top">
              <el-col :span="20" class="company textOver">
                {{ item.name }}
              </el-col>
              <el-col :span="4" class="date">
                {{ getDate(item.meta) }}
              </el-col>
            </el-col>
          </el-col>
        </el-col>
        <el-col :span="24" class="thr" v-else-if="type == '3'">
          <el-col :span="12" class="thrList" v-for="(item, index) in list" :key="index">
            <el-col :span="24" class="name textOver">
              {{ item.basic.achieve_name }}
            </el-col>
            <el-col :span="24" class="other">
              <el-col :span="24" class="text textOver">
                成果取得时间：<span>{{ item.basic.achieve_date }}</span>
              </el-col>
            </el-col>
            <el-col :span="24" class="other">
              <el-col :span="12" class="text textOver">
                成果类别：<span>{{ item.basic.achieve_type }}</span>
              </el-col>
              <el-col :span="12" class="text textOver">
                成果形式：<span>{{ item.basic.achieve_form }}</span>
              </el-col>
            </el-col>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
const moment = require('moment');
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'list',
  props: {
    type: {
      type: String,
    },
    list: {
      type: Array,
    },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    getDate(date) {
      if (date) {
        let newDate = moment(date.createdAt).format('YYYY-MM-DD');
        if (newDate) return newDate;
      }
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  padding: 5px;
  .one {
    height: 430px;
    overflow: hidden;
    .oneList {
      padding: 8px 0;
      border-bottom: 1px dashed #ccc;
      .top {
        margin: 0 0 5px 0;
        .company {
          font-size: 16px;
        }
        .date {
          font-size: 16px;
        }
      }
      .other {
        .text {
          font-size: 14px;
          color: #666;
          span {
            color: #000;
          }
        }
      }
    }
    .oneList:last-child {
      border-bottom: none;
    }
    .oneList:hover {
      cursor: pointer;
      .top {
        .company {
          font-weight: bold;
          color: #409eff;
        }
      }
    }
  }
  .two {
    height: 430px;
    overflow: hidden;
    .twoList {
      padding: 8px 0;
      border-bottom: 1px dashed #ccc;
      .top {
        margin: 0 0 5px 0;
        .company {
          font-size: 16px;
        }
        .date {
          font-size: 16px;
        }
      }
    }
    .twoList:last-child {
      border-bottom: none;
    }
    .twoList:hover {
      cursor: pointer;
      .top {
        .company {
          font-weight: bold;
          color: #409eff;
        }
      }
    }
  }
  .thr {
    height: 430px;
    overflow: hidden;
    .thrList {
      padding: 5px 10px;
      border-bottom: 1px dashed #ccc;
      border-right: 1px dashed #ccc;
      .name {
        font-size: 16px;
        margin: 0 0 5px 0;
      }
      .other {
        margin: 0 0 5px 0;
        .text {
          font-size: 14px;
          color: #666;
          span {
            color: #000;
          }
        }
      }
    }
    .thrList:nth-child(2n) {
      border-right: none;
    }
    .thrList:nth-child(9) {
      border-bottom: none;
    }
    .thrList:nth-child(10) {
      border-bottom: none;
    }
    .thrList:hover {
      cursor: pointer;
      .name {
        font-weight: bold;
        color: #409eff;
      }
    }
  }
}
</style>
