<!-- 计划管理-固定计划管理 -->
<template>
  <div class="examination fixedScheduleManagement">
    <div class="common-head-search">
      <el-form :inline="true" @submit.native.prevent>
        <el-form-item label="委托单位">
          <el-select
            v-model="search.planCompanyNo"
            filterable
            style="width:100%"
            clearable
            collapse-tags
            @change="selectDepartment"
            size="small"
          >
            <el-option
              v-for="item in companyNameType"
              :key="item.orgCode"
              :label="item.orgName"
              :value="item.orgCode"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="联系人">
          <el-select
            v-model="search.planDeptNo"
            filterable
            style="width:100%"
            clearable
            collapse-tags
            size="small"
          >
            <el-option
              v-for="item in sectionNameType"
              :key="item.orgCode"
              :label="item.orgName"
              :value="item.orgCode"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="计划年份">
          <el-date-picker
            v-model="search.planYear"
            type="year"
            placeholder="选择年"
            size="small"
            style="width: 100%;"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="样品类型">
          <el-select
            v-model="search.sampleTypeCode"
            filterable
            clearable
            collapse-tags
            size="small"
            style="width: 100%"
          >
            <el-option
              v-for="(item, index) in sampleTypeNameType"
              :key="index"
              :label="item.baseName"
              :value="item.baseCode"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="物料名称">
          <el-input
            v-model="search.matName"
            size="small"
            @keyup.enter.native="searchData()"
            style="width: 100%"
            clearable
          ></el-input>
          <!-- <el-select v-model="search.matNo" clearable  style="width:100%" filterable collapse-tags size="small" >
            <el-option v-for="(item,index) in matNameType" :key="index" :label="item.matName"
              :value="item.matNo">
            </el-option>
          </el-select> -->
        </el-form-item>
        <el-form-item>
          <el-button
            icon="el-icon-search"
            type="goon"
            size="mini"
            @click="searchData"
            >查询</el-button
          >
          <el-button
            icon="el-icon-refresh"
            type="info"
            plain
            size="mini"
            @click="reset"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="common-title-div">
      <div class="common-title-name">
        <img
          style="width: 25px; height: 25px"
          src="../../../../assets/img/imgScreen/logo.png"
        />
        固定计划信息
      </div>
      <div>
        <el-button
          icon="el-icon-circle-plus-outline"
          type="goon"
          size="mini"
          v-privilege="activeMenu + 'ADD'"
          @click="addData"
          >新增</el-button
        >
        <el-button
          icon="el-icon-edit"
          type="goon"
          size="mini"
          v-privilege="activeMenu + 'PUT'"
          @click="modifyData"
          >修改</el-button
        >
        <el-button
          icon="el-icon-remove-outline"
          type="danger"
          size="mini"
          v-privilege="activeMenu + 'disable'"
          @click="deleteData"
          >停用</el-button
        >
        <el-button
          icon="el-icon-check"
          type="goon"
          size="mini"
          v-privilege="activeMenu + 'effectivity'"
          @click="recoverData"
          >启用</el-button
        >
        <el-button
          icon="el-icon-check"
          type="goon"
          size="mini"
          :loading="submitLoading"
          v-privilege="activeMenu + 'submit'"
          @click="submitData"
          >提交</el-button
        >
        <el-button
          icon="el-icon-remove-outline"
          type="danger"
          size="mini"
          v-privilege="activeMenu + 'backSubmit'"
          :loading="backSubmitLoading"
          @click="backsubmitData"
          >取消提交</el-button
        >
      </div>
      <div class="common-button-div">
        <el-button
          icon="el-icon-download"
          type="goon"
          size="mini"
          v-privilege="activeMenu + 'export'"
          :loading="tableExportLoading"
          @click="doExport"
          >导出</el-button
        >
      </div>
      <div style="margin-left: 8px">
        <el-upload
          class="upload"
          action=""
          :multiple="false"
          :show-file-list="false"
          accept="csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
          :http-request="httpRequest"
        >
          <el-button
            icon="el-icon-upload2"
            type="goon"
            v-privilege="activeMenu + 'import'"
            size="mini"
            >导入</el-button
          >
        </el-upload>
      </div>
    </div>
    <div
      class="common-table-div"
      id="topTable"
      style="margin-bottom:0;margin-top:0"
    >
      <el-table
        id="excelTable"
        v-loading="dataLoading"
        ref="dataTable"
        border
        :height="height_top"
        highlight-current-row
        @selection-change="handleSelectionChange"
        :data="table.list"
        :icore-filter-flag="icoreFilterFlag"
        :header-cell-style="tableHeaderCellStyle"
        @cell-click="searchFollow"
        :cell-class-name="tableCellClassName"
        :row-class-name="tableRowClassName"
        :summary-method="getSummaries"
        show-summary
      >
        <el-table-column
          type="index"
          label="序号"
          align="center"
        ></el-table-column>
        <el-table-column
          type="selection"
          width="55"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          width="80px"
          prop="stateFlagName"
          label="状态"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="100px"
          prop="id"
          label="编号"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="planYear"
          label="计划年份"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="planCompanyName"
          label="委托单位"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="planDeptName"
          label="联系人"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="sampleTypeName"
          label="样品类型"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="120px"
          prop="matName"
          label="物料名称"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="120px"
          prop="smpDeliName"
          label="送样频次"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="120px"
          prop="testTypeName"
          label="检验类型"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="planDate1"
          label="计划日期"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="100px"
          prop="gradeName"
          label="牌号"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="100px"
          prop="matShapeName"
          label="形状"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="100px"
          prop="testTime1"
          label="测试起始时间"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="100px"
          prop="durTime"
          label="间隔时间（h）"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="120px"
          prop="pointName"
          label="取样地点"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="smpCompanyName"
          label="取样单位"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="smpDeptName"
          label="取样车间"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="smpSectionName"
          label="取样班组"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="100px"
          prop="testLimit"
          label="测试时限(h)"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="160px"
          prop="anlyName"
          label="分析项目"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="isSmp1"
          label="是否取样"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="isPrepName"
          label="是否组合"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="isPostponeName"
          label="是否顺延"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="isBatchName"
          label="是否组批"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="isMaterName"
          label="是否计量"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="companyName"
          label="检验单位"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="deptName"
          label="检验车间"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="sectionName"
          label="检验班组"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="suppName"
          label="发货单位"
          align="center"
        ></el-table-column><el-table-column
        :show-overflow-tooltip="true"
        sortable
        min-width="140px"
        prop="acceptName"
        label="收货单位"
        align="center"
      ></el-table-column><el-table-column
      :show-overflow-tooltip="true"
      sortable
      min-width="100px"
      prop="spec"
      label="规格/说明"
      align="center"
    ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="memo"
          label="备注"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="validFlag1"
          label="数据状态"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="95px"
          prop="createMan"
          label="创建人"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="160px"
          prop="createTime"
          label="创建时间"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="160px"
          prop="nextSubmitDate"
          label="下次执行时间"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="isCheckName"
          label="是否加权"
          align="center"
        >
        </el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="160px"
          prop="planSectionName"
          label="联系电话"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="80px"
          prop="auditManName"
          label="审核人"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="160px"
          prop="auditTime"
          label="审核时间"
          align="center"
        ></el-table-column>
      </el-table>
    </div>
    <div class="common-foot-style">
      <el-pagination
        @size-change="pageSizeChange"
        @current-change="pageCurrentChange"
        :current-page="page.pageNum"
        :page-sizes="[100, 200, 500, 800, 1000]"
        :page-size="page.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.totalPage"
        background
      >
      </el-pagination>
    </div>
    <div class="common-title-div">
      <div class="common-title-name">
        <img
          style="width: 25px; height: 25px"
          src="../../../../assets/img/imgScreen/logo.png"
        />
        计划分析项目信息
      </div>
      <div>
        <el-button
          icon="el-icon-circle-plus-outline"
          type="goon"
          size="mini"
          v-privilege="activeMenu + 'addDep'"
          @click="addData2"
          >新增</el-button
        >
        <el-button
          icon="el-icon-edit"
          type="goon"
          size="mini"
          v-privilege="activeMenu + 'modify'"
          @click="modifyDep"
          >修改</el-button
        >
        <el-button
          icon="el-icon-remove-outline"
          type="danger"
          size="mini"
          v-privilege="activeMenu + 'delete'"
          :loading="deleteLoading"
          @click="deleteData2"
          >删除</el-button
        >
        <el-button
          icon="el-icon-check"
          type="goon"
          size="mini"
          :loading="extractLoading"
          v-privilege="activeMenu + 'addDep'"
          @click="extract"
          >提取分析项目</el-button
        >
        <el-button
          icon="el-icon-check"
          type="goon"
          size="mini"
          :loading="upperLowerLoading"
          v-privilege="activeMenu + 'upperLower'"
          @click="upperLower"
          >维护上下限</el-button
        >
      </div>
    </div>
    <div class="common-table-div" style="margin-bottom:0;margin-top:0">
      <el-table
        v-loading="dataLoading2"
        ref="dataTable2"
        border
        :height="height_bot"
        highlight-current-row
        @row-click="saveData"
        :data="
          table.list2.slice(
            (this.page2.pageNum - 1) * this.page2.pageSize,
            this.page2.pageNum * this.page2.pageSize
          )
        "
        :icore-filter-flag="icoreFilterFlag"
        :header-cell-style="tableHeaderCellStyle"
        :cell-class-name="tableRowClassName2"
        :summary-method="getSummaries"
        show-summary
      >
        <el-table-column type="index" label="NO" fixed="left" align="center"></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="60px"
          prop="dspOrder"
          label="序号"
          align="center"
        ></el-table-column>
        <!-- <el-table-column :show-overflow-tooltip="true" sortable min-width="140px" prop="planIdD" label="计划单子号" align="center"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable min-width="140px" prop="planId" label="计划单号" align="center"></el-table-column> -->
        <!-- <el-table-column :show-overflow-tooltip="true" sortable min-width="100px" prop="matName" label="物料名称" align="center"></el-table-column> -->
        <!-- <el-table-column :show-overflow-tooltip="true" sortable min-width="140px" prop="testItemName" label="任务名称" align="center"></el-table-column> -->
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="anlyItemNo"
          label="分析项目编号"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="160px"
          prop="anlyItemName"
          label="分析项目"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="maxSign"
          label="上限符"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="maxValue"
          label="上限值"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="minSign"
          label="下限符"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="minValue"
          label="下限值"
          align="center"
        ></el-table-column>
                <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="aprMaxSign"
          label="审批上限符"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="aprMaxValue"
          label="审批上限值"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="aprMinSign"
          label="审批下限符"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="aprMinValue"
          label="审批下限值"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="unitName"
          label="单位"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="90px"
          prop="validFlag1"
          label="数据状态"
          align="center"
        ></el-table-column>
        <el-table-column
          :show-overflow-tooltip="true"
          sortable
          min-width="140px"
          prop="memo"
          label="备注"
          align="center"
        ></el-table-column>
      </el-table>
    </div>
    <!-- <div class="common-foot-style">
        <el-pagination  @size-change="pageSizeChange2" @current-change="pageCurrentChange2"
          :current-page="page2.pageNum" :page-sizes="[10, 20, 50, 100, 200]" :page-size="page2.pageSize" layout="total, sizes, prev, pager, next, jumper"
          :total="page2.totalPage" background>
        </el-pagination>
    </div> -->
    <el-dialog
      @close="fxcloseDialog"
      :close-on-click-modal="false"
      :visible.sync="fxdialogTableVisible"
    >
      <div slot="title" class="titleBox">
        <i class="el-icon-document" style="font-size: 20px"></i>
        <span style="margin-left:10px;font-size:18px;margin-right:20px"
          >修改计划检验项目信息</span
        >
      </div>
      <el-form label-width="80px">
        <el-row>
          <el-col :span="12">
            <el-form-item prop="maxSignTypeIndex" label="上限符">
              <el-select
                v-model="baseData.maxSign"
                filterable
                collapse-tags
                size="small"
                style="width:100%"
              >
                <el-option
                  v-for="(item, index) in maxSignType"
                  :key="index"
                  :label="item.maxSign"
                  :value="item.maxSign"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="最大值">
              <el-input
                v-model="baseData.maxValue"
                style="width:100%"
                size="small"
              ></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item prop="minSignTypeIndex" label="下限符">
              <el-select
                v-model="baseData.minSign"
                filterable
                collapse-tags
                size="small"
                style="width:100%"
              >
                <el-option
                  v-for="(item, index) in minSignType"
                  :key="index"
                  :label="item.minSign"
                  :value="item.minSign"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="最小值">
              <el-input
                v-model="baseData.minValue"
                style="width:100%"
                size="small"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="序号">
              <el-input
                v-model="baseData.dspOrder"
                style="width:100%"
                size="small"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button
          type="goon"
          icon="el-icon-check"
          size="mini"
          @click="fxaddData()"
          >确定</el-button
        >
        <el-button
          size="mini"
          type="goon"
          icon="el-icon-remove-outline"
          @click="fxcloseDialog"
          >取消</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      @close="upperLowerCloseDialog"
      :close-on-click-modal="false"
      :visible.sync="upperLowerTableVisible"
    >
      <div slot="title" class="titleBox">
        <i class="el-icon-document" style="font-size: 20px"></i>
        <span style="margin-left:10px;font-size:18px;margin-right:20px"
          >维护上下限</span
        >
      </div>
      <el-form label-width="80px">
        <el-row>
          <el-col :span="12">
            <el-form-item prop="maxSignTypeIndex" label="上限符">
              <el-select
                v-model="upperLowerData.aprMaxSign"
                filterable
                collapse-tags
                size="small"
                style="width:100%"
                clearable
              >
                <el-option
                  v-for="(item, index) in maxSignType"
                  :key="index"
                  :label="item.maxSign"
                  :value="item.maxSign"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="审批最大值">
              <el-input
                v-model="upperLowerData.aprMaxValue"
                style="width:100%"
                size="small"
              ></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item prop="minSignTypeIndex" label="下限符">
              <el-select
                v-model="upperLowerData.aprMinSign"
                filterable
                collapse-tags
                size="small"
                style="width:100%"
                clearable
              >
                <el-option
                  v-for="(item, index) in minSignType"
                  :key="index"
                  :label="item.minSign"
                  :value="item.minSign"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="审批最小值">
              <el-input
                v-model="upperLowerData.aprMinValue"
                style="width:100%"
                size="small"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button
          type="goon"
          icon="el-icon-check"
          size="mini"
          @click="upperLowerAddData()"
          >确定</el-button
        >
        <el-button
          size="mini"
          type="goon"
          icon="el-icon-remove-outline"
          @click="upperLowerCloseDialog"
          >取消</el-button
        >
      </span>
    </el-dialog>
    <div
      is="alertComponets"
      :showFlag="showFlag"
      :Params="Params"
      @refresh="refresh"
    ></div>
    <div
      is="alertComponets2"
      :showFlag2="showFlag2"
      :Params="Params"
      :Params2="Params2"
      @refresh="refresh2"
    ></div>
  </div>
</template>
<script>
import { getCookie, formatDate } from "@/utils/util.js";
import { cookieUserId, cookieUserName } from "@/config/config.js";
import alertComponets from "./alertComponents";
import alertComponets2 from "./alertComponents2";
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);

export default {
  components: { alertComponets, alertComponets2 },
  data() {
    return {
      table: {
        list: [],
        list2: [],
      },
      tableExportLoading: false,
      dataLoading: false,
      dataLoading2: false,
      saveRow: {},
      icoreFilterFlag: true,
      stopLoading: false,
      startLoading: false,
      submitLoading: false,
      backSubmitLoading: false,
      deleteLoading: false,
      fxdialogTableVisible: false,
      extractLoading: false,
      upperLowerLoading: false,
      page: {
        pageSize: 200,
        pageNum: 1,
        totalPage: 0,
      },
      page2: {
        pageSize: 200,
        pageNum: 1,
        totalPage: 0,
      },
      baseData: {},
      upperLowerData: {},
      minSignType: [{ minSign: ">=" }, { minSign: ">" }],
      maxSignType: [{ maxSign: "<=" }, { maxSign: "<" }],
      list: [],
      planSave: {},
      planId: "",
      height_top: 0,
      height_bot: 0,
      showFlag: false,
      Params: {},
      showFlag2: false,
      Params2: {},
      companyNameType: [],
      companyNameType1: [],
      sampleTypeNameType: [],
      multipleSelection3: [],
      multipleSelection4: [],
      matNameType: [],
      sectionNameType: [],
      search: {
        planYear: "",
        planCompanyNo: "",
        planDeptNo: "",
        matNo: "",
        sampleTypeCode: "",
      },
      activeMenu: "",
      upperLowerTableVisible: false,
    };
  },
  watch: {
    // table: {
    //   handler(val) {
    //     console.log("固定计划信息:", val);
    //   },
    //   deep: true,
    //   immediate: true,
    // },
  },
  computed: {},
  filters: {},
  created() {
    this.height_top =
      window.innerHeight / 2 - 130 < 249 ? 249 : window.innerHeight / 2 - 110;
    this.height_bot =
      window.innerHeight / 2 - 140 < 249 ? 249 : window.innerHeight / 2 - 110;
    this.activeMenu = window.top.localStorage.getItem("activeMenu");
    this.search.planYear = new Date();
  },
  mounted() {
    this.axios
      .post(
        "pass/baseManagement/v1/sysorgs/querySysOrgCompanyAll",
        {},
        { individualType: "json" }
      )
      .then((response) => {
        this.companyNameType = response.data;
      });
    this.axios
      .post(
        "pass/baseManagement/v1/limsbasematerialss/queryLimsBaseMaterialsPage/",
        { object: { validFlag: 1 }, pageIndex: 1, pageSize: 99999 },
        { individualType: "json" }
      )
      .then((res) => {
        this.matNameType = res.data.list;
      });
    //样品类型
    this.axios
      .post(
        "pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",
        { validFlag: 1, baseCode: 4801 },
        { individualType: "json" }
      )
      .then((res) => {
        this.sampleTypeNameType = res.data;
      });
    this.searchData();
    // this.getDataList2();
    // this.addScreen();
    this.addScreen2();
  },
  methods: {
    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;
    },
    selectDepartment(val) {
      this.sectionNameType = [];
      // this.pointNameType = []
      this.companyNameType.find((item) => {
        if (val === item.orgCode) {
          this.sectionNameType = item.sysOrgList;
          this.search.planDeptNo = "";
        }
      });
    },
    smpSection() {
      this.$forceUpdate();
    },
    refresh() {
      this.mainData();
    },
    refresh2() {
      this.depData(this.saveRow.planId);
    },
    saveData(row) {
      this.planSave = Object.assign({}, row);
    },
    getDate(strDate) {
      var st = strDate;
      // var a = st.split(" ");
      // var b = a[0].split("-");
      var c = st.split(":");
      var date = new Date("2020", "8", "29", c[0], c[1], c[2]);
      return date;
    },
    // httpRequest(e) {
    //   let file = e.file; // 文件信息
    //   if (!file) {
    //     // 没有文件
    //     return false;
    //   } else if (!/\.(xls|xlsx)$/.test(file.name.toLowerCase())) {
    //     // 格式根据自己需求定义
    //     this.$message.error("上传格式不正确，请上传xls或者xlsx格式");
    //     return false;
    //   }
    //   const fileReader = new FileReader();
    //   fileReader.onload = (ev) => {
    //     let _this = this;
    //     _this.list = [];
    //     try {
    //       const data = ev.target.result;
    //       const workbook = XLSX.read(data, {
    //         type: "binary", // 以字符编码的方式解析
    //       });
    //       const exlname = workbook.SheetNames[0]; // 取第一张表
    //       _this.jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[exlname]); // 生成json表格内容
    //       for (var j = 0; j < _this.jsonData.length; j++) {
    //         // 按照生成jsonData 的数据格式 处理 生成所需表格
    //         if (_this.jsonData[j]["是否取样"] === "是") {
    //           _this.isSmp1 = 1;
    //         } else if (_this.jsonData[j]["是否取样"] === "否") {
    //           _this.isSmp1 = 0;
    //         }
    //         _this.planDate1 = new Date(_this.jsonData[j]["计划日期"]).getTime();
    //         _this.testTime1 = _this
    //           .getDate(_this.jsonData[j]["测试起始时间"])
    //           .getTime();
    //         _this.list.push({
    //           isSmp: _this.isSmp1,
    //           planYear: _this.jsonData[j]["计划年份"],
    //           companyName: _this.jsonData[j]["委托单位"],
    //           deptName: _this.jsonData[j]["联系人"],
    //           sampleTypeCode: _this.jsonData[j]["样品类型"],
    //           matName: _this.jsonData[j]["物料名称"],
    //           matNo: _this.jsonData[j]["物料编号"],
    //           planDate: _this.planDate1,
    //           testTime: _this.testTime1,
    //           createMan: userName,
    //           createNo: userId,
    //           planTypeCode: "481701",
    //           planTypeName: "固定计划",
    //           durTime: _this.jsonData[j]["间隔时间（小时）"],
    //           pointName: _this.jsonData[j]["状取样地点"],
    //           planTypeCode: _this.jsonData[j]["计划类型编号"],
    //           planTypeName: _this.jsonData[j]["计划类型"],
    //           smpDeptName: _this.jsonData[j]["取样单位"],
    //           testLimit: _this.jsonData[j]["测试时限(小时)"],
    //           memo: _this.jsonData[j]["备注"],
    //         });
    //       }
    //       console.log(_this.list);
    //       _this.operateLoading = true;
    //       _this.axios
    //         .post("pass/testManagement/v1/limstestplans/list", _this.list, {
    //           individualType: "json",
    //         })
    //         .then((res) => {
    //           if (res.succeed) {
    //             this.$message.success("导入成功");
    //             _this.refresh();
    //           } else {
    //             this.$message.error(res.message);
    //           }
    //         })
    //         .catch((e) => {
    //           this.$message.error(e.message);
    //         });
    //     } catch (e) {
    //       return false;
    //     }
    //   };
    //   fileReader.readAsBinaryString(file);
    // },
    async httpRequest(e) {
      console.log('upload....:',e)
      let file = e.file; // 文件信息
      if (!file) {
        // 没有文件
        return false;
      } else if (!/\.(xls|xlsx)$/.test(file.name.toLowerCase())) {
        // 格式根据自己需求定义
        this.$message.error("上传格式不正确，请上传xls或者xlsx格式");
        return false;
      }
      // const fileReader = new FileReader();
      let reader = new FileReader();
      try {
        let data = await new Promise((resolve) => {
          reader.readAsBinaryString(file);
          reader.onload = (ev) => {
            resolve(ev.target.result);
          };
        });
        let workbook = xlsx.read(data, { type: "binary" });
        let firstSheetName = workbook.SheetNames[0];
        let worksheet = workbook.Sheets[firstSheetName];
        let res = xlsx.utils.sheet_to_json(worksheet); // 使用 utils 里的方法转换内容为便于使用的数组
        // res.splice(0,1);
        // this.errObjs = [];
        let count = 10000;
        if (res.length > count) {
          return this.$message.warning("单次导入数量不能超过" + count + "条,");
        }
        let loadingInstance = Loading.service({
          text: "正在处理上传的数据，等待的时间可能比较长，请耐心等待!",
          background: "rgba(0,0,0,.5)",
        });
        for (let i = 1; i < res.length; i++) {
          let item = res[i];
          // this.checkErr(item);
          item.CREATE_TIME = null;
          item.UPDATE_TIME = null;
          item.nextSubmitDate = null;
          item.PLAN_TYPE_CODE = '481701';
          item.PLAN_TYPE_NAME = '固定计划';
        }
        res.splice(0, 1);


        await this.axios
          .post("pass/testManagement/v1/limstestplans/importData", res, {
            individualType: "json",
          })
          .then((res) => {
            if (res.code == 0 || res.code == 200) {
              this.$message.success("成功上传" + res.data + "条数据！");
              loadingInstance.close();
            } else {
              this.$message.warning(res.message);
              loadingInstance.close();
            }
          })
          .catch((e) => {
            this.$message.warning(e.message);
            loadingInstance.close();
          });
      } catch (e) {
        this.$message.warning(e.message);
        loadingInstance.close();
      }
    },
    // 导出
    doExport() {
      if (this.table.list.length === 0) {
        this.$message.warning("表格无数据不能导出");
        return true;
      }
      this.tableExportLoading = true;
      this.isFixed = false;
      this.icoreFilterFlag = false;
      setTimeout(() => {
        let data = this.table.list;
        this.table.list = [];
        // 将大表控件bigDataShow改成[10000, 28];
        setTimeout(() => {
          // this.bigDataShow = [10000, 28];
          // this.isFixed = false;
          this.table.list = data;
          setTimeout(() => {
            this.tableExportLoading = false;
            this.doExport2();
          }, 0);
        }, 0);
      }, 0);
    },
    doExport2() {
      // 将固定列去掉，否则导出的element-ui表格会有两个，因为element-ui固定列的实现原理是表格上面再套一层表格
      this.$nextTick(() => {
        let table = document.querySelector("#topTable .el-table");
        let header = document.querySelector(
          "#topTable .el-table .el-table__header"
        );
        let body = document.querySelector(
          "#topTable .el-table .el-table__body"
        );
        let footer = document.querySelector(
          "#topTable .el-table .el-table__footer"
        );
        let oTd = document.querySelectorAll("#topTable .el-table td");
        let oTh = document.querySelectorAll("#topTable .el-table th");
        // let tjTd = document.querySelectorAll('#power_table .el-table .el-table__footer td[rowspan="1"]');
        // 设置表格的border属性值为1，解决表格导出后无边框问题
        header.border = "1";
        body.border = "1";
        footer.border = "1";
        for (let item of Array.from(oTd)) {
          item.style.height = "27px";
          // item.setAttribute('style', 'height:27px;mso-number-format:"@"');
        }
        for (let item of Array.from(oTh)) {
          item.style.height = "27px";
        }
        // 处理表格底部合计统计样式问题
        // for (let item of Array.from(tjTd)) {
        //   item.setAttribute('rowspan', '2');
        // }
        let ex = '<th class="gutter" style="width: 10px; height: 27px;"></th>';
        let ex2 = '<th class="gutter" style="width: 0px; height: 27px;"></th>';
        ex = new RegExp(ex, "g").test(table.outerHTML) ? ex : ex2;
        // console.log(new RegExp(ex2, 'g').test(table.outerHTML), 'table.outerHTML', table.outerHTML);
        let bd = table.outerHTML.replace(new RegExp(ex, "g"), "");
        bd = bd.replace("正在整理数据", "");
        let html =
          '<html><head><meta charset="utf-8" /></head><body>' +
          bd +
          "</body></html>";
        let blob = new Blob([html], { type: "application/vnd.ms-excel" });
        let link = document.createElement("a");
        link.download = "固定计划信息表.xls";
        link.href = URL.createObjectURL(blob);
        // document.body.appendChild(link);
        link.click();
        // 导出之后将a标签移除掉，并将border属性设置为最初的0
        // document.body.removeChild(link)
        header.border = "0";
        body.border = "0";
        footer.border = "0";
        for (let item of Array.from(oTd)) {
          item.style.height = "";
        }
        for (let item of Array.from(oTh)) {
          item.style.height = "";
        }
        // for (let item of Array.from(tjTd)) {
        //   item.setAttribute('rowspan', '1');
        // }
        // this.bigDataShow = [4, 28];
        this.isFixed = true;
        this.icoreFilterFlag = true;
      });
    },
    addData() {
      let _this = this;
      _this.showFlag = !_this.showFlag;
      if (_this.saveRow) {
        _this.Params = _this.saveRow;
        _this.Params.addFlag = "1";
      } else {
        _this.Params = { addFlag: "1" };
      }
    },
    modifyData() {
      let _this = this;
      if (_this.multipleSelection3.length !== 1) {
        this.$message.warning("请勾选您要修改的一条数据！");
        return;
      }
      if (_this.multipleSelection3[0].stateFlag === "1") {
        _this.$message.warning("已提交的数据不可以进行修改！");
        return;
      }
      // if (JSON.stringify(this.saveRow)==="{}") {
      //  this.$message.warning('请选择你要修改的数据！')
      //  return
      // }
      // if (this.saveRow.stateFlag == 1) {
      //   this.$message.warning('数据已提交，不可再修改')
      //   return
      // }
      // this.Params = this.saveRow
      this.showFlag = !this.showFlag;
      this.Params = this.multipleSelection3[0];
      this.Params.addFlag = "0";
    },
    //停用
    deleteData() {
      if (this.multipleSelection3.length < 1) {
        this.$message.warning("请勾选您要停用的数据！");
        return;
      }
      let tempArr = [];
      this.multipleSelection3.map((item) => {
        tempArr.push(item.id);
      });
      this.stopLoading = true;
      this.axios
        .post("pass/testManagement/v1/limstestplans/disable", tempArr, {
          individualType: "json",
        })
        .then((res) => {
          this.stopLoading = false;
          if (res.succeed) {
            this.dialogTableVisible = false;
            this.$message.success("停用操作成功");
            this.refresh();
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((e) => {
          this.stopLoading = false;
          this.$message.error(e.message);
        });
    },
    //启用
    recoverData() {
      if (this.multipleSelection3.length < 1) {
        this.$message.warning("请勾选您要启用的数据！");
        return;
      }
      let tempArr = [];
      this.multipleSelection3.map((item) => {
        tempArr.push(item.id);
      });
      this.startLoading = true;
      this.axios
        .post("pass/testManagement/v1/limstestplans/enabled", tempArr, {
          individualType: "json",
        })
        .then((res) => {
          this.startLoading = false;
          if (res.succeed) {
            this.dialogTableVisible = false;
            this.$message.success("启用成功");
            this.refresh();
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((e) => {
          this.startLoading = false;
          this.$message.error(e.message);
        });
    },
    //提交
    submitData() {
      if (this.multipleSelection3.length < 1) {
        this.$message.warning("请勾选您要提交的数据！");
        return;
      }
      for (let item of this.multipleSelection3) {
        if (item.stateFlag == 1) {
          this.$message.warning(
            "数据中含有已提交的数据，已提交的数据不可再次提交"
          );
          return;
        }
        if (item.validFlag == 0) {
          this.$message.warning("无效状态的数据，不可以提交!");
          return;
        }
      }
      this.submitLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limstestplans/submit",
          this.multipleSelection3,
          { individualType: "json" }
        )
        .then((res) => {
          this.submitLoading = false;
          if (res.succeed) {
            this.$message.success("提交成功");
            this.refresh();
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((e) => {
          this.submitLoading = false;
          this.$message.error(e.message);
        });
    },
    //取消提交
    backsubmitData() {
      if (this.multipleSelection3.length < 1) {
        this.$message.warning("请勾选您要取消提交的数据！");
        return;
      }
      for (let item of this.multipleSelection3) {
        if (item.stateFlag == 0) {
          this.$message.warning("数据中含有编辑状态的数据，不可取消提交");
          return;
        }
        if (item.validFlag == 0) {
          this.$message.warning("无效状态的数据，不可以取消提交!");
          return;
        }
      }
      this.backSubmitLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limstestplans/updatestate",
          this.multipleSelection3,
          { individualType: "json" }
        )
        .then((res) => {
          this.backSubmitLoading = false;
          if (res.succeed) {
            this.$message.success(res.message);
            this.refresh();
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((e) => {
          this.backSubmitLoading = false;
          this.$message.error(e.message);
        });
    },
    //计划检验项目表新增
    addData2() {
      if (JSON.stringify(this.saveRow) === "{}") {
        this.$message.warning("请点击选中一条固定计划信息数据！");
        return;
      }
      if (this.saveRow.stateFlag == 1) {
        this.$message.warning("数据已提交，不可再新增");
        return;
      }
      this.showFlag2 = !this.showFlag2;
      this.Params2 = null;
      this.Params = this.saveRow;
    },
    modifyDep() {
      if (JSON.stringify(this.planSave) === "{}") {
        this.$message.warning("请点击选中一条固定计划信息数据！");
        return;
      }
      if (this.saveRow.stateFlag == 1) {
        this.$message.warning("数据已提交，不可再修改");
        return;
      }
      this.baseData = Object.assign({}, this.planSave);
      this.fxdialogTableVisible = true;
    },
    fxcloseDialog() {
      this.fxdialogTableVisible = false;
      this.baseData = {};
    },
    upperLowerCloseDialog() {
      this.upperLowerTableVisible = false;
      this.upperLowerData = {};
    },
    fxaddData() {
      this.axios
        .post(
          "pass/testManagement/v1/limstestplands/saveLimsTestPlanD",
          this.baseData,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.succeed) {
            this.fxdialogTableVisible = false;
            this.$message.success(res.message);
            this.depData(this.saveRow.planId);
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((e) => {
          this.$message.error(e.message);
        });
    },
    upperLowerAddData() {
      this.axios
        .post(
          "pass/testManagement/v1/limstestplands/upperLowerLimit",
          this.upperLowerData,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.succeed) {
            this.upperLowerTableVisible = false;
            this.$message.success(res.message);
            this.depData(this.saveRow.planId);
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((e) => {
          this.$message.error(e.message);
        });
    },
    ////计划检验项目表删除
    deleteData2() {
      if (JSON.stringify(this.planSave) === "{}") {
        this.$message.warning("请点击选中一条需要删除的数据");
        return;
      }
      if (this.saveRow.stateFlag == 1) {
        this.$message.warning("数据已提交，不可再删除");
        return;
      }
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.axios
            .post(
              "pass/testManagement/v1/limstestplands/deleteLimsTestPlanD?id=" +
                this.planSave.id,
              { individualType: "json" }
            )
            .then((res) => {
              if (res.succeed) {
                this.$message.success("删除操作成功");
                this.depData(this.saveRow.planId);
              } else {
                this.$message.error(res.message);
              }
            })
            .catch((e) => {
              this.$message.error(e.message);
            });
        })
        .catch(() => {});
    },
    searchData() {
      this.page.pageNum = 1;
      this.page.pageSize = 200;
      this.mainData();
    },
    mainData() {
      this.saveRow = {};
      this.table.list2 = [];
      this.dataLoading = true;
      let planYear = formatDate(this.search.planYear, "yyyy");
      let obj = {
        object: {
          planCompanyNo: this.search.planCompanyNo,
          planDeptNo: this.search.planDeptNo,
          planYear: planYear,
          matName: this.search.matName,
          planTypeCode: 481701,
          sampleTypeCode: this.search.sampleTypeCode,
        },
        pageIndex: this.page.pageNum,
        pageSize: this.page.pageSize,
      };
      this.axios
        .post(
          "pass/testManagement/v1/limstestplans/queryLimsTestPlanPage",
          obj,
          { individualType: "json" }
        )
        .then((res) => {
          this.dataLoading = false;
          this.table.list = res.data.list;
          this.table.list.forEach((item) => {
            item.stateFlagName =
              item.stateFlag === "0"
                ? "编辑"
                : item.stateFlag === "1"
                ? "提交"
                : "";
            item.validFlag1 =
              item.validFlag === "0"
                ? "无效"
                : item.validFlag === "1"
                ? "有效"
                : "";
            item.isSmp1 =
              item.isSmp === "0" ? "否" : item.isSmp === "1" ? "是" : "";
            item.isPrepName =
              item.isPrep === "0" ? "否" : item.isPrep === "1" ? "是" : "";
            item.isPostponeName =
              item.isPostpone === "0"
                ? "否"
                : item.isPostpone === "1"
                ? "是"
                : "";
            item.isMaterName =
              item.isMater === "0" ? "否" : item.isMater === "1" ? "是" : "";
            item.isBatchName =
              item.isBatch === "0" ? "否" : item.isBatch === "1" ? "是" : "";
            item.isCheckName = item.isCheck ? "否" : "是";
            item.planDate1 = formatDate(item.planDate, "yyyy-MM-dd");
            item.testTime1 = formatDate(item.testTime, "HH:mm:ss");
          });
          this.page.totalPage = res.data.total;
          if (this.table.list.length > 0) {
            this.$refs.dataTable.setCurrentRow(this.table.list[0]);
            this.searchFollow(this.table.list[0]);
          }
        })
        .catch((e) => {
          this.dataLoading = false;
        });
    },
    //提取分析项目
    extract() {
      if (JSON.stringify(this.saveRow) === "{}") {
        this.$message.warning("请先点击选中一条固定计划信息数据");
        return;
      }
      if (this.saveRow.stateFlag == 1) {
        this.$message.warning("数据已提交，不可进行操作");
        return;
      }
      this.extractLoading = true;
      this.axios
        .get(
          "pass/testManagement/v1/limstestplands/batchsaveLimsPlanDByMatNo",
          {
            params: { matNo: this.saveRow.matNo, planId: this.saveRow.planId },
          },
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success(res.message);
            this.depData(this.saveRow.planId);
          } else {
            this.$message.error(res.message);
          }
          this.extractLoading = false;
        })
        .catch((e) => {
          this.extractLoading = false;
          this.$message.error(e.message);
        });
    },
    //维护上下限
    upperLower() {
      if (JSON.stringify(this.saveRow) === "{}") {
        this.$message.warning("请先点击选中一条固定计划信息数据");
        return;
      }
      if (JSON.stringify(this.planSave) == "{}") {
        this.$message.warning("请先点击选中一条分析项目数据");
        return;
      }
      this.upperLowerData = { ...this.planSave };
      this.upperLowerTableVisible = true;
    },
    searchFollow(row) {
      this.saveRow = row;
      this.page2.pageNum = 1;
      this.page2.pageSize = 50;
      this.depData(this.saveRow.planId);
    },
    depData(planId) {
      this.planSave = {};
      this.dataLoading2 = true;
      let planIds = planId ? planId : "";
      this.axios
        .post(
          "pass/testManagement/v1/limstestplands/queryLimsTestPlanDByPlanId?planId=" +
            planIds,
          { individualType: "json" }
        )
        .then((res) => {
          this.dataLoading2 = false;
          this.table.list2 = res.data;
          this.table.list2.forEach((item) => {
            item.validFlag1 =
              item.validFlag === "0"
                ? "无效"
                : item.validFlag === "1"
                ? "有效"
                : "";
          });
          this.page2.totalPage = res.data.total;
        })
        .catch((e) => {
          this.dataLoading2 = false;
        });
    },
    reset() {
      this.search.planYear = new Date();
      this.search.planCompanyNo = "";
      this.search.planDeptNo = "";
      this.search.matName = "";
      this.searchData();
    },
    handleSelectionChange(val) {
      this.multipleSelection3 = val;
      if (val.length > 0) {
        this.$refs.dataTable.setCurrentRow(val[val.length - 1]);
        this.saveRow = val[val.length - 1];
        this.depData(this.saveRow.planId);
      }
    },
    pageSizeChange(size) {
      this.page.pageSize = size;
      this.mainData();
    },
    pageCurrentChange(index) {
      this.page.pageNum = index;
      this.mainData();
    },
    handleSelectionChange2(val) {
      this.multipleSelection4 = val;
    },
    pageSizeChange2(size) {
      this.page2.pageSize = size;
    },
    pageCurrentChange2(index) {
      this.page2.pageNum = index;
    },
    // 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);
      });
    },
    tableRowClassName({ row, rowIndex }) {
      if (row.validFlag !== "1") {
        return "error-row";
      }
      return "";
    },
    tableCellClassName({ row, column, rowIndex, columnIndex }) {
      // if (columnIndex === 29) {
      // if (row.validFlag !== '1') {
      //   return 'error-row';
      // }
      // return '';
      // }
      if (columnIndex === 2) {
        if (row.stateFlag === "1") {
          return "error-green";
        }
        return "";
      }
    },
    tableRowClassName2({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 7) {
        if (row.validFlag !== "1") {
          return "error-row";
        }
        return "";
      }
      if (columnIndex === 1) {
        if (row.memo == "已新增") {
          return "error-green";
        }
      }
      // if (columnIndex === 10 || columnIndex === 9) {
      //   return 'erroe-bule2'
      // }
      // if (columnIndex === 12) {
      // if (Date.parse(row.startTime) > new Date ()) {
      //   return 'error-green2';
      // }
      // return '';
      // }
      // if (columnIndex === 13) {
      // if (Date.parse(row.endTime) < new Date ()) {
      //   return 'error-yellow2';
      // }
      // return '';
      // }
    },
    tableHeaderCellStyle() {
      return "color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;";
    },
  },
};
</script>
<style scoped></style>
<style lang="less">
.fixedScheduleManagement {
  .common-table-div {
    .el-table .el-table__body tr.error-row {
      background-color: rgb(253, 89, 89) !important;
    }
    .el-table .el-table__body tr.error-row > td {
      background-color: rgb(253, 89, 89) !important;
    }
  }
}
</style>
