<template>
  <div class="app-container">
    <el-card>
      <!--      <span style="margin-left: 15px">班次类型:</span>-->
      <el-select v-model="dataTypeValue" placeholder="工位号" clearable size="small" style="width:100px">
        <el-option
          v-for="item in dataType"
          :key="item.value"
          :label="item.label"
          :value="item.value"/>
      </el-select>
      <el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 15px" plain @click="searchTable()">查询</el-button>
      <el-button type="distribution" icon="el-icon-circle-plus-outline" size="small" @click="addShiftTable('formData')">新增</el-button>
      <el-button type="success" plain icon="el-icon-document-copy" size="small" @click="copyData()">复制</el-button>
      <el-button type="info" plain size="small" icon="el-icon-upload2" @click="importOrder('form')">导入</el-button>
      <el-button type="info" plain size="small" icon="el-icon-download" @click="exportExcel()">Excel</el-button>
      <el-table
        v-loading="loading"
        :data="tableData"
        highlight-current-row
        border
        size="mini"
        height="800"
        center
        style="width: 100%"
        @row-click="rowClick">
        <el-table-column type="index" width="60" label="序号" align="center"/>
        <el-table-column label="工位代码" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工位代码 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工位号" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工位号 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="指南工位号" width="90px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.指南工位号 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工位名称" min-width="220px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工位名称 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column disabled label="机床类型" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.机床类型 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="线体类型" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.线体类型 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="二维码扫描枪" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.二维码扫描枪 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="固定条形码扫描枪" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.固定条形码扫描枪 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="手持条形码扫描枪" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.手持条形码扫描枪 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="PC" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.PC }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工控机名称" width="90px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工控机名称 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工控机IP" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工控机IP }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="通讯端口" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.通讯端口 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="文件名称" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.文件名称 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="PLC" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.PLC }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="PLC代码" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.PLC代码 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="PLC加工状态" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.PLC加工状态 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="PLC代码加工状态" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.PLC代码加工状态 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="发动机型号代码合成" width="140px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.发动机型号代码合成 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="日计划产量" width="100px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.日计划产量 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="准备时间" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.准备时间 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="机器时间" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.机器时间 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="人工时间" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.人工时间 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="技术难度系数" width="100px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.技术难度系数 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="是否线首" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.是否线首 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="分线物料追踪工位" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.分线物料追踪工位 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="总线上线工位" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.总线上线工位 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="总线被监测工位" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.总线被监测工位 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="扫描枪类型" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.扫描枪类型 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工位类型" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工位类型 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="分线物料追踪工位数据文件连接" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.分线物料追踪工位数据文件连接 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="总线上线工位数据文件连接" width="110px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.总线上线工位数据文件连接 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="OpcServer" width="110px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.OpcServer }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="OpcServer_MIS" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.OpcServer_MIS }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="OpcServer_OPNAME" width="150px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.OpcServer_OPNAME }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="目标循环时间" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.目标循环时间 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工件类型" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工件类型 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工位基本操作指导" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工位基本操作指导 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工位基本指导图片" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工位基本指导图片 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工位上下线类型" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工位上下线类型 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="大屏幕代码" width="60px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.大屏幕代码 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="大屏幕显示产量端口" width="90px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.大屏幕显示产量端口 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="大屏幕显示Andon大屏幕代码" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.大屏幕显示Andon大屏幕代码 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="大屏幕显示Andon端口" width="90px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.大屏幕显示Andon端口 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="是否有打印机" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.是否有打印机 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="打印机通讯端口" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.打印机通讯端口 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工序号" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工序号 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工序名称" width="220px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工序名称 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="是否有工位计算机" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.是否有工位计算机 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="是否有测量数据" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.是否有测量数据 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="是否启用MES" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.是否启用MES }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="在线状态" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.在线状态 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="是否通过监控系统保存数据" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.是否通过监控系统保存数据 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="是否监控" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.是否监控 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="返修工位号" width="90px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.返修工位号 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="工步属性" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.工步属性 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="MesServerCode" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.MesServerCode }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="MesDll" width="90px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.MesDll }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="MesWebCode" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.MesWebCode }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="订单选择权限" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.订单选择权限 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="服务器IP" width="120px" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.服务器IP }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="Bar版本号" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.Bar版本号 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="监控属性代码" align="center">
          <template slot-scope="scope">
            <template>
              {{ scope.row.监控属性代码 }}
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" width="150" align="center">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              plain
              icon="el-icon-edit"
              @click="editShiftTable(scope.row)">编辑</el-button>
            <el-button
              size="mini"
              type="text"
              plain
              icon="el-icon-delete"
              style="color: #ff0000"
              @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <el-drawer
      :visible.sync="drawer"
      :direction="direction"
      :before-close="handleClose"
      :title="title"
      size="55%">
      <el-form ref="formData" :model="formData" :rules="rules" label-position="right" label-width="160px">
        <el-form-item label="工位代码" prop="stationCode" style="display: inline-block">
          <el-input v-model="formData.stationCode" clearable size="small" placeholder="工位代码" @blur="selectCode(formData.stationCode)"/>
        </el-form-item>
        <el-form-item label="工位号" prop="stationNumber" style="display: inline-block">
          <el-input v-model="formData.stationNumber" clearable size="small" placeholder="工位号"/>
        </el-form-item>
        <el-form-item label="指南工位号" prop="guideStationNumber" style="display: inline-block">
          <el-input v-model="formData.guideStationNumber" clearable size="small" placeholder="指南工位号"/>
        </el-form-item>
        <el-form-item label="机床类型" prop="machineType" style="display: inline-block">
          <el-input v-model="formData.machineType" clearable size="small" placeholder="机床类型"/>
        </el-form-item>
        <el-form-item label="工位名称" prop="stationName" style="display: inline-block">
          <el-input v-model="formData.stationName" clearable size="small" placeholder="工位名称"/>
        </el-form-item>
        <el-form-item label="线体类型" prop="lineType" style="display: inline-block">
          <el-input v-model="formData.lineType" clearable size="small" placeholder="线体类型"/>
        </el-form-item>
        <el-form-item label="二维码扫描枪" prop="QRcodeScannGun" style="display: inline-block">
          <el-input v-model="formData.QRcodeScannGun" clearable size="small" placeholder="二维码扫描枪"/>
        </el-form-item>
        <el-form-item label="固定条形码扫描" prop="fixedBarcodeScannGun" style="display: inline-block">
          <el-input v-model="formData.fixedBarcodeScannGun" clearable size="small" placeholder="固定条形码扫描枪"/>
        </el-form-item>
        <el-form-item label="手持条形码扫描" prop="handheldBarcodeScannGun" style="display: inline-block">
          <el-input v-model="formData.handheldBarcodeScannGun" clearable size="small" placeholder="手持条形码扫描枪"/>
        </el-form-item>
        <el-form-item label="PC" prop="PC" style="display: inline-block">
          <el-input v-model="formData.PC" clearable size="small" placeholder=" PC"/>
        </el-form-item>
        <el-form-item label="工控机名称" prop="nameIndustrialComputer" style="display: inline-block">
          <el-input v-model="formData.nameIndustrialComputer" clearable size="small" placeholder="工控机名称"/>
        </el-form-item>
        <el-form-item label="工控机IP" prop="ipIndustrialComputer" style="display: inline-block">
          <el-input v-model="formData.ipIndustrialComputer" clearable size="small" placeholder="工控机IP"/>
        </el-form-item>
        <el-form-item label="通讯端口" prop="communicationPort" style="display: inline-block">
          <el-input-number v-model="formData.communicationPort" :min="1" :max="65534" :step="1" clearable size="small" placeholder="通讯端口"/>
        </el-form-item>
        <el-form-item label="文件名称" prop="fileName" style="display: inline-block">
          <el-input v-model="formData.fileName" clearable size="small" placeholder="文件名称"/>
        </el-form-item>
        <el-form-item label="PLC" prop="PLC" style="display: inline-block">
          <el-select v-model="formData.PLC" placeholder="PLC" clearable size="small">
            <el-option
              v-for="item in PLCIP"
              :key="item.value1"
              :label="item.label"
              :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="PLC代码" prop="PLCCode" style="display: inline-block">
          <el-input v-model="formData.PLCCode" clearable size="small" placeholder="PLC代码"/>
        </el-form-item>
        <el-form-item label="PLC加工状态" prop="PLCState" style="display: inline-block">
          <el-input v-model="formData.PLCState" clearable size="small" placeholder="PLC加工状态"/>
        </el-form-item>
        <el-form-item label="PLC代码加工状态" prop="PLCCodeState" style="display: inline-block">
          <el-input v-model="formData.PLCCodeState" clearable size="small" placeholder="PLC代码加工状态"/>
        </el-form-item>
        <el-form-item label="发动机型号代码合成" prop="engineModelCodeSynthesis" style="display: inline-block">
          <el-input v-model="formData.engineModelCodeSynthesis" clearable size="small" placeholder="发动机型号代码合成"/>
        </el-form-item>
        <el-form-item label="日计划产量" prop="dailyPlannedOutput" style="display: inline-block">
          <el-input v-model="formData.dailyPlannedOutput" clearable size="small" placeholder="日计划产量"/>
        </el-form-item>
        <el-form-item label="准备时间" prop="preparationTime" style="display: inline-block">
          <el-input v-model="formData.preparationTime" clearable size="small" placeholder="准备时间"/>
        </el-form-item>
        <el-form-item label="机器时间" prop="machineTime" style="display: inline-block">
          <el-input v-model="formData.machineTime" clearable size="small" placeholder="机器时间"/>
        </el-form-item>
        <el-form-item label="人工时间" prop="laborTime" style="display: inline-block">
          <el-input v-model="formData.laborTime" clearable size="small" placeholder="人工时间"/>
        </el-form-item>
        <el-form-item label="技术难度系数" prop="technicalDifficultyCoefficient" style="display: inline-block">
          <el-input v-model="formData.technicalDifficultyCoefficient" clearable size="small" placeholder="技术难度系数"/>
        </el-form-item>
        <el-form-item label="是否线首" prop="whetherLineHead" style="display: inline-block">
          <el-input v-model="formData.whetherLineHead" clearable size="small" placeholder="是否线首"/>
        </el-form-item>
        <el-form-item label="分线物料追踪工位" prop="branchMaterialTrackingStation" style="display: inline-block">
          <el-input v-model="formData.branchMaterialTrackingStation" clearable size="small" placeholder="分线物料追踪工位"/>
        </el-form-item>
        <el-form-item label="总线上线工位" prop="busOnlineStation" style="display: inline-block">
          <el-input v-model="formData.busOnlineStation" clearable size="small" placeholder="总线上线工位"/>
        </el-form-item>
        <el-form-item label="总线被监测工位" prop="busMonitoredStation" style="display: inline-block">
          <el-input v-model="formData.busMonitoredStation" clearable size="small" placeholder="总线被监测工位"/>
        </el-form-item>
        <el-form-item label="扫描枪类型" prop="scanningGunType" style="display: inline-block">
          <el-input v-model="formData.scanningGunType" clearable size="small" placeholder="扫描枪类型"/>
        </el-form-item>
        <el-form-item label="工位类型" prop="stationType" style="display: inline-block">
          <el-input v-model="formData.stationType" clearable size="small" placeholder="工位类型"/>
        </el-form-item>
        <el-form-item label="OpcServer" prop="OpcServer" style="display: inline-block">
          <el-input v-model="formData.OpcServer" clearable size="small" placeholder="OpcServer"/>
        </el-form-item>
        <el-form-item label="OpcServer_MIS" prop="OpcServer_MIS" style="display: inline-block">
          <el-input v-model="formData.OpcServer_MIS" clearable size="small" placeholder="OpcServer_MIS"/>
        </el-form-item>
        <el-form-item label="OpcServer_OPNAME" prop="OpcServer_OPNAME" style="display: inline-block">
          <el-input v-model="formData.OpcServer_OPNAME" clearable size="small" placeholder="OpcServer_OPNAME"/>
        </el-form-item>
        <el-form-item label="目标循环时间" prop="TargetCycleTime" style="display: inline-block">
          <el-input v-model="formData.TargetCycleTime" clearable size="small" placeholder="目标循环时间"/>
        </el-form-item>
        <el-form-item label="工件类型" prop="WorkpieceType" style="display: inline-block">
          <el-input v-model="formData.WorkpieceType" clearable size="small" placeholder="工件类型"/>
        </el-form-item>
        <el-form-item label="工位基本操作指导" prop="basicOperationInstructionsStation" style="display: inline-block">
          <el-input v-model="formData.basicOperationInstructionsStation" clearable size="small" placeholder="工位基本操作指导"/>
        </el-form-item>
        <!--        <el-form-item label="工位基本指导图片" prop="stationBasicGuidePicture" style="display: inline-block">-->
        <!--          <el-input v-model="formData.stationBasicGuidePicture" clearable size="small" placeholder="工位基本指导图片"/>-->
        <!--        </el-form-item>-->
        <el-form-item label="工位上下线类型" prop="stationUpperLowerLineType" style="display: inline-block">
          <el-input v-model="formData.stationUpperLowerLineType" clearable size="small" placeholder="工位上下线类型"/>
        </el-form-item>
        <el-form-item label="大屏幕代码" prop="largeScreenCode" style="display: inline-block">
          <el-input v-model="formData.largeScreenCode" clearable size="small" placeholder="大屏幕代码"/>
        </el-form-item>
        <el-form-item label="大屏幕显示产量端口" prop="largeScreenDisplayOutputPort" style="display: inline-block">
          <el-input v-model="formData.largeScreenDisplayOutputPort" clearable size="small" placeholder="大屏幕显示产量端口"/>
        </el-form-item>
        <el-form-item label="Andon大屏幕代码" prop="AndonCode" style="display: inline-block">
          <el-input v-model="formData.AndonCode" clearable size="small" placeholder="大屏幕显示Andon大屏幕代码"/>
        </el-form-item>
        <el-form-item label="大屏幕显示Andon端口" prop="AndonPort" style="display: inline-block">
          <el-input v-model="formData.AndonPort" clearable size="small" placeholder="大屏幕显示Andon端口"/>
        </el-form-item>
        <el-form-item label="是否有打印机" prop="isTherePrinter" style="display: inline-block">
          <el-input v-model="formData.isTherePrinter" clearable size="small" placeholder="是否有打印机"/>
        </el-form-item>
        <el-form-item label="打印机通讯端口" prop="printerPort" style="display: inline-block">
          <el-input v-model="formData.printerPort" clearable size="small" placeholder="打印机通讯端口"/>
        </el-form-item>
        <el-form-item label="工序号" prop="processNo" style="display: inline-block">
          <el-input v-model="formData.processNo" clearable size="small" placeholder="工序号"/>
        </el-form-item>
        <el-form-item label="工序名称" prop="processName" style="display: inline-block">
          <el-input v-model="formData.processName" clearable size="small" placeholder="工序名称"/>
        </el-form-item>
        <el-form-item label="是否有工位计算机" prop="isThereComputer" style="display: inline-block">
          <el-input v-model="formData.isThereComputer" clearable size="small" placeholder="是否有工位计算机"/>
        </el-form-item>
        <el-form-item label="是否有测量数据" prop="isThereData" style="display: inline-block">
          <el-input v-model="formData.isThereData" clearable size="small" placeholder="是否有测量数据"/>
        </el-form-item>
        <el-form-item label="是否启用MES" prop="enableMES" style="display: inline-block">
          <el-input v-model="formData.enableMES" clearable size="small" placeholder="是否启用MES"/>
        </el-form-item>
        <el-form-item label="在线状态" prop="onlineStatus" style="display: inline-block">
          <el-input v-model="formData.onlineStatus" clearable size="small" placeholder="在线状态"/>
        </el-form-item>
        <el-form-item label="是否监控" prop="whetherMonitor" style="display: inline-block">
          <el-input v-model="formData.whetherMonitor" clearable size="small" placeholder="是否监控"/>
        </el-form-item>
        <el-form-item label="返修工位号" prop="repairStationNo" style="display: inline-block">
          <el-input v-model="formData.repairStationNo" clearable size="small" placeholder="返修工位号"/>
        </el-form-item>
        <el-form-item label="工步属性" prop="workStepAttribute" style="display: inline-block">
          <el-input v-model="formData.workStepAttribute" clearable size="small" placeholder="工步属性"/>
        </el-form-item>
        <el-form-item label="MesServerCode" prop="MesServerCode" style="display: inline-block">
          <el-input v-model="formData.MesServerCode" clearable size="small" placeholder="MesServerCode"/>
        </el-form-item>
        <el-form-item label="MesDll" prop="MesDll" style="display: inline-block">
          <el-input v-model="formData.MesDll" clearable size="small" placeholder="MesDll"/>
        </el-form-item>
        <el-form-item label="MesWebCode" prop="MesWebCode" style="display: inline-block">
          <el-input v-model="formData.MesWebCode" clearable size="small" placeholder="MesWebCode"/>
        </el-form-item>
        <el-form-item label="订单选择权限" prop="orderSelectionPermission" style="display: inline-block">
          <el-input v-model="formData.orderSelectionPermission" clearable size="small" placeholder="订单选择权限"/>
        </el-form-item>
        <el-form-item label="服务器IP" prop="theServerIP" style="display: inline-block">
          <el-input v-model="formData.theServerIP" clearable size="small" placeholder="服务器IP"/>
        </el-form-item>
        <el-form-item label="Bar版本号" prop="BarVersion" style="display: inline-block">
          <el-input v-model="formData.BarVersion" clearable size="small" placeholder="Bar版本号"/>
        </el-form-item>
        <el-form-item label="监控属性代码" prop="monitoringAttributeCode" style="display: inline-block">
          <el-input v-model="formData.monitoringAttributeCode" clearable size="small" placeholder="监控属性代码"/>
        </el-form-item>
        <el-form-item label="IP" prop="IP" style="display: inline-block">
          <el-input v-model="formData.IP" clearable size="small" placeholder="IP"/>
        </el-form-item>
        <el-form-item label="报警数" prop="numberAlarms" style="display: inline-block">
          <el-input v-model="formData.numberAlarms" clearable size="small" placeholder="报警数"/>
        </el-form-item>
        <el-form-item label="质量组数" prop="numberQualityGroups" style="display: inline-block">
          <el-input v-model="formData.numberQualityGroups" clearable size="small" placeholder="质量组数"/>
        </el-form-item>
        <el-form-item label="是否通过监控系统保存数据" prop="whetherSaveData" label-width="210px" style="display: inline-block">
          <el-input v-model="formData.whetherSaveData" clearable size="small" placeholder="是否通过监控系统保存数据"/>
        </el-form-item>
        <el-form-item label="分线物料追踪工位数据文件连接" prop="DFCBMTS" label-width="210px" style="display: inline-block">
          <el-input v-model="formData.DFCBMTS" clearable size="small" placeholder="分线物料追踪工位数据文件连接"/>
        </el-form-item>
        <el-form-item label="总线上线工位数据文件连接" prop="BOSDFC" label-width="210px" style="display: inline-block">
          <el-input v-model="formData.BOSDFC" clearable size="small" placeholder="总线上线工位数据文件连接"/>
        </el-form-item>
      </el-form>
      <div class="dialog-footer" style="margin-left: 45%;margin-bottom: 10px">
        <el-button size="small" @click="callOff('formData')">取消</el-button>
        <el-button v-if="title === '添加工位信息'" type="primary" size="small" @click="submitAdd()">确定</el-button>
        <el-button v-if="title === '编辑工位信息'" type="primary" size="small" @click="submitAdd1('formData')">确定</el-button>
      </div>
    </el-drawer>
    <el-dialog :visible.sync="dialogFormVisible" :title="title" center style="min-height: 200px;" width="400px">
      <el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="110px">
        <el-form-item label="电气元器件" prop="dataTypeValue" style="display: inline-block">
          <el-select v-model="form.dataTypeValue" placeholder="电气元器件" clearable size="small" style="width:200px" @change="changeName(form.dataTypeValue)">
            <el-option
              v-for="item in dataType"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="编号" prop="value" style="display: inline-block">
          <el-input v-model="form.value" clearable size="small" placeholder="序号"/>
        </el-form-item>
        <el-form-item label="描述" prop="descript" style="display: inline-block">
          <el-input
            v-model="form.descript"
            clearable
            size="small"
            placeholder="描述"/>
        </el-form-item>
        <el-form-item label="是否禁用" prop="active" style="display: inline-block">
          <el-select v-model="form.active" placeholder="是否禁用" clearable size="small" style="width:200px">
            <el-option
              v-for="item in active"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="备注" prop="comments" style="display: inline-block">
          <el-input
            v-model="form.comments"
            clearable
            size="small"
            placeholder="备注"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="callOff('form')">取消</el-button>
        <el-button v-if="title === '增加'" type="primary" size="small" @click="submitAdd('form')">确定</el-button>
        <el-button v-if="title === '编辑'" type="primary" size="small" @click="submitAdd1('form')">确定</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormVisible3" title="导入" center style="min-height: 200px" width="900px">
      <div class="app-container">
        <upload-excel-component style="margin-left: 15%" @on-selected-file="selected"/>
        <div style="margin-left: 395px">
          <span v-show="worksheet.length > 1" style="cursor: pointer;width: 50px;" @click="removeAll"><i class="el-icon-close"/></span>
          <el-upload :on-remove="handleRemove" :file-list="itemFile" style="width: 220px" action=""/>
        </div>
        <div v-if="worksheet.length !== 0" style="margin: 3px 0 0 395px">
          <el-button icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">导入到数据库</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { sleep } from '../../../utils/tool'
import UploadExcelComponent from './UploadExcel.vue'
import request from '@/utils/request'
export default {
  name: 'UploadExcel',
  components: { UploadExcelComponent },
  data() {
    return {
      drawer: false,
      direction: 'rtl',
      loading: true,
      worksheet: [],
      itemFile: [],
      unSpecification: [],
      dataTypeValue: '',
      dataType: [],
      PLCIP: [],
      tableData: [],
      activeValue: '',
      active: [{
        label: '启用',
        value: 1
      }, {
        label: '禁用',
        value: 0
      }],
      dialogFormVisible: false,
      dialogFormVisible3: false,
      form: {
        name: '',
        value: '',
        descript: '',
        comments: '',
        ID: '',
        active: '',
        dataTypeValue: ''
      },
      rules: { // 表单验证规则
        dataTypeValue: [{ required: true, message: '请选择', trigger: 'change' }]
      },
      formData: {
        ID: '', // ID
        stationCode: '', // 工位代码
        stationNumber: '', // 工位号
        guideStationNumber: '', // 指南工位号
        machineType: '', // 机床类型
        stationName: '', // 工位名称
        lineType: '', // 线体类型
        QRcodeScannGun: '', // 二维码扫描枪
        fixedBarcodeScannGun: '', // 固定条形码扫描枪
        handheldBarcodeScannGun: '', // 手持条形码扫描枪
        PC: '',
        nameIndustrialComputer: '', // 工控机名称
        ipIndustrialComputer: '', // 工控机IP
        communicationPort: '', // 通讯端口
        fileName: '', // 文件名称
        PLC: '',
        PLCCode: '', // PLC代码
        PLCState: '', // PLC加工状态
        PLCCodeState: '', // PLC代码加工状态
        engineModelCodeSynthesis: '', // 发动机型号代码合成
        dailyPlannedOutput: '', // 日计划产量
        preparationTime: '', // 准备时间
        machineTime: '', // 机器时间
        laborTime: '', // 人工时间
        technicalDifficultyCoefficient: '', // 技术难度系数
        whetherLineHead: '', // 是否线首
        branchMaterialTrackingStation: '', // 分线物料追踪工位
        busOnlineStation: '', // 总线上线工位
        busMonitoredStation: '', // 总线被监测工位
        scanningGunType: '', // 扫描枪类型
        stationType: '', // 工位类型
        DFCBMTS: '', // 分线物料追踪工位数据文件连接
        BOSDFC: '', // 总线上线工位数据文件连接
        OpcServer: '',
        OpcServer_MIS: '',
        OpcServer_OPNAME: '',
        TargetCycleTime: '', // 目标循环时间
        WorkpieceType: '', // 工件类型
        basicOperationInstructionsStation: '', // 工位基本操作指导
        stationBasicGuidePicture: '', // 工位基本指导图片
        stationUpperLowerLineType: '', // 工位上下线类型
        largeScreenCode: '', // 大屏幕代码
        largeScreenDisplayOutputPort: '', // 大屏幕显示产量端口
        AndonCode: '', // 大屏幕显示Andon大屏幕代码
        AndonPort: '', // 大屏幕显示Andon端口
        isTherePrinter: '', // 是否有打印机
        printerPort: '', // 打印机通讯端口
        processNo: '', // 工序号
        processName: '', // 工序名称
        isThereComputer: '', // 是否有工位计算机
        isThereData: '', // 是否有测量数据
        enableMES: '', // 是否启用MES
        onlineStatus: '', // 在线状态
        whetherSaveData: '', // 是否通过监控系统保存数据
        whetherMonitor: '', // 是否监控
        repairStationNo: '', // 返修工位号
        workStepAttribute: '', // 工步属性
        MesServerCode: '',
        MesDll: '',
        MesWebCode: '',
        orderSelectionPermission: '', // 订单选择权限
        theServerIP: '', // 服务器IP
        BarVersion: '', // Bar版本号
        monitoringAttributeCode: '', // 监控属性代码
        IP: '',
        numberAlarms: '', //
        numberQualityGroups: ''
      },
      title: '',
      pageCurrent: 1,
      pageSize: 20,
      total: 0
    }
  },
  created() {
    this.getIP()
    this.getNumber()
    this.searchTable()
  },
  methods: {
    selectCode(val) {
      for (let i = 0; i < this.tableData.length; i++) {
        if (val === this.tableData[i].工位代码) {
          this.$message.error('工位代码重复，请重新输入！')
        }
      }
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => {})
    },
    getNumber() {
      this.dataType = []
      request({
        url: '',
        method: 'post',
        data: {
          type: '3',
          name: `SELECT [工位号] FROM [dbo].[MES_计划BOM_工位与名称]`
        }
      }).then(response => {
        if (response.data.length) {
          for (let i = 0; i < response.data.length; i++) {
            this.dataType.push({
              label: response.data[i].工位号,
              value: response.data[i].工位号
            })
          }
        }
      })
    },
    getIP() {
      this.PLCIP = []
      request({
        url: '',
        method: 'post',
        data: {
          type: '3',
          name: `SELECT [设备IP],[ID] FROM [dbo].[MES_基本变量设备类型对应表] ORDER BY ID`
        }
      }).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.PLCIP.push({
            label: response.data[i].设备IP,
            value: response.data[i].设备IP,
            value1: response.data[i].ID
          })
        }
      })
    },
    changeName(val) {
      for (let i = 0; i < this.dataType.length; i++) {
        if (this.dataType[i].value === val) {
          console.log(this.dataType[i].label, 'this.stationNumber[i].label')
          this.form.name = this.dataType[i].label
        }
      }
    },
    searchTable() {
      this.loading = true
      this.tableData = []
      let dataTypeValue_check
      this.dataTypeValue ? dataTypeValue_check = 1 : dataTypeValue_check = 0
      var param = []
      param[0] = ['type_ischeck', dataTypeValue_check]
      param[1] = ['type', this.dataTypeValue]
      var Data = this.CreateData('11', '基础数据_工位信息维护_查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length !== 0) {
          for (let i = 0; i < response.data.length; i++) {
            this.tableData.push({
              ID: response.data[i].ID,
              工位代码: response.data[i].工位代码,
              工位号: response.data[i].工位号,
              指南工位号: response.data[i].指南工位号,
              机床类型: response.data[i].机床类型,
              工位名称: response.data[i].工位名称,
              线体类型: response.data[i].线体类型,
              二维码扫描枪: response.data[i].二维码扫描枪,
              固定条形码扫描枪: response.data[i].固定条形码扫描枪,
              手持条形码扫描枪: response.data[i].手持条形码扫描枪,
              PC: response.data[i].PC,
              工控机名称: response.data[i].工控机名称,
              工控机IP: response.data[i].工控机IP,
              通讯端口: response.data[i].通讯端口,
              文件名称: response.data[i].文件名称,
              PLC: response.data[i].PLC,
              PLC代码: response.data[i].PLC代码,
              PLC加工状态: response.data[i].PLC加工状态,
              PLC代码加工状态: response.data[i].PLC代码加工状态,
              发动机型号代码合成: response.data[i].发动机型号代码合成,
              日计划产量: response.data[i].日计划产量,
              准备时间: response.data[i].准备时间,
              机器时间: response.data[i].机器时间,
              人工时间: response.data[i].人工时间,
              技术难度系数: response.data[i].技术难度系数,
              是否线首: response.data[i].是否线首,
              分线物料追踪工位: response.data[i].分线物料追踪工位,
              总线上线工位: response.data[i].总线上线工位,
              总线被监测工位: response.data[i].总线被监测工位,
              扫描枪类型: response.data[i].扫描枪类型,
              工位类型: response.data[i].工位类型,
              分线物料追踪工位数据文件连接: response.data[i].分线物料追踪工位数据文件连接,
              总线上线工位数据文件连接: response.data[i].总线上线工位数据文件连接,
              OpcServer: response.data[i].OpcServer,
              OpcServer_MIS: response.data[i].OpcServer_MIS,
              OpcServer_OPNAME: response.data[i].OpcServer_OPNAME,
              目标循环时间: response.data[i].目标循环时间,
              工件类型: response.data[i].工件类型,
              工位基本操作指导: response.data[i].工位基本操作指导,
              工位基本指导图片: response.data[i].工位基本指导图片,
              工位上下线类型: response.data[i].工位上下线类型,
              大屏幕代码: response.data[i].大屏幕代码,
              大屏幕显示产量端口: response.data[i].大屏幕显示产量端口,
              大屏幕显示Andon大屏幕代码: response.data[i].大屏幕显示Andon大屏幕代码,
              大屏幕显示Andon端口: response.data[i].大屏幕显示Andon端口,
              是否有打印机: response.data[i].是否有打印机,
              打印机通讯端口: response.data[i].打印机通讯端口,
              工序号: response.data[i].工序号,
              工序名称: response.data[i].工序名称,
              是否有工位计算机: response.data[i].是否有工位计算机,
              是否有测量数据: response.data[i].是否有测量数据,
              是否启用MES: response.data[i].是否启用MES,
              在线状态: response.data[i].在线状态,
              是否通过监控系统保存数据: response.data[i].是否通过监控系统保存数据,
              是否监控: response.data[i].是否监控,
              返修工位号: response.data[i].返修工位号,
              工步属性: response.data[i].工步属性,
              MesServerCode: response.data[i].MesServerCode,
              MesDll: response.data[i].MesDll,
              MesWebCode: response.data[i].MesWebCode,
              订单选择权限: response.data[i].订单选择权限,
              服务器IP: response.data[i].服务器IP,
              Bar版本号: response.data[i].Bar版本号,
              监控属性代码: response.data[i].监控属性代码,
              IP: response.data[i].IP,
              报警数: response.data[i].报警数,
              质量组数: response.data[i].质量组数,
              edit: false
            })
          }
        }
        this.loading = false
        console.log(this.tableData, 'this.tableData')
      })
    },
    exportExcel() {
      if (this.tableData.length !== 0) {
        let dataTypeValue_check
        this.dataTypeValue ? dataTypeValue_check = 1 : dataTypeValue_check = 0
        var param = []
        param[0] = ['type_ischeck', dataTypeValue_check]
        param[1] = ['type', this.dataTypeValue]
        var Data = this.CreateData('2001', '基础数据_工位信息维护_导出', param)
        this.exportExcel_NPOI(Data)
      } else {
        this.$message.warning('暂无数据')
      }
    },
    addShiftTable(formName) {
      if (this.$refs[formName] !== undefined) {
        this.$refs[formName].resetFields()
      }
      this.title = '添加工位信息'
      this.formData.stationCode = '' // 工位代码
      this.formData.stationNumber = '' // 工位号
      this.formData.guideStationNumber = '' // 指南工位号
      this.formData.machineType = '' // 机床类型
      this.formData.stationName = '' // 工位名称
      this.formData.lineType = '' // 线体类型
      this.formData.QRcodeScannGun = '' // 二维码扫描枪
      this.formData.fixedBarcodeScannGun = '' // 固定条形码扫描枪
      this.formData.handheldBarcodeScannGun = '' // 手持条形码扫描枪
      this.formData.PC = ''
      this.formData.nameIndustrialComputer = '' // 工控机名称
      this.formData.ipIndustrialComputer = '' // 工控机IP
      this.formData.communicationPort = '' // 通讯端口
      this.formData.fileName = '' // 文件名称
      this.formData.PLC = ''
      this.formData.PLCCode = '' // PLC代码
      this.formData.PLCState = '' // PLC加工状态
      this.formData.PLCCodeState = '' // PLC代码加工状态
      this.formData.engineModelCodeSynthesis = '' // 发动机型号代码合成
      this.formData.dailyPlannedOutput = '' // 日计划产量
      this.formData.preparationTime = '' // 准备时间
      this.formData.machineTime = '' // 机器时间
      this.formData.laborTime = '' // 人工时间
      this.formData.technicalDifficultyCoefficient = '' // 技术难度系数
      this.formData.whetherLineHead = '' // 是否线首
      this.formData.branchMaterialTrackingStation = '' // 分线物料追踪工位
      this.formData.busOnlineStation = '' // 总线上线工位
      this.formData.busMonitoredStation = '' // 总线被监测工位
      this.formData.scanningGunType = '' // 扫描枪类型
      this.formData.stationType = '' // 工位类型
      this.formData.DFCBMTS = '' // 分线物料追踪工位数据文件连接
      this.formData.BOSDFC = '' // 总线上线工位数据文件连接
      this.formData.OpcServer = ''
      this.formData.OpcServer_MIS = ''
      this.formData.OpcServer_OPNAME = ''
      this.formData.TargetCycleTime = '' // 目标循环时间
      this.formData.WorkpieceType = '' // 工件类型
      this.formData.basicOperationInstructionsStation = '' // 工位基本操作指导
      this.formData.stationBasicGuidePicture = '' // 工位基本指导图片
      this.formData.stationUpperLowerLineType = '' // 工位上下线类型
      this.formData.largeScreenCode = '' // 大屏幕代码
      this.formData.largeScreenDisplayOutputPort = '' // 大屏幕显示产量端口
      this.formData.AndonCode = '' // 大屏幕显示Andon大屏幕代码
      this.formData.AndonPort = '' // 大屏幕显示Andon端口
      this.formData.isTherePrinter = '' // 是否有打印机
      this.formData.printerPort = '' // 打印机通讯端口
      this.formData.processNo = '' // 工序号
      this.formData.processName = '' // 工序名称
      this.formData.isThereComputer = '' // 是否有工位计算机
      this.formData.isThereData = '' // 是否有测量数据
      this.formData.enableMES = '' // 是否启用MES
      this.formData.onlineStatus = '' // 在线状态
      this.formData.whetherSaveData = '' // 是否通过监控系统保存数据
      this.formData.whetherMonitor = '' // 是否监控
      this.formData.repairStationNo = '' // 返修工位号
      this.formData.workStepAttribute = '' // 工步属性
      this.formData.MesServerCode = ''
      this.formData.MesDll = ''
      this.formData.MesWebCode = ''
      this.formData.orderSelectionPermission = '' // 订单选择权限
      this.formData.theServerIP = '' // 服务器IP
      this.formData.BarVersion = '' // Bar版本号
      this.formData.monitoringAttributeCode = '' // 监控属性代码
      this.formData.IP = ''
      this.formData.numberAlarms = '' //
      this.formData.numberQualityGroups = ''
      this.drawer = true
    },
    submitAdd() {
      var param = []
      param[0] = ['工位代码', this.formData.stationCode]
      param[1] = ['工位号', this.formData.stationNumber]
      param[2] = ['指南工位号', this.formData.guideStationNumber]
      param[3] = ['机床类型', this.formData.machineType]
      param[4] = ['工位名称', this.formData.stationName]
      param[5] = ['线体类型', this.formData.lineType]
      param[6] = ['二维码扫描枪', this.formData.QRcodeScannGun]
      param[7] = ['固定条形码扫描枪', this.formData.fixedBarcodeScannGun]
      param[8] = ['手持条形码扫描枪', this.formData.handheldBarcodeScannGun]
      param[9] = ['PC', this.formData.PC]
      param[10] = ['工控机名称', this.formData.nameIndustrialComputer]
      param[11] = ['工控机IP', this.formData.ipIndustrialComputer]
      param[12] = ['通讯端口', this.formData.communicationPort]
      param[13] = ['文件名称', this.formData.fileName]
      param[14] = ['PLC', this.formData.PLC]
      param[15] = ['PLC代码', this.formData.PLCCode]
      param[16] = ['PLC加工状态', this.formData.PLCState]
      param[17] = ['PLC代码加工状态', this.formData.PLCCodeState]
      param[18] = ['发动机型号代码合成', this.formData.engineModelCodeSynthesis]
      param[19] = ['日计划产量', this.formData.dailyPlannedOutput]
      param[20] = ['准备时间', this.formData.preparationTime]
      param[21] = ['机器时间', this.formData.machineTime]
      param[22] = ['人工时间', this.formData.laborTime]
      param[23] = ['技术难度系数', this.formData.technicalDifficultyCoefficient]
      param[24] = ['是否线首', this.formData.whetherLineHead]
      param[25] = ['分线物料追踪工位', this.formData.branchMaterialTrackingStation]
      param[26] = ['总线上线工位', this.formData.busOnlineStation]
      param[27] = ['总线被监测工位', this.formData.busMonitoredStation]
      param[28] = ['扫描枪类型', this.formData.scanningGunType]
      param[29] = ['工位类型', this.formData.stationType]
      param[30] = ['分线物料追踪工位数据文件连接', this.formData.DFCBMTS]
      param[31] = ['总线上线工位数据文件连接', this.formData.BOSDFC]
      param[32] = ['OpcServer', this.formData.OpcServer]
      param[33] = ['OpcServer_MIS', this.formData.OpcServer_MIS]
      param[34] = ['OpcServer_OPNAME', this.formData.OpcServer_OPNAME]
      param[35] = ['目标循环时间', this.formData.TargetCycleTime]
      param[36] = ['工件类型', this.formData.WorkpieceType]
      param[37] = ['工位基本操作指导', this.formData.basicOperationInstructionsStation]
      param[38] = ['工位基本指导图片', null]
      param[39] = ['工位上下线类型', this.formData.stationUpperLowerLineType]
      param[40] = ['大屏幕代码', this.formData.largeScreenCode]
      param[41] = ['大屏幕显示产量端口', this.formData.largeScreenDisplayOutputPort]
      param[42] = ['大屏幕显示Andon大屏幕代码', this.formData.AndonCode]
      param[43] = ['大屏幕显示Andon端口', this.formData.AndonPort]
      param[44] = ['是否有打印机', this.formData.isTherePrinter]
      param[45] = ['打印机通讯端口', this.formData.printerPort]
      param[46] = ['工序号', this.formData.processNo]
      param[47] = ['工序名称', this.formData.processName]
      param[48] = ['是否有工位计算机', this.formData.isThereComputer]
      param[49] = ['是否有测量数据', this.formData.isThereData]
      param[50] = ['是否启用MES', this.formData.enableMES]
      param[51] = ['在线状态', this.formData.onlineStatus]
      param[52] = ['是否通过监控系统保存数据', this.formData.whetherSaveData]
      param[53] = ['是否监控', this.formData.whetherMonitor]
      param[54] = ['返修工位号', this.formData.repairStationNo]
      param[55] = ['工步属性', this.formData.workStepAttribute]
      param[56] = ['MesServerCode', this.formData.MesServerCode]
      param[57] = ['MesDll', this.formData.MesDll]
      param[58] = ['MesWebCode', this.formData.MesWebCode]
      param[59] = ['订单选择权限', this.formData.orderSelectionPermission]
      param[60] = ['服务器IP', this.formData.theServerIP]
      param[61] = ['Bar版本号', this.formData.BarVersion]
      param[62] = ['监控属性代码', this.formData.monitoringAttributeCode]
      param[63] = ['IP', this.formData.IP]
      param[64] = ['报警数', this.formData.numberAlarms]
      param[65] = ['质量组数', this.formData.numberQualityGroups]
      var Data = this.CreateData('12', '基础数据_工位信息维护_增加', param)
      this.ExecDatabase(Data).then(response => {
        console.log(response)
        if (response.data[0].result === '1') {
          this.$message({
            message: '增加成功',
            type: 'success'
          })
          this.dialogFormVisible = false
          this.searchTable()
        } else {
          this.$message.error('增加失败！')
        }
      })
      this.drawer = false
    },
    editShiftTable(row) {
      this.title = '编辑工位信息'
      this.formData.ID = row.ID // ID
      this.formData.stationCode = row.工位代码 // 工位代码
      this.formData.stationNumber = row.工位号 // 工位号
      this.formData.guideStationNumber = row.指南工位号 // 指南工位号
      this.formData.machineType = row.机床类型 // 机床类型
      this.formData.stationName = row.工位名称 // 工位名称
      this.formData.lineType = row.线体类型 // 线体类型
      this.formData.QRcodeScannGun = row.二维码扫描枪 // 二维码扫描枪
      this.formData.fixedBarcodeScannGun = row.固定条形码扫描枪 // 固定条形码扫描枪
      this.formData.handheldBarcodeScannGun = row.手持条形码扫描枪 // 手持条形码扫描枪
      this.formData.PC = row.PC
      this.formData.nameIndustrialComputer = row.工控机名称 // 工控机名称
      this.formData.ipIndustrialComputer = row.工控机IP // 工控机IP
      this.formData.communicationPort = row.通讯端口 // 通讯端口
      this.formData.fileName = row.文件名称 // 文件名称
      this.formData.PLC = row.PLC
      this.formData.PLCCode = row.PLC代码 // PLC代码
      this.formData.PLCState = row.PLC加工状态 // PLC加工状态
      this.formData.PLCCodeState = row.PLC代码加工状态 // PLC代码加工状态
      this.formData.engineModelCodeSynthesis = row.发动机型号代码合成 // 发动机型号代码合成
      this.formData.dailyPlannedOutput = row.日计划产量 // 日计划产量
      this.formData.preparationTime = row.准备时间 // 准备时间
      this.formData.machineTime = row.机器时间 // 机器时间
      this.formData.laborTime = row.人工时间 // 人工时间
      this.formData.technicalDifficultyCoefficient = row.技术难度系数 // 技术难度系数
      this.formData.whetherLineHead = row.是否线首 // 是否线首
      this.formData.branchMaterialTrackingStation = row.分线物料追踪工位 // 分线物料追踪工位
      this.formData.busOnlineStation = row.总线上线工位 // 总线上线工位
      this.formData.busMonitoredStation = row.总线被监测工位 // 总线被监测工位
      this.formData.scanningGunType = row.扫描枪类型 // 扫描枪类型
      this.formData.stationType = row.工位类型 // 工位类型
      this.formData.DFCBMTS = row.分线物料追踪工位数据文件连接 // 分线物料追踪工位数据文件连接
      this.formData.BOSDFC = row.总线上线工位数据文件连接 // 总线上线工位数据文件连接
      this.formData.OpcServer = row.OpcServer
      this.formData.OpcServer_MIS = row.OpcServer_MIS
      this.formData.OpcServer_OPNAME = row.OpcServer_OPNAME
      this.formData.TargetCycleTime = row.目标循环时间 // 目标循环时间
      this.formData.WorkpieceType = row.工件类型 // 工件类型
      this.formData.basicOperationInstructionsStation = row.工位基本操作指导 // 工位基本操作指导
      this.formData.stationBasicGuidePicture = row.工位基本指导图片 // 工位基本指导图片
      this.formData.stationUpperLowerLineType = row.工位上下线类型 // 工位上下线类型
      this.formData.largeScreenCode = row.大屏幕代码 // 大屏幕代码
      this.formData.largeScreenDisplayOutputPort = row.大屏幕显示产量端口 // 大屏幕显示产量端口
      this.formData.AndonCode = row.大屏幕显示Andon大屏幕代码 // 大屏幕显示Andon大屏幕代码
      this.formData.AndonPort = row.大屏幕显示Andon端口 // 大屏幕显示Andon端口
      this.formData.isTherePrinter = row.是否有打印机 // 是否有打印机
      this.formData.printerPort = row.打印机通讯端口 // 打印机通讯端口
      this.formData.processNo = row.工序号 // 工序号
      this.formData.processName = row.工序名称 // 工序名称
      this.formData.isThereComputer = row.是否有工位计算机 // 是否有工位计算机
      this.formData.isThereData = row.是否有测量数据 // 是否有测量数据
      this.formData.enableMES = row.是否启用MES // 是否启用MES
      this.formData.onlineStatus = row.在线状态 // 在线状态
      this.formData.whetherSaveData = row.是否通过监控系统保存数据 // 是否通过监控系统保存数据
      this.formData.whetherMonitor = row.是否监控 // 是否监控
      this.formData.repairStationNo = row.返修工位号 // 返修工位号
      this.formData.workStepAttribute = row.工步属性 // 工步属性
      this.formData.MesServerCode = row.MesServerCode
      this.formData.MesDll = row.MesDll
      this.formData.MesWebCode = row.MesWebCode
      this.formData.orderSelectionPermission = row.订单选择权限 // 订单选择权限
      this.formData.theServerIP = row.服务器IP // 服务器IP
      this.formData.BarVersion = row.Bar版本号 // Bar版本号
      this.formData.monitoringAttributeCode = row.监控属性代码 // 监控属性代码
      this.formData.IP = row.IP
      this.formData.numberAlarms = row.报警数 // 报警数
      this.formData.numberQualityGroups = row.质量组数
      this.drawer = true
    },
    rowClick(row) {
      this.formData.stationCode = row.工位代码 // 工位代码
      this.formData.stationNumber = row.工位号 // 工位号
      this.formData.guideStationNumber = row.指南工位号 // 指南工位号
      this.formData.machineType = row.机床类型 // 机床类型
      this.formData.stationName = row.工位名称 // 工位名称
      this.formData.lineType = row.线体类型 // 线体类型
      this.formData.QRcodeScannGun = row.二维码扫描枪 // 二维码扫描枪
      this.formData.fixedBarcodeScannGun = row.固定条形码扫描枪 // 固定条形码扫描枪
      this.formData.handheldBarcodeScannGun = row.手持条形码扫描枪 // 手持条形码扫描枪
      this.formData.PC = row.PC
      this.formData.nameIndustrialComputer = row.工控机名称 // 工控机名称
      this.formData.ipIndustrialComputer = row.工控机IP // 工控机IP
      this.formData.communicationPort = row.通讯端口 // 通讯端口
      this.formData.fileName = row.文件名称 // 文件名称
      this.formData.PLC = row.PLC
      this.formData.PLCCode = row.PLC代码 // PLC代码
      this.formData.PLCState = row.PLC加工状态 // PLC加工状态
      this.formData.PLCCodeState = row.PLC代码加工状态 // PLC代码加工状态
      this.formData.engineModelCodeSynthesis = row.发动机型号代码合成 // 发动机型号代码合成
      this.formData.dailyPlannedOutput = row.日计划产量 // 日计划产量
      this.formData.preparationTime = row.准备时间 // 准备时间
      this.formData.machineTime = row.机器时间 // 机器时间
      this.formData.laborTime = row.人工时间 // 人工时间
      this.formData.technicalDifficultyCoefficient = row.技术难度系数 // 技术难度系数
      this.formData.whetherLineHead = row.是否线首 // 是否线首
      this.formData.branchMaterialTrackingStation = row.分线物料追踪工位 // 分线物料追踪工位
      this.formData.busOnlineStation = row.总线上线工位 // 总线上线工位
      this.formData.busMonitoredStation = row.总线被监测工位 // 总线被监测工位
      this.formData.scanningGunType = row.扫描枪类型 // 扫描枪类型
      this.formData.stationType = row.工位类型 // 工位类型
      this.formData.DFCBMTS = row.分线物料追踪工位数据文件连接 // 分线物料追踪工位数据文件连接
      this.formData.BOSDFC = row.总线上线工位数据文件连接 // 总线上线工位数据文件连接
      this.formData.OpcServer = row.OpcServer
      this.formData.OpcServer_MIS = row.OpcServer_MIS
      this.formData.OpcServer_OPNAME = row.OpcServer_OPNAME
      this.formData.TargetCycleTime = row.目标循环时间 // 目标循环时间
      this.formData.WorkpieceType = row.工件类型 // 工件类型
      this.formData.basicOperationInstructionsStation = row.工位基本操作指导 // 工位基本操作指导
      this.formData.stationBasicGuidePicture = row.工位基本指导图片 // 工位基本指导图片
      this.formData.stationUpperLowerLineType = row.工位上下线类型 // 工位上下线类型
      this.formData.largeScreenCode = row.大屏幕代码 // 大屏幕代码
      this.formData.largeScreenDisplayOutputPort = row.大屏幕显示产量端口 // 大屏幕显示产量端口
      this.formData.AndonCode = row.大屏幕显示Andon大屏幕代码 // 大屏幕显示Andon大屏幕代码
      this.formData.AndonPort = row.大屏幕显示Andon端口 // 大屏幕显示Andon端口
      this.formData.isTherePrinter = row.是否有打印机 // 是否有打印机
      this.formData.printerPort = row.打印机通讯端口 // 打印机通讯端口
      this.formData.processNo = row.工序号 // 工序号
      this.formData.processName = row.工序名称 // 工序名称
      this.formData.isThereComputer = row.是否有工位计算机 // 是否有工位计算机
      this.formData.isThereData = row.是否有测量数据 // 是否有测量数据
      this.formData.enableMES = row.是否启用MES // 是否启用MES
      this.formData.onlineStatus = row.在线状态 // 在线状态
      this.formData.whetherSaveData = row.是否通过监控系统保存数据 // 是否通过监控系统保存数据
      this.formData.whetherMonitor = row.是否监控 // 是否监控
      this.formData.repairStationNo = row.返修工位号 // 返修工位号
      this.formData.workStepAttribute = row.工步属性 // 工步属性
      this.formData.MesServerCode = row.MesServerCode
      this.formData.MesDll = row.MesDll
      this.formData.MesWebCode = row.MesWebCode
      this.formData.orderSelectionPermission = row.订单选择权限 // 订单选择权限
      this.formData.theServerIP = row.服务器IP // 服务器IP
      this.formData.BarVersion = row.Bar版本号 // Bar版本号
      this.formData.monitoringAttributeCode = row.监控属性代码 // 监控属性代码
      this.formData.IP = row.IP
      this.formData.numberAlarms = row.报警数 // 报警数
      this.formData.numberQualityGroups = row.质量组数
    },
    copyData() {
      if (this.formData.stationNumber) {
        var param = []
        param[0] = ['工位代码', 'copeData']
        param[1] = ['工位号', 'copeData']
        param[2] = ['指南工位号', this.formData.guideStationNumber]
        param[3] = ['机床类型', this.formData.machineType]
        param[4] = ['工位名称', this.formData.stationName]
        param[5] = ['线体类型', this.formData.lineType]
        param[6] = ['二维码扫描枪', this.formData.QRcodeScannGun]
        param[7] = ['固定条形码扫描枪', this.formData.fixedBarcodeScannGun]
        param[8] = ['手持条形码扫描枪', this.formData.handheldBarcodeScannGun]
        param[9] = ['PC', this.formData.PC]
        param[10] = ['工控机名称', this.formData.nameIndustrialComputer]
        param[11] = ['工控机IP', this.formData.ipIndustrialComputer]
        param[12] = ['通讯端口', this.formData.communicationPort]
        param[13] = ['文件名称', this.formData.fileName]
        param[14] = ['PLC', this.formData.PLC]
        param[15] = ['PLC代码', this.formData.PLCCode]
        param[16] = ['PLC加工状态', this.formData.PLCState]
        param[17] = ['PLC代码加工状态', this.formData.PLCCodeState]
        param[18] = ['发动机型号代码合成', this.formData.engineModelCodeSynthesis]
        param[19] = ['日计划产量', this.formData.dailyPlannedOutput]
        param[20] = ['准备时间', this.formData.preparationTime]
        param[21] = ['机器时间', this.formData.machineTime]
        param[22] = ['人工时间', this.formData.laborTime]
        param[23] = ['技术难度系数', this.formData.technicalDifficultyCoefficient]
        param[24] = ['是否线首', this.formData.whetherLineHead]
        param[25] = ['分线物料追踪工位', this.formData.branchMaterialTrackingStation]
        param[26] = ['总线上线工位', this.formData.busOnlineStation]
        param[27] = ['总线被监测工位', this.formData.busMonitoredStation]
        param[28] = ['扫描枪类型', this.formData.scanningGunType]
        param[29] = ['工位类型', this.formData.stationType]
        param[30] = ['分线物料追踪工位数据文件连接', this.formData.DFCBMTS]
        param[31] = ['总线上线工位数据文件连接', this.formData.BOSDFC]
        param[32] = ['OpcServer', this.formData.OpcServer]
        param[33] = ['OpcServer_MIS', this.formData.OpcServer_MIS]
        param[34] = ['OpcServer_OPNAME', this.formData.OpcServer_OPNAME]
        param[35] = ['目标循环时间', this.formData.TargetCycleTime]
        param[36] = ['工件类型', this.formData.WorkpieceType]
        param[37] = ['工位基本操作指导', this.formData.basicOperationInstructionsStation]
        param[38] = ['工位基本指导图片', null]
        param[39] = ['工位上下线类型', this.formData.stationUpperLowerLineType]
        param[40] = ['大屏幕代码', this.formData.largeScreenCode]
        param[41] = ['大屏幕显示产量端口', this.formData.largeScreenDisplayOutputPort]
        param[42] = ['大屏幕显示Andon大屏幕代码', this.formData.AndonCode]
        param[43] = ['大屏幕显示Andon端口', this.formData.AndonPort]
        param[44] = ['是否有打印机', this.formData.isTherePrinter]
        param[45] = ['打印机通讯端口', this.formData.printerPort]
        param[46] = ['工序号', this.formData.processNo]
        param[47] = ['工序名称', this.formData.processName]
        param[48] = ['是否有工位计算机', this.formData.isThereComputer]
        param[49] = ['是否有测量数据', this.formData.isThereData]
        param[50] = ['是否启用MES', this.formData.enableMES]
        param[51] = ['在线状态', this.formData.onlineStatus]
        param[52] = ['是否通过监控系统保存数据', this.formData.whetherSaveData]
        param[53] = ['是否监控', this.formData.whetherMonitor]
        param[54] = ['返修工位号', this.formData.repairStationNo]
        param[55] = ['工步属性', this.formData.workStepAttribute]
        param[56] = ['MesServerCode', this.formData.MesServerCode]
        param[57] = ['MesDll', this.formData.MesDll]
        param[58] = ['MesWebCode', this.formData.MesWebCode]
        param[59] = ['订单选择权限', this.formData.orderSelectionPermission]
        param[60] = ['服务器IP', this.formData.theServerIP]
        param[61] = ['Bar版本号', this.formData.BarVersion]
        param[62] = ['监控属性代码', this.formData.monitoringAttributeCode]
        param[63] = ['IP', this.formData.IP]
        param[64] = ['报警数', this.formData.numberAlarms]
        param[65] = ['质量组数', this.formData.numberQualityGroups]
        console.log(param, 'param')
        var Data = this.CreateData('12', '基础数据_工位信息维护_增加', param)
        this.ExecDatabase(Data).then(response => {
          console.log(response)
          if (response.data[0].result === '1') {
            this.$message({
              message: '增加成功',
              type: 'success'
            })
            this.dialogFormVisible = false
            this.searchTable()
          } else {
            this.$message.error('增加失败！')
          }
        })
      } else {
        this.$message.error('请选中一行信息进行复制！')
      }
    },
    submitAdd1() {
      this.$refs['formData'].validate((valid) => {
        if (valid) {
          var param = []
          param[0] = ['工位代码', this.formData.stationCode]
          param[1] = ['工位号', this.formData.stationNumber]
          param[2] = ['指南工位号', this.formData.guideStationNumber]
          param[3] = ['机床类型', this.formData.machineType]
          param[4] = ['工位名称', this.formData.stationName]
          param[5] = ['线体类型', this.formData.lineType]
          param[6] = ['二维码扫描枪', this.formData.QRcodeScannGun]
          param[7] = ['固定条形码扫描枪', this.formData.fixedBarcodeScannGun]
          param[8] = ['手持条形码扫描枪', this.formData.handheldBarcodeScannGun]
          param[9] = ['PC', this.formData.PC]
          param[10] = ['工控机名称', this.formData.nameIndustrialComputer]
          param[11] = ['工控机IP', this.formData.ipIndustrialComputer]
          param[12] = ['通讯端口', this.formData.communicationPort]
          param[13] = ['文件名称', this.formData.fileName]
          param[14] = ['PLC', this.formData.PLC]
          param[15] = ['PLC代码', this.formData.PLCCode]
          param[16] = ['PLC加工状态', this.formData.PLCState]
          param[17] = ['PLC代码加工状态', this.formData.PLCCodeState]
          param[18] = ['发动机型号代码合成', this.formData.engineModelCodeSynthesis]
          param[19] = ['日计划产量', this.formData.dailyPlannedOutput]
          param[20] = ['准备时间', this.formData.preparationTime]
          param[21] = ['机器时间', this.formData.machineTime]
          param[22] = ['人工时间', this.formData.laborTime]
          param[23] = ['技术难度系数', this.formData.technicalDifficultyCoefficient]
          param[24] = ['是否线首', this.formData.whetherLineHead]
          param[25] = ['分线物料追踪工位', this.formData.branchMaterialTrackingStation]
          param[26] = ['总线上线工位', this.formData.busOnlineStation]
          param[27] = ['总线被监测工位', this.formData.busMonitoredStation]
          param[28] = ['扫描枪类型', this.formData.scanningGunType]
          param[29] = ['工位类型', this.formData.stationType]
          param[30] = ['分线物料追踪工位数据文件连接', this.formData.DFCBMTS]
          param[31] = ['总线上线工位数据文件连接', this.formData.BOSDFC]
          param[32] = ['OpcServer', this.formData.OpcServer]
          param[33] = ['OpcServer_MIS', this.formData.OpcServer_MIS]
          param[34] = ['OpcServer_OPNAME', this.formData.OpcServer_OPNAME]
          param[35] = ['目标循环时间', this.formData.TargetCycleTime]
          param[36] = ['工件类型', this.formData.WorkpieceType]
          param[37] = ['工位基本操作指导', this.formData.basicOperationInstructionsStation]
          param[38] = ['工位基本指导图片', null]
          param[39] = ['工位上下线类型', this.formData.stationUpperLowerLineType]
          param[40] = ['大屏幕代码', this.formData.largeScreenCode]
          param[41] = ['大屏幕显示产量端口', this.formData.largeScreenDisplayOutputPort]
          param[42] = ['大屏幕显示Andon大屏幕代码', this.formData.AndonCode]
          param[43] = ['大屏幕显示Andon端口', this.formData.AndonPort]
          param[44] = ['是否有打印机', this.formData.isTherePrinter]
          param[45] = ['打印机通讯端口', this.formData.printerPort]
          param[46] = ['工序号', this.formData.processNo]
          param[47] = ['工序名称', this.formData.processName]
          param[48] = ['是否有工位计算机', this.formData.isThereComputer]
          param[49] = ['是否有测量数据', this.formData.isThereData]
          param[50] = ['是否启用MES', this.formData.enableMES]
          param[51] = ['在线状态', this.formData.onlineStatus]
          param[52] = ['是否通过监控系统保存数据', this.formData.whetherSaveData]
          param[53] = ['是否监控', this.formData.whetherMonitor]
          param[54] = ['返修工位号', this.formData.repairStationNo]
          param[55] = ['工步属性', this.formData.workStepAttribute]
          param[56] = ['MesServerCode', this.formData.MesServerCode]
          param[57] = ['MesDll', this.formData.MesDll]
          param[58] = ['MesWebCode', this.formData.MesWebCode]
          param[59] = ['订单选择权限', this.formData.orderSelectionPermission]
          param[60] = ['服务器IP', this.formData.theServerIP]
          param[61] = ['Bar版本号', this.formData.BarVersion]
          param[62] = ['监控属性代码', this.formData.monitoringAttributeCode]
          param[63] = ['IP', this.formData.IP]
          param[64] = ['报警数', this.formData.numberAlarms]
          param[65] = ['质量组数', this.formData.numberQualityGroups]
          param[66] = ['ID', this.formData.ID]
          console.log(param, 'param')
          var Data = this.CreateData('12', '基础数据_工位信息维护_修改', param)
          this.ExecDatabase(Data).then(response => {
            if (response.data[0].result === '1') {
              this.$message({
                message: '修改成功',
                type: 'success'
              })
              this.searchTable()
            } else {
              this.$message.error('修改失败！')
            }
          })
          this.drawer = false
        } else {
          return false
        }
      })
    },
    handleDelete(row) {
      this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var param = []
        param[0] = ['ID', row.ID]
        var Data = this.CreateData('12', '基础数据_工位信息维护_删除', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.searchTable()
          } else {
            this.$message.error('删除失败！')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    callOff() {
      this.drawer = false
    },
    importOrder() {
      this.dialogFormVisible3 = true
    },
    removeAll() {
      this.worksheet = []
      this.itemFile = []
    },
    async selected(data) { // 选择需要导入的文件
      console.log(data, 1111)
      this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
      this.itemFile = data.itemFile
    },
    handleRemove(file) { // 移除文件
      for (let i = 0; i < this.itemFile.length; i++) {
        if (this.itemFile[i].name === file.name) {
          this.worksheet.splice(i, 1)
          this.itemFile.splice(i, 1)
        }
      }
    },
    async basicPartsToSQL() {
      try {
        this.loading = true
        this.err = 0
        for (let j = this.worksheet.length - 1; j >= 0; j--) {
          let stationCode,
            stationNumber,
            guideStationNumber,
            machineType,
            stationName,
            lineType,
            QRcodeScannGun,
            fixedBarcodeScannGun,
            handheldBarcodeScannGun,
            PC,
            nameIndustrialComputer,
            ipIndustrialComputer,
            communicationPort,
            fileName,
            PLC,
            PLCCode,
            PLCState,
            PLCCodeState,
            engineModelCodeSynthesis,
            dailyPlannedOutput,
            preparationTime,
            machineTime,
            laborTime,
            technicalDifficultyCoefficient,
            whetherLineHead,
            branchMaterialTrackingStation,
            busOnlineStation,
            busMonitoredStation,
            scanningGunType,
            stationType,
            DFCBMTS,
            BOSDFC,
            OpcServer,
            OpcServer_MIS,
            OpcServer_OPNAME,
            TargetCycleTime,
            WorkpieceType,
            basicOperationInstructionsStation,
            stationUpperLowerLineType,
            largeScreenCode,
            largeScreenDisplayOutputPort,
            AndonCode,
            AndonPort,
            isTherePrinter,
            printerPort,
            processNo,
            processName,
            isThereComputer,
            isThereData,
            enableMES,
            onlineStatus,
            whetherSaveData,
            whetherMonitor,
            repairStationNo,
            workStepAttribute,
            MesServerCode,
            MesDll,
            MesWebCode,
            orderSelectionPermission,
            theServerIP,
            BarVersion,
            monitoringAttributeCode,
            IP,
            numberAlarms,
            numberQualityGroups
          var param = []
          param[0] = ['工位号', this.worksheet[j].B2.v]
          console.log('工位号', this.worksheet[j].B2.v)
          var Data = this.CreateData('11', '基础数据_工位信息维护_导入校验', param)
          const response = await this.ExecDatabase(Data)
          const res = response.data
          if (res[0].Column1 !== 0) {
            this.$notify.error(`${this.worksheet[j].B2.v}已经存在，请确认文件是否正确`)
            this.loading = false
            this.disabled = false
            return
          } else {
            for (let i = 0; i < 999; i++) {
              const attr = i + 2
              stationCode = this.worksheet[j][`A${attr}`] ? this.worksheet[j][`A${attr}`].v : ''
              stationNumber = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
              guideStationNumber = this.worksheet[j][`C${attr}`] ? this.worksheet[j][`C${attr}`].v : ''
              machineType = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
              stationName = this.worksheet[j][`E${attr}`] ? this.worksheet[j][`E${attr}`].v : ''
              lineType = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
              QRcodeScannGun = this.worksheet[j][`G${attr}`] ? this.worksheet[j][`G${attr}`].v : ''
              fixedBarcodeScannGun = this.worksheet[j][`H${attr}`] ? this.worksheet[j][`H${attr}`].v : ''
              handheldBarcodeScannGun = this.worksheet[j][`I${attr}`] ? this.worksheet[j][`I${attr}`].v : ''
              PC = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
              nameIndustrialComputer = this.worksheet[j][`K${attr}`] ? this.worksheet[j][`K${attr}`].v : ''
              ipIndustrialComputer = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
              communicationPort = this.worksheet[j][`M${attr}`] ? this.worksheet[j][`M${attr}`].v : ''
              fileName = this.worksheet[j][`N${attr}`] ? this.worksheet[j][`N${attr}`].v : ''
              PLC = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
              PLCCode = this.worksheet[j][`P${attr}`] ? this.worksheet[j][`P${attr}`].v : ''
              PLCState = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
              PLCCodeState = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
              engineModelCodeSynthesis = this.worksheet[j][`S${attr}`] ? this.worksheet[j][`S${attr}`].v : ''
              dailyPlannedOutput = this.worksheet[j][`T${attr}`] ? this.worksheet[j][`T${attr}`].v : ''
              preparationTime = this.worksheet[j][`U${attr}`] ? this.worksheet[j][`U${attr}`].v : ''
              machineTime = this.worksheet[j][`V${attr}`] ? this.worksheet[j][`V${attr}`].v : ''
              laborTime = this.worksheet[j][`W${attr}`] ? this.worksheet[j][`W${attr}`].v : ''
              technicalDifficultyCoefficient = this.worksheet[j][`X${attr}`] ? this.worksheet[j][`X${attr}`].v : ''
              whetherLineHead = this.worksheet[j][`Y${attr}`] ? this.worksheet[j][`Y${attr}`].v : ''
              branchMaterialTrackingStation = this.worksheet[j][`Z${attr}`] ? this.worksheet[j][`Z${attr}`].v : ''
              busOnlineStation = this.worksheet[j][`AA${attr}`] ? this.worksheet[j][`AA${attr}`].v : ''
              busMonitoredStation = this.worksheet[j][`AB${attr}`] ? this.worksheet[j][`AB${attr}`].v : ''
              scanningGunType = this.worksheet[j][`AC${attr}`] ? this.worksheet[j][`AC${attr}`].v : ''
              stationType = this.worksheet[j][`AD${attr}`] ? this.worksheet[j][`AD${attr}`].v : ''
              DFCBMTS = this.worksheet[j][`AE${attr}`] ? this.worksheet[j][`AE${attr}`].v : ''
              BOSDFC = this.worksheet[j][`AF${attr}`] ? this.worksheet[j][`AF${attr}`].v : ''
              OpcServer = this.worksheet[j][`AG${attr}`] ? this.worksheet[j][`AG${attr}`].v : ''
              OpcServer_MIS = this.worksheet[j][`AH${attr}`] ? this.worksheet[j][`AH${attr}`].v : ''
              OpcServer_OPNAME = this.worksheet[j][`AI${attr}`] ? this.worksheet[j][`AI${attr}`].v : ''
              TargetCycleTime = this.worksheet[j][`AJ${attr}`] ? this.worksheet[j][`AJ${attr}`].v : ''
              WorkpieceType = this.worksheet[j][`AK${attr}`] ? this.worksheet[j][`AK${attr}`].v : ''
              basicOperationInstructionsStation = this.worksheet[j][`AL${attr}`] ? this.worksheet[j][`AL${attr}`].v : ''
              stationUpperLowerLineType = this.worksheet[j][`AM${attr}`] ? this.worksheet[j][`AM${attr}`].v : ''
              largeScreenCode = this.worksheet[j][`AN${attr}`] ? this.worksheet[j][`AN${attr}`].v : ''
              largeScreenDisplayOutputPort = this.worksheet[j][`AO${attr}`] ? this.worksheet[j][`AO${attr}`].v : ''
              AndonCode = this.worksheet[j][`AP${attr}`] ? this.worksheet[j][`AP${attr}`].v : ''
              AndonPort = this.worksheet[j][`AQ${attr}`] ? this.worksheet[j][`AQ${attr}`].v : ''
              isTherePrinter = this.worksheet[j][`AR${attr}`] ? this.worksheet[j][`AR${attr}`].v : ''
              printerPort = this.worksheet[j][`AS${attr}`] ? this.worksheet[j][`AS${attr}`].v : ''
              processNo = this.worksheet[j][`AT${attr}`] ? this.worksheet[j][`AT${attr}`].v : ''
              processName = this.worksheet[j][`AU${attr}`] ? this.worksheet[j][`AU${attr}`].v : ''
              isThereComputer = this.worksheet[j][`AV${attr}`] ? this.worksheet[j][`AV${attr}`].v : ''
              isThereData = this.worksheet[j][`AW${attr}`] ? this.worksheet[j][`AW${attr}`].v : ''
              enableMES = this.worksheet[j][`AX${attr}`] ? this.worksheet[j][`AX${attr}`].v : ''
              onlineStatus = this.worksheet[j][`AY${attr}`] ? this.worksheet[j][`AY${attr}`].v : ''
              whetherSaveData = this.worksheet[j][`AZ${attr}`] ? this.worksheet[j][`AZ${attr}`].v : ''
              whetherMonitor = this.worksheet[j][`BA${attr}`] ? this.worksheet[j][`BA${attr}`].v : ''
              repairStationNo = this.worksheet[j][`BB${attr}`] ? this.worksheet[j][`BB${attr}`].v : ''
              workStepAttribute = this.worksheet[j][`BC${attr}`] ? this.worksheet[j][`BC${attr}`].v : ''
              MesServerCode = this.worksheet[j][`BD${attr}`] ? this.worksheet[j][`BD${attr}`].v : ''
              MesDll = this.worksheet[j][`BE${attr}`] ? this.worksheet[j][`BE${attr}`].v : ''
              MesWebCode = this.worksheet[j][`BF${attr}`] ? this.worksheet[j][`BF${attr}`].v : ''
              orderSelectionPermission = this.worksheet[j][`BG${attr}`] ? this.worksheet[j][`BG${attr}`].v : ''
              theServerIP = this.worksheet[j][`BH${attr}`] ? this.worksheet[j][`BH${attr}`].v : ''
              BarVersion = this.worksheet[j][`BI${attr}`] ? this.worksheet[j][`BI${attr}`].v : ''
              monitoringAttributeCode = this.worksheet[j][`BJ${attr}`] ? this.worksheet[j][`BJ${attr}`].v : ''
              IP = this.worksheet[j][`BK${attr}`] ? this.worksheet[j][`BK${attr}`].v : ''
              numberAlarms = this.worksheet[j][`BL${attr}`] ? this.worksheet[j][`BL${attr}`].v : ''
              numberQualityGroups = this.worksheet[j][`BM${attr}`] ? this.worksheet[j][`BM${attr}`].v : ''
              console.log(stationCode,
                stationNumber,
                guideStationNumber,
                machineType,
                stationName,
                lineType,
                QRcodeScannGun,
                fixedBarcodeScannGun,
                handheldBarcodeScannGun,
                PC,
                nameIndustrialComputer,
                ipIndustrialComputer,
                communicationPort,
                fileName,
                PLC,
                PLCCode,
                PLCState,
                PLCCodeState,
                engineModelCodeSynthesis,
                dailyPlannedOutput,
                preparationTime,
                machineTime,
                laborTime,
                technicalDifficultyCoefficient,
                whetherLineHead,
                branchMaterialTrackingStation,
                busOnlineStation,
                busMonitoredStation,
                scanningGunType,
                stationType,
                DFCBMTS,
                BOSDFC,
                OpcServer,
                OpcServer_MIS,
                OpcServer_OPNAME,
                TargetCycleTime,
                WorkpieceType,
                basicOperationInstructionsStation,
                stationUpperLowerLineType,
                largeScreenCode,
                largeScreenDisplayOutputPort,
                AndonCode,
                AndonPort,
                isTherePrinter,
                printerPort,
                processNo,
                processName,
                isThereComputer,
                isThereData,
                enableMES,
                onlineStatus,
                whetherSaveData,
                whetherMonitor,
                repairStationNo,
                workStepAttribute,
                MesServerCode,
                MesDll,
                MesWebCode,
                orderSelectionPermission,
                theServerIP,
                BarVersion,
                monitoringAttributeCode,
                IP,
                numberAlarms,
                numberQualityGroups)
              if (!stationCode && !stationNumber && !guideStationNumber && !machineType && !stationName && !lineType) {
                break
              } else if (!stationNumber) { // 名称不能为空
                this.$notify.error(`工位号不能为空`)
                break
              } else {
                if (stationNumber) {
                  await sleep(50)
                  await this.insertToSQL(stationCode,
                    stationNumber,
                    guideStationNumber,
                    machineType,
                    stationName,
                    lineType,
                    QRcodeScannGun,
                    fixedBarcodeScannGun,
                    handheldBarcodeScannGun,
                    PC,
                    nameIndustrialComputer,
                    ipIndustrialComputer,
                    communicationPort,
                    fileName,
                    PLC,
                    PLCCode,
                    PLCState,
                    PLCCodeState,
                    engineModelCodeSynthesis,
                    dailyPlannedOutput,
                    preparationTime,
                    machineTime,
                    laborTime,
                    technicalDifficultyCoefficient,
                    whetherLineHead,
                    branchMaterialTrackingStation,
                    busOnlineStation,
                    busMonitoredStation,
                    scanningGunType,
                    stationType,
                    DFCBMTS,
                    BOSDFC,
                    OpcServer,
                    OpcServer_MIS,
                    OpcServer_OPNAME,
                    TargetCycleTime,
                    WorkpieceType,
                    basicOperationInstructionsStation,
                    stationUpperLowerLineType,
                    largeScreenCode,
                    largeScreenDisplayOutputPort,
                    AndonCode,
                    AndonPort,
                    isTherePrinter,
                    printerPort,
                    processNo,
                    processName,
                    isThereComputer,
                    isThereData,
                    enableMES,
                    onlineStatus,
                    whetherSaveData,
                    whetherMonitor,
                    repairStationNo,
                    workStepAttribute,
                    MesServerCode,
                    MesDll,
                    MesWebCode,
                    orderSelectionPermission,
                    theServerIP,
                    BarVersion,
                    monitoringAttributeCode,
                    IP,
                    numberAlarms,
                    numberQualityGroups)
                } else {
                  this.loading = false
                  this.disabled = false
                  this.$notify.error(`请确认导入文件是否正确`)
                  return
                }
              }
            }
          }
          this.itemFile.splice(j, 1)
          this.worksheet.splice(j, 1)
          this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err}，请检查文件是否正确`)
        }
        this.loading = false
        this.searchTable()
      } catch (e) {
        this.err++
        this.loading = false
        this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
        console.log(`导入数据错误${e}`)
      }
    },
    async insertToSQL(stationCode,
      stationNumber,
      guideStationNumber,
      machineType,
      stationName,
      lineType,
      QRcodeScannGun,
      fixedBarcodeScannGun,
      handheldBarcodeScannGun,
      PC,
      nameIndustrialComputer,
      ipIndustrialComputer,
      communicationPort,
      fileName,
      PLC,
      PLCCode,
      PLCState,
      PLCCodeState,
      engineModelCodeSynthesis,
      dailyPlannedOutput,
      preparationTime,
      machineTime,
      laborTime,
      technicalDifficultyCoefficient,
      whetherLineHead,
      branchMaterialTrackingStation,
      busOnlineStation,
      busMonitoredStation,
      scanningGunType,
      stationType,
      DFCBMTS,
      BOSDFC,
      OpcServer,
      OpcServer_MIS,
      OpcServer_OPNAME,
      TargetCycleTime,
      WorkpieceType,
      basicOperationInstructionsStation,
      stationUpperLowerLineType,
      largeScreenCode,
      largeScreenDisplayOutputPort,
      AndonCode,
      AndonPort,
      isTherePrinter,
      printerPort,
      processNo,
      processName,
      isThereComputer,
      isThereData,
      enableMES,
      onlineStatus,
      whetherSaveData,
      whetherMonitor,
      repairStationNo,
      workStepAttribute,
      MesServerCode,
      MesDll,
      MesWebCode,
      orderSelectionPermission,
      theServerIP,
      BarVersion,
      monitoringAttributeCode,
      IP,
      numberAlarms,
      numberQualityGroups) {
      try {
        var param = []
        param[0] = ['工位代码', stationCode]
        param[1] = ['工位号', stationNumber]
        param[2] = ['指南工位号', guideStationNumber]
        param[3] = ['机床类型', machineType]
        param[4] = ['工位名称', stationName]
        param[5] = ['线体类型', lineType]
        param[6] = ['二维码扫描枪', QRcodeScannGun]
        param[7] = ['固定条形码扫描枪', fixedBarcodeScannGun]
        param[8] = ['手持条形码扫描枪', handheldBarcodeScannGun]
        param[9] = ['PC', PC]
        param[10] = ['工控机名称', nameIndustrialComputer]
        param[11] = ['工控机IP', ipIndustrialComputer]
        param[12] = ['通讯端口', communicationPort]
        param[13] = ['文件名称', fileName]
        param[14] = ['PLC', PLC]
        param[15] = ['PLC代码', PLCCode]
        param[16] = ['PLC加工状态', PLCState]
        param[17] = ['PLC代码加工状态', PLCCodeState]
        param[18] = ['发动机型号代码合成', engineModelCodeSynthesis]
        param[19] = ['日计划产量', dailyPlannedOutput]
        param[20] = ['准备时间', preparationTime]
        param[21] = ['机器时间', machineTime]
        param[22] = ['人工时间', laborTime]
        param[23] = ['技术难度系数', technicalDifficultyCoefficient]
        param[24] = ['是否线首', whetherLineHead]
        param[25] = ['分线物料追踪工位', branchMaterialTrackingStation]
        param[26] = ['总线上线工位', busOnlineStation]
        param[27] = ['总线被监测工位', busMonitoredStation]
        param[28] = ['扫描枪类型', scanningGunType]
        param[29] = ['工位类型', stationType]
        param[30] = ['分线物料追踪工位数据文件连接', DFCBMTS]
        param[31] = ['总线上线工位数据文件连接', BOSDFC]
        param[32] = ['OpcServer', OpcServer]
        param[33] = ['OpcServer_MIS', OpcServer_MIS]
        param[34] = ['OpcServer_OPNAME', OpcServer_OPNAME]
        param[35] = ['目标循环时间', TargetCycleTime]
        param[36] = ['工件类型', WorkpieceType]
        param[37] = ['工位基本操作指导', basicOperationInstructionsStation]
        param[38] = ['工位基本指导图片', null]
        param[39] = ['工位上下线类型', stationUpperLowerLineType]
        param[40] = ['大屏幕代码', largeScreenCode]
        param[41] = ['大屏幕显示产量端口', largeScreenDisplayOutputPort]
        param[42] = ['大屏幕显示Andon大屏幕代码', AndonCode]
        param[43] = ['大屏幕显示Andon端口', AndonPort]
        param[44] = ['是否有打印机', isTherePrinter]
        param[45] = ['打印机通讯端口', printerPort]
        param[46] = ['工序号', processNo]
        param[47] = ['工序名称', processName]
        param[48] = ['是否有工位计算机', isThereComputer]
        param[49] = ['是否有测量数据', isThereData]
        param[50] = ['是否启用MES', enableMES]
        param[51] = ['在线状态', onlineStatus]
        param[52] = ['是否通过监控系统保存数据', whetherSaveData]
        param[53] = ['是否监控', whetherMonitor]
        param[54] = ['返修工位号', repairStationNo]
        param[55] = ['工步属性', workStepAttribute]
        param[56] = ['MesServerCode', MesServerCode]
        param[57] = ['MesDll', MesDll]
        param[58] = ['MesWebCode', MesWebCode]
        param[59] = ['订单选择权限', orderSelectionPermission]
        param[60] = ['服务器IP', theServerIP]
        param[61] = ['Bar版本号', BarVersion]
        param[62] = ['监控属性代码', monitoringAttributeCode]
        param[63] = ['IP', IP]
        param[64] = ['报警数', numberAlarms]
        param[65] = ['质量组数', numberQualityGroups]
        param[66] = ['导入类型', '1', 'int', '1']
        var Data = this.CreateData('12', '基础数据_工位信息维护_导入', param)
        const response = await this.ExecDatabase(Data)
        const res = response.data
        if (res.hasOwnProperty('output') === false) {
          if (res[0].result === '0') {
            this.$notify.error(`${stationNumber}导入失败`)
          }
        } else {
          if (res.result[0].result === '0') {
            this.$notify.error(`${stationNumber}导入失败`)
          }
          if (res.output[0].导入类型 === '2') {
            this.$notify.warning(`${stationNumber}存在重复数据`)
          }
        }
      } catch (e) {
        this.err++
        this.$message.error(`导入数据错误`)
        console.log(`导入数据错误${e}`)
      }
    },
    handleSizeChange(val) {
      this.pageSize = val
      this.pageCurrent = 1
      this.searchTable()
    },
    handleCurrentChange(val) {
      this.pageCurrent = val
      this.searchTable()
    }
  }
}
</script>

<style scoped>
  /deep/.el-input__inner{
    padding: 0 3px!important;
  }
  /deep/.el-form-item{
    margin-bottom: 10px!important;
  }
   /deep/.el-drawer.rtl{
     overflow: scroll;
   }
  /*1.显示滚动条：当内容超出容器的时候，可以拖动：*/
  /deep/.el-drawer__body {
    overflow: auto;
    /* overflow-x: auto; */
  }

  /*2.隐藏滚动条，太丑了*/
  /deep/.el-drawer__container ::-webkit-scrollbar{
    display: none;
  }
</style>

