<template>
  <div class="mod-config">
    <!-- 条件查询 -->
    <el-form :inline="true" label-position="top" :model="searchData">
      <!-- <el-form-item label="BU">
        <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px">
          <el-option
            v-for = "i in userBuList"
            :key = "i.buNo"
            :label = "i.buDesc"
            :value = "i.buDesc">
          </el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="项目编码">
        <el-input v-model="searchData.itemNo" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item label="项目名称">
        <el-input v-model="searchData.itemDesc" clearable style="width: 200px"></el-input>
      </el-form-item>
      <el-form-item label="检验类型">
        <el-select v-model="searchData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" placeholder="请选择" style="width: 100px">
          <el-option v-if="!lineInspectionRoleFlag" label="全部" value=""></el-option>
          <el-option
            v-for = "i in options"
            :key = "i.inspectionTypeNo"
            :label = "i.inspectionTypeName"
            :value = "i.inspectionTypeNo">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label=" ">
        <el-button v-if="authSearch" type="primary" @click="getDataList()">查询</el-button>
        <el-button v-if="authSave" type="primary" @click="addModal()">新增</el-button>
      </el-form-item>
      <el-form-item label=" ">
        <el-button type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>
        <download-excel
          :fields="fields()"
          :data="exportData"
          type="xls"
          :name="exportName"
          :header="exportHeader"
          :footer="exportFooter"
          :fetch="createExportData"
          :before-generate="startDownload"
          :before-finish="finishDownload"
          worksheet="导出信息"
          class="el-button el-button--primary el-button--medium">
          {{ "导出" }}
        </download-excel>
      </el-form-item>
    </el-form>

    <!-- 展示列表 -->
    <el-table
      :height="height"
      :data="dataList"
      border
      style="width: 100%;">
      <el-table-column
        v-for="(item,index) in columnList" :key="index"
        :sortable="item.columnSortable"
        :prop="item.columnProp"
        :header-align="item.headerAlign"
        :show-overflow-tooltip="item.showOverflowTooltip"
        :align="item.align"
        :fixed="item.fixed == '' ? false : item.fixed"
        :min-width="item.columnWidth"
        :label="item.columnLabel">
        <template slot-scope="scope">
          <span v-if="!item.columnHidden">
            <span v-if="columnsProp.includes(item.columnProp)">{{ scope.row[`${item.columnProp}Desc`] }}</span>
            <span v-else>
              {{ scope.row[item.columnProp] }}
            </span>
          </span>
          <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="160"
        label="操作">
        <template slot-scope="scope">
          <a v-if="authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a>
          <a v-if="authDelete" type="text" size="small" @click="deleteModal(scope.row)">删除</a>
          <!-- <a type="text" size="small" @click="itemObjectModal(scope.row)">采集设备配置</a> -->
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[20, 50, 100, 200, 500]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>

    <!-- 新增和修改 -->
    <el-dialog title="检验项目" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="500px">
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <!-- <el-form-item label="BU" prop="bu" :rules="rules.bu">
          <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" @change="buChangeFunction" style="width: 456px">
            <el-option
              v-for = "i in userBuList"
              :key = "i.buNo"
              :label = "i.sitename"
              :value = "i.buNo">
              <span style="float: left;width: 100px">{{ i.sitename }}</span>
              <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
                {{ i.buDesc }}
              </span>
            </el-option>
          </el-select>
        </el-form-item> -->
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目名称" prop="itemDesc" :rules="rules.itemDescType">
          <el-input v-model="modalData.itemDesc" style="width: 143px"></el-input>
        </el-form-item>
        <el-form-item label="检验值类型" prop="valueTypeDb" :rules="rules.valueTypeDbType">
          <el-select filterable v-model="modalData.valueTypeDb" style="width: 143px">
            <el-option label="文本" value="T"></el-option>
            <el-option label="数字" value="N"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="检验类型" prop="inspectionTypeNo" :rules="rules.inspectionTypeNoType">
          <el-select v-model="modalData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" placeholder="请选择" style="width: 143px">
            <el-option
              v-for = "i in options"
              :key = "i.inspectionTypeNo"
              :label = "i.inspectionTypeName"
              :value = "i.inspectionTypeNo">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item prop="methodNo" :rules="rules.methodNoType">
          <span slot="label" @click="queryMethodList"><a>方法编码</a></span>
          <el-input v-model="modalData.methodNo" style="width: 143px"></el-input>
        </el-form-item>
        <el-form-item label="方法名称" prop="methodName" :rules="rules.methodNameType">
          <el-input v-model="modalData.methodName" disabled style="width: 300px"></el-input>
        </el-form-item>
      </el-form>
      <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item>
          <span slot="label" @click="getBaseList(207)"><a herf="#">抽样方案编码</a></span>
          <el-input v-model="modalData.samplingProgrammeNo" style="width: 143px"></el-input>
        </el-form-item>
        <el-form-item label="抽样方案名称">
          <el-input v-model="modalData.samplingProgrammeDesc" disabled style="width: 300px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item>
          <span slot="label" @click="getBaseList(208)"><a herf="#">检验水平编码</a></span>
          <el-input v-model="modalData.samplingLevelNo" style="width: 143px"></el-input>
        </el-form-item>
        <el-form-item label="检验水平名称">
          <el-input v-model="modalData.samplingLevelDesc" disabled style="width: 300px"></el-input>
        </el-form-item>
      </el-form> -->
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="参照值">
          <el-input v-model="modalData.defaultValue" style="width: 143px"></el-input>
        </el-form-item>
        <el-form-item label="最大值">
          <el-input v-if="modalData.valueTypeDb === 'T'" v-model="modalData.maxValue" type="number" disabled style="width: 143px"></el-input>
          <el-input v-if="modalData.valueTypeDb === 'N'" v-model="modalData.maxValue" type="number" style="width: 143px"></el-input>
        </el-form-item>
        <el-form-item label="最小值">
          <el-input v-if="modalData.valueTypeDb === 'T'" v-model="modalData.minValue" type="number" disabled style="width: 143px"></el-input>
          <el-input v-if="modalData.valueTypeDb === 'N'" v-model="modalData.minValue" type="number" style="width: 143px"></el-input>
        </el-form-item>
      </el-form>
<!--      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">-->
<!--        <el-form-item label="抽样数量">-->
<!--          <el-input v-model="modalData.itemSamplingQuantity" type="number" style="width: 143px"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="抽样比例%">-->
<!--          <el-input v-model="modalData.defaultSamplingProportion" type="number" style="width: 143px"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-form>-->
      <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="采集数据来源">
          <el-select multiple collapse-tags v-model="modalData.collectionSourceList" style="width: 220px">
            <el-option label="采集数据01" value="value0"></el-option>
            <el-option label="采集数据02" value="value1"></el-option>
            <el-option label="采集数据03" value="value2"></el-option>
            <el-option label="采集数据04" value="value3"></el-option>
            <el-option label="采集数据05" value="value4"></el-option>
            <el-option label="采集数据06" value="value5"></el-option>
            <el-option label="采集数据07" value="value6"></el-option>
            <el-option label="采集数据08" value="value7"></el-option>
            <el-option label="采集数据09" value="value8"></el-option>
            <el-option label="采集数据10" value="value9"></el-option>
            <el-option label="图片采集" value="photo_value1"></el-option>
            <el-option label="文件采集" value="file_value1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="采集数据方式">
          <el-select multiple collapse-tags v-model="modalData.collectionMethodList" style="width: 220px">
            <el-option label="PLC数据" value="plc"></el-option>
            <el-option label="RS232" value="RS232"></el-option>
            <el-option label="文件数据" value="file"></el-option>
            <el-option label="图片路径" value="image"></el-option>
            <el-option label="文件路径" value="fileUrl"></el-option>
            <el-option label="胶厚采集" value="thickness"></el-option>
          </el-select>
        </el-form-item>
      </el-form> -->
      <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="采集数据内容">
          <el-select v-model="modalData.collectionDataContent" clearable style="width: 456px">
            <el-option
              v-for = "i in dataContentList"
              :key = "i.contentDesc"
              :label = "i.contentDesc"
              :value = "i.contentDesc">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form> -->
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="saveData()">保存</el-button>
        <el-button type="primary" @click="modalFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 检验方法 -->
    <el-dialog title="检验方法清单" :close-on-click-modal="false" v-drag :visible.sync="methodModelFlag" width="520px">
      <div class="rq">
        <el-form :inline="true" label-position="top" :model="methodData">
          <el-form-item :label="'方法编码'">
            <el-input v-model="methodData.methodNo" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="'方法名称'">
            <el-input v-model="methodData.methodName" clearable style="width: 120px"></el-input>
          </el-form-item>
<!--          <el-form-item :label="'检验类型'">-->
<!--            <el-select v-model="methodData.inspectionTypeNo" style="width: 100px">-->
<!--              <el-option-->
<!--                v-for = "i in options"-->
<!--                :key = "i.inspectionTypeNo"-->
<!--                :label = "i.inspectionTypeName"-->
<!--                :value = "i.inspectionTypeNo">-->
<!--              </el-option>-->
<!--            </el-select>-->
<!--          </el-form-item>-->
          <el-form-item :label="' '">
            <el-button type="primary" @click="queryMethodList">查询</el-button>
          </el-form-item>
        </el-form>
        <el-table
          :height="300"
          :data="methodList"
          @row-dblclick="getRowData"
          border
          style="width: 100%;">
          <el-table-column
            v-for="(item,index) in methodDetailList" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed==''?false:item.fixed"
            :min-width="item.columnWidth"
            :label="item.columnLabel">
            <template slot-scope="scope">
              <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
              <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="methodModelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 设备-> 快速新增 -->
    <el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="objectModelFlag" width="900px">
      <div style="font-size: 12px">
        <el-form :inline="true" label-position="top" :model="objectData">
          <el-form-item :label="'设备编码'">
            <el-input v-model="objectData.objectID" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="'设备名称'">
            <el-input v-model="objectData.objectDesc" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="' '">
            <el-button type="primary" @click="getObjectList">查询</el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-container style="margin-top: 0px;">
        <el-main style="width: 350px; padding: 1px">
          <span style="font-size: 12px" >可选设备:</span>
          <el-table
            height="400px"
            :data="objectList1"
            border
            ref="objectTable1"
            @row-click="objectClickRow1"
            @selection-change="selectionObject1"
            highlight-current-row
            style="width: 100%">
            <el-table-column
              type="selection"
              header-align="center"
              align="center"
              width="50">
            </el-table-column>
            <el-table-column
              prop="objectID"
              header-align="center"
              align="center"
              min-width="80"
              label="设备编码">
            </el-table-column>
            <el-table-column
              prop="objectDesc"
              header-align="center"
              align="center"
              min-width="120"
              label="设备名称">
            </el-table-column>
          </el-table>
        </el-main>
        <el-main style="width: 111px;padding: -1px">
          <div style="margin-top: 182px;margin-left: 18px">
            <el-button type="primary" @click="addObject">添加>></el-button>
          </div>
          <div style="margin-top: 15px;margin-left: 18px">
            <el-button type="primary" @click="deleteObject">删除<<</el-button>
          </div>
        </el-main>
        <el-main style="width: 350px;padding: 1px">
          <span style="font-size: 12px" >已有设备:</span>
          <el-table
            height="400px"
            :data="objectList2"
            border
            ref="objectTable2"
            @row-click="objectClickRow2"
            @selection-change="selectionObject2"
            highlight-current-row
            style="width: 100%">
            <el-table-column
              type="selection"
              header-align="center"
              align="center"
              width="50">
            </el-table-column>
            <el-table-column
              prop="objectID"
              header-align="center"
              align="center"
              min-width="80"
              label="设备编码">
            </el-table-column>
            <el-table-column
              prop="objectDesc"
              header-align="center"
              align="center"
              min-width="120"
              label="设备名称">
            </el-table-column>
            <el-table-column
              header-align="center"
              align="center"
              min-width="50"
              label="默认">
              <template slot-scope="{row}">
                <el-checkbox v-model="row.defaultFlag" true-label="Y" @change="(val)=>defaultChange(row)" false-label="N"></el-checkbox>
              </template>
            </el-table-column>
          </el-table>
        </el-main>
      </el-container>
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="updateItemObject">保存</el-button>
        <el-button type="primary" @click="objectModelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <Chooselist ref="baseList"  @getBaseData="getBaseData"></Chooselist>

    <!-- 导入 -->
    <qcUpload ref="qcUpload" @refreshPageTables="getDataList()" v-drag></qcUpload>
  </div>
</template>

<script>
  import {
    qcItemSearch, // 查询项目
    qcItemSave, // 新增项目
    qcItemUpdate, // 修改项目
    qcItemDelete, // 删除项目
    inspectionTypeSearch, // 查询检验类型
    queryMethodList, // 查询检验方法
    getSiteAndBuByUserName,
    getEquipmentNoList, // 获取采集条件路径
    getDataContentList, // 获取采集数据内容
    getObjectList, // 获取设备列表
    getObjectListBy,
    addItemObject, // 新增项目设备
    deleteItemObject, // 删除项目设备
    updateItemObject, // 修改项目设备
  } from "@/api/qc/qc.js"
  import { buildQcBu } from './qcBuUtils'
  import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  import Chooselist from '@/views/modules/common/Chooselist_eam'
  import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  import qcUpload from "./qc_upload"
  export default {
    components: {
      Chooselist,
      qcUpload
    },
    watch: {
      searchData: {
        deep: true,
        handler: function (newV, oldV) {
          this.searchData.itemNo = this.searchData.itemNo.toUpperCase()
        }
      },
      modalData: {
        deep: true,
        handler: function (newV, oldV) {
          this.modalData.itemNo = this.modalData.itemNo.toUpperCase()
        }
      },
    },
    data () {
      return {
        columnsProp:['createdBy', 'updateBy'],
        // 是否收藏
        favorite: false,
        // 导出 start
        exportData: [],
        exportName: "检验项目" + this.dayjs().format('YYYYMMDDHHmmss'),
        exportHeader: ["检验项目"],
        exportFooter: [],
        exportList: [],
        // 导出 end
        searchData: {
          site: this.$store.state.user.site,
          userName: this.$store.state.user.name,
          itemNo: '',
          itemDesc: '',
          itemType: 'D',
          inspectionTypeNo: '',
          buDesc: '',
          page: 1,
          limit: 10,
        },
        pageIndex: 1,
        pageSize: 20,
        totalPage: 0,
        height: 200,
        dataList: [],
        modalFlag: false,
        modalDisableFlag: false,
        modalData: {
          site: '',
          bu: '',
          flag: '',
          itemNo: '',
          itemDesc: '',
          valueTypeDb: '',
          defaultValue: '',
          createdBy: this.$store.state.user.name,
          maxValue: '',
          minValue: '',
          itemRemark: '',
          itemType: 'D',
          methodNo: '',
          methodName: '',
          updateBy: '',
          inspectionTypeNo: '',
          itemSamplingQuantity: '',
          samplingProgrammeNo: '',
          samplingProgrammeDesc: '',
          samplingLevelNo: '',
          samplingLevelDesc: '',
          defaultSamplingProportion: '',
          collectionFlag: '',
          collectionSource: '',
          collectionSourceList: [],
          collectionMethod: '',
          collectionMethodList: [],
          collectionCondition: '',
          collectionConditionList: [],
          collectionDataContent: ''
        },
        // 检验项目展示标头
        columnList: [
          // {
          //   userId: this.$store.state.user.name,
          //   functionId: 301002,
          //   serialNumber: '301002TableBuDesc',
          //   tableId: "301002Table",
          //   tableName: "检验项目维护表",
          //   columnProp: 'buDesc',
          //   headerAlign: 'center',
          //   align: "center",
          //   columnLabel: 'BU',
          //   columnHidden: false,
          //   columnImage: false,
          //   columnSortable: false,
          //   sortLv: 0,
          //   status: true,
          //   fixed: '',
          //   columnWidth: 100,
          // },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableItemNo',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'itemNo',
            headerAlign: 'center',
            align: "center",
            columnLabel: '检验项目编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableItemDesc',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'itemDesc',
            headerAlign: 'center',
            align: "left",
            columnLabel: '检验项目名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableMethodName',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'methodName',
            headerAlign: 'center',
            align: "left",
            columnLabel: '检验方法',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableMethodRemark',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'methodRemark',
            headerAlign: 'center',
            align: "left",
            columnLabel: '检验方法说明',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableValueType',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'valueType',
            headerAlign: 'center',
            align: "center",
            columnLabel: '检验值类型',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableInspectionTypeName',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'inspectionTypeName',
            headerAlign: 'center',
            align: "center",
            columnLabel: '检验类型',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableDefaultValue',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'defaultValue',
            headerAlign: 'center',
            align: "right",
            columnLabel: '标准值',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableMaxValue',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'maxValue',
            headerAlign: 'center',
            align: "right",
            columnLabel: '最大值',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableMinValue',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'minValue',
            headerAlign: 'center',
            align: "right",
            columnLabel: '最小值',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          /*{
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableSamplingProgrammeDesc',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'samplingProgrammeDesc',
            headerAlign: 'center',
            align: "left",
            columnLabel: '抽样方案',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableSamplingLevelDesco',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'samplingLevelDesc',
            headerAlign: 'center',
            align: "left",
            columnLabel: '检验水平',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },*/
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableItemSamplingQuantity',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'itemSamplingQuantity',
            headerAlign: 'center',
            align: "right",
            columnLabel: '抽样数量',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableDefaultSamplingProportion',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'defaultSamplingProportion',
            headerAlign: 'center',
            align: "right",
            columnLabel: '抽样比例',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableCreatedDate',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'createdDate',
            headerAlign: 'center',
            align: "center",
            columnLabel: '创建时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 170,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableCreatedBy',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'createdBy',
            headerAlign: 'center',
            align: "center",
            columnLabel: '创建人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableUpdateDate',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'updateDate',
            headerAlign: 'center',
            align: "center",
            columnLabel: '更新时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 170,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301002,
            serialNumber: '301002TableUpdateBy',
            tableId: "301002Table",
            tableName: "检验项目维护表",
            columnProp: 'updateBy',
            headerAlign: 'center',
            align: "center",
            columnLabel: '更新人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
        ],
        rules: {
          itemDescType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          valueTypeDbType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          methodNoType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          methodNameType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          inspectionTypeNoType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          bu:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ]
        },
        options: [],
        methodData: {
          site: '',
          bu: '',
          methodNo: '',
          methodName: '',
          inspectionTypeNo: '',
          inspectionTypeName: ''
        },
        methodList: [],
        methodModelFlag: false,
        methodDetailList: [
          {
            columnProp: 'methodNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '方法编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'methodName',
            headerAlign: "center",
            align: "center",
            columnLabel: '方法名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'inspectionTypeName',
            headerAlign: "center",
            align: "center",
            columnLabel: '检验类型',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
        ],
        userBuList: [],
        equipmentNoList: [],
        authSearch: false,
        authSave: false,
        authUpdate: false,
        authDelete: false,
        lineInspectionRoleFlag: false,
        pqcInspectionTypeNo: '108',
        menuId: this.$route.meta.menuId,
        dataContentList: [],
        objectSelections1: [],
        objectSelections2: [],
        objectList1: [],
        objectList2: [],
        objectData: {
          site: '',
          buNo: '',
          itemNo: '',
          objectID: '',
          objectDesc: '',
        },
        objectModelFlag: false
      }
    },

    mounted () {
      this.$nextTick(() => {
        this.height = window.innerHeight - 180
      })
    },

    created () {
      // 按钮控制
      this.getButtonAuthData()
      // 当前用户是否包含换线点检角色
      this.lineInspectionRoleFlag = this.resolveLineInspectionRoleFlag()
      // 获取用户的 site 和 bu
      this.getSiteAndBuByUserName()
      // 校验用户是否收藏
      this.favoriteIsOk()
      // 获取检验类型
      this.inspectionTypeSearch()
      // 动态列
      this.getTableUserColumn(this.$route.meta.menuId+'table',1)
      if (this.authSearch) {
        // 获取数据列表
        this.getDataList()
      }
    },

    methods: {
      // 默认设备
      defaultChange (row) {
        this.objectList2 = this.objectList2.map(val => {
          if (val.objectID === row.objectID) {
            return val
          }
          val.defaultFlag = 'N'
          return val
        })
      },

      // 绑定项目的设备
      itemObjectModal (row) {
        this.objectSelections1 = null
        this.objectSelections2 = null
        getObjectList(row).then(({data}) => {
          this.objectList1 = data.row1
          this.objectList2 = data.row2
        })
        this.objectData = {
          site: row.site,
          buNo: row.buNo,
          itemNo: row.itemNo,
          objectID: '',
          objectDesc: '',
        }
        this.objectModelFlag = true
      },

      // 选择设备
      getObjectList () {
        // 查询所有设备
        getObjectListBy(this.objectData).then(({data}) => {
          if (data && data.code === 0) {
            this.objectList1 = data.rows
          } else {
            this.objectList1 = []
          }
        })
      },

      // 可选设备
      objectClickRow1 (row) {
        this.$refs.objectTable1.toggleRowSelection(row)
      },

      // 已有设备
      objectClickRow2 (row) {
        this.$refs.objectTable2.toggleRowSelection(row)
      },

      selectionObject1 (val) {
        this.objectSelections1 = val
      },

      selectionObject2 (val) {
        this.objectSelections2 = val
      },

      // 新增项目设备
      addObject () {
        if (this.objectSelections1 == null || this.objectSelections1.length === 0) {
          this.$message.warning('请选择可选设备！')
          return
        }
        let inData = {
          site: this.objectData.site,
          buNo: this.objectData.buNo,
          itemNo: this.objectData.itemNo,
          objectList: this.objectSelections1
        }
        addItemObject(inData).then(({data}) => {
          if (data && data.code === 0) {
            getObjectList(this.objectData).then(({data}) => {
              this.objectList1 = data.row1
              this.objectList2 = data.row2
            })
            this.objectSelections1 = []
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 删除项目设备
      deleteObject () {
        if(this.objectSelections2 == null || this.objectSelections2.length === 0){
          this.$message.warning('请选择已有代理商！')
          return
        }
        let inData = {
          site: this.objectData.site,
          buNo: this.objectData.buNo,
          itemNo: this.objectData.itemNo,
          objectList: this.objectSelections2
        }
        deleteItemObject(inData).then(({data}) => {
          if (data && data.code === 0) {
            getObjectList(this.objectData).then(({data}) => {
              this.objectList1 = data.row1
              this.objectList2 = data.row2
            })
            this.objectSelections2 = []
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 修改项目设备
      updateItemObject () {
        let inData = {
          site: this.objectData.site,
          buNo: this.objectData.buNo,
          itemNo: this.objectData.itemNo,
          objectList: this.objectList2
        }
        updateItemObject(inData).then(({data}) => {
          if (data && data.code === 0) {
            this.getDataList()
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {}
            })
            this.objectModelFlag = false
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 获取用户的bu
      getSiteAndBuByUserName () {
        let tempData = {
          username: this.$store.state.user.name,
          site: this.$store.state.user.site,
        }
        getSiteAndBuByUserName(tempData).then(({data}) => {
          if (data.code === 0) {
            this.userBuList = data.rows
          }
        })
      },

      // 是否包含换线点检角色
      resolveLineInspectionRoleFlag () {
        return this.$store.state.user.lineInspectionRoleFlag === true || localStorage.getItem('lineInspectionRoleFlag') === 'Y'
      },

      // 获取PQC对应的检验类型编码
      getPqcInspectionTypeNo () {
        const pqcData = this.options.find(item => item.inspectionTypeName && item.inspectionTypeName==='PQC')
        if (pqcData) {
          this.pqcInspectionTypeNo = pqcData.inspectionTypeNo
        }
        return this.pqcInspectionTypeNo
      },

      // 换线点检角色仅允许PQC
      applyPqcInspectionTypeLimit () {
        if (!this.lineInspectionRoleFlag) {
          return
        }
        const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
        this.searchData.inspectionTypeNo = pqcInspectionTypeNo
        this.modalData.inspectionTypeNo = pqcInspectionTypeNo
        this.methodData.inspectionTypeNo = pqcInspectionTypeNo
      },

      // bu改变事件
      buChangeFunction () {
        //this.modalData.collectionConditionList = []
        this.modalData.collectionDataContent = ''
        //this.getEquipmentNoList()
        this.getDataContentList()
      },

      // 获取采集条件路径
      getEquipmentNoList () {
        let tempData = {
          bu: this.modalData.bu
        }
        getEquipmentNoList(tempData).then(({data}) => {
          if (data.code === 0) {
            this.equipmentNoList = data.rows
          }
        })
      },

      // 获取采集数据内容
      getDataContentList () {
        let tempData = {
          bu: this.modalData.bu
        }
        getDataContentList(tempData).then(({data}) => {
          if (data.code === 0) {
            this.dataContentList = data.rows
          }
        })
      },

      // 获取基础数据列表S
      getBaseList (val,type) {
        this.tagNo = val
        this.$nextTick(() => {
          let strVal = ''
          let conSql = ''
          if (this.modalData.bu === null || this.modalData.bu === '') {
            this.$message.warning("请选择BU!")
            return
          } else {
            conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '*'"
          }
          if (val === 207) {
            strVal = this.modalData.samplingProgrammeNo
          }
          if (val === 208) {
            strVal = this.modalData.samplingLevelNo
          }
          if (val === 1036) {
            strVal = this.modalData.methodNo
            conSql = ''
          }
          this.$refs.baseList.init(val, strVal, conSql)
        })
      },

      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },

      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },

      // 查询检验类型
      inspectionTypeSearch () {
        let tempData = {
          site: this.$store.state.user.site
        }
        inspectionTypeSearch(tempData).then(({data}) => {
          if (data.code === 0) {
            this.options = data.rows
            if (this.lineInspectionRoleFlag) {
              const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
              this.options = this.options.filter(item => item.inspectionTypeNo === pqcInspectionTypeNo)
              this.searchData.inspectionTypeNo = pqcInspectionTypeNo
              this.modalData.inspectionTypeNo = pqcInspectionTypeNo
              this.methodData.inspectionTypeNo = pqcInspectionTypeNo
            }
          }
        })
      },

      // 列表方法的回调
      getBaseData (val) {
        if (this.tagNo === 1036) {
          this.modalData.methodNo = val.method_no
          this.modalData.methodName = val.method_name
        }
        if (this.tagNo === 207) {
          this.modalData.samplingProgrammeNo = val.sampling_programme_no
          this.modalData.samplingProgrammeDesc = val.sampling_programme_desc
        }
        if (this.tagNo === 208) {
          this.modalData.samplingLevelNo = val.sampling_level_no
          this.modalData.samplingLevelDesc = val.sampling_level_desc
        }
      },

      // 获取数据列表
      getDataList () {
        this.applyPqcInspectionTypeLimit()
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        qcItemSearch(this.searchData).then(({data}) => {
          this.dataList = data.page.list
          this.pageIndex = data.page.currPage
          this.pageSize = data.page.pageSize
          this.totalPage = data.page.totalCount
        })
      },

      addModal () {
        this.modalData = {
          flag: '1',
          site: '',
          bu: this.userBuList[0].buNo,
          createdBy: this.$store.state.user.name,
          itemNo: '',
          itemDesc: '',
          valueTypeDb: 'T',
          defaultValue: '',
          maxValue: '',
          minValue: '',
          itemRemark: '',
          itemType: 'D',
          methodNo: '',
          methodName: '',
          updateBy: '',
          inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : '',
          itemSamplingQuantity: '',
          samplingProgrammeNo: '',
          samplingProgrammeDesc: '',
          samplingLevelNo: '',
          samplingLevelDesc: '',
          defaultSamplingProportion: '',
          collectionFlag: '',
          collectionSource: '',
          collectionSourceList: [],
          collectionMethod: '',
          collectionMethodList: [],
          collectionCondition: '',
          collectionConditionList: [],
          collectionDataContent: ''
        }
        // 获取采集条件路径
        this.getEquipmentNoList()
        // 获取采集数据内容
        this.getDataContentList()
        this.modalDisableFlag = false
        this.modalFlag = true
      },

      updateModal (row) {
        this.modalData = {
          flag: '2',
          bu: buildQcBu(row.site),
          site: row.site,
          itemNo: row.itemNo,
          itemDesc: row.itemDesc,
          valueTypeDb: row.valueTypeDb,
          defaultValue: row.defaultValue,
          createdBy: this.$store.state.user.name,
          maxValue: row.maxValue,
          minValue: row.minValue,
          itemRemark: row.itemRemark,
          itemType: 'D',
          methodNo: row.methodNo,
          methodName: row.methodName,
          updateBy: this.$store.state.user.name,
          inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : row.inspectionTypeNo,
          itemSamplingQuantity: row.itemSamplingQuantity,
          samplingProgrammeNo: row.samplingProgrammeNo,
          samplingProgrammeDesc: row.samplingProgrammeDesc,
          samplingLevelNo: row.samplingLevelNo,
          samplingLevelDesc: row.samplingLevelDesc,
          defaultSamplingProportion: row.defaultSamplingProportion,
          collectionFlag: row.collectionFlag,
          collectionSource: row.collectionSource,
          collectionSourceList: row.collectionSource == null || row.collectionSource === '' ? [] : row.collectionSource.split(','),
          collectionMethod: row.collectionMethod,
          collectionMethodList: row.collectionMethod == null || row.collectionMethod === '' ? [] : row.collectionMethod.split(','),
          collectionCondition: row.collectionCondition,
          collectionConditionList: row.collectionCondition == null || row.collectionCondition === '' ? [] : row.collectionCondition.split(','),
          collectionDataContent: row.collectionDataContent
        }
        // 获取采集条件路径
        this.getEquipmentNoList()
        // 获取采集数据内容
        this.getDataContentList()
        this.modalDisableFlag = true
        this.modalFlag = true
      },

      // 删除
      deleteModal (row) {
        this.$confirm(`是否删除这个检验项目?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          qcItemDelete(row).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }).catch(() => {
        })
      },

      saveData () {
        this.applyPqcInspectionTypeLimit()
        if (this.modalData.bu === '' || this.modalData.bu == null) {
          this.$message.warning('请选择BU！')
          return
        }
        if (this.modalData.itemDesc === '' || this.modalData.itemDesc == null) {
          this.$message.warning('请输入检验项目名称！')
          return
        }
        if (this.modalData.valueTypeDb === '' || this.modalData.valueTypeDb == null) {
          this.$message.warning('请选择检验值类型！')
          return
        }
        if (this.modalData.inspectionTypeNo === '' || this.modalData.inspectionTypeNo == null) {
          this.$message.warning('请选择检验类型！')
          return
        }
        if (this.modalData.methodNo === '' || this.modalData.methodNo == null) {
          this.$message.warning('请选择检验方法！')
          return
        }
        if ((this.modalData.samplingProgrammeNo !== '' && this.modalData.samplingProgrammeNo != null) && (this.modalData.samplingLevelNo === '' || this.modalData.samplingLevelNo == null)) {
          this.$message.warning('请选择检验水平！')
          return
        }
        if (this.modalData.collectionFlag === 'Y' && (this.modalData.collectionSourceList == null || this.modalData.collectionSourceList.length === 0)) {
          this.$message.warning('请选择采集数据来源！')
          return
        }
        if (this.modalData.collectionFlag === 'Y' && (this.modalData.collectionMethodList == null || this.modalData.collectionMethodList.length === 0)) {
          this.$message.warning('请选择采集数据方式！')
          return
        }
        if (this.modalData.collectionFlag === 'Y' && (this.modalData.collectionMethodList.some(value => value === 'file') && this.modalData.collectionMethodList.some(value => value === 'plc'))) {
          this.$message.warning('文件数据采集和PLC数据采集只能选一个！')
          return
        }
        this.modalData.collectionSource = this.modalData.collectionSourceList.join(',')
        this.modalData.collectionMethod = this.modalData.collectionMethodList.join(',')
        //this.modalData.collectionCondition = this.modalData.collectionConditionList.join(',')
        if (this.modalData.flag === '1') {
          qcItemSave(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.modalFlag = false
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        } else {
          qcItemUpdate(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.modalFlag = false
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }
      },

      // 获取检验方法列表
      queryMethodList () {
        this.methodData.bu = this.modalData.bu
        this.methodData.inspectionTypeNo = this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : this.modalData.inspectionTypeNo
        queryMethodList(this.methodData).then(({data}) => {
          if (data && data.code === 0) {
            this.methodList = data.rows
            this.methodModelFlag = true
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 选中检验方法
      getRowData (row) {
        this.modalData.methodNo = row.methodNo
        this.modalData.methodName = row.methodName
        this.methodModelFlag = false
      },

      // 校验用户是否收藏
      favoriteIsOk () {
        let userFavorite = {
          userId: this.$store.state.user.id,
          languageCode: this.$i18n.locale
        }
        userFavoriteList(userFavorite).then(({data}) => {
          for (let i = 0; i < data.list.length; i++) {
            if (this.$route.meta.menuId === data.list[i].menuId) {
              this.favorite = true
            }
          }
        })
      },

      // 收藏 OR 取消收藏
      favoriteFunction () {
        let userFavorite = {
          userId: this.$store.state.user.id,
          functionId: this.$route.meta.menuId,
        }
        if (this.favorite) {
          removeUserFavorite(userFavorite).then(({data}) => {
            this.$message.success(data.msg)
            this.favorite = false
          })
        } else {
          // 收藏
          saveUserFavorite(userFavorite).then(({data}) => {
            this.$message.success(data.msg)
            this.favorite = true
          })
        }
      },

      //导出excel
      async createExportData() {
        this.applyPqcInspectionTypeLimit()
        this.searchData.limit = -1
        this.searchData.page = 1
        await qcItemSearch(this.searchData).then(({data}) => {
          this.exportList= data.page.list;
        })
        return this.exportList;
      },

      startDownload() {},

      finishDownload() {},

      fields () {
        let json = "{"
        this.columnList.forEach((item, index) => {
          if (index == this.columnList.length - 1) {
            json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
          } else {
            json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
          }
        })
        json += "}"
        let s = eval("(" + json + ")")
        return s
      },

      // 导入
      qcUpload () {
        let currentData = {
          flag: 'item',
          createBy: this.$store.state.user.name,
          site: this.$store.state.user.site,
        }
        //打开组件 去做新增业务
        this.$nextTick(() => {
          this.$refs.qcUpload.init(currentData)
        })
      },

      // 动态列开始 获取 用户保存的 格式列
      async getTableUserColumn (tableId, columnId) {
        let queryTableUser = {
          userId: this.$store.state.user.name,
          functionId: this.$route.meta.menuId,
          tableId: tableId,
          status: true,
          languageCode: this.$i18n.locale
        }
        await getTableUserListLanguage(queryTableUser).then(({data}) => {
          if (data.rows.length > 0) {
            //this.columnList1 = []
            switch (columnId) {
              case 1:
                this.columnList = data.rows
                break;
              // case 2:
              //   this.columnDetailList = data.rows
              //   break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            this.getColumnList(tableId, columnId)
          }
        })
      },

      // 获取 tableDefault 列
      async getColumnList (tableId, columnId) {
        let queryTable = {
          functionId: this.$route.meta.menuId,
          tableId: tableId,
          languageCode: this.$i18n.locale
        }
        await getTableDefaultListLanguage(queryTable).then(({data}) => {
          if (!data.rows.length == 0) {
            switch (columnId) {
              case 1:
                this.columnList = data.rows
                break;
              // case 2:
              //   this.columnDetailList = data.rows
              //   break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            // this.showDefault = true.
          }
        })
      },

      //获取按钮的权限数据
      getButtonAuthData () {
        let searchFlag = this.isAuth(this.menuId+":search")
        let saveFlag = this.isAuth(this.menuId+":save")
        let updateFlag = this.isAuth(this.menuId+":update")
        let deleteFlag = this.isAuth(this.menuId+":delete")
        //处理页面的权限数据
        this.authSearch = searchFlag
        this.authSave = saveFlag
        this.authUpdate = updateFlag
        this.authDelete = deleteFlag
      },
    }
  }
</script>
<style scoped>
.el-table /deep/ .cell{
  height: auto;
  line-height: 1.5;
}
</style>
