<template>
  <a-card :bordered="false" title="终端培训详情">
    <template slot="extra">
      <a-button size="small" @click="close">返回</a-button>
    </template>
    <a-descriptions title="" layout="horizontal" bordered size="small" :column="1">
      <a-descriptions-item label="培训名称">{{ detailData.trainName }}</a-descriptions-item>
      <a-descriptions-item label="培训时间"
        >{{ detailData.trainSdate }} 至 {{ detailData.trainEdate }}</a-descriptions-item
      >
      <a-descriptions-item label="主持人">{{ detailData.host }}</a-descriptions-item>
      <a-descriptions-item label="会议人数">{{ detailData.personNum }}</a-descriptions-item>
      <a-descriptions-item label="学习内容">{{ detailData.learningContent }}</a-descriptions-item>
      <a-descriptions-item label="联系人">{{ detailData.contact }}:{{ detailData.phone }}</a-descriptions-item>
      <a-descriptions-item label="备注">{{ detailData.remark }}</a-descriptions-item>
    </a-descriptions>
    <br />
    <div style="width: 100%; height: 32px; margin-bottom: 8px">
      <a-button  v-if="hasPerm('terminal:train:edit')" type="primary" @click="editInfo()">修 改 信 息</a-button>
      <a-button v-if="hasPerm('terminal:train:list')" type="primary" @click="signInfo()">会议签到信息</a-button>
    </div>
  </a-card>
</template>

<script>
import { terminalTrainGet } from '@/api/project/terminalTrain'

export default {
  components: {
    terminalTrainGet,
  },
  data() {
    return {
      queryParam: this.$route.query.terminalTrainId,
      detailData: {},
    }
  },
  created: function () {
    let parameter = {}
    terminalTrainGet(this.queryParam).then((res) => {
      this.detailData = res.data
    })
  },
  methods: {
    close() {
      this.$router.push({
        path: '/project/project/terminalTrain/list',
        query: {
          terminalTrainName: this.$route.query.terminalTrainName,
          terminalTrainStatus: this.$route.query.terminalTrainStatus,
          terminalTrainStartDate: this.$route.query.terminalTrainStartDate,
          terminalTrainEndDate: this.$route.query.terminalTrainEndDate,
          terminalTrainPageNum: this.$route.query.terminalTrainPageNum,
        },
      })
    },
    editInfo(){ //修改信息按钮
      this.$router.push({
        path: '/project/terminalTrain/form',
        query: {
          id: this.detailData.id,
        }
      })
    },

    signInfo(){ //跳转签到信息页面
      this.$router.push({
        path: '/project/terminalTrain/signList',
        query: {
          id: this.detailData.id,
        }
      })
    }
  },
}
</script>

<style>
.ant-descriptions-item-label {
  width: 100px;
  text-align: center;
}
</style>