<template>
  <div id="detail">
    <el-row>
      <el-col :span="24">
        <el-col :span="24" class="top">
          <detailTopInfo :topTitle="topTitle" :display="display" @goBack="goBack"></detailTopInfo>
        </el-col>
        <el-col :span="24" class="main">
          <detailInfo :formTitle="formTitle" :form="form"></detailInfo>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import detailTopInfo from '@/layout/custom/detailTopInfo.vue';
import detailInfo from '@/layout/intelligentDocking/detail.vue';
import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
const { mapActions: intelligentDocking } = createNamespacedHelpers('intelligentDocking');
export default {
  name: 'detail',
  props: {},
  components: {
    detailTopInfo, //头部
    detailInfo, //详情
  },
  data: () => ({
    display: 'block',
    topTitle: '银企对接已成功信息管理',
    formTitle: '详细信息',
    form: {
      company: {},
      dictionary: {},
      finance_claims: {},
      when: {},
      follow: {},
    },
  }),
  created() {
    this.searchInfo();
  },
  computed: {
    ...mapState(['user']),
    intelligentId() {
      return this.$route.query.intelligentId;
    },
  },
  methods: {
    ...intelligentDocking(['dockingSearch']),
    // 查询详情
    async searchInfo() {
      if (this.intelligentId) {
        const res = await this.dockingSearch({ id: this.intelligentId });
        for (const val of res.result) {
          this.$set(this, `form`, val);
        }
      }
    },
    // 返回
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="less" scoped>
.top {
  height: 50px;
  margin: 0 0 10px 0;
}
.main {
  height: 765px;
  background: #ffffff;
}
</style>
