<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-01-09 15:48:09
 * @Description:
-->
<template>
  <el-dialog title="原始数据" :visible.sync="visible">
    <el-table
      :data="dataList"
      :stripe="true"
      :header-cell-style="{
        background: '#eef1f6',
        color: '#606266',
        height: '56px',
      }"
      height="500"
      v-loading="dataListLoading"
      style="width: 100%;"
    >
      <el-table-column type="index" header-align="center" align="center" label="序号" width="50">
      </el-table-column>
      <el-table-column prop="data" align="center" label="原始数据">
        <template slot-scope="scope">
          <span>{{ lineIndex === 2 ? scope.row.x : scope.row.data.toString() }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column :prop="lowLine[lineIndex].rules" align="center" :label="'判读'+lowLine[lineIndex].name">
        <template slot-scope="scope">
          <span>{{ scope.row[lowLine[lineIndex].rules].toString() }}</span>
        </template>
      </el-table-column> -->
      <el-table-column
        :prop="lowLine[lineIndex].name"
        align="center"
        :label="lowLine[lineIndex].name"
      >
      </el-table-column>
      <!-- <el-table-column :prop="upLine[lineIndex].rules" align="center" :label="'判读'+upLine[lineIndex].name">
        <template slot-scope="scope">
          <span>{{ scope.row[upLine[lineIndex].rules].toString() }}</span>
        </template>
      </el-table-column> -->
      <el-table-column
        :prop="upLine[lineIndex].name"
        align="center"
        :label="upLine[lineIndex].name"
      >
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
export default {
  props: {
    dataList: {
      type: Array,
      default: () => {
        [];
      },
    },
    lineIndex: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      dataListLoading: false,
      visible: false,
      upLine: [
        { name: "xbar", rules: "xbarUnsatisfiedRules" },
        { name: "xbar", rules: "xbarUnsatisfiedRules" },
        { name: "x", rules: "xUnsatisfiedRules" },
      ],
      lowLine: [
        { name: "r", rules: "rUnsatisfiedRules" },
        { name: "s", rules: "sUnsatisfiedRules" },
        { name: "rs", rules: "rsUnsatisfiedRules" },
      ],
    };
  },
  methods: {
    init() {
      console.log(this.dataList);
      this.visible = true;
      this.dataListLoading = false;
      this.$nextTick(() => {});
    },
  },
};
</script>
