<template>
  <div style="height: 100%;width: 100%;background: #d6dde5">
    <el-col :span="20" style="height: 100%; background: #fff">
      <el-row
          style="background-color: #ffffff;height: 100%;position: relative;margin: 0 6px 0 3px;cursor: pointer;border: 2px solid #9e9b9b"
          @click.native="showAlarmList()">
        <el-col :span="3" style="text-align: center;border-right: 2px solid #9e9b9b">
          <div style="font-size: 32px;background-color: #d7dee6;">
            报警信息：
          </div>
        </el-col>
        <el-col :span="21">
          <div v-if="alarmList.length > 0" :class="getAlarmClassType(alarmList[0])">
            {{ alarmList[0].报警内容 }}
          </div>
          <div v-else class="slogan1"/>
        </el-col>
      </el-row>
    </el-col>
    <el-col :span="4" style="height: 100%">
      <el-row style="height: 100%;width: 100%">
        <el-popover content="" placement="bottom" title="" trigger="click" width="250">
          <div style="width: 290px;">
            <!--v-if="$store.state.station.stationName !== 'J07MA005' && $store.state.station.stationName !== 'J07ET010'"-->
            <el-switch
                v-if="buttonShowList.indexOf('MES_OnlineStatus') > -1"
                v-model="value"
                active-color="#13ce66"
                active-text="MES在线"
                inactive-color="#ff4949"
                inactive-text="MES屏蔽"
                @change="changeStationStatus"
            />
            <el-switch
                v-if="this.$store.state.station.stationName == 'J07MA005' || this.$store.state.station.stationName == 'J07ET010'"
                v-model="NullWorkValue"
                active-color="#13ce66"
                active-text="正常流转"
                inactive-color="#ff4949"
                inactive-text="空托盘放行"
                @change="changeStationStatusNullWork">
            </el-switch>
            <!--            v-if="$store.state.station.stationName === 'J07MA150'"-->
            <el-switch
                v-if="buttonShowList.indexOf('MES_PartStatus') > -1"
                v-model="TurnLineWorkValue"
                active-color="#13ce66"
                active-text="正常工件"
                inactive-color="#ff4949"
                inactive-text="转线工件"
                @change="changeTurnLineWork"
            />
            <el-button
                v-if="buttonShowList.indexOf('MES_NotNowLineWorkOrder') > -1"
                class="button"
                plain
                type="primary"
                @click="NotNowLineWorkOrder">
              <span>非 本 线 工 作 订 单</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_NotNowLineWorkOrderEnd') > -1"
                class="button"
                plain
                style="background-color:#fbff08;"
                type="primary"
                @click="NotNowLineWorkOrderEnd">
              <span>本 线 工 作 订 单</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_ConfirmOk') > -1"
                class="button"
                plain
                type="primary"
                @click="qualifiedRelease">
              <span>合 格 放 行</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_NgGO') > -1"
                class="button"
                plain
                type="primary"
                @click="unqualifiedRelease">
              <span>不 合 格 放 行</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_OutLineGo') > -1"
                class="button"
                plain
                type="primary"
                @click="OutLineGo">
              <span>空 托 盘 放 行</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_OutLineGo') > -1"
                class="button"
                plain
                type="primary"
                @click="NoOkOutLineGo">
              <span>未 完 工 下 线</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_BoltAddWorkStart') > -1"
                class="button"
                plain
                type="primary"
                @click="remedyWork">
              <span>补 拧 螺 栓</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_BoltAddWorkEnd') > -1"
                class="button"
                plain
                style="background-color:#fbff08;"
                type="primary"
                @click="remedyWorkEnd">
              <span>结 束 补 拧</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_BoltSpotCheckStart') > -1"
                class="button"
                plain
                type="primary"
                @click="SpotCheck">
              <span>间 隙 抽 检</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_BoltSpotCheckEnd') > -1"
                class="button"
                plain
                style="background-color:#fbff08;"
                type="primary"
                @click="SpotCheckEnd">
              <span>取 消 抽 检</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_BackWorkGo') > -1"
                class="button"
                plain
                type="primary"
                @click="showBackWorkMode">
              <span>返 工 放 行</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_BackWork') > -1"
                class="button"
                plain
                type="primary"
                @click="faultBackWork">
              <span>故 障 返 工</span>
            </el-button>
            <el-button class="button" plain type="primary" @click="backCheckRecord">
              <span>巡 检 记 录</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_FaultStart') > -1"
                class="button"
                plain
                type="primary"
                @click="faultStart">
              <span>故 障 停 机</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_SkipDiskBearing') > -1"
                class="button"
                plain
                type="primary"
                @click="SkipDiskBearing">
              <span>跳 过 盘 轴</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_FaultEnd') > -1"
                class="button"
                plain
                style="background-color:#fbff08;"
                type="primary"
                @click="faultEnd">
              <span>停 机 结 束</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_OilPressureCheck') > -1"
                class="button"
                plain
                type="primary"
                @click="OilPressureCheck">
              <span>油 压 点 检</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_SetTemperature') > -1"
                class="button"
                plain
                type="primary"
                @click="isShowSetTemperatureVisible = true">
              <span>温 度 设 置</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_WritePallet') > -1"
                class="button"
                plain
                type="primary"
                @click="mesWritePallet">
              <span>修改托盘号</span>
            </el-button>
            <el-button
                v-if="buttonShowList.indexOf('MES_Reset') > -1"
                class="button"
                plain
                type="primary"
                @click="mesReset">
              <span>MES 复 位</span>
            </el-button>
            <el-button class="button" plain type="primary" @click="loginOut">
              <span>退 出 系 统</span>
            </el-button>
          </div>
          <el-button
              slot="reference"
              style="font-size: 25px;background-color: #005bac;color: white; width: 99%; height: 100%;border: 3px solid black;padding: 0;">
            功能按钮
          </el-button>
        </el-popover>
      </el-row>
    </el-col>
    <el-dialog
        :append-to-body="true"
        :visible.sync="dialogFormVisible2"
        center
        style="text-align: center"
        title="报警列表"
        width="850px">
      <el-table
          :data="alarmList"
          :header-cell-style="{background:'#F5F5F5'}"
          :index="tableIndexValue"
          :row-class-name="tableRowClassName"
          max-height="500px"
          style="width: 100%; border: 1px solid #9e9b9b"
          tooltip-effect="dark"
      >
        <el-table-column align="center" label="#" type="index" width="50px"/>
        <el-table-column align="center" label="报警内容" show-overflow-tooltip>
          <template #default="scope">
            {{ scope.row.报警内容 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="报警等级" width="300px">
          <template #default="scope">
            {{ scope.row.报警等级 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
        :append-to-body="true"
        :visible.sync="dialogFormVisible1"
        center
        style="text-align: center"
        title="合格放行"
        width="400px">
      <div style="text-align: center">
        <el-form
            ref="form1"
            :model="form1"
            class="demo-ruleForm"
            label-position="left"
            label-width="100px"
            style="width: 90%;margin: auto"
        >
          <div>
            <span style="font-size: large; color: black; line-height: 90px; ">请输入班组长工号确认：</span>
            <el-input
                v-model="form1.userName"
                style="width:150px; margin-top: 20px; border: 2px solid black; border-radius:6px"/>
          </div>
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="confirm11()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 60px" @click="cancel()">取消</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 修改托盘编号弹窗-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="mesWritePalletVisible"
        center
        style="text-align: center"
        title="修改托盘编号"
        width="400px">
      <div style="text-align: center">
        <el-form
            ref="form2"
            :model="form2"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <div>
            <span style="font-size: large; color: black; line-height: 90px; ">托盘编号：</span>
            <el-input-number v-model="form2.pallet" :min="0" :step="1" style="width:150px;"/>
          </div>
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="confirmWritePallet()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="cancelWritePallet()">关闭</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 返修放行 返工方式选择弹窗-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="backWorkModeIsShow"
        center
        style="text-align: center"
        title="返工方式选择"
        width="400px">
      <div style="text-align: center">
        <el-form
            :model="backWorkform"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="反工方式" prop="engineTypeValue" style="display: inline-block">
            <el-select
                v-model="backWorkModelValue"
                placeholder="请选择返工方式"
                size="small"
                @change="backWorkModelEdit">
              <el-option
                  v-for="item in backWorkModeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  size="mini"/>
            </el-select>
          </el-form-item>
          <div> {{ backWorkModelValueTip }}</div>
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="ShowBackWorkSelectBackOpName">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="backWorkModeIsShow = false">关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--返修放行 选择返工工位号弹窗-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="backWorkSelectBackOpNameIsShow"
        center
        height="100vh"
        style="text-align: center"
        title="返工工位号选择"
        width="800px">
      <div style="text-align: center">
        <el-form
            :model="backWorkform"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="起始工位号" prop="engineTypeValue" style="display: inline-block">
            <el-select v-model="stationNumberValue" placeholder="请选择返工起始工位号" size="small">
              <el-option
                  v-for="item in stationNumber"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  size="mini"/>
            </el-select>
          </el-form-item>
          <!--          // 展示易损清单列表-->
          <el-table
              v-if="backWorkEasyBadIsShow"
              ref="backWorkEasyBadSelectListTable"
              :data="backWorkEasyBadSelectList"
              :row-class-name="tableRowClassName"
              border
              max-height="365px"
              size="small"
              style="width: 100%; height: 280px; font-size: 20px; color: #000; border: 1px solid #9e9b9b"
          >
            <el-table-column
                type="selection"
                width="50">
            </el-table-column>
            <el-table-column align="center" label="类别" prop="类别" width="100"/>
            <el-table-column align="center" label="零部件" prop="零部件"/>
            <el-table-column align="center" label="重复使用原则" prop="重复使用原则"/>
          </el-table>
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="backWorkGoSubmit">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="backWorkSelectBackOpNameIsShow = false">
              关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 标记返工件弹窗-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="faultBackWorkVisible"
        center
        style="text-align: center"
        title="返工信息"
        width="400px">
      <div style="text-align: center">
        <el-form
            :model="backWorkform"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="返工类型" prop="engineTypeValue" style="display: inline-block">
            <el-select v-model="backWorkform.backWorkType" placeholder="请选择返工类型" size="small">
              <el-option
                  v-for="item in backWorkform.backWorkTypeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.label"
                  size="mini"/>
            </el-select>
          </el-form-item>
          <el-form-item label="故障原因" prop="engineTypeValue" style="display: inline-block">
            <el-select
                v-model="backWorkform.faultCode"
                placeholder="请选择故障原因"
                size="small"
                @change="faultCodeEdit">
              <el-option
                  v-for="item in backWorkform.faultList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  size="mini"/>
            </el-select>
          </el-form-item>
          <el-form-item
              v-if="faultBackWorkTextIsShow"
              label="原因"
              prop="engineTypeValue"
              style="display: inline-block">
            <el-input v-model="backWorkform.faultTxt" placeholder="请输入原因" size="small" style="width:200px;"/>
          </el-form-item>
          <el-form-item label="备注" prop="engineTypeValue" style="display: inline-block">
            <el-input
                v-model="backWorkform.remark"
                :rows="2"
                placeholder="请输入备注"
                style="height: 42px;"
                type="textarea">
            </el-input>
          </el-form-item>
          <!--<el-form-item label="发现人" prop="engineTypeValue" style="display: inline-block">-->
          <!--  <el-input v-model="backWorkform.discoverer" style="width:200px;" placeholder="请输入发现人" size="small"/>-->
          <!--</el-form-item>-->
          <el-form-item label="确认人" prop="engineTypeValue" style="display: inline-block">
            <el-input
                v-model="backWorkform.identifying"
                placeholder="请输入确认人工号"
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <!--          底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="faultBackWorkSubmit()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="faultBackWorkVisible = false">关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 油压点检弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="oilPressureCheckVisible"
        center
        style="text-align: center"
        title="油压点检"
        width="400px">
      <div style="text-align: center">
        <el-form
            ref="oilPressureCheckFormRef"
            :model="oilPressureCheckForm"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="油压" prop="engineTypeValue" style="display: inline-block">
            <el-input-number
                v-model="oilPressureCheckForm.oilPressure"
                :max="9999"
                :precision="2"
                :step="0.01"
                size="small"
                style="width:200px;"></el-input-number>
          </el-form-item>

          <el-form-item label="温度" prop="engineTypeValue" style="display: inline-block">
            <el-input-number
                v-model="oilPressureCheckForm.temperature"
                :max="9999"
                :precision="2"
                :step="0.01"
                size="small"
                style="width:200px;"></el-input-number>
          </el-form-item>
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="OilPressureCheckSubmit()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="oilPressureCheckVisible = false">关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 巡检弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="isShowBackCheckRecord"
        center
        style="text-align: center"
        title="巡检记录"
        width="400px">
      <div style="text-align: center">
        <el-form
            ref="backCheckRecordFormRef"
            :model="backCheckRecordForm"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="检验项目" prop="engineTypeValue" style="display: inline-block">
            <el-select
                v-model="backCheckRecordForm.checkDetails"
                placeholder="请选择检验项目"
                size="small"
                @change="checkDetailsChange($event)">
              <el-option
                  v-for="item in backCheckRecordForm.checkDetailsList"
                  :key="item.id"
                  :label="item.检验项目"
                  :value="item.id"
                  size="mini"/>
            </el-select>
          </el-form-item>
          <el-form-item label="检验标准" prop="engineTypeValue" style="display: inline-block">
            <el-input
                v-model="backCheckRecordForm.checkStandard"
                placeholder="请输入检验标准"
                readonly
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <el-form-item label="检验方法" prop="engineTypeValue" style="display: inline-block">
            <el-input
                v-model="backCheckRecordForm.checkFunction"
                placeholder="请输入检验方法"
                readonly
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <el-form-item label="巡检记录" prop="engineTypeValue" style="display: inline-block">
            <el-input
                v-model="backCheckRecordForm.checkResult"
                placeholder="请输入巡检记录"
                size="small"
                style="width:200px;"
                @input="checkDetailsCheckValueChange"/>
          </el-form-item>
          <el-form-item label="巡检员编号" prop="engineTypeValue" style="display: inline-block">
            <el-input
                v-model="backCheckRecordForm.checkerCode"
                placeholder="请输入巡检员编号"
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <el-form-item
              v-if="backCheckRecordForm.isAutoOK"
              label="上限值"
              prop="engineTypeValue"
              style="display: inline-block">
            <el-input
                v-model="backCheckRecordForm.okUpperLimit"
                readonly
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <el-form-item
              v-if="backCheckRecordForm.isAutoOK"
              label="下限值"
              prop="engineTypeValue"
              style="display: inline-block">
            <el-input
                v-model="backCheckRecordForm.okLowerLimit"
                readonly
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <el-form-item
              label="巡检通过结果"
              prop="engineTypeValue"
              style="display: inline-block"
          >
            <el-select
                v-model="backCheckRecordForm.isOk"
                :disabled="backCheckRecordForm.isAutoOK == 1"
                placeholder="请选择巡检通过结果"
                size="small">
              <el-option
                  label="不通过"
                  size="mini"
                  value="0"/>
              <el-option
                  label="通过"
                  size="mini"
                  value="1"/>
            </el-select>
          </el-form-item>
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="backCheckRecordSubmit()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="isShowBackCheckRecord = false">关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 故障停机弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="isShowFaultStart"
        center
        style="text-align: center"
        title="故障停机"
        width="400px">
      <div style="text-align: center">
        <el-form
            ref="faultStartFormRef"
            :model="faultStartForm"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="故障开始时间" prop="engineTypeValue" style="display: inline-block">
            <el-date-picker
                v-model="faultStartForm.startTime"
                placeholder="请选择故障开始时间"
                size="small"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"/>
          </el-form-item>
          <el-form-item label="故障发现人" prop="engineTypeValue" style="display: inline-block">
            <el-input
                v-model="faultStartForm.discoverer"
                placeholder="请输入故障发现人工号"
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="faultStartSubmit()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="isShowFaultStart = false">关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 停机结束弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="isShowFaultEnd"
        center
        style="text-align: center"
        title="停机结束"
        width="500px">
      <div style="text-align: center">
        <el-form
            ref="faultStartFormRef"
            :model="faultStartForm"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="故障开始时间" prop="engineTypeValue" style="display: inline-block;width: 60%">
            <el-date-picker
                v-model="faultEndForm.startTime"
                placeholder="请选择故障开始时间"
                size="small"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                @change="faultStartEndTimeChange()"/>
          </el-form-item>
          <el-form-item label="故障结束时间" prop="engineTypeValue" style="display: inline-block;width: 60%">
            <el-date-picker
                v-model="faultEndForm.endTime"
                placeholder="请选择故障结束时间"
                size="small"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                @change="faultStartEndTimeChange()"/>
          </el-form-item>
          <el-form-item label="停机时长(秒)" prop="engineTypeValue" style="display: inline-block;width: 60%">
            <el-input-number
                v-model="faultEndForm.stopTIme"
                :max="999999"
                :precision="0"
                :step="1"
                size="small"
                style="width:200px;"></el-input-number>
          </el-form-item>
          <el-form-item label="停机时长" prop="engineTypeValue" style="display: inline-block;width: 60%">
            <el-input v-model="faultEndForm.stopTimeStr" placeholder="停机时长" size="small" style="width:200px;"/>
          </el-form-item>
          <el-form-item label="故障处理人工号" prop="engineTypeValue" style="display: inline-block;width: 60%">
            <el-input
                v-model="faultEndForm.handlinger"
                placeholder="请输入故障处理人"
                size="small"
                style="width:200px;"/>
          </el-form-item>
          <el-form-item label="停机原因" prop="engineTypeValue" style="display: inline-block;width: 60%">
            <el-input
                v-model="faultEndForm.stopCause"
                :rows="2"
                placeholder="请输入停机原因"
                style="height: 42px;width: 200px"
                type="textarea">
            </el-input>
          </el-form-item>
          <el-form-item label="故障停机类型" prop="engineTypeValue" style="display: inline-block">
            <el-select
                v-model="backWorkform.faultType"
                placeholder="请选择故障原因"
                size="small"
                @change="faultCodeEdit">
              <el-option
                  v-for="item in backWorkform.faultTypeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  size="mini"/>
            </el-select>
          </el-form-item>
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="faultEndSubmit()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="isShowFaultEnd = false">关闭</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 设置温度弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="isShowSetTemperatureVisible"
        center
        style="text-align: center"
        title="设置温度"
        width="500px">
      <div style="text-align: center">
        <el-form
            ref="faultStartFormRef"
            :model="setTemperatureForm"
            label-position="left"
            label-width="100px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="放行温度(度)" prop="engineTypeValue" style="display: inline-block;width: 60%">
            <el-input-number
                v-model="setTemperatureForm.temperature"
                :max="999999"
                :precision="0"
                :step="1"
                size="small"
                style="width:200px;"></el-input-number>
          </el-form-item>
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="setTemperatureSubmit()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="isShowSetTemperatureVisible = false">
              关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 螺栓补拧弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="isShowBoltAddWork"
        center
        style="text-align: center"
        title="螺栓补拧"
        width="500px">
      <div style="text-align: center">
        <el-form
            :model="boltAddWork"
            label-position="left"
            label-width="130px"
            style="width: 100%;margin: auto"
        >
          <el-form-item label="允许补班长拧工号" style="display: inline-block;width: 80%">
            <el-input v-model="boltAddWork.boltAddWorkName" size="small" style="width:200px;"></el-input>
          </el-form-item>
          <el-form-item
              v-if="boltAddWork.boltAddWorkList.length > 0"
              label="补拧OP顺序号"
              style="display: inline-block;width: 80%">
            <el-select v-model="boltAddWork.boltAddWorkNumber" placeholder="请选择补拧OP顺序号" size="small">
              <el-option
                  v-for="item in boltAddWork.boltAddWorkList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  size="mini"/>
            </el-select>
          </el-form-item>
          <el-form-item label="补拧数量" style="display: inline-block;width: 80%">
            <el-input-number v-model="boltAddWork.boltAddWorkCount" size="small" style="width:200px;"></el-input-number>
          </el-form-item>
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="boltAddWorkSubmit()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="isShowBoltAddWork = false">关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 间隙抽检弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="isShowSpotCheck"
        center
        style="text-align: center"
        title="间隙抽检"
        width="500px">
      <div style="text-align: center">
        <el-form
            :model="boltAddWork"
            label-position="left"
            label-width="130px"
            style="width: 100%;margin: auto"
        >
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button class="el-icon-check" type="primary" @click="SpotCheck()">确定</el-button>
            <el-button class="el-icon-close" style="margin-left: 50px" @click="isShowSpotCheck = false">关闭</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!--// 间隙抽检弹出框-->
    <el-dialog
        :append-to-body="true"
        :visible.sync="isShowSpotCheckTip"
        center
        style="text-align: center"
        title="间隙抽检提示"
        width="550px">
      <div style="text-align: center">
        <el-form
            :model="boltAddWork"
            label-position="left"
            label-width="130px"
            style="width: 100%;margin: auto"
        >
          <div
              v-if="$store.state.station.stationName == 'J07MA050'"
              class="stepTip"
              style="text-align: left;font-size: 25px">
            step1:一轴朝上姿势时，在MA050先拧对角线2颗合箱螺灯(合计E紧4颗)<br>
            step2:检测主轴间隙 (咖啡机)<br>
            step3:再恢复正常流程。。·
          </div>
          <div v-else class="stepTip" style="text-align: left;font-size: 25px">
            step1:到返工工站(以下在返工站，全手工操作，包括翻转、拆下分离导套)<br>
            <!--step2:检测主轴间隙(咖啡机)<br>-->
            <!--step3:恢复装配分离导套;返工站返回主线<br>-->
            <!--Step4:再恢复正常流程MA120去装KIT-->
          </div>
          <!--底部按钮-->
          <div style="text-align: center; margin-top: 20px">
            <el-button
                v-if="$store.state.station.stationName == 'J07MA050'"
                class="el-icon-video-pause"
                type="primary"
                @click="SpotCheckEnd()">取消间隙抽检
            </el-button>
            <el-button v-else class="el-icon-circle-close" type="primary" @click="isShowSpotCheckTip = false">关闭
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
  </div>
</template>

<script>

import { mapGetters } from 'vuex'

export default {
  data() {
    return {
      tableIndexValue: Math.random(),
      value: true,
      NullWorkValue: false,
      mesWritePalletVisible: false,
      TurnLineWorkValue: true,
      publication: {
        topic: '',
        qos: 0,
        payload: ''
      },
      options: [
        {
          value: 0,
          label: '在线'
        }, {
          value: 2,
          label: '屏蔽'
        }
      ],
      slogan: 'MES系统正在调试！！',
      visible: false,
      dialogFormVisible1: false,
      dialogFormVisible2: false,
      faultBackWorkVisible: false,
      oilPressureCheckVisible: false,
      faultBackWorkTextIsShow: false,
      isShowBackCheckRecord: false,
      isShowFaultStart: false,
      isShowFaultEnd: false,
      isShowSetTemperatureVisible: false,
      isShowNoOkOutLineVisible: false,
      isShowRemedyWorkVisible: false,
      isShowBoltAddWork: false,
      isShowSpotCheck: false,
      alarmListTagId: [''],
      TagIdList: new Map(),
      alarmList: [],
      alarmList_Alarm: [],
      alarmList_Error: [],
      alarmList_Warning: [],
      title: '合格放行',
      form1: {
        userName: '',
        userPassword: ''
      },
      form2: {
        pallet: 0
      },
      backWorkform: {
        remark: '', // 备注
        identifying: '', // 确认人
        discoverer: '', // 发现人
        faultCode: '', // 故障原因代码
        faultTxt: '', // 故障原因内容  用于其他选项
        faultList: [], // 故障列表
        faultType: '', // 故障类型
        backWorkType: '', // 返工类型
        faultTypeList: [
          {
            value: '1',
            label: '生产停机'
          },
          {
            value: '2',
            label: '质量停机'
          },
          {
            value: '3',
            label: '设备停机'
          },
          {
            value: '4',
            label: '物流停机'
          }
        ], // 故障类型列表
        backWorkTypeList: [
          {
            value: '返工站返工',
            label: '返工站返工'
          },
          {
            value: '本工位返工',
            label: '本工位返工'
          }
        ] // 返工类型列表
      },
      remedyWorkForm: {
        confirmMonitor: '' // 确认班长

      },
      setTemperatureForm: {
        temperature: 0 // 温度
      },
      oilPressureCheckForm: {
        temperature: 0, // 温度
        oilPressure: 0 // 油压
      },
      boltAddWork: { // 螺栓补拧
        boltAddWorkName: '', // 班长工号
        boltAddWorkNumber: '', // 补拧OP顺序号
        boltAddWorkCount: 0, // 补拧数量
        boltAddWorkList2: [], // 存原数据
        boltAddWorkList: [] // 拉出本机型本工位的拧紧数据
      },
      // 间隙抽检
      SpotCheckForm: {
        SpotCheckFormList: []
      },
      backCheckRecordForm: {
        checkerCode: '', // 巡检员编号
        checkDetails: '', // 巡检内容
        checkResult: '', // 巡检结果
        isOk: '0',
        checkDetailsList: [], // 检验项目列表
        checkStandard: '', // 检验标准
        checkFunction: '', // 检验方法
        isAutoOK: '', // 是否自动判断合格
        okUpperLimit: '', // 上限值
        okLowerLimit: '' // 下限值
      },
      faultStartForm: {
        startTime: '', // 开始时间
        discoverer: '' // 故障发现人
      },
      faultEndForm: {
        startTime: '', // 开始时间
        endTime: '', // 结束时间
        handlinger: '', // 故障处理人
        stopTIme: '', // 停机时间
        stopCause: '', // 停机原因
        stopTimeStr: '' // 停机时间中文
      },
      buttonShowList: [],
      stationNumberValue: '', // 工位号
      stationNumber: [], // 工位号列表
      backWorkModelValueTip: '', // 返修方式提示
      backWorkModeList: [], // 返修方式列表
      backWorkModelValue: 0, // 返修方式值
      backWorkModeIsShow: false, // 返修方式弹窗是否显示
      backWorkEasyBadIsShow: false, // 返修易损件列表是否显示
      backWorkSelectBackOpNameIsShow: false, // 返修选择工位弹窗是否显示
      backWorkEasyBadList: [], // 返修易损件列表
      backWorkEasyBadSelectList: [], // 返修易损件选择列表
      backWorkSelectBackOpName: [], // 返修选择工位
      backWorkSelectBackOpNameList: [], // 返修选择工位列表
      isShowSpotCheckTip: false
    }
  },
  // 得引入vuex的数据才能监听里面存储的数据
  computed: {
    // ...mapState({
    //   processList_table: state => this.$store.state.operationGuide.processList_table
    // })
    ...mapGetters([
      'processList_table',
      'materialList_table',
      'pic',
      'tighteningPosition',
      'smile',
      'engineValue',
      'tempDataObject'
    ])
  },
  mounted() {
    this.getStationStatus()
    this.getStationButton()
    this.getTagList()
    // 获取初始化专线状态
    setTimeout(() => {
      this.TurnLineWorkValue = this.$store.state.station.turnLineWorkStatus
    }, 2000)
  },
  watch: {
    // 监听变量数据的某个对象
    'tempDataObject.ShowBackWorkBox': {
      handler(newV, oldV) {
        console.log('materialList_table', newV)
        if (newV) {
          this.faultBackWorkVisible = true
          this.backWorkform.backWorkType = '返工站返工'
          // 查询故障原因列表
          const param = []
          param[0] = ['工位号', this.$store.state.station.stationName]
          const Data = this.CreateData('11', '北汽福田返工_故障原因_查询', param)
          this.ExecDatabase(Data).then(response => {
            for (let i = 0; i < response.data.length; i++) {
              this.backWorkform.faultList.push({
                label: response.data[i].故障原因,
                value: response.data[i].故障代码
              })
            }
          })
        }
      },
      deep: true
    },
    // 空托盘放行
    'tempDataObject.emptyTrayGo': {
      handler(newV, oldV) {
        this.NullWorkValue = !newV
      },
      deep: true
    },
    // 刷新功能按钮
    'tempDataObject.SetButtomShouOrHide': {
      handler(newV, oldV) {
        this.isShowSpotCheckTip = false
        this.getStationButton()
      },
      deep: true
    },
    // MA050 换型首台 进间隙抽检
    'tempDataObject.MaterialList_Dif_Resources_MA050': {
      handler(newV, oldV) {
        this.boltAddWork.boltAddWorkName = ''
        this.boltAddWork.boltAddWorkNumber = ''
        this.boltAddWork.boltAddWorkCount = 0
        this.boltAddWork.boltAddWorkList2 = []
        this.boltAddWork.boltAddWorkList = []
        // 2.拉取该机型补拧列表
        this.boltAddWork.boltAddWorkList = []
        if (this.$store.state.station.stationName == 'J07MA050') {
          const param = []
          param[0] = ['工位号', this.$store.state.station.stationName]
          param[1] = ['机型编号', this.$store.state.station.engineValue.EngineType]
          const Data = this.CreateData('11', '北汽福田BOM_拧紧程序_间隙抽检_查询', param)
          this.ExecDatabase(Data).then(response => {
            if (response.data.length > 0) {
              this.SpotCheckForm.SpotCheckFormList = response.data
              this.SpotCheckSubmit()
            }
          })
        }
      },
      deep: true
    }
  },
  methods: {
    tableRowClassName({ row }) {
      console.log('报警列表', row)
      if (row.报警等级 === '错误') {
        return 'alarm_Alarm'
      } else if (row.报警等级 === '报警') {
        return 'alarm_Alarm'
      } else if (row.报警等级 === '警告') {
        return 'warning_Alarm'
      } else {
        return 'alarm_Default'
      }
    },
    // 获取报警类型
    getAlarmClassType(item) {
      console.log('报警等级', item)
      if (item.报警等级 == '警告') {
        return 'yellow-slogan'
      } else {
        return 'slogan'
      }
    },
    // 巡检记录弹窗
    backCheckRecord() {
      this.backCheckRecordForm.checkerCode = '' // 巡检员编号
      this.backCheckRecordForm.checkDetails = '' // 巡检内容
      this.backCheckRecordForm.checkResult = '' // 巡检结果
      this.backCheckRecordForm.isOk = '0'
      this.backCheckRecordForm.checkDetailsList = [] // 检验项目列表
      this.backCheckRecordForm.checkStandard = '' // 检验标准
      this.backCheckRecordForm.checkFunction = '' // 检验方法
      // 去查故障列表
      var param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      var Data = this.CreateData('11', '福田_巡检检验项维护项_工位_查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length > 0) {
          this.backCheckRecordForm.checkDetailsList = response.data
        } else {
          this.backCheckRecordForm.checkDetailsList = []
        }
      })
      this.isShowBackCheckRecord = true
    },
    // 故障停机提交
    faultStartSubmit() {
      if (!this.faultStartForm.discoverer) {
        this.$message({
          message: '故障发现人不能为空',
          type: 'error'
        })
        return false
      }
      var param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['故障发现人', this.faultStartForm.discoverer]
      param[2] = ['操作人', this.$store.state.station.stationUserCount]
      param[3] = ['开始时间', this.faultStartForm.startTime]
      var Data = this.CreateData('12', '北汽福田_停机记录_开始', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message({
            message: '故障停机提交成功',
            type: 'success'
          })
          // 查询更新后的功能按钮列表
          this.getStationButton()
          this.isShowFaultStart = false
        } else {
          this.$message({
            message: '故障停机提交失败',
            type: 'error'
          })
        }
      })
    },
    // 故障结束提交
    faultEndSubmit() {
      var param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['故障处理人', this.faultEndForm.handlinger]
      param[2] = ['结束时间', this.faultEndForm.endTime]
      param[3] = ['开始时间', this.faultEndForm.startTime]
      param[4] = ['停机时长', this.faultEndForm.stopTIme]
      param[5] = ['停机时长统计', this.faultEndForm.stopTimeStr]
      param[6] = ['停机原因', this.faultEndForm.stopCause]
      var Data = this.CreateData('12', '北汽福田_停机记录_结束', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message({
            message: '停机结束提交成功',
            type: 'success'
          })
          // 查询更新后的功能按钮列表
          this.getStationButton()
          this.isShowFaultEnd = false
        } else {
          this.$message({
            message: '停机结束提交失败',
            type: 'error'
          })
        }
      })
    },
    // 故障结束弹窗提交
    setTemperatureSubmit() {
      // 1. 将这条数据保存在数据库持久化表中
      var param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['名称', '温度']
      param[2] = ['数值', this.setTemperatureForm.temperature]
      var Data = this.CreateData('12', '北汽福田_持久化数据记录表_增加修改', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message({
            message: '温度提交成功',
            type: 'success'
          })
          this.isShowSetTemperatureVisible = false
          // 2. 将数据存储到VUEX临时变量区中
          this.$store.commit('set_tempDataObject', {
            key: 'setTemperatureForm',
            value: this.setTemperatureForm.temperature
          })
          console.log(this.$store.state.station.tempDataObject)
        } else {
          this.$message({
            message: '温度提交失败',
            type: 'error'
          })
        }
      })
    },
    // 故障停机弹窗
    faultStart() {
      this.isShowFaultStart = true
      this.faultStartForm.startTime = this.getNowFormatDate()
      this.faultStartForm.discoverer = ''
    },
    // 跳过盘轴按钮
    SkipDiskBearing() {
      // 1. 先弹窗是否跳过盘轴
      // 2. 点确定发送mqtt给后端将点置一秒后复位
      this.$confirm('是否确定跳过盘轴?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.publication.topic = window.g.mqttPublishTopic
        this.publication.payload = 'WEB|SkipDiskBearing|' + this.$store.state.station.stationName + '|' + 1
        const result = window.g.mqttClient.doPublish(this.publication)
        if (result === true) {
          this.$notify.success({
            title: '提示',
            message: '跳过盘轴成功！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        } else {
          this.$notify.error({
            title: '提示',
            message: '跳过盘轴失败！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        }
      })
    },
    // 将秒转为日 时 分 秒
    getSecondTurnDate(seconds) {
      let d = Math.floor(seconds / (3600 * 24))
      let h = Math.floor(seconds % (3600 * 24) / 3600)
      let m = Math.floor(seconds % 3600 / 60)
      let s = Math.floor(seconds % 60)

      d = d > 10 ? d : '0' + d
      h = h > 10 ? h : '0' + h
      m = m > 10 ? m : '0' + m
      s = s > 10 ? s : '0' + s

      d = parseInt(seconds / 60 / 60 / 24) // 计算天数
      h = parseInt(seconds / 60 / 60 % 24) // 计算小时
      m = parseInt(seconds / 60 % 60) // 计算分数
      s = parseInt(seconds % 60) // 计算当前秒数

      let timeStr = s + '秒'
      if (m !== 0) {
        timeStr = m + '分 ' + timeStr
      }
      if (h !== 0) {
        timeStr = h + '小时 ' + timeStr
      }
      if (d !== 0) {
        timeStr = d + '天 ' + timeStr
      }
      return timeStr
    },
    // 停机开始结束时间发生改变
    faultStartEndTimeChange() {
      console.log(6666)
      this.faultEndForm.stopTIme = (new Date(this.faultEndForm.endTime) - new Date(this.faultEndForm.startTime)) / 1000
      this.faultEndForm.stopTimeStr = this.getSecondTurnDate(this.faultEndForm.stopTIme)
    },
    // 停机结束弹窗
    faultEnd() {
      // 查询停机记录进行回写
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      const Data = this.CreateData('11', '北汽福田_停机记录_开始_查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length > 0) {
          this.faultEndForm.startTime = response.data[0].开始时间
          this.faultStartForm.discoverer = response.data[0].故障发现人
          // 将数据进行处理
          this.faultEndForm.endTime = this.getNowFormatDate()
          this.faultEndForm.handlinger = ''
          // 获取相差秒数
          console.log((new Date(this.faultEndForm.endTime) - new Date(response.data[0].开始时间)) / 1000)
          this.faultEndForm.stopTIme = (new Date(this.faultEndForm.endTime) - new Date(response.data[0].开始时间)) / 1000
          this.faultEndForm.stopTimeStr = this.getSecondTurnDate(this.faultEndForm.stopTIme)
          this.faultEndForm.stopCause = ''
          this.isShowFaultEnd = true
        }
      })
    },
    // 获取当前日期函数
    getNowFormatDate() {
      var date = new Date()
      // 年 getFullYear()：四位数字返回年份
      var year = date.getFullYear() // getFullYear()代替getYear()
      // 月 getMonth()：0 ~ 11
      var month = date.getMonth() + 1
      // 日 getDate()：(1 ~ 31)
      var day = date.getDate()
      // 时 getHours()：(0 ~ 23)
      var hour = date.getHours()
      // 分 getMinutes()： (0 ~ 59)
      var minute = date.getMinutes()
      // 秒 getSeconds()：(0 ~ 59)
      var second = date.getSeconds()
      var time = year + '-' + this.addZero(month) + '-' + this.addZero(day) + ' ' + this.addZero(hour) + ':' + this.addZero(minute) + ':' + this.addZero(second)
      return time
    },
    // 小于10的拼接上0字符串
    addZero(s) {
      return s < 10 ? ('0' + s) : s
    },
    // 显示返修方式弹窗
    showBackWorkMode() {
      this.backWorkModeList = []
      this.backWorkModeIsShow = true
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      const 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.backWorkModeList.push({
              label: response.data[i].返修提示,
              value: response.data[i].方式代码,
              describe: response.data[i].描述
            })
          }
          this.backWorkModelValue = this.backWorkModeList[0].value
          this.backWorkModelValueTip = this.backWorkModeList[0].describe
        }
      })
    },
    // 补拧螺栓按钮
    remedyWork() {
      this.boltAddWork.boltAddWorkName = ''
      this.boltAddWork.boltAddWorkNumber = ''
      this.boltAddWork.boltAddWorkCount = 0
      this.boltAddWork.boltAddWorkList2 = []
      this.boltAddWork.boltAddWorkList = []
      // 1.显示补拧窗口
      this.isShowBoltAddWork = true
      // 2.拉取该机型补拧列表
      this.boltAddWork.boltAddWorkList = []
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['机型编号', this.$store.state.station.engineValue.EngineType]
      const Data = this.CreateData('11', '北汽福田BOM_拧紧程序_螺栓补拧_查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length > 0) {
          this.boltAddWork.boltAddWorkList2 = response.data
          for (const item of response.data) {
            console.log(item)
            this.boltAddWork.boltAddWorkList.push({
              label: item.零件名称,
              value: item.OP本工位操作顺序号
            })
          }
          console.log(this.boltAddWork.boltAddWorkList)
        }
      })
    },
    // 螺栓补拧提交
    boltAddWorkSubmit() {
      if (this.$store.state.station.statusValue[3].status != 1) {
        this.$message({
          type: 'warning',
          message: '请在传递机型后再进行此操作！'
        })
        return
      }

      if (this.boltAddWork.boltAddWorkList) {
        if (!this.boltAddWork.boltAddWorkList || !this.boltAddWork.boltAddWorkName) {
          this.$message.warning('请将信息填写完毕后提交!')
          return
        }
      }
      if (this.boltAddWork.boltAddWorkCount <= 0) {
        this.$message.warning('请填写螺栓数量!')
        return
      } else {
        for (const item of this.boltAddWork.boltAddWorkList2) {
          if (item.OP本工位操作顺序号 === this.boltAddWork.boltAddWorkNumber) {
            if (this.boltAddWork.boltAddWorkCount > item.数量) {
              this.$message.warning(item.零件名称 + '螺栓数量不能大于' + item.数量)
              return
            }
          }
        }
      }

      var powerParam = []
      powerParam[0] = ['工号', this.boltAddWork.boltAddWorkName]
      var powerData = this.CreateData('11', '菜单系统模块_人员与角色_角色工位操作权限校验', powerParam)
      this.ExecDatabase(powerData).then(response => {
        if (response.data.length !== 0) {
          if (response.data[0].result === 1) {
            const param = []
            param[0] = ['工位号', this.$store.state.station.stationName]
            param[1] = ['总成号', this.$store.state.station.engineValue.EngineID]
            param[2] = ['操作员', this.$store.state.station.stationUserCount]
            param[3] = ['班长名', this.boltAddWork.boltAddWorkName]
            param[4] = ['OP顺序号', this.boltAddWork.boltAddWorkNumber]
            param[5] = ['机型编号', this.$store.state.station.engineValue.EngineType]
            param[6] = ['补拧数量', this.boltAddWork.boltAddWorkCount]
            const Data = this.CreateData('12', 'MES_螺栓补拧_记录表_添加', param)
            this.ExecDatabase(Data).then(response => {
              if (response.data[0].result === '1') {
                this.publication.topic = window.g.mqttPublishTopic
                this.publication.payload = 'WEB|remedyWork|' + this.$store.state.station.stationName + '|' + this.boltAddWork.boltAddWorkNumber + '&' + this.boltAddWork.boltAddWorkCount
                const result = window.g.mqttClient.doPublish(this.publication)
                if (result === true) {
                  this.$message.success('允许补拧螺栓成功！')
                  // 查询更新后的功能按钮列表
                  this.getStationButton()
                  this.isShowBoltAddWork = false
                } else {
                  this.$notify.error({
                    title: '提示',
                    message: '发送允许补拧螺栓消息失败！',
                    position: 'bottom-right',
                    duration: 2000,
                    offset: 170
                  })
                }
              } else {
                this.$notify.error({
                  title: '提示',
                  message: '允许补拧螺栓失败！',
                  position: 'bottom-right',
                  duration: 2000,
                  offset: 170
                })
              }
            })
          } else {
            this.$message({
              message: '该确认人无工位确认操作权限，操作失败，请确认！',
              type: 'warning',
              duration: 3000
            })
          }
        }
      })
    },
    // 补拧结束
    remedyWorkEnd() {
      this.$confirm('是否确定结束补拧?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 1. 切换按钮状态
        this.setButtomShouOrHide('MES_BoltAddWorkStart', 1, 1, 'MES_BoltAddWorkEnd', 0)
        // 2.通知服务器设置地址值
        this.publication.topic = window.g.mqttPublishTopic
        this.publication.payload = 'WEB|remedyWorkEnd|' + this.$store.state.station.stationName + '|' + 1
        const result = window.g.mqttClient.doPublish(this.publication)
        if (result === true) {
          this.$message.success('螺栓补拧结束！')
          // 查询更新后的功能按钮列表
          this.isShowBoltAddWork = false
        } else {
          this.$notify.error({
            title: '提示',
            message: '螺栓补拧结束失败！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        }
      }).catch(() => {
      })
    },
    // 非本线操作订单
    NotNowLineWorkOrder() {
      // 首先修改持久化表状态  成功后修改按钮状态
      this.$confirm('是否进行其他线工件工作?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const param = []
        param[0] = ['工位号', this.$store.state.station.stationName]
        param[1] = ['名称', '非本线工作订单']
        param[2] = ['数值', 1]
        const Data = this.CreateData('12', '北汽福田_持久化数据记录表_增加修改', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message({
              message: '提交成功！',
              type: 'success'
            })
            // 1. 切换按钮状态
            this.setButtomShouOrHide('MES_NotNowLineWorkOrder', 0, 1, 'MES_NotNowLineWorkOrderEnd', 1)
            // 查询更新后的功能按钮列表
            this.getStationButton()
          } else {
            this.$message({
              message: '提交失败！',
              type: 'error'
            })
          }
        })
      })
    },
    // 非本线操作订单 结束
    NotNowLineWorkOrderEnd() {
      // 首先修改持久化表状态  成功后修改按钮状态
      this.$confirm('是否进行进行本产线工件工作?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const param = []
        param[0] = ['工位号', this.$store.state.station.stationName]
        param[1] = ['名称', '非本线工作订单']
        param[2] = ['数值', 0]
        const Data = this.CreateData('12', '北汽福田_持久化数据记录表_增加修改', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message({
              message: '提交成功！',
              type: 'success'
            })
            // 1. 切换按钮状态
            this.setButtomShouOrHide('MES_NotNowLineWorkOrder', 1, 1, 'MES_NotNowLineWorkOrderEnd', 0)
            // 查询更新后的功能按钮列表
            this.getStationButton()
          } else {
            this.$message({
              message: '提交失败！',
              type: 'error'
            })
          }
        })
      })
    },
    // 间隙抽检
    SpotCheck() {
      this.boltAddWork.boltAddWorkName = ''
      this.boltAddWork.boltAddWorkNumber = ''
      this.boltAddWork.boltAddWorkCount = 0
      this.boltAddWork.boltAddWorkList2 = []
      this.boltAddWork.boltAddWorkList = []
      // 2.拉取该机型补拧列表
      this.boltAddWork.boltAddWorkList = []
      if (this.$store.state.station.stationName == 'J07MA050') {
        const param = []
        param[0] = ['工位号', this.$store.state.station.stationName]
        param[1] = ['机型编号', this.$store.state.station.engineValue.EngineType]
        const Data = this.CreateData('11', '北汽福田BOM_拧紧程序_间隙抽检_查询', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data.length > 0) {
            this.SpotCheckForm.SpotCheckFormList = response.data
          }
        })
      }
      // 弹出抽检弹窗
      this.$confirm('是否进行间隙抽检?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.SpotCheckSubmit()
      }).catch(() => {
      })
    },
    // 间隙抽检提交
    SpotCheckSubmit() {
      // if(this.$store.state.station.statusValue[3].status != 1){
      //   this.$message({
      //     type: 'warning',
      //     message: '请在传递机型后再进行此操作！'
      //   })
      //   return
      // }

      console.log('提交间隙抽检')
      console.log(this.SpotCheckForm.SpotCheckFormList.length)
      if (this.SpotCheckForm.SpotCheckFormList.length == 0) {
        this.boltAddWork.boltAddWorkNumber = this.$store.state.station.stationName == 'J07MA050' ? 0 : 0
      } else {
        this.boltAddWork.boltAddWorkNumber = this.$store.state.station.stationName == 'J07MA050' ? this.SpotCheckForm.SpotCheckFormList[0]['OP本工位操作顺序号'] : 0
      }
      console.log(this.SpotCheckForm.SpotCheckFormList)
      console.log(123165)
      this.boltAddWork.boltAddWorkCount = 2
      this.publication.topic = window.g.mqttPublishTopic
      console.log(this.publication.topic, '0000')
      this.publication.payload = 'WEB|boltSpotCheck|' + this.$store.state.station.stationName + '|' + this.boltAddWork.boltAddWorkNumber + '&' + this.boltAddWork.boltAddWorkCount
      console.log(this.publication.payload, '1111')
      const result = window.g.mqttClient.doPublish(this.publication)
      console.log(result, this.publication, 'aaaa')
      if (result === true) {
        // 1. 切换按钮状态
        this.setButtomShouOrHide('MES_BoltSpotCheckStart', 0, 1, 'MES_BoltSpotCheckEnd', 1)
        this.$message.success('间隙抽检设置成功！')
        // 查询更新后的功能按钮列表
        this.getStationButton()
        this.isShowSpotCheckTip = true
      } else {
        this.$notify.error({
          title: '提示',
          message: '发送允许抽检间隙消息失败！',
          position: 'bottom-right',
          duration: 2000,
          offset: 170
        })
      }
    },
    // 抽检结束
    SpotCheckEnd() {
      this.$confirm('是否确定结束抽检?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 1. 切换按钮状态
        this.setButtomShouOrHide('MES_BoltSpotCheckStart', 1, 1, 'MES_BoltSpotCheckEnd', 0)
        // 2.通知服务器设置地址值
        this.publication.topic = window.g.mqttPublishTopic
        this.publication.payload = 'WEB|boltSpotCheckEnd|' + this.$store.state.station.stationName + '|' + 1
        const result = window.g.mqttClient.doPublish(this.publication)
        if (result === true) {
          this.$message.success('间隙抽检结束！')
          // 查询更新后的功能按钮列表
          this.isShowSpotCheck = false
          this.isShowSpotCheckTip = false
        } else {
          this.$notify.error({
            title: '提示',
            message: '间隙抽检结束失败！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        }
      }).catch(() => {
      })
    },
    // 设置按钮的显示隐藏方法
    setButtomShouOrHide(buttomID, isShow, buttom2_check, buttomID2, isShow2) {
      // 同时后台结束补拧并且返回补拧按钮
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['按钮ID', buttomID]
      param[2] = ['是否启用', isShow]
      param[3] = ['按钮2_check', buttom2_check]
      param[4] = ['按钮ID2', buttomID2]
      param[5] = ['是否启用2', isShow2]
      const Data = this.CreateData('12', 'MES界面显示_功能区_显示隐藏_设置', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          // 查询更新后的功能按钮列表
          this.getStationButton()
        } else {
          this.$notify.error({
            title: '提示',
            message: '切换按钮状态失败！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        }
      })
    },
    // 返修方式选择
    backWorkModelEdit(value) {
      for (let i = 0; i < this.backWorkModeList.length; i++) {
        console.log(this.backWorkModeList[i], value)
        if (this.backWorkModeList[i].value === value) {
          this.backWorkModelValueTip = this.backWorkModeList[i].describe
        }
      }
    },
    // 易损件清单查询
    ShowBackWorkSelectBackOpName() {
      if (this.$store.state.station.statusValue[3].status != 1) {
        this.$message({
          type: 'warning',
          message: '请在传递机型后再进行此操作！'
        })
        return
      }

      this.$confirm('请确认 当前返工后的箱体结合面是否已经除胶，请除胶后放行', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 判断如果是拆解方式则拉出易损件清单供选择
        // 1 是拆解上线，将工件全部拆解后上线  2 是选择工位上线  3 是空托盘上线
        if (this.backWorkModelValue === 2) {
          // 得根据工位号来给2和4
          this.backWorkEasyBadIsShow = true
          const param = []
          const Data = this.CreateData('11', '北汽福田返工_易损件清单_查询', param)
          this.ExecDatabase(Data).then(response => {
            if (response.data.length > 0) {
              this.backWorkEasyBadSelectList = response.data
            }
          })
          // 获取工位列表
          this.getBackWorkStationNumber()
          this.backWorkSelectBackOpNameIsShow = true
        } else {
          // 直接将返工状态改为 2 结束,拆解后在上线工位扫码重新上线即可
          this.publication.topic = window.g.mqttPublishTopic
          if (this.backWorkModelValue === 1) {
            this.publication.payload = 'WEB|FaultBackWorkType|' + this.$store.state.station.stationName + '|' + 1
          } else if (this.backWorkModelValue === 3) {
            // 空托盘上线
            this.publication.payload = 'WEB|FaultBackWorkType|' + this.$store.state.station.stationName + '|' + 3
          }
          const result = window.g.mqttClient.doPublish(this.publication)
          if (result === true) {
            const param3 = []
            param3[0] = ['返修状态', 2]
            param3[1] = ['总成号', this.$store.state.station.engineValue.EngineID]
            param3[2] = ['返回工位号', 'J07MA005']
            const Data3 = this.CreateData('12', '北汽福田返工_记录_修改状态', param3)
            this.ExecDatabase(Data3).then(response => {
              if (response.data[0].result == 1) {
                this.getBackWorkform()
                this.$notify.success({
                  title: '提示',
                  message: '返修放行成功！',
                  position: 'bottom-right',
                  duration: 2000,
                  offset: 170
                })
                this.backWorkModeIsShow = false
              } else {
                this.$notify.error({
                  title: '提示',
                  message: '返修放行失败！',
                  position: 'bottom-right',
                  duration: 2000,
                  offset: 170
                })
              }
            })
          } else {
            this.$notify.error({
              title: '提示',
              message: '返工设置失败！',
              position: 'bottom-right',
              duration: 2000,
              offset: 170
            })
          }
        }
      }).catch(() => {
        return
      })
    },
    getTagList() {
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      const Data = this.CreateData('11', 'MES_基本变量_原始数据_根据工位号查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length > 0) {
          for (let i = 0; i < response.data.length; i++) {
            this.TagIdList.set(response.data[i].TagID, response.data[i])
          }
        }
      })
    },
    // 返工结果提交 应许工作 工件放行
    backWorkGoSubmit() {
      if (this.$store.state.station.statusValue[3].status != 1) {
        this.$message({
          type: 'warning',
          message: '请在传递机型后再进行此操作！'
        })
        return
      }

      // 根据选择的工位号来发给PLC 2 和 4
      const OpNameInt = Number(this.stationNumberValue.substring(this.stationNumberValue.length - 3))
      this.publication.topic = window.g.mqttPublishTopic
      if (OpNameInt <= 80) {
        // 发送给PLC 2
        this.publication.payload = 'WEB|FaultBackWorkType|' + this.$store.state.station.stationName + '|' + 2
      } else {
        // 发送给PLC 4
        this.publication.payload = 'WEB|FaultBackWorkType|' + this.$store.state.station.stationName + '|' + 4
      }
      window.g.mqttClient.doPublish(this.publication)

      const OpNameList = [] // 返工线体工位列表
      let OpNameList2 = [] // 后面的工位列表

      // 1.将根据再开始工位进行备份数据
      // 1.1 根据返修工位号获取到主分线列表
      const param = []
      param[0] = ['工位号', this.stationNumberValue]
      const Data = this.CreateData('11', 'MES_计划BOM_工位与名称_线体类型_查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length > 0) {
          OpNameList2 = response.data

          // 1.2 判断选中再工作工位是否在故障工位之前
          // 1.3 如果在之前则从再工作工位开始备份数据到返工质量数据表中

          // 遍历获取该重新工作工位列表
          let isGo = false
          for (let i = 0; i < OpNameList2.length; i++) {
            const item = OpNameList2[i]
            if (item.工位号 === this.stationNumberValue) {
              isGo = true
            }
            if (isGo) {
              OpNameList.push(item.工位号)
            }
          }
          // 遍历工位列表 挨个进行删数据
          for (const item of OpNameList) {
            console.log(item)
            const param = []
            param[0] = ['工位号', item]
            param[1] = ['变速器序列号', this.$store.state.station.engineValue.EngineID]
            param[2] = ['删除人', this.$store.state.station.stationUserCount]
            const Data = this.CreateData('11', '北汽福田返工_返工备份删除数据_增加', param)
            this.ExecDatabase(Data).then(response => {
              if (response.data[0].result === 1) {
                this.$message.success('删除成功！')
              }
            })
          }
        }
      })

      // 2.保存选中的易损清单中的物料
      console.log('this.stationNumberValue', this.backWorkModelValue)
      if (this.backWorkModelValue === 2) {
        for (const item of this.$refs.backWorkEasyBadSelectListTable.selection) {
          console.log(item)
          // 2.2 调用存储过程存储对应数据到表中
          const param2 = []
          param2[0] = ['易损件编号', item.ID]
          param2[1] = ['总成号', this.$store.state.station.engineValue.EngineID]
          param2[2] = ['操作人', this.$store.state.station.stationUserCount]
          param2[3] = ['工位号', this.$store.state.station.stationName]
          const Data2 = this.CreateData('11', '北汽福田返工_易损件清单记录_增加', param2)
          this.ExecDatabase(Data2).then(response => {
            if (response.data[0].result === 1) {
              // this.$message.success('成功！')
            }
          })
        }
      }

      // 3.通知PLC允许工作信号 并且传再工作工位   北汽福田返工_记录_修改状态
      const param3 = []
      param3[0] = ['返修状态', 1]
      param3[1] = ['总成号', this.$store.state.station.engineValue.EngineID]
      param3[2] = ['返工操作人', this.$store.state.station.stationUserCount]
      param3[3] = ['返回工位号', this.stationNumberValue]
      const Data3 = this.CreateData('12', '北汽福田返工_记录_修改状态', param3)
      this.ExecDatabase(Data3).then(response => {
        if (response.data[0].result == 1) {
          this.publication.topic = window.g.mqttPublishTopic
          this.publication.payload = 'WEB|BackWorkGo|' + this.$store.state.station.stationName + '|' + this.stationNumberValue.replace('J07ET', '2').replace('J07MA', '1')
          const result = window.g.mqttClient.doPublish(this.publication)
          if (result === true) {
            this.$notify.success({
              title: '提示',
              message: '返修放行成功！',
              position: 'bottom-right',
              duration: 2000,
              offset: 170
            })
            this.getBackWorkform()
            this.backWorkSelectBackOpNameIsShow = false
            this.backWorkModeIsShow = false
          } else {
            this.$notify.error({
              title: '提示',
              message: '返修放行失败！',
              position: 'bottom-right',
              duration: 2000,
              offset: 170
            })
          }
        } else {
          this.$notify.error({
            title: '提示',
            message: '返修放行失败！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        }
      })
    },

    // 从数据库查询返工数据
    getBackWorkform() {
      const param = []
      param[0] = ['总成号', this.$store.state.station.engineValue.EngineID]
      const Data = this.CreateData('11', '北汽福田返工_记录_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.backWorkform = response.data[0]
      })
    },

    // 返修原因选择变化
    faultCodeEdit(id) {
      for (const item of this.backWorkform.faultList) {
        if (item.value === id) {
          this.backWorkform.faultTxt2 = item.label
          if (this.backWorkform.faultTxt2.indexOf('其他') > -1) {
            this.faultBackWorkTextIsShow = true
          } else {
            this.faultBackWorkTextIsShow = false
          }
        }
      }
    },
    // 检验项目变化
    checkDetailsChange(e) {
      this.backCheckRecordForm.checkDetailsList.forEach((item) => {
        if (item.id == e) {
          this.backCheckRecordForm.checkStandard = item.检验标准
          this.backCheckRecordForm.checkFunction = item.检验方法
          this.backCheckRecordForm.isAutoOK = item.是否自动判断
          this.backCheckRecordForm.okUpperLimit = item.上限值
          this.backCheckRecordForm.okLowerLimit = item.下限值
        }
      })
    },
    // 巡检记录变化
    checkDetailsCheckValueChange() {
      console.log(this.backCheckRecordForm)
      // 先判断是否自动判断合格不合格 如果自动判断 = 1 则去使用上下限判断
      if (this.backCheckRecordForm.isAutoOK == 1) {
        // 判断是否在范围内
        if (Number(this.backCheckRecordForm.checkResult) >= this.backCheckRecordForm.okLowerLimit && Number(this.backCheckRecordForm.checkResult) <= this.backCheckRecordForm.okUpperLimit) {
          this.backCheckRecordForm.isOk = '1'
        } else {
          this.backCheckRecordForm.isOk = '0'
        }
      } else {
        // 手动判断
      }
    },
    // 返修请求提交
    faultBackWorkSubmit() {
      if (this.$store.state.station.statusValue[3].status != 1) {
        this.$message({
          type: 'warning',
          message: '请在传递机型后再进行此操作！'
        })
        return
      }

      if (!this.$store.state.station.engineValue.OrderForm || !this.$store.state.station.engineValue.EngineID) {
        // 提示工件未到位
        this.$message({
          type: 'warning',
          message: '工件未到位,请确认工件是否到位'
        })
        return
      }
      if (this.backWorkform.identifying && this.backWorkform.faultCode && this.backWorkform.backWorkType) {
        // 判断班长权限
        var powerParam = []
        powerParam[0] = ['工号', this.backWorkform.identifying]
        var powerData = this.CreateData('11', '菜单系统模块_人员与角色_角色工位操作权限校验', powerParam)
        this.ExecDatabase(powerData).then(response => {
          if (response.data.length !== 0) {
            if (response.data[0].result === 1) {
              // 发送mqtt通知服务端
              {
                this.publication.topic = window.g.mqttPublishTopic
              }
              this.publication.payload = 'WEB|FaultBackWork|' + this.$store.state.station.stationName + '|' + '1'
              const result = window.g.mqttClient.doPublish(this.publication)
              // mqtt 发送成功后才进行下一步
              if (result === true) {
                // 判断是否存在故障文本
                let faultBackWorkText_check
                this.faultBackWorkTextIsShow ? faultBackWorkText_check = true : faultBackWorkText_check = false
                var param = []
                param[0] = ['故障代码', this.backWorkform.faultCode]
                param[1] = ['故障文本_check', faultBackWorkText_check]
                param[2] = ['故障文本', this.backWorkform.faultTxt]
                param[3] = ['工位号', this.$store.state.station.stationName]
                param[4] = ['总成号', this.$store.state.station.engineValue.EngineID]
                param[5] = ['机型', this.$store.state.station.engineValue.EngineType]
                param[6] = ['订单号', this.$store.state.station.engineValue.OrderForm]
                param[7] = ['发现人', this.$store.state.station.stationUserCount]
                param[8] = ['确认人', this.backWorkform.identifying]
                param[9] = ['备注', this.backWorkform.remark]
                param[10] = ['返工类型', this.backWorkform.backWorkType]
                var Data = this.CreateData('11', '北汽福田返工_记录_增加', param)
                this.ExecDatabase(Data).then(response => {
                  console.log(response, 66)
                  if (response.data.length !== 0) {
                    if (response.data[0].result === 1) {
                      this.$notify.success({
                        title: '提示',
                        message: '返工确认成功！',
                        position: 'bottom-right',
                        duration: 2000,
                        offset: 170
                      })
                      this.faultBackWorkVisible = false
                    } else {
                      // 返工确认失败
                      this.$notify.error({
                        title: '提示',
                        message: '返工确认失败！',
                        position: 'bottom-right',
                        duration: 2000,
                        offset: 170
                      })
                    }
                  }
                })
              } else {
                this.$notify.error({
                  title: '提示',
                  message: '返工消息发送失败！',
                  position: 'bottom-right',
                  duration: 4000,
                  offset: 170
                })
              }
            } else {
              this.$message({
                message: '该确认人无工位确认操作权限，操作失败，请确认！',
                type: 'warning',
                duration: 3000
              })
            }
          }
        })
      } else {
        this.$notify.error({
          title: '提示',
          message: '请将返工信息填写完毕后提交！',
          position: 'bottom-right',
          duration: 4000,
          offset: 170
        })
      }
    },
    loginOut() {
      // 给后台发送退出请求
      this.publication.topic = window.g.mqttPublishTopic
      this.publication.payload = 'WEB|closeWebWindow|' + this.$store.state.station.stationName + '|' + '0'
      window.g.mqttClient.doPublish(this.publication)

      var param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['名称', '登陆状态']
      param[2] = ['数值', 0]
      var Data = this.CreateData('12', '北汽福田_持久化数据记录表_增加修改', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
        } else {
          this.$message({
            message: '工位登陆状态设置失败，可能会导致设备仍可工作，请联系管理员！',
            type: 'error'
          })
        }
      })
      setTimeout(() => {
        this.$store.commit('set_processList_table', [])
        this.$store.commit('set_materialList_table', [])
        this.$store.commit('set_pic', '')
        this.$store.commit('set_smile', '')
        this.$store.commit('set_tighteningPosition', [])
        this.$store.commit('set_greenBoltInformation', [])
        this.$store.commit('set_partAssemblyInformation', {})
        this.$store.commit('set_engineValue', {})
        this.$router.push('/')
      }, 200)
    },
    getStationNumber() {
      this.stationNumber = []
      var param = []
      var Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length) {
          this.stationNumberValue = response.data[0].工位号
        }
        for (let i = 0; i < response.data.length; i++) {
          this.stationNumber.push({
            label: response.data[i].工位号,
            value: response.data[i].工位号,
            labelName: response.data[i].工位名称
          })
        }
      })
    },
    getBackWorkStationNumber() {
      this.stationNumber = []
      var param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['总成号', this.$store.state.station.engineValue.EngineID]
      var Data = this.CreateData('11', 'MES_计划BOM_工位与名称_线体类型_查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length) {
          this.stationNumberValue = response.data[0].工位号
        }
        for (let i = 0; i < response.data.length; i++) {
          this.stationNumber.push({
            label: response.data[i].工位号,
            value: response.data[i].工位号,
            labelName: response.data[i].工位名称
          })
        }
      })
    },
    solveAlarm(m_Value) {
      const m_ValueList = m_Value.split('&')
      const tagId = m_ValueList[0]
      const tagValue = m_ValueList[1]
      const alarmContent = m_ValueList[2]
      const alarmType = m_ValueList[3]
      if (tagValue === '1') {
        if (this.alarmListTagId.indexOf(tagId) === -1) {
          const tagInfo = this.TagIdList.get(tagId)
          this.alarmListTagId.push(tagId)
          switch (alarmType) {
            case '报警':
              this.alarmList_Alarm.unshift({
                TagId: tagId,
                报警内容: tagInfo['DbName'] + '.' + tagInfo['变量类型'] + tagInfo['变量地址'] + tagInfo['变量其它'] + '【' + alarmContent + '】',
                报警等级: alarmType
              })
              break
            case '错误':
              this.alarmList_Error.unshift({
                TagId: tagId,
                报警内容: tagInfo['DbName'] + '.' + tagInfo['变量类型'] + tagInfo['变量地址'] + tagInfo['变量其它'] + '【' + alarmContent + '】',
                报警等级: alarmType
              })
              break
            case '警告':
              this.alarmList_Warning.unshift({
                TagId: tagId,
                报警内容: tagInfo['DbName'] + '.' + tagInfo['变量类型'] + tagInfo['变量地址'] + tagInfo['变量其它'] + '【' + alarmContent + '】',
                报警等级: alarmType
              })
              break
          }
          this.alarmList = []
          this.alarmList = [...this.alarmList_Error, ...this.alarmList_Alarm, ...this.alarmList_Warning]
        }
      } else {
        this.alarmListTagId = this.alarmListTagId.filter(item => item !== tagId)
        this.alarmList_Alarm = this.alarmList_Alarm.filter(res => {
          return res.TagId !== tagId
        })
        this.alarmList_Error = this.alarmList_Error.filter(res => {
          return res.TagId !== tagId
        })
        this.alarmList_Warning = this.alarmList_Warning.filter(res => {
          return res.TagId !== tagId
        })
        this.alarmList = []
        this.alarmList = [...this.alarmList_Error, ...this.alarmList_Alarm, ...this.alarmList_Warning]
      }
      this.tableIndexValue = Math.random()
    },
    showAlarmList() {
      this.dialogFormVisible2 = true
      this.tableIndexValue = Math.random()
    },
    // 故障返工
    faultBackWork() {
      this.backWorkform.faultList = []
      this.backWorkform.remark = ''
      this.backWorkform.identifying = ''
      this.backWorkform.discoverer = ''
      this.backWorkform.remark = ''
      this.backWorkform.faultTxt = ''
      this.backWorkform.faultType = ''
      this.backWorkform.backWorkType = ''
      this.backWorkform.faultCode = ''
      console.log('this.$store.state.station.engineValue', this.$store.state.station.engineValue)
      this.faultBackWorkVisible = true
      // 查询故障原因列表
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      const Data = this.CreateData('11', '北汽福田返工_故障原因_查询', param)
      this.ExecDatabase(Data).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.backWorkform.faultList.push({
            label: response.data[i].故障原因,
            value: response.data[i].故障代码
          })
        }
      })
    },
    // 油压点检
    OilPressureCheck() {
      this.oilPressureCheckVisible = true
    },
    // 油压点检提交
    OilPressureCheckSubmit() {
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      param[1] = ['温度', this.oilPressureCheckForm.temperature]
      param[2] = ['点检人', this.$store.state.station.stationUserCount]
      param[3] = ['油压', this.oilPressureCheckForm.oilPressure]
      const Data = this.CreateData('11', '北汽福田_油压点检_增加', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === 1) {
          this.$message.success('点检成功！')
          this.oilPressureCheckVisible = false
          this.oilPressureCheckForm.temperature = 0
          this.oilPressureCheckForm.oilPressure = 0
        }
      })
    },
    backCheckRecordSubmit() {
      if (!this.backCheckRecordForm.checkerCode || !this.backCheckRecordForm.checkDetails || !this.backCheckRecordForm.checkResult || !this.backCheckRecordForm.isOk) {
        this.$message.error('请填写完整信息！')
        return
      }
      const param = []
      param[0] = ['员工编号', this.$store.state.station.stationUserCount]
      param[1] = ['巡检员编号', this.backCheckRecordForm.checkerCode]
      param[2] = ['巡检工位', this.$store.state.station.stationName]
      param[3] = ['巡检内容', this.backCheckRecordForm.checkDetails]
      param[4] = ['巡检结果', this.backCheckRecordForm.checkResult]
      param[5] = ['通过状态', this.backCheckRecordForm.isOk]
      const Data = this.CreateData('11', '北汽福田_巡检记录_增加', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === 1) {
          this.$message.success('巡检成功！')
          this.backCheckRecordForm.checkerCode = ''
          this.backCheckRecordForm.checkDetails = ''
          this.backCheckRecordForm.checkResult = ''
          this.isShowBackCheckRecord = false
          if (this.backCheckRecordForm.isOk == '0') {
            this.$message.error('巡检结果未通过，请确认是否需要停机！')
            this.isShowFaultStart = true
            this.faultStartForm.startTime = this.getNowFormatDate()
            this.faultStartForm.discoverer = ''
          }
        }
      })
    },
    // 不合格放行
    unqualifiedRelease() {
      this.$confirm('是否确定不合格放行该工件？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.publication.topic = window.g.mqttPublishTopic
        this.publication.payload = 'WEB|NgGO|' + this.$store.state.station.stationName + '|' + '1'
        const result = window.g.mqttClient.doPublish(this.publication)
        if (result === true) {
          this.$notify.success({
            title: '提示',
            message: '不合格放行成功！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        } else {
          this.$notify.error({
            title: '提示',
            message: '不合格放行失败！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        }
      }).catch(() => {
        // this.$message({
        //   type: 'info',
        //   message: '已取消删除'
        // });
      })
    },
    // 未完工下线
    NoOkOutLineGo() {
      this.$prompt('请输入未完工原因', '未完工下线填写', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      }).then(({ value }) => {
        const param = []
        param[0] = ['工位号', this.$store.state.station.stationName]
        param[1] = ['总成号', this.$store.state.station.engineValue.EngineID]
        param[2] = ['原因', value]
        const Data = this.CreateData('12', '生产计划_派工订单_打印记录_详细_完工状态更改', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.publication.topic = window.g.mqttPublishTopic
            this.publication.payload = 'WEB|OutLineGo|' + this.$store.state.station.stationName + '|' + '1'
            const result = window.g.mqttClient.doPublish(this.publication)
            if (result === true) {
              this.$message.success('未完工下线成功！')
            } else {
              this.$notify.error({
                title: '提示',
                message: '未完工下线失败！',
                position: 'bottom-right',
                duration: 2000,
                offset: 170
              })
            }
          }
        })
      }).catch(() => {

      })
    },
    // 下线放行
    OutLineGo() {
      if (this.$store.state.station.statusValue[3].status != 1) {
        this.$message({
          type: 'warning',
          message: '请在传递机型后再进行此操作！'
        })
        return
      }
      this.$confirm('请确定托盘上已无工件', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.publication.topic = window.g.mqttPublishTopic
        this.publication.payload = 'WEB|OutLineGo|' + this.$store.state.station.stationName + '|' + '1'
        const result = window.g.mqttClient.doPublish(this.publication)
        if (result === true) {
          this.$notify.success({
            title: '提示',
            message: '下线放行成功！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        } else {
          this.$notify.error({
            title: '提示',
            message: '下线放行失败！',
            position: 'bottom-right',
            duration: 2000,
            offset: 170
          })
        }
      }).catch(() => {
      })
    },
    // mes复位
    mesReset() {
      this.publication.topic = window.g.mqttPublishTopic
      this.publication.payload = 'WEB|Reset|' + this.$store.state.station.stationName + '|' + '1'
      const result = window.g.mqttClient.doPublish(this.publication)
      if (result === true) {
        this.$notify.success({
          title: '提示',
          message: 'MES复位成功！',
          position: 'bottom-right',
          duration: 2000,
          offset: 170
        })
      } else {
        this.$notify.error({
          title: '提示',
          message: 'MES复位失败！',
          position: 'bottom-right',
          duration: 2000,
          offset: 170
        })
      }
    },
    // mes写入托盘号
    mesWritePallet() {
      this.mesWritePalletVisible = true
    },
    // 是否屏蔽MES
    changeStationStatus(status) {
      const str = status ? '0' : '2'
      this.publication.topic = window.g.mqttPublishTopic
      this.publication.payload = 'WEB|OnLineState|' + this.$store.state.station.stationName + '|' + str
      window.g.mqttClient.doPublish(this.publication)
    },
    // 空托盘放行
    changeStationStatusNullWork(status) {
      const str = status ? '0' : '1'
      this.publication.topic = window.g.mqttPublishTopic
      this.publication.payload = 'WEB|NullWorkGo|' + this.$store.state.station.stationName + '|' + str
      window.g.mqttClient.doPublish(this.publication)
    },
    // MA150独有 转线工件上线
    changeTurnLineWork(status) {
      const str = status ? '0' : '1'
      this.publication.topic = window.g.mqttPublishTopic
      this.publication.payload = 'WEB|TurnLineWork|' + this.$store.state.station.stationName + '|' + str
      window.g.mqttClient.doPublish(this.publication)
    },
    getStationStatus() {
      const param = []
      param[0] = ['工位号', this.$store.state.station.stationName]
      const Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询_在线状态', param)
      this.ExecDatabase(Data).then(response => {
        this.value = parseInt(response.data[0]['在线状态']) === 0
        console.log(this.value)
      })
    },
    // 查询功能按钮
    getStationButton() {
      setTimeout(() => {
        this.buttonShowList = []
        const param = []
        param[0] = ['工位号', this.$store.state.station.stationName]
        const Data = this.CreateData('11', 'MES界面显示_功能按钮_查询', param)
        this.ExecDatabase(Data).then(response => {
          for (let i = 0; i < response.data.length; i++) {
            this.buttonShowList.push(response.data[i]['按钮ID'])
          }
          console.log(this.buttonShowList)
        })
      }, 500)
    },
    qualifiedRelease() {
      // console.log('合格放型')
      this.dialogFormVisible1 = true
    },
    cancel() {
      this.dialogFormVisible1 = false
    },
    confirm11() {
      if (this.$store.state.station.statusValue[3].status != 1) {
        this.$message({
          type: 'warning',
          message: '请在传递机型后再进行此操作！'
        })
        return
      }
      var powerParam = []
      powerParam[0] = ['工号', this.form1.userName]
      var powerData = this.CreateData('11', '菜单系统模块_人员与角色_角色工位操作权限校验', powerParam)
      this.ExecDatabase(powerData).then(response => {
        if (response.data.length !== 0) {
          if (response.data[0].result === 1) {
            this.publication.topic = window.g.mqttPublishTopic
            this.publication.payload = 'WEB|ConfirmOkGo|' + this.$store.state.station.stationName + '|' + '1'
            const result = window.g.mqttClient.doPublish(this.publication)
            if (result === true) {
              const param = []
              param[0] = ['工位号', this.$store.state.station.stationName]
              param[1] = ['总成号', this.$store.state.station.engineValue.EngineID]
              const Data = this.CreateData('12', 'MES_强制放行记录_增加', param)
              this.ExecDatabase(Data).then(response => {
                if (response.data[0].result === '1') {

                }
              })
              this.$notify.success({
                title: '提示',
                message: '合格放行成功！',
                position: 'bottom-right',
                duration: 2000,
                offset: 170
              })
            } else {
              this.$notify.error({
                title: '提示',
                message: '合格放行失败！',
                position: 'bottom-right',
                duration: 2000,
                offset: 170
              })
            }
          } else {
            this.$message({
              message: '该确认人无工位确认操作权限，操作失败，请确认！',
              type: 'warning',
              duration: 3000
            })
          }
        }
      })
    },
    confirmWritePallet() {
      this.publication.topic = window.g.mqttPublishTopic
      this.publication.payload = 'WEB|WritePartPalletCode|' + this.$store.state.station.stationName + '|' + this.form2.pallet
      const result = window.g.mqttClient.doPublish(this.publication)
      if (result === true) {
        this.$notify.success({
          title: '提示',
          message: '发送申请写入托盘号成功！',
          position: 'bottom-right',
          duration: 2000,
          offset: 170
        })
      } else {
        this.$notify.error({
          title: '提示',
          message: '发送申请写入托盘号失败！',
          position: 'bottom-right',
          duration: 2000,
          offset: 170
        })
      }
    },
    cancelWritePallet() {
      this.mesWritePalletVisible = false
    }
  }
}
</script>

<style scoped>

::v-deep.el-table .alarm_Alarm {
  background: #ff0000 !important;
  color: #000 !important;
}

::v-deep.el-table .alarm_Default {
  background: #ffffff !important;
  color: #000 !important;
}

::v-deep.el-table .warning_Alarm {
  background: #ffad1b !important;
  color: #000 !important;
}

::v-deep.el-table th.el-table__cell > .cell {
  font-size: 22px;
  color: #2f2f2f;
}

.button {
  background-color: white;
  color: black;
  margin: 10px 0 0 0;
  border: 2px solid black;
  font-size: 23px;
  line-height: 0px;
  /*宽度原先290 无高度限制  字体大小29*/
  width: 250px;
  height: 40px;
}

.slogan {
  color: #000;
  background-color: red;
  font-size: 32px;
  font-weight: bolder;
  text-align: center;
  animation: alarm_bg 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.yellow-slogan {
  color: #000;
  background-color: #ffad1b;
  font-size: 32px;
  font-weight: bolder;
  text-align: center;
  animation: yellow-alarm_bg 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.slogan1 {
  color: #000;
  background-color: #ffffff;
  font-size: 32px;
  font-weight: bolder;
  text-align: center;
}

.el-switch {
  margin: 10px 0;
}

@keyframes alarm_bg {
  0% {
    color: #000;
    background-color: #ff0000;
  }
  100% {
    color: #000;
    background-color: #ffffff;
  }
}

@keyframes yellow-alarm_bg {
  0% {
    color: #000;
    background-color: rgba(255, 135, 0, 0.89);
  }
  100% {
    color: #000;
    background-color: #ffffff;
  }
}

@keyframes example {
  0% {
    left: 0px;
    top: 0px;
  }

  50% {
    left: 1250px;
    top: 0px;
  }

  100% {
    left: 0px;
    top: 0px;
  }
}

::v-deep.el-table th.el-table__cell > .cell {
  font-size: 20px;
  color: #2f2f2f;
}

::v-deep.el-table td.el-table__cell div {
  font-size: 16px !important;
}

/*多选框选样式*/
::v-deep .el-checkbox__input.is-indeterminate .el-checkbox__inner::before {
  top: 8px;
}

::v-deep .el-checkbox__inner {
  width: 20px;
  height: 20px;
}

::v-deep .el-checkbox__inner::after {
  left: 7px;
  top: 4px;
}

::v-deep .el-table--scrollable-y .el-table__body-wrapper {
  max-height: 240px !important;
}
</style>
