<template>
  <section class="content">
    <div class="box-body">
      <div class="ques-tag-main2">
        <div>整卷属性</div>
        <div
          v-for="(paperTag, tagIndex) in paperData.tags"
          :key="tagIndex"
          class="ques-tag-container"
        >
          <div class="ques-tag">
            <div class="ques-tag-title">{{ paperTag.tag }}</div>
            <div>{{ paperTag.content }}</div>
          </div>
        </div>
      </div>
      <div class="ques-tag-main2">
        <div>组成结构</div>
        <div style="width: 100%">
          <el-table :data="paperData.data" border>
            <el-table-column
              v-for="(colval, colIndex) in paperData.head"
              :key="colIndex"
              width="100"
            >
              <template slot="header">
                <span style="margin-left: 10px">{{ colval }}</span>
              </template>
              <template slot-scope="scope">
                <span style="margin-left: 10px">{{ scope.row[colIndex] }}</span>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
  </section>
</template>
<script>
import { QUESTION_API } from "@/constants/constants.js";
import { mapState } from "vuex";

export default {
  props: {
    paperId: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      paperData: {},
      loading: false,
    };
  },
  computed: {
    ...mapState({ user: (state) => state.user }),
  },
  //初始化查询
  created() {
    this.init();
  },
  methods: {
    init() {
      this.$http
        .get(QUESTION_API + "/paper/basic/composition?id=" + this.paperId)
        .then((response) => {
          this.paperData = response.data;
        });
    },
  },
};
</script>
<style scoped src="../styles/EditPaper.css"></style>
<style scoped src="../styles/Common.css"></style>
