<template>

  <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
    <div style="padding: 20px; background-color: #fff;">
      测一测模板详情
    </div>

<div class="content" v-if="item!=null">
    <div class="desct">
      测一测模板信息
    </div>
    <el-descriptions title="" :column="3" border>
    <el-descriptions-item label="名称" >
        <span v-if="item!=null">{{item.name}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="模板编号" >
        <span v-if="item!=null">{{item.tempCode}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="状态" >
         <dict-tag :options="statusOptions" :value="item.status"/>
    </el-descriptions-item>

    <el-descriptions-item label="创建时间" >
        <span v-if="item!=null">{{item.createTime}}</span>
    </el-descriptions-item>
    <el-descriptions-item label="修改时间" >
        <span v-if="item!=null">{{item.updateTime}}</span>
    </el-descriptions-item>
    </el-descriptions>
  </div>
<div class="content" v-for="mb in itemTypeJson">
    <div class="desct">
      {{mb.itemType}}
    </div>
    <el-table :data="mb.item" :cell-style="{ textAlign: 'center' }" :header-cell-style="{textAlign: 'center'}">
      <el-table-column label="名称" prop="name" width="200px">
        <template slot-scope="scope">
          {{ scope.row.name }}
        </template>
      </el-table-column>
      <el-table-column label="内容" prop="value" >
        <template slot-scope="scope">
          <div style="white-space: pre-wrap;">
            {{ scope.row.value }}
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>

      </div>
</template>

<script>
import { listTestTemp, getTestTemp, delTestTemp, addTestTemp, updateTestTemp, exportTestTemp } from "@/api/store/testTemp";
  export default {
    name: "testTempDetails",
    props:["data"],
    data() {
      return {
       // 状态字典
       statusOptions: [],
       itemTypeJson:[],
        item:null,
      }
    },
    created() {
    this.getDicts("sys_company_status").then(response => {
      this.statusOptions = response.data;
    });

    },
    methods: {
      getDetails(orderId) {
          this.item=null;
          getTestTemp(orderId).then(response => {
              this.item = response.data;
              this.itemTypeJson=  JSON.parse(this.item.itemTypeJson)
          });
      },

    }
  }
</script>
<style>
  .el-descriptions-item__content {
    max-width: 150px;
    min-width: 100px;
  }
  .content{
      height: 100%;
      background-color: #fff;
     padding: 0px 20px 20px;

      margin: 20px;
  }
  .el-descriptions-item__label.is-bordered-label{
    font-weight: normal;
  }
  .desct{
      padding-top: 20px;
      padding-bottom: 20px;
      color: #524b4a;
      font-weight: bold;
    }
</style>


