<!-- 物品管理：有bug还没解决完 -->
<template>
  <div class="resource">
    <div class="zy-head-search">
      <el-form :inline="true" :model="search">
        <el-form-item label="物品类别">
          <el-select v-model="search.stuffTypeName" clearable filterable collapse-tags size="small"
            style="width:150px;margin-right: 10px;" placeholder="请选择物品类别">
            <el-option v-for="(item, index) in stuffTypeNameList" :key="index" :label="item.baseName"
              :value="item.baseName">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="物品名称">
          <el-input v-model="search.stuffName" size="small" style="width: 150px;" placeholder="请输入物品名称"></el-input>
        </el-form-item>
        <el-form-item label="入库时间">
          <el-date-picker v-model="search.times[0]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
            placeholder="开始日期" size="mini" style="width: 140px" :default-time="'00:00:00'">
          </el-date-picker>
          <span>至</span>
          <el-date-picker v-model="search.times[1]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
            placeholder="结束日期" size="mini" style="width: 140px" :default-time="'23:59:59'">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button icon="el-icon-search" type="primary" size="mini" @click="searchData">查询</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="reset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div>
      <el-tabs v-model="activeName" type="card" style="height: 750px">
        <div class="zy-title-div">
          <div class="zy-title-name">
            <img style="width: 25px; height: 25px" src='../../../../assets/img/imgScreen/logo.png' />
            物品入库表
          </div>
          <div>
            <el-form :inline='true'>
              <!-- <el-button icon="el-icon-circle-plus-outline" type="goon" size="mini" @click="addData3">新增</el-button> -->
              <el-button icon="el-icon-check" type="goon" size="mini" @click="putIn">入库</el-button>
              <el-button icon="el-icon-edit" type="goon" size="mini" @click="modifyData3">修改</el-button>
              <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="deleteData3">停用</el-button>
              <el-button icon="el-icon-check" type="goon" size="mini" @click="recoverData3">启用</el-button>
            </el-form>
          </div>
          <div class="common-button-div">
            <el-button icon="el-icon-download" type="goon" size="mini" :loading="tableExportLoading"
              @click="doExport">导出</el-button>
          </div>
        </div>
        <!-- 物品入库表表格 -->
        <div class="common-table-div">
          <div class="table-wrapper" :style="{ transform: `scale(${scale})`, transformOrigin: 'top left' }">
            <el-table v-loading="dataLoading3" ref="dataTable3" border :height="height_top" highlight-current-row
              @selection-change="handleSelectionChange3" :data="table.list3" :icore-filter-flag="icoreFilterFlag"
              :header-cell-style="tableHeaderCellStyle" :summary-method="getSummaries" show-summary
              :cell-class-name="tableRowClassName3" @row-click="getRowCheck2"
              :exchangeFilterMap="{ 'validFlag': { '0': '已停用', '1': '已启用' }, 'state': { '0': '未验收', '1': '已验收' }, }">
              <el-table-column type="index" label="NO" fixed="left" align="center"></el-table-column>
              <el-table-column type="selection" width="55" fixed="left" align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="validFlag" label="数据状态"
                align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.validFlag == '1'">已启用</span>
                  <span v-else-if="scope.row.validFlag == '0'">已停用</span>
                </template>
              </el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="state" label="验收状态"
                align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.state == '1'">已验收</span>
                  <span v-else-if="scope.row.state == '0'">未验收</span>
                </template>
              </el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="130px" prop="inId" label="入库记录号"
                align="center"></el-table-column>
              <!-- <el-table-column sortable width="100px" prop="hetongName" label="入库单号" align="center"></el-table-column> -->
              <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="strNo" label="库房名称"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="stuffNo" label="物品编码"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stuffNoUser" label="物品批号 "
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stuffName" label="物品名称 "
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stuffSpec" label="规格说明"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stuffTypeName"
                label="物品类别" align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="stuffUnit" label="计量单位"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="instkType" label="入库类型"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="110px" prop="qtyInstk" label="入库数量"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="instkApp" label="入库申请人"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="instkHnd" label="入库经办人"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="instkTime" label="入库时间"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="endDate" label="有效期至"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="strLoc" label="存放位置"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="130px" prop="certNum" label="证书数量"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="130px" prop="merchName" label="供应商"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="130px" prop="stkId" label="库存记录号"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="memo" label="备注"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="createMan" label="创建人"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="createTime" label="创建时间"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="updateMan" label="更新人"
                align="center"></el-table-column>
              <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="updateTime" label="更新时间"
                align="center"></el-table-column>
            </el-table>
            <div class="zy-foot-page">
              <el-pagination v-loading="dataLoading" @size-change="pageSizeChange3" @current-change="pageCurrentChange3"
                :current-page="page3.pageNum" :page-sizes="[10, 20, 50, 100, 200]" :page-size="page3.pageSize"
                layout="total, sizes, prev, pager, next, jumper" :total="page3.totalPage" background>
              </el-pagination>
            </div>
          </div>
        </div>
      </el-tabs>
    </div>
    <div>
      <div id="docx">
        <div ref="file"></div>
      </div>
      <div id="xlsx">
        <el-tabs v-model="activeName1" v-if="DialogVisible" type="border-card">
          <el-tab-pane v-for="(item, index) in excelSheet" :key="index" :label="item.name" :name="item.name">
            <div class="table" v-html="item.innerHTML"></div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
    <!-- 新增仪器信息弹窗 -->
    <div is="alertComponents" :showFlag="showFlag" :Params="Params" @refresh='refresh(1)'></div>
    <!-- 新增物品入库信息弹窗 -->
    <div is="alertComponents2" :showFlag2="showFlag2" :Params="Params" :Params2="Params2" @refresh='refresh(2)'></div>
    <div is="alertComponents3" :showFlag3="showFlag3" :Params="Params" :Params3="Params3" :opFlag="opFlag"
      @refresh='refresh(3)' @refresh2="refresh(2)"></div>
    <div is="alertComponents31" :showFlag31="showFlag31" :Params="Params" :Params3="Params3" :opFlag="opFlag"
      @refresh='refresh(3)' @refresh2="refresh(2)"></div>
    <div is="alertComponents4" :showFlag4="showFlag4" :Params="Params" :Params4="Params4" @refresh='refresh(4)'
      @refresh2="refresh(2)"></div>
    <div is="alertComponents5" :showFlag5="showFlag5" :Params="Params" :Params5="Params5" @refresh='refresh(5)'></div>
    <div is="alertComponents6" :showFlag6="showFlag6" :Params="Params" :Params6="Params6" @refresh='refresh(6)'></div>
    <div is="alertComponents7" :showFlag7="showFlag7" :Params="Params" :Params7="Params7" @refresh='refresh(7)'></div>
    <div is="alertComponents8" :showFlag8="showFlag8" :Params="Params" :Params8="Params8" @refresh='myRefresh'
      @refresh2="refresh(2)"></div>
    <div is="alertComponents9" :showFlag9="showFlag9" :Params9="Params9" @refresh='refresh(7)'></div>
  </div>
</template>
<script>
import {
  getCookie,
  formatDate
} from '@/utils/util.js';
import {
  cookieUserId,
  cookieUserName
} from '@/config/config.js';
import alertComponents from './alertComponents';
import alertComponents2 from './alertComponents2';
import alertComponents3 from './alertComponents3';
import alertComponents31 from './alertComponents3-1';
import alertComponents4 from './alertComponents4';
import alertComponents5 from './alertComponents5';
import alertComponents6 from './alertComponents6';
import alertComponents7 from './alertComponents7';
import alertComponents8 from './alertComponents8';
import alertComponents9 from './alertComponents9';
import { exportToExcel } from '../../../../utils/utils.js'
import pdf from 'vue-pdf'
import XLSX from 'xlsx';
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
  components: { alertComponents, alertComponents2, alertComponents3, alertComponents31, alertComponents4, alertComponents5, alertComponents6, alertComponents7, alertComponents8, alertComponents9 },
  data() {
    return {
      headerHeight: 0, // 搜索栏高度
      titleHeight: 0, // 标题栏高度
      footerHeight: 0, // 分页栏高度
      minTableHeight: 250, // 表格最小高度阈值
      resizeObserver: null, // 窗口监听对象
      scale: 1, // 缩放比例
      table: {
        list: [],
        list2: [],
        list3: [],
        list4: [],
        list5: [],
        list6: [],
        list7: []
      },
      buttonLoading: false,
      icoreFilterFlag: true,
      dataLoading: false,
      dataLoading2: false,
      dataLoading3: false,
      dataLoading4: false,
      dataLoading5: false,
      dataLoading6: false,
      dataLoading7: false,
      DialogVisible: false,
      page: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      page2: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      page3: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      page4: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      page5: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      page6: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      page7: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      showFlag: false,
      Params: {},
      showFlag2: false,
      Params2: {},
      showFlag3: false,
      showFlag31: false,
      Params3: {},
      opFlag: '',
      showFlag4: false,
      Params4: {},
      showFlag5: false,
      Params5: {},
      showFlag6: false,
      showFlag7: false,
      showFlag8: false,
      showFlag9: false,
      Params6: {},
      Params7: {},
      Params8: {},
      Params9: {},
      stuffNo: '',
      rukuList: [],
      multipleSelection3: [],
      multipleSelection4: [],
      multipleSelection5: [],
      multipleSelection6: [],
      multipleSelection7: [],
      multipleSelection8: [],
      multipleSelectionSeven: [],
      tableExportLoading: false,
      stuffTypeNameList: [],//物品类别
      tableClick: {},
      search: {
        stuffName: '',
        stuffTypeName: '',
        times: "",
      },
      search1: {
        stuffName: '',
        stuffTypeName: '',
        time1: []
      },
      height_top: 0,
      height_bot: 0,
      activeName: 'first',
    }
  },

  created() {
    // this.height_top = window.innerHeight / 2 - 130 < 250 ? 250 : window.innerHeight / 2 - 110;
    // this.height_bot = window.innerHeight - 130 < 550 ? 550 : window.innerHeight - 150;
    // this.search.times = [this.getYNM(new Date()) + ' 00:00:00', this.getYNM(new Date()) + ' 23:59:59']
    let timestamp = new Date().getTime() - 7 * 24 * 60 * 60 * 1000; // 默认前一周
    this.search.times = [this.getYNM(new Date(timestamp)), this.getYNM(new Date())]
  },
  mounted() {
    this.calcTableHeight();
    this.getStuffTypeNameList()
    this.getDataList3();
    window.addEventListener('resize', this.calcTableHeight);
    this.resizeObserver = new ResizeObserver(() => {
      this.calcTableHeight();
    });
    const headerEl = document.querySelector('.zy-head-search');
    const titleEl = document.querySelector('.zy-title-div');
    const footerEl = document.querySelector('.zy-foot-page');
    if (headerEl) this.resizeObserver.observe(headerEl);
    if (titleEl) this.resizeObserver.observe(titleEl);
    if (footerEl) this.resizeObserver.observe(footerEl);
  },
  beforeDestroy() {
    window.removeEventListener("resize", this.calcTableHeight);
  },
  methods: {
    calcTableHeight() {
      this.$nextTick(() => {
        const headerEl = document.querySelector('.zy-head-search');
        const titleEl = document.querySelector('.zy-title-div');
        const footerEl = document.querySelector('.zy-foot-page');

        this.headerHeight = headerEl ? headerEl.offsetHeight : 0;
        this.titleHeight = titleEl ? titleEl.offsetHeight : 0;
        this.footerHeight = footerEl ? footerEl.offsetHeight : 0;

        const totalReserveHeight = this.headerHeight + this.titleHeight + this.footerHeight + 20; // 20为额外边距（可调整）

        const calcHeight = window.innerHeight / 2 - totalReserveHeight;
        this.height_top = calcHeight < this.minTableHeight ? this.minTableHeight : calcHeight;
        this.height_bot = this.height_top;

        this.$refs.dataTable3.doLayout();
      });
    },
    getYNM(date) {
      let year = date.getFullYear().toString();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      month = month < 10 ? "0" + month : month;
      day = day < 10 ? "0" + day : day;
      return `${year}-${month}-${day}`;
    },
    getStuffTypeNameList() {
      this.axios.post('pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode', { validFlag: 1, baseCode: 4813 }, { individualType: 'json' })
        .then(res => {
          res.data.forEach(item => {
            if (item.baseCode !== '481311') { // 只查看非标准液类型的物料,标准液物料仅限在标准液界面查看
              this.stuffTypeNameList.push(item)
            }
          })
        })
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      const unitGroups = {};
      data.forEach(item => {
        const unit = item.stuffUnit;
        const qty = Number(item.qtyInstk);
        if (!isNaN(qty) && unit) {
          if (unitGroups[unit]) {
            unitGroups[unit] += qty;
          } else {
            unitGroups[unit] = qty;
          }
        }
      });
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计';
          return;
        }
        if (index === 1) {
          sums[index] = data.length;
        }
        if (column.property === 'qtyInstk') {
          const unitSummary = Object.entries(unitGroups).map(([unit, total]) => {
            return `${total} ${unit}`; // 拼接单位和总和
          }).join(', '); // 用逗号分隔多个单位
          sums[index] = unitSummary || 'N/A'; // 无数据时显示 N/A
        }
      });
      return sums;
    },
    // 页面刷新，重新加载表格数据
    refresh(number) {
      switch (number) {
        case 1:
          this.getDataList();
          break
        case 2:
          this.getDataList2(this.stuffNo);
          break
        case 3:
          this.getDataList3();
          break
        case 4:
          this.getDataList4(this.stuffNo);
          break
        case 5:
          this.getDataList5(this.stuffNo);
          break
        case 6:
          this.getDataList6(this.stuffNo);
          break
        case 7:
          this.getDataList7(this.stuffNo)
      }
    },
    myRefresh() {
      this.getDataList2(this.stuffNo);
      this.getDataList4(this.stuffNo);
    },
    // 物品信息表新增
    addData() {
      this.showFlag = !this.showFlag;
      this.Params = null;
    },
    // 修改物品信息表
    modifyData() {
      if (this.multipleSelection3.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
      } else {
        this.showFlag = !this.showFlag;
        this.Params = this.multipleSelection3[0]
      }
    },
    // 物品信息表删除
    deleteData() {
      if (this.multipleSelection3.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        this.dialogTableVisible = false;
        for (var i = 0; i < this.multipleSelection3.length; i++) {
          this.multipleSelection3[i].updateMan = userName;
          this.multipleSelection3[i].updateNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffs/abolish', this.multipleSelection3, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('停用操作成功');
            this.refresh(1)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 信息表恢复
    recoverData() {
      if (this.multipleSelection3.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        this.dialogTableVisible2 = false;
        for (var i = 0; i < this.multipleSelection3.length; i++) {
          this.multipleSelection3[i].evaMan = userName;
          this.multipleSelection3[i].evaNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffs/recover', this.multipleSelection3, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('启用成功');
            this.refresh(1)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 人员查询
    //  searchData () {
    //     this.dataLoading = true;
    //     let startTime =''
    //     let endTime = ''
    //     if (!this.search.time) {
    //     startTime = null
    //     endTime = null
    //     } else {
    //     startTime = this.search.time[0] + ' 00:00:00'
    //     endTime = this.search.time[1] + ' 23:59:59'
    //     }
    //     this.page.pageNum = 1;
    //     this.axios.get('pass/baseManagement/v1/limslrcstuffs/queryLimsLrcStuffPage' + '?pageNum=' + this.page.pageNum +
    //       '&pageSize=' + this.page.pageSize + '&stuffTypeName=' + this.search.stuffTypeName  + '&stuffName=' + this.search.stuffName +
    //       '&startTime=' + startTime + '&endTime=' + endTime + '&optEvent=' + '1')
    //     .then(res => {
    //       this.dataLoading = false;
    //       this.table.list = res.data.list;
    //       this.page.totalPage = res.data.total;
    //     }).catch(e => {
    //       this.dataLoading = false;
    //     });
    //   },
    searchData() {
      // this.dataLoading3 = true;
      // let startTime = '';
      // let endTime = '';
      // startTime = this.search.times[0] === '' ? '' : (this.search.times[0] + ' 00:00:00')
      // endTime = this.search.times[1] === ''? '' : (this.search.times[1] + ' 23:59:59')
      // let startTime = ''
      // let endTime = ''
      // if (this.search.times[0]==''||this.search.times[1]=='') {
      //   startTime = null
      //   endTime = null
      // } else {
      //   startTime = this.search.times[0]+ ' 00:00:00'
      //   endTime = this.search.times[1]+ ' 23:59:59'
      // }
      let startTime = null;
      let endTime = null;
      startTime = this.search.times[0] === null ? null : (this.search.times[0] + ' 00:00:00')
      endTime = this.search.times[1] === null ? null : (this.search.times[1] + ' 23:59:59')
      let obj = {
        stuffTypeName: this.search.stuffTypeName,
        stuffName: this.search.stuffName,
        startTime: startTime,
        endTime: endTime
      }
      this.axios.post('pass/baseManagement/v1/limslrcstuffis/selectRuku' + '?pageNum=' + this.page3.pageNum + '&pageSize=' + this.page3.pageSize, obj)
        .then(res => {
          this.dataLoading3 = false;
          this.table.list3 = res.data.list;
          console.log('this.table.list3: ', this.table.list3.length, this.table.list3[0]);
          this.page3.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading3 = false;
        });
      // }
    },
    // 重置
    reset() {
      this.search.stuffTypeName = '';
      this.search.stuffName = '';
      let timestamp = new Date().getTime() - 7 * 24 * 60 * 60 * 1000; // 默认前一周
      this.search.times = [this.getYNM(new Date(timestamp)), this.getYNM(new Date())]
      this.getDataList3();
    },
    // 库存
    addData2() {
      if (this.multipleSelection3.length != 1) {
        this.$message.warning('请在设备信息表中勾选您要新增的一条数据！')
      } else {
        this.showFlag2 = !this.showFlag2;
        this.Params2 = null;
        this.Params = this.multipleSelection3[0];
        console.log(this.Params)
      }
    },
    // 修改
    modifyData2() {
      if (this.multipleSelection4.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
      } else {
        this.showFlag2 = !this.showFlag2;
        this.Params2 = this.multipleSelection4[0];
        this.Params = null
      }
    },
    // 停用
    deleteData2() {
      if (this.multipleSelection4.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        this.dialogTableVisible = false;
        for (var i = 0; i < this.multipleSelection4.length; i++) {
          this.multipleSelection4[i].updateMan = userName;
          this.multipleSelection4[i].updateNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffstks/abolish', this.multipleSelection4, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('停用操作成功');
            this.refresh(2)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 入库
    storeStuff() {
      if (this.multipleSelection4.length === 1) {
        this.showFlag3 = !this.showFlag3;
        this.Params3 = null;
        this.Params = this.multipleSelection4[0];
        this.opFlag = '1'
      } else {
        return this.$message.warning('请勾选一条库存信息')
      }
    },
    // 出库
    outbound() {
      if (this.multipleSelection4.length < 1) {
        this.$message.warning('请在物品库存表中勾选您要新增的一条数据！')
      } else {
        this.showFlag8 = !this.showFlag8;
        this.Params8 = null;
        this.Params = this.multipleSelection4[0];
      }
    },
    // 启用按钮
    recoverData2() {
      if (this.multipleSelection4.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        this.dialogTableVisible2 = false;
        for (var i = 0; i < this.multipleSelection4.length; i++) {
          this.multipleSelection4[i].evaMan = userName;
          this.multipleSelection4[i].evaNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffstks/recover', this.multipleSelection4, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('启用成功');
            this.refresh(2)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 入库
    addData3() {
      if (this.multipleSelection3.length != 1) {
        this.$message.warning('请在设备信息表中勾选您要新增的一条数据！')
      } else {
        this.showFlag3 = !this.showFlag3;
        this.Params3 = null;
        this.Params = this.multipleSelection3[0];
      }
    },
    putIn() {
      if (this.multipleSelection5.length < 1) {
        this.$message.warning('请勾选您要验收的数据！')
        return;
      }
      let tt = false;
      let userVilidate = false;
      this.multipleSelection5.forEach(s => {
        if (s.state == '1') {
          tt = true;
        }
        if (userName === s.createMan) {
          userVilidate = true;
        }
      })
      if (userVilidate) {
        this.$message.warning('存在数据的创建人与当前用户一致,请重新勾选！')
        return;
      }

      if (tt) {
        this.$message.warning('请勾选未验收的数据！')
        return;
      }
      this.axios.post('pass/baseManagement/v1/limslrcstuffis/putIn', this.multipleSelection5, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('验收成功');
          this.searchData()
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    //下载文件
    imgPreView(row, fileName) {
      this.axios.get('pass/baseManagement/v1/file/download/' + fileName, { responseType: 'blob' }, { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(res => {
        let blob = new Blob([res]);
        let elink = document.createElement('a');
        elink.download = fileName;
        elink.style.display = 'none';
        elink.target = "_blank";
        elink.href = URL.createObjectURL(blob);
        document.body.appendChild(elink);
        elink.click();
        URL.revokeObjectURL(elink.href); // 释放URL对象
        document.body.removeChild(elink);
      }).catch(e => {
        return this.$message.error(e.message)
      })
    },
    imgPreViewY(row, fileName) {
      let aaa = fileName.substr(fileName.indexOf(".") + 1);
      if (aaa == "pdf") {
        this.axios.get('pass/baseManagement/v1/file/download/' + fileName, { responseType: 'blob' }, { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(res => {
          const binaryData = [];
          binaryData.push(res);
          this.srcUrl = window.URL.createObjectURL(new Blob(binaryData, { type: 'application/pdf' }))
          window.open(this.srcUrl, fileName);
        }).catch(e => {
          return this.$message.error(e.message)
        })
      } else if (aaa == "xlsx") {
        this.axios.get('pass/baseManagement/v1/file/download/' + fileName, { responseType: 'arraybuffer' }, { headers: { 'content-type': 'application/x-www-form-urlencoded' } }).then(res => {
          this.excelSheet = [];
          this.showFlag(false);
          let workbook = XLSX.read(new Uint8Array(res), { type: "array" });
          this.tableToHtml(workbook);
        }).catch(e => {
          return this.$message.error(e.message)
        })
      } else {
        return this.$message.error("不支持这个类型的文件展示！")
      }
    },
    tableToHtml(workbook) {
      const sheetList = workbook.SheetNames.filter(v => v.indexOf('数据源') === -1);
      this.activeName1 = sheetList[0];
      sheetList.forEach(sheet => {
        const worksheet = workbook.Sheets[sheet];
        if (worksheet) {
          const innerHTML = XLSX.utils.sheet_to_html(worksheet);
          this.excelSheet.push({
            name: sheet,
            innerHTML: innerHTML
          });
        } else {
          this.excelSheet.push({
            name: sheet,
            innerHTML: '暂无数据',
          });
        }
      });
      this.DialogVisible = true;
    },
    showFlag(docx) {
      if (docx) {
        document.getElementById("docx").style.display = "block";
        document.getElementById("xlsx").style.display = "none";
      } else {
        document.getElementById("docx").style.display = "none";
        document.getElementById("xlsx").style.display = "block";
      }
    },
    // 修改
    modifyData3() {
      if (this.multipleSelection5.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
      } else {
        let tt = false;
        this.multipleSelection5.forEach(s => {
          if (s.state == '1') {
            tt = true;
          }
        })
        if (tt) {
          this.$message.warning('请勾选未验收的数据！')
          return;
        } else {
          this.showFlag31 = !this.showFlag31;
          this.Params3 = this.multipleSelection5[0];
          this.Params = null
        }
      }
    },
    // 停用
    deleteData3() {
      if (this.multipleSelection5.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        this.dialogTableVisible = false;
        for (var i = 0; i < this.multipleSelection5.length; i++) {
          this.multipleSelection5[i].updateMan = userName;
          this.multipleSelection5[i].updateNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffis/abolish', this.multipleSelection5, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('停用操作成功');
            this.searchData()
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 启用
    recoverData3() {
      if (this.multipleSelection5.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        this.dialogTableVisible2 = false;
        for (var i = 0; i < this.multipleSelection5.length; i++) {
          this.multipleSelection5[i].evaMan = userName;
          this.multipleSelection5[i].evaNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffis/recover', this.multipleSelection5, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('启用成功');
            this.searchData()
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 确认出库
    confirmData() {
      if (this.multipleSelection6.length < 1) {
        this.$message.warning("请勾选您需要确认的出库信息！");
        return;
      }
      let tt = false;
      for (let i = 0; i < this.multipleSelection6.length; i++) {
        if (userId == this.multipleSelection6[i].createNo) {
          tt = true;
        }
        if (this.multipleSelection6[i].state == '1') {
          return this.$message.warning("请选中为待确认信息！");
        }
      }
      if (tt) {
        this.$message.warning("审批人不能是申请人，请重试！");
        return;
      }
      this.axios.post('pass/baseManagement/v1/limslrcstuffos/confirmData', this.multipleSelection6, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success(res.message);
          this.getDataList4(this.stuffNo)
        } else {
          this.$message.warning(res.message)
        }
      }).catch(e => {
        return this.$message.error(e.message)
      })
    },

    // 出库发放
    grantData() {
      if (this.multipleSelection6.length < 1) {
        this.$message.warning("请勾选您需要发放的出库信息！");
        return;
      }
      for (let i = 0; i < this.multipleSelection6.length; i++) {
        if (this.multipleSelection6[i].state == '2') {
          return this.$message.warning("已发放，请选择待发放申请！");
        }
        if (this.multipleSelection6[i].state == '0') {
          return this.$message.warning("未审批，请选择待发放申请！");
        }
      }
      this.axios.post('pass/baseManagement/v1/limslrcstuffos/grantData', this.multipleSelection6, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success(res.message);
          this.getDataList4(this.stuffNo)
        } else {
          this.$message.warning(res.message)
        }
      }).catch(e => {
        return this.$message.error(e.message)
      })
    },

    // 申请出库
    addData4() {
      if (this.multipleSelection3.length != 1) {
        this.$message.warning('请在设备信息表中勾选您要新增的一条数据！')
      } else {
        this.showFlag4 = !this.showFlag4;
        this.Params4 = null;
        this.Params = this.multipleSelection3[0];
      }
    },
    // 修改
    modifyData4() {
      let tt = true;
      this.multipleSelection6.forEach(aa => {
        if (aa.state == "1") {
          tt = false;
          this.$message.warning("请选中为待确认信息！");
        }
        if (aa.state == "2") {
          tt = false;
          this.$message.warning("请选中为待确认信息！");
        }
      })
      if (tt) {
        if (this.multipleSelection6.length !== 1) {
          this.$message.warning('请勾选您要修改的一条数据！')
        } else {
          this.showFlag4 = !this.showFlag4;
          this.Params4 = this.multipleSelection6[0];
          this.Params = null
        }
      }
    },
    // 停用
    deleteData4() {
      if (this.multipleSelection6.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        this.dialogTableVisible = false;
        for (var i = 0; i < this.multipleSelection6.length; i++) {
          this.multipleSelection6[i].updateMan = userName;
          this.multipleSelection6[i].updateNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffos/abolish', this.multipleSelection6, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('停用操作成功');
            this.refresh(4)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 启用
    recoverData4() {
      if (this.multipleSelection6.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        this.dialogTableVisible2 = false;
        for (var i = 0; i < this.multipleSelection6.length; i++) {
          this.multipleSelection6[i].evaMan = userName;
          this.multipleSelection6[i].evaNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffos/recover', this.multipleSelection6, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('启用成功');
            this.refresh(4)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 标准液配制
    addData5() {
      if (this.multipleSelection3.length != 1) {
        this.$message.warning('请在设备信息表中勾选您要新增的一条数据！')
      } else {
        this.showFlag5 = !this.showFlag5;
        this.Params5 = null;
        this.Params = this.multipleSelection3[0];
        console.log(this.Params)
      }
    },
    // 修改
    modifyData5() {
      if (this.multipleSelection7.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
      } else {
        this.showFlag5 = !this.showFlag5;
        this.Params5 = this.multipleSelection7[0];
        this.Params = null
      }
    },
    //停用
    deleteData5() {
      if (this.multipleSelection7.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        this.dialogTableVisible = false;
        for (var i = 0; i < this.multipleSelection7.length; i++) {
          this.multipleSelection7[i].updateMan = userName;
          this.multipleSelection7[i].updateNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstufffabrs/abolish', this.multipleSelection7, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('停用操作成功');
            this.refresh(5)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 启用
    recoverData5() {
      if (this.multipleSelection7.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        this.dialogTableVisible2 = false;
        for (var i = 0; i < this.multipleSelection7.length; i++) {
          this.multipleSelection7[i].evaMan = userName;
          this.multipleSelection7[i].evaNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstufffabrs/recover', this.multipleSelection7, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('启用成功');
            this.refresh(5)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 标定
    addData6() {
      if (this.multipleSelection3.length != 1) {
        this.$message.warning('请在设备信息表中勾选您要新增的一条数据！')
      } else {
        this.showFlag6 = !this.showFlag6;
        this.Params6 = null;
        this.Params = this.multipleSelection3[0];
        console.log(this.Params)
      }
    },
    // 修改
    modifyData6() {
      if (this.multipleSelection8.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
      } else {
        this.showFlag6 = !this.showFlag6;
        this.Params6 = this.multipleSelection8[0];
        this.Params = null
      }
    },
    // 停用
    deleteData6() {
      if (this.multipleSelection8.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        this.dialogTableVisible = false;
        for (var i = 0; i < this.multipleSelection8.length; i++) {
          this.multipleSelection8[i].updateMan = userName;
          this.multipleSelection8[i].updateNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffcalibrs/abolish', this.multipleSelection8, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('停用操作成功');
            this.refresh(6)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 启用
    recoverData6() {
      if (this.multipleSelection8.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        this.dialogTableVisible2 = false;
        for (var i = 0; i < this.multipleSelection8.length; i++) {
          this.multipleSelection8[i].evaMan = userName;
          this.multipleSelection8[i].evaNo = userId
        }
        this.axios.post('pass/baseManagement/v1/limslrcstuffcalibrs/recover', this.multipleSelection8, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('启用成功');
            this.refresh(6)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    addData7() {
      if (this.multipleSelection3.length != 1) {
        this.$message.warning('请在物品信息表中勾选您要新增的一条数据！')
      } else {
        this.showFlag7 = !this.showFlag7;
        this.Params7 = null;
        this.Params = this.multipleSelection3[0];
        console.log(this.Params)
      }

    },
    modifyData7() {
      if (this.multipleSelectionSeven.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
      } else {
        let bool = false;
        this.multipleSelectionSeven.forEach(s => {
          if (s.tenantNo == '1') {
            bool = true;
          }
        })
        if (bool) {
          this.$message.warning('请勾选未确认的数据！')
          return
        }
        this.showFlag9 = !this.showFlag9;
        this.Params9 = this.multipleSelectionSeven[0];
      }
    },
    httpRequest(e) {
      if (this.multipleSelectionSeven.length == 0) {
        this.$message.warning('请勾选您要上传文件对应的数据！')
        return
      }
      if (!e.file) {
        return false
      }
      let file = new FormData()
      file.append('file', e.file)
      let config = {
        headers: {
          'Content-Type': 'multipart/form-data'
        }
      }
      this.axios.post('pass/baseManagement/v1/file/upload', file, config).then(res => {
        if (res.code === '0' || res.code === '200') {
          console.log(list)
          console.log(res.data[0].fileName)
          let list = []
          this.multipleSelectionSeven.forEach(ss => {
            list.push(ss.iId)
          })
          let Cdata = {
            list: list,
            fileName: res.data[0].fileName
          }
          this.axios.post('pass/baseManagement/v1/limslrcstuffinfos/fileMemo1', Cdata, { individualType: 'json' }).then(res1 => {
            if (res1.code === '0' || res1.code === '200') {
              this.$message.success('上传成功')
            }
          }).catch(e1 => {
            this.$message.error(e1.message)
          })
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        return this.$message.error(e.message)
      })
    },
    confirmDataIn() {
      let bool = false;
      if (this.multipleSelectionSeven.length == 0) {
        this.$message.warning('请勾选您要确认的数据！')
        return
      }
      this.multipleSelectionSeven.forEach(s => {
        if (s.createMan == userName) {
          bool = true;
        }
      })
      if (bool) {
        this.$message.warning('确认人与录入人一致，无法确认')
        return
      }
      let arrList = []
      this.multipleSelectionSeven.forEach(s => {
        s.memo2 = userName,
          s.tenantNo = '1'
      })
      this.buttonLoading = true;
      this.axios.post('pass/baseManagement/v1/limslrcstuffinfos/confirmData', this.multipleSelectionSeven, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('操作成功');
          this.getDataList7(this.tableClick.stuffNo)
        } else {
          this.$message.error(res.message)
        }
        this.buttonLoading = false;
      }).catch(e => {
        this.buttonLoading = false;
        this.$message.error(e.message)
      })
    },
    confirmDataFo() {
      if (this.multipleSelectionSeven.length == 0) {
        this.$message.warning('请勾选您要取消确认的数据！')
        return
      }
      let bool = false;
      this.multipleSelectionSeven.forEach(s => {
        if (s.memo2 != userName) {
          bool = true;
        }
      })
      if (bool) {
        this.$message.warning('确认人与取消确认人不一致，无法取消')
        return
      }
      let arrList = []
      this.multipleSelectionSeven.forEach(s => {
        arrList.push(s.iId)
      })
      this.buttonLoading = true;
      this.axios.post('pass/baseManagement/v1/limslrcstuffinfos/confirmDataFo', arrList, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('操作成功');
          this.getDataList7(this.tableClick.stuffNo)
        } else {
          this.$message.error(res.message)
        }
        this.buttonLoading = false;
      }).catch(e => {
        this.buttonLoading = false;
        this.$message.error(e.message)
      })
    },
    batchUpdate7() {
      if (this.multipleSelectionSeven.length == 0) {
        this.$message.warning('请勾选您要保存的数据！')
        return
      }
      let bool = false;
      this.multipleSelectionSeven.forEach(s => {
        if (s.tenantNo == '1') {
          bool = true;
        }
      })
      if (bool) {
        this.$message.warning('请勾选未确认的数据！')
        return
      }
      this.axios.post('pass/baseManagement/v1/limslrcstuffinfos/batchUpdate', this.multipleSelectionSeven, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('操作成功');
          this.getDataList7(this.tableClick.stuffNo)
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    deleteData7() {
      if (this.multipleSelectionSeven.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        this.axios.post('pass/baseManagement/v1/limslrcstuffinfos/abolish', this.multipleSelectionSeven, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('停用操作成功');
            this.refresh(7)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    recoverData7() {
      if (this.multipleSelectionSeven.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        this.axios.post('pass/baseManagement/v1/limslrcstuffinfos/recover', this.multipleSelectionSeven, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.$message.success('启用成功');
            this.refresh(7)
          } else {
            this.$message.error(res.message)
          }
        }).catch(e => {
          this.$message.error(e.message)
        })
      }
    },
    // 一个
    pageSizeChange(size) {
      this.page.pageSize = size;
      this.getDataList();
    },
    pageCurrentChange(index) {
      this.page.pageNum = index;
      this.getDataList();
    },
    handleSelectionChange(val) {
      this.multipleSelection3 = val;
      if (val.length > 0) {
        this.stuffNo = val[val.length - 1].stuffNo
        this.$refs.dataTable.setCurrentRow(val[val.length - 1])
        this.getAllListByEmpNo(val[val.length - 1])
      }
    },
    getAllListByEmpNo(val) {
      // this.$refs.dataTable.toggleRowSelection(val,true)
      // this.getDataList2 (val.stuffNo)
      this.getDataList3()
      // this.getDataList4 (val.stuffNo)
      // this.getDataList5 (val.stuffNo)
      // this.getDataList6 (val.stuffNo)
      // this.getDataList7 (val.stuffNo)
      this.tableClick = val;
    },
    getRowCheck(val) {
      this.$refs.dataTable2.toggleRowSelection(val, true)
    },
    getRowCheck2(val) {
      this.$refs.dataTable3.toggleRowSelection(val, true)
    },
    getRowCheck3(val) {
      this.$refs.dataTable4.toggleRowSelection(val, true)
    },
    getRowCheck4(val) {
      this.$refs.dataTable5.toggleRowSelection(val, true)
    },
    getRowCheck5(val) {
      this.$refs.dataTable6.toggleRowSelection(val, true)
    },
    getRowCheck7(val) {
      this.$refs.dataTable7.toggleRowSelection(val, true)
    },
    // 二个
    pageSizeChange2(size) {
      this.page2.pageSize = size;
      this.getDataList2();
    },
    pageCurrentChange2(index) {
      this.page2.pageNum = index;
      this.getDataList2();
    },
    handleSelectionChange2(val) {
      this.multipleSelection4 = val;
    },
    // 第三
    pageSizeChange3(size) {
      this.page3.pageSize = size;
      // this.page3.pageNum = 1;
      // this.getDataList3();
      this.searchData()
    },
    pageCurrentChange3(index) {
      this.page3.pageNum = index;
      // this.getDataList3();
      this.searchData()

    },
    handleSelectionChange3(val) {
      this.multipleSelection5 = val;
    },
    //第四
    pageSizeChange4(size) {
      this.page4.pageSize = size;
      this.getDataList4();
    },
    pageCurrentChange4(index) {
      this.page4.pageNum = index;
      this.getDataList4();
    },
    handleSelectionChange4(val) {
      this.multipleSelection6 = val;
    },
    //第五
    pageSizeChange5(size) {
      this.page5.pageSize = size;
      this.getDataList5();
    },
    pageCurrentChange5(index) {
      this.page5.pageNum = index;
      this.getDataList5();
    },
    handleSelectionChange5(val) {
      this.multipleSelection7 = val;
    },
    //第六
    pageSizeChange6(size) {
      this.page6.pageSize = size;
      this.getDataList6();
    },
    pageCurrentChange6(index) {
      this.page6.pageNum = index;
      this.getDataList6();
    },
    handleSelectionChange6(val) {
      this.multipleSelection8 = val;
    },
    handleSelectionChange7(val) {
      this.multipleSelectionSeven = val;
    },
    getDataListruku(val) {
      this.getDataList3()
    },
    getDataListchuku(val) {
      this.getDataList4(val.stuffNo)
    },
    addScreen() {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    addScreen2() {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable2.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    addScreen3() {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable3.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    addScreen4() {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable4.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    addScreen5() {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable5.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    addScreen6() {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable6.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    getDataList() {
      this.dataLoading = true;
      this.axios.get('pass/baseManagement/v1/limslrcstuffs/' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize)
        .then(res => {
          this.dataLoading = false;
          this.table.list = res.data.list;
          this.page.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading = false;
        });
    },
    getDataList2(stuffNo) {
      this.dataLoading2 = true;
      if (stuffNo === null || stuffNo === '') {
        this.table.list2 = [];
        this.dataLoading2 = false;
        return 0
      } else {
        this.axios.get('pass/baseManagement/v1/limslrcstuffstks/' + '?pageNum=' + this.page2.pageNum + '&pageSize=' + this.page2.pageSize + '&stuffNo=' + stuffNo)
          .then(res => {
            this.dataLoading2 = false;
            this.table.list2 = res.data.list;
            this.page2.totalPage = res.data.total;
          }).catch(e => {
            this.dataLoading2 = false;
          });
      }
    },
    getDataList3() {
      this.dataLoading3 = true;
      let startTime = '';
      let endTime = '';
      startTime = this.search.times[0] === '' ? null : (this.search.times[0] + ' 00:00:00')
      endTime = this.search.times[1] ===  ''? null : (this.search.times[1] + ' 23:59:59')
      // let startTime = ''
      // let endTime = ''
      // if (!this.search.times) {
      //   startTime = null
      //   endTime = null
      // } else {
      //   startTime = this.search.times[0]+ ' 00:00:00'
      //   endTime = this.search.times[1]+ ' 23:59:59'
      // }
      this.axios.post('pass/baseManagement/v1/limslrcstuffis/selectRuku' + '?pageNum=' + this.page3.pageNum + '&pageSize=' + this.page3.pageSize
        + '&stuffTypeName=' + this.search.stuffTypeName + '&stuffName=' + this.search.stuffName
        + '&startTime=' + startTime + '&endTime=' + endTime)
        .then(res => {
          console.log('res.......', res)
          this.dataLoading3 = false;
          this.table.list3 = res.data.list;
          this.page3.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading3 = false;
        });
    },
    getDataList4(stuffNo) {
      this.dataLoading4 = true;
      let startTime = ''
      let endTime = ''
      if (!this.search1.time) {
        startTime = null
        endTime = null
      } else {
        startTime = this.search.time[0] + ' 00:00:00'
        endTime = this.search.time[1] + ' 23:59:59'
      }
      if (stuffNo === null || stuffNo === '') {
        this.table.list4 = [];
        this.dataLoading4 = false;
        return 0
      } else {
        this.axios.get('pass/baseManagement/v1/limslrcstuffos/' + '?pageNum=' + this.page4.pageNum + '&pageSize=' + this.page4.pageSize
          + '&stuffTypeName=' + this.search.stuffTypeName + '&stuffName=' + this.search.stuffName
          + '&stuffNo=' + stuffNo + '&startTime=' + startTime + '&endTime=' + endTime)
          .then(res => {
            this.dataLoading4 = false;
            this.table.list4 = res.data.list;
            this.page4.totalPage = res.data.total;
          }).catch(e => {
            this.dataLoading4 = false;
          });
      }
    },
    // 导出
    doExport() {
      if (this.multipleSelection5.length === 0) {
        this.$message.warning("表格无数据不能导出");
        return true;
      }
      // if(this.multipleSelection6.length < 1){
      //     this.$message.warning("表格无数据不能导出");
      //     return;
      // }
      let validState;
      for (let i = 0; i < this.multipleSelection5.length; i++) {
        if (this.multipleSelection5[i].validFlag == '0') {
          this.multipleSelection5[i].validFlag = '已停用'
          this.multipleSelection5[i].state = ''
        }
        if (this.multipleSelection5[i].validFlag == '1') {
          this.multipleSelection5[i].validFlag = '已启用'
          if (this.multipleSelection5[i].state == '0') {
            this.multipleSelection5[i].state = '未验收'
          }
          if (this.multipleSelection5[i].state == '1') {
            this.multipleSelection5[i].state = '已验收'
          }
        }
      }
      this.tableExportLoading = true;
      let tHeader = [];
      let filterVal = [];
      tHeader = ['数据状态', '验收状态', '入库记录号', '库房名称', '物品编码', '物品批号', '物品名称', '规格说明', '物品类别', '计量单位', '入库类型', '入库数量', '入库申请人', '入库经办人', '入库时间', '有效期至', '存放位置', '证书数量', '供应商', '库存记录号', '备注', '创建人', '创建时间', '更新人', '更新时间']
      filterVal = ['validFlag', 'state', 'inId', 'strNo', 'stuffNo', 'stuffNoUser', 'stuffName', 'stuffSpec', 'stuffTypeName', 'stuffUnit', 'instkType', 'qtyInstk', 'instkApp', 'instkHnd', 'instkTime', 'endDate', 'strLoc', 'certNum', 'merchName', 'stkId', 'memo', 'createMan', 'createTime', 'updateMan', 'updateTime']

      exportToExcel(this.multipleSelection5, tHeader, filterVal, '物品入库信息', [], [], [])
      // setTimeout(() => {
      //     setTimeout(() => {
      //     setTimeout(() => {
      this.tableExportLoading = false;
      //         this.doExport2();
      //     }, 0);
      //     }, 0);
      // }, 0);
    },
    getDataList5(stuffNo) {
      this.dataLoading5 = true;
      if (stuffNo === null || stuffNo === '') {
        this.table.list5 = [];
        this.dataLoading5 = false;
        return 0
      } else {
        this.axios.get('pass/baseManagement/v1/limslrcstufffabrs/' + '?pageNum=' + this.page5.pageNum + '&pageSize=' + this.page5.pageSize + '&stuffNo=' + stuffNo)
          .then(res => {
            this.dataLoading5 = false;
            this.table.list5 = res.data.list;
            this.page5.totalPage = res.data.total;
          }).catch(e => {
            this.dataLoading5 = false;
          });
      }
    },
    getDataList6(stuffNo) {
      this.dataLoading6 = true;
      if (stuffNo === null || stuffNo === '') {
        this.table.list6 = [];
        this.dataLoading6 = false;
        return 0
      } else {
        this.axios.get('pass/baseManagement/v1/limslrcstuffcalibrs/' + '?pageNum=' + this.page6.pageNum + '&pageSize=' + this.page6.pageSize + '&stuffNo=' + stuffNo)
          .then(res => {
            this.dataLoading6 = false;
            this.table.list6 = res.data.list;
            this.table.list6.forEach(item => {
              item.calibrTime = formatDate(item.calibrTime, "yyyy-MM-dd")
              item.failureDate = formatDate(item.failureDate, "yyyy-MM-dd")
            })
            this.page6.totalPage = res.data.total;
          }).catch(e => {
            this.dataLoading6 = false;
          });
      }
    },
    getDataList7(stuffNo) {
      this.dataLoading7 = true;
      if (stuffNo === null || stuffNo === '') {
        this.table.list7 = [];
        this.dataLoading7 = false;
        return 0
      } else {
        this.axios.get('pass/baseManagement/v1/limslrcstuffinfos/' + '?pageNum=' + this.page7.pageNum + '&pageSize=' + this.page7.pageSize + '&stuffNo=' + stuffNo)
          .then(res => {
            this.dataLoading7 = false;
            this.table.list7 = res.data.list;
            this.page7.totalPage = res.data.total;
          }).catch(e => {
            this.dataLoading7 = false;
          });
      }
    },
    tableRowClassName({
      row, column, rowIndex, columnIndex
    }) {
      if (columnIndex === 10) {
        if (row.validFlag === '0') {
          return 'error-row';
        }
        return '';
      }
    },
    tableRowClassName2({
      row, column, rowIndex, columnIndex
    }) {
      if (columnIndex === 2) {
        if (row.validFlag === '0') {
          return 'error-row';
        }
        return '';
      }
    },
    tableRowClassName3({
      row, column, rowIndex, columnIndex
    }) {
      if (columnIndex === 2) {
        if (row.validFlag === '0') {
          return 'error-row';
        }
        return '';
      }
    },
    tableRowClassName4({
      row, column, rowIndex, columnIndex
    }) {
      if (columnIndex === 2) {
        if (row.validFlag === '0') {
          return 'error-row';
        }
        if (row.state === '1') {
          return 'error-blue';
        }
        if (row.state === '2') {
          return 'error-green';
        }
        return '';
      }
    },
    tableRowClassName5({
      row, column, rowIndex, columnIndex
    }) {
      if (columnIndex === 12) {
        if (row.validFlag === '0') {
          return 'error-row';
        }
        return '';
      }
    },
    tableRowClassName6({
      row, column, rowIndex, columnIndex
    }) {
      if (columnIndex === 11) {
        if (row.validFlag === '0') {
          return 'error-row';
        }
        return '';
      }
    },
    tableRowClassName7({
      row, column, rowIndex, columnIndex
    }) {

      if (row.validFlag === '0') {
        return 'error-row';
      }
      return '';
    },
    // 切栏
    //   handleClick (tab, event) {
    //   console.log(tab, event);
    //   if (tab.name === 'first') {
    //     this.doSearch()
    //   } else if (tab.name === 'second') {
    //     this.doSearch2()
    //   } else if (tab.name === 'third') {
    //     this.doSearch3()
    //   } else if (tab.name ==='fourth') {
    //     this.doSearch4()
    //   } else if (tab.name ==='fifth') {
    //     this.doSearch5()
    //   }
    // },
    // 表格上横线
    tableHeaderCellStyle() {
      return 'color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;'
    }
  }
}
</script>
<style lang="less">
// .common-table-div {
//   width: 100%;
//   height: 500px; /* 根据需求调整固定高度 */
//   overflow: auto;
//   border: 1px solid #ebeef5;
// }

// .table-wrapper {
//   height: 100%;
//   transform-origin: top left; /* 缩放原点：左上角 */
//   transition: transform 0.2s ease; /* 平滑缩放过渡 */
// }</style>
