<template>
  <div>
    <a-row>
        <a-col :span="24">
          <a-table style="margin: 5px;" :dataSource="tableData" size="small" :columns="columns" rowKey="id" :pagination="false" :loading="loading">
            <template slot="expertInfo" slot-scope="record">
              <a-tag :color="record.expertType == 1 ? technology : finance">{{ record.expertType == 1 ? "技术专家" : "财务专家" }}</a-tag>
            </template>
            <template slot="spec" slot-scope="record">
              <a-tag v-for="data in record.specList" :key="data.id" :color="'green'">{{data.specName+' '}}</a-tag>
            </template>
          </a-table>
        </a-col>
      </a-row>
  </div>
</template>

<script>
export default {
  name: "GroupExpertDetail",
  props: {
    value: {
      type: String,
      default: () => {
        return null;
      },
    },
  },
  data() {
    return {
      tableData: [],
      columns: [
        // { title: '证件号', dataIndex: 'certId', align: 'center' },
        { title: '姓名', dataIndex: 'personName', align: 'center' },
        { title: "评审专业", scopedSlots: { customRender: 'spec' }, align: 'center' },
        { title: '单位', dataIndex: 'workUnit', align: 'center' },
        { title: "专家类型", scopedSlots: { customRender: 'expertInfo' }, align: 'center' },
        { title: '手机号', dataIndex: 'mobile', align: 'center' },
        { title: '电子邮箱', dataIndex: 'email', align: 'center' },
      ],
      loading: true,
      technology: "#2db7f5",
      finance: "#87d068",
    };
  },
  created() {
    this.getAssignExpertList()
  },
  methods: {
    getAssignExpertList() {
      let pars = { groupId: this.value }
      this.$api.projectAssign.getAssignExpertList(pars).then(({ data = {} }) => {
        if (data) {
          this.tableData = data
          this.loading = false
        }
      }).catch(() => { })
    }
  },
};
</script>
