<template>
<!-- 增加任务 -->
  <div class="examination">
    <el-dialog :close-on-click-modal='false' @close="closebatch" width='100%' :visible.sync="batchShow" top="0">
      <div slot="title" class="titleBox">
        <i class='el-icon-document' style="font-size: 20px"></i>
        <span style="margin-left:10px;font-size:18px">历史记录</span>
      </div>
      <div class="common-title-name" style="padding-bottom: 3px;">
      </div>
      <el-table ref="table13" border :height="theight13" highlight-current-row :data="tableData13"
                :span-method="arraySpanMethod13" @selection-change="searchFollow13"
                :header-cell-style="tableHeaderCellStyle" :summary-method="getSummaries" show-summary>
        <el-table-column type="index" label="NO" width="45" fixed align="center"></el-table-column>
        <el-table-column type="selection" width="45" fixed align="center"></el-table-column>
        <el-table-column show-overflow-tooltip sortable min-width="118" fixed align='center' prop="SAMPLE_NO" label="中心编号"></el-table-column>
        <el-table-column show-overflow-tooltip sortable min-width="125" fixed align="center" prop="MAT_NAME" label="物料名称"></el-table-column>
        <el-table-column show-overflow-tooltip sortable min-width="110" fixed align='center' prop="TEST_ITEM_NAME" label="测试项目" ></el-table-column>
        <el-table-column show-overflow-tooltip sortable width="80" fixed align="center" prop="CREATE_TIME" label="退回时间"></el-table-column>
        <el-table-column show-overflow-tooltip sortable min-width="80" fixed align="center" prop="CREATE_MAN" label="退回人"></el-table-column>
        <el-table-column show-overflow-tooltip sortable min-width="80" fixed align="center" prop="LOG_MEMO" label="退回原因"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="180" align="center" prop="ANLY_ITEM_NAME" label="分析项目"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="100" align="center" prop="ANLY_VALUE" label="报出值"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="100" align="center" prop="REVISE_VALUE" label="录入值"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="100" align="center" prop="DAS_VALUE" label="采集值"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="100" align="center" prop="CPT_VALUE" label="计算值"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="100" align="center" prop="REVISE_VALUE" label="修约值"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="90" align="center" prop="UNIT_NAME" label="单位"></el-table-column>
        <el-table-column show-overflow-tooltip min-width="100" align="center" prop="FORMULA_NAME" label="计算公式" ></el-table-column>
        <el-table-column show-overflow-tooltip min-width="100" align="center" prop="REVISE_RULE_NAME" label="修约规则"></el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="closebatch">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { getCookie } from "@/utils/util.js";
import { cookieUserId, cookieUserName } from "@/config/config.js";
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
  props: ["showFlag", "Params"],
  data() {
    return {
      batchShow: false,
      backLoading: false,
      theight13:'',
      tableData13:[],
    }
  },
  created(){
    this.theight13 = window.innerHeight -240;
  },
  mounted() {

  },
  methods: {
    // 关闭原始记录页面
    closebatch (){
      this.multipleSelection13 = []
      this.batchShow = false;
      // this.dataMain();
    },
    searchFollow13 (val){
      this.multipleSelection13 = val
    },
    tableHeaderCellStyle () {
      return 'color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;'
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
        }
        if (index === 1) {
          sums[index] = data.length;
        }
      });
      return sums;
    },
    arraySpanMethod13 ({ row, column, rowIndex, columnIndex }) {
      let tableData = this.$refs.table13.tableData
      let rowsPan = 1;
      let thisColomnData = row[column['property']];
      let st = row['SH_ID'];
      if (columnIndex > 0 && columnIndex < 8 && st) {
        if (rowIndex > 0 && st === tableData[rowIndex - 1]['SH_ID']) {
          return {
            rowspan: 0,
            colspan: 0
          };
        }
        while (tableData[rowIndex + rowsPan] && st === tableData[rowIndex + rowsPan]['SH_ID']) {
          rowsPan += 1
        }
        return {
          rowspan: rowsPan,
          colspan: 1
        };
      }
    },
  },
  watch: {
    showFlag(arg) {
      this.batchShow = true;
      this.tableData13 = this.Params
    }
  },
};
</script>
<style lang="less">
.customWidth_test {
  width: 1000px !important;
}
</style>
