loulijun2021
2022-11-10 239fe20af73c1c9a4c86acd947d77c8836f03f9e
src/views/scgl/sckbg.vue
@@ -7,13 +7,15 @@
            <div style="display: flex;align-items: center">
              <div style="width: 90px">扫描条码:</div>
              <!--              oninput="value=value.replace(/[^0-9a-zA-Z;_]/g,'')"-->
              <el-input
                id="keyWords"
                v-model="form.orderstepqrcode"
                name="produceCode"
                style="width: 300px"
                @keyup.enter.native="val=>enterNative(val,'produceCode')"
              />
              <!--                @keyup.native="e=>judgeIsScanning(e,'produceCode')"-->
            </div>
            <div v-if="false" style="display: flex;padding-right: 10px">
              <el-button @click="ZZstart">
@@ -29,6 +31,8 @@
          <el-divider />
          <div class="elTableDiv">
            <el-table
              ref="tableDataRef"
              class="tableFixed"
              :data="tableData"
              :height="isIpad? (tableHeight+50):tableHeight"
              border
@@ -39,19 +43,6 @@
              :cell-style="this.$cellStyle"
              @sort-change="sortChange"
            >
              <!--              <el-table-column-->
              <!--                width="50"-->
              <!--                fixed-->
              <!--              >-->
              <!--                <template slot-scope="{row}">-->
              <!--                  <el-radio-->
              <!--                    v-model="radioSelected"-->
              <!--                    :label="row.wo"-->
              <!--                    style="color: #fff;padding-left: 10px; margin-right: -25px;"-->
              <!--                    @change.native="getCurrentRow(row.wo)"-->
              <!--                  />-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column
                prop="RowNum"
                width="50"
@@ -62,7 +53,7 @@
                prop="status"
                label="状态"
                sortable="custom"
                width="110"
                width="80"
              >
                <template slot-scope="{row}">
                  <div v-if="row.status==='NEW'">新订单</div>
@@ -74,7 +65,8 @@
              <el-table-column
                prop="wo_code"
                label="工单号"
                min-width="160"
                width="160"
                show-tooltip-when-overflow
                sortable="custom"
              />
              <el-table-column
@@ -85,14 +77,16 @@
              />
              <el-table-column
                prop="partname"
                min-width="160"
                width="160"
                show-tooltip-when-overflow
                label="产品名称"
                sortable="custom"
              />
              <el-table-column
                prop="stepname"
                label="工序"
                min-width="80"
                show-tooltip-when-overflow
                width="120"
                sortable="custom"
              />
              <!--              <el-table-column-->
@@ -142,18 +136,23 @@
              <el-table-column
                prop="plan_startdate"
                label="计划开工日期"
                width="185"
                width="150"
                sortable="custom"
              />
              >
                <template slot-scope="{row}">
                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0, 11) }}</div>
                  <div v-else>/</div>
                </template>
              </el-table-column>
              <el-table-column
                prop="plan_enddate"
                label="计划完工日期"
                width="185"
                width="150"
                sortable="custom"
                fixed="right"
              >
                <template slot-scope="{row}">
                  <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0, 11) }}</div>
                  <div v-else>/</div>
                </template>
              </el-table-column>
@@ -206,6 +205,8 @@
                style="width: 300px"
                @keyup.enter.native="val=>enterNative(val,'WXproduceCode')"
              />
              <!--              @keyup.native="e=>judgeIsScanning(e,'WXproduceCode')"-->
            </div>
            <div v-if="false" style="display: flex;padding-right: 10px">
              <el-button @click="WXsend">
@@ -221,6 +222,8 @@
          <el-divider />
          <div class="elTableDiv">
            <el-table
              ref="tableDataRef"
              class="tableFixed"
              :data="WXtableData"
              :height="isIpad? (tableHeight+50):tableHeight"
              border
@@ -231,19 +234,6 @@
              :cell-style="this.$cellStyle"
              @sort-change="WXsortChange"
            >
              <!--              <el-table-column-->
              <!--                width="50"-->
              <!--                fixed-->
              <!--              >-->
              <!--                <template slot-scope="{row}">-->
              <!--                  <el-radio-->
              <!--                    v-model="radioSelected"-->
              <!--                    :label="row.wo_code"-->
              <!--                    style="color: #fff;padding-left: 10px; margin-right: -25px;"-->
              <!--                    @change.native="getWXCurrentRow(row.wo_code)"-->
              <!--                  />-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column
                prop="RowNum"
                width="50"
@@ -254,7 +244,7 @@
                prop="status"
                label="状态"
                sortable="custom"
                width="110"
                width="80"
              >
                <template slot-scope="{row}">
                  <div v-if="row.status==='NEW'">新订单</div>
@@ -266,25 +256,27 @@
              <el-table-column
                prop="wo_code"
                label="工单号"
                min-width="160"
                width="160"
                show-tooltip-when-overflow
                sortable="custom"
              />
              <el-table-column
                prop="partcode"
                label="产品编码"
                min-width="110"
                width="110"
                sortable="custom"
              />
              <el-table-column
                prop="partname"
                label="产品名称"
                min-width="160"
                width="160"
                show-tooltip-when-overflow
                sortable="custom"
              />
              <el-table-column
                prop="stepname"
                label="工序"
                min-width="80"
                width="120"
                sortable="custom"
              />
              <!--              <el-table-column-->
@@ -334,18 +326,23 @@
              <el-table-column
                prop="plan_startdate"
                label="计划开工日期"
                width="185"
                width="150"
                sortable="custom"
              />
              >
                <template slot-scope="{row}">
                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0, 11) }}</div>
                  <div v-else>/</div>
                </template>
              </el-table-column>
              <el-table-column
                prop="plan_enddate"
                label="计划完工日期"
                width="185"
                width="150"
                sortable="custom"
                fixed="right"
              >
                <template slot-scope="{row}">
                  <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0, 11) }}</div>
                  <div v-else>/</div>
                </template>
              </el-table-column>
@@ -386,11 +383,15 @@
                style="width: 300px"
                @keyup.enter.native="val=>enterNative(val,'badProduceCode')"
              />
              <!--              @keyup.native="e=>judgeIsScanning(e,'badProduceCode')"-->
            </div>
          </div>
          <el-divider />
          <div class="elTableDiv">
            <el-table
              ref="tableDataRef"
              class="tableFixed"
              :data="badTableData"
              :height="isIpad? (tableHeight+50):tableHeight"
              border
@@ -407,7 +408,6 @@
                label="序号"
                fixed
              />
              <el-table-column
                prop="wo_code"
                label="工单号"
@@ -429,13 +429,13 @@
              <el-table-column
                prop="stepname"
                label="工序"
                min-width="80"
                min-width="120"
                sortable="custom"
              />
              <el-table-column
                prop="plan_qty"
                label="任务数量"
                min-width="110"
                width="110"
                sortable="custom"
              />
              <el-table-column
@@ -447,13 +447,13 @@
              <el-table-column
                prop="ng_qty"
                label="不良数量"
                min-width="150"
                width="150"
                sortable="custom"
              />
              <el-table-column
                prop="bad_qty"
                label="已报废数量"
                min-width="120"
                width="120"
                sortable="custom"
              />
              <el-table-column
@@ -606,6 +606,7 @@
            placeholder="请选择"
            :disabled="parseFloat(dialogForm.noputqty)===0||dialogForm.noputqty.trim()===''"
            multiple
            collapse-tags
          >
            <el-option
              v-for="item in badArr"
@@ -615,12 +616,34 @@
            />
          </el-select>
        </el-form-item>
        <!--        <el-form-item v-if="dialogTitle==='自制报工'" label="报工人员:">-->
        <!--          <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />-->
        <!--        </el-form-item>-->
        <el-form-item v-if="dialogTitle==='自制报工'" label="报工人:">
          <el-select
            v-model="dialogForm.operation"
            style="width: 200px;"
            placeholder="请选择"
          >
            <el-option
              v-for="item in OperationArr"
              :key="item.usercode"
              :label="item.username"
              :value="item.usercode"
            />
          </el-select>
        </el-form-item>
        <el-form-item v-if="dialogTitle==='自制报工'" label="备注:">
          <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />
        </el-form-item>
        <div v-if="dialogTitle==='自制报工'">
          <i class="el-icon-s-operation" style="color:#42b983;" /> 人员列表
          <el-button type="primary" style="margin: 10px 0" @click="userAdd">增行</el-button>
          <el-table
            ref="userTableDataRef"
            :data="userTableData"
            border
            class="tableFixed"
            :row-class-name="tableRowClassName"
            :header-cell-style="this.$headerCellStyle"
            :cell-style="this.$cellStyle"
@@ -795,12 +818,13 @@
        <el-form-item
          v-if="dialogTitle==='外协收料'"
          label="不良原因:"
          prop="badcode"
        >
          <!--          prop="badcode"-->
          <el-select
            v-model="dialogForm.badcode"
            style="width: 200px;"
            multiple
            collapse-tags
            :disabled="parseFloat(dialogForm.noputqty)===0||dialogForm.noputqty.trim()===''"
            placeholder="请选择"
          >
@@ -812,20 +836,60 @@
            />
          </el-select>
        </el-form-item>
        <!--        <el-form-item v-if="dialogTitle==='外协收料'" label="收料人:">-->
        <!--          <el-select-->
        <!--            v-model="dialogForm.operation"-->
        <!--            style="width: 200px;"-->
        <!--            placeholder="请选择"-->
        <!--          >-->
        <!--            <el-option-->
        <!--              v-for="item in OperationArr"-->
        <!--              :key="item.usercode"-->
        <!--              :label="item.username"-->
        <!--              :value="item.usercode"-->
        <!--            />-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
        <el-form-item v-if="dialogTitle==='外协收料'" label="备注:">
          <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <el-button v-if="dialogTitle==='自制开始'" type="primary" @click="dialogVisibleConfirm">开 工</el-button>
          <el-button v-if="dialogTitle==='自制报工'" type="primary" @click="dialogVisibleConfirm">提交/打印</el-button>
          <el-button v-if="dialogTitle==='外协发料'" type="primary" @click="dialogVisibleConfirm">发料</el-button>
          <el-button v-if="dialogTitle==='外协收料'" type="primary" @click="dialogVisibleConfirm">收料/打印</el-button>
          <el-button
            v-if="dialogTitle==='自制开始'"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            type="primary"
            @click="dialogVisibleConfirm"
          >开 工</el-button>
          <el-button
            v-if="dialogTitle==='自制报工'"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            type="primary"
            @click="dialogVisibleConfirm"
          >提交/打印</el-button>
          <el-button
            v-if="dialogTitle==='外协发料'"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            type="primary"
            @click="dialogVisibleConfirm"
          >发料</el-button>
          <el-button
            v-if="dialogTitle==='外协收料'"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            type="primary"
            @click="dialogVisibleConfirm"
          >收料/打印</el-button>
        </div>
      </span>
    </el-dialog>
    <!--打印预览页面-->
    <!--打印预览页面  小标签-->
    <el-dialog
      title="预览"
      :visible.sync="dialogVisible2"
@@ -837,43 +901,56 @@
      <!-- 要打印的区域 -->
      <div id="printMe2" style="padding: 30px;">
        <div
          style="display: flex;width: 250px;height: 150px;border: 1px solid #000;text-align: center;font-size: 10px;"
          style="display: flex;width: 280px;height: 150px;border: 1px solid #000;text-align: center;font-size: 10px;"
        >
          <div style="width: 60px;display: flex;flex-direction: column;border-right: 1px solid #000">
          <div style="width: 90px;display: flex;flex-direction: column;border-right: 1px solid #000">
            <div
              style="display: flex;height: 75%;border-bottom:1px solid #000;justify-content: center;align-items: center "
              style="display: flex;height: 90px;border-bottom:1px solid #000;
              justify-content: center;align-items: center;position: relative"
            >
              <div id="qrCode2" ref="qrCodeDiv2" />
              <div id="qrCode2" ref="qrCodeDiv2" style="overflow-y: hidden;height:60px;position: absolute;left: 14px;" />
            </div>
            <div style="display: flex;height: 25%;justify-content: flex-start;align-items: center">
              <div style="margin-left: 5px;width: 40px">数量:</div>
            <div
              style="display: flex;height: 30px;justify-content: flex-start;border-bottom:1px solid #000;align-items: center"
            >
              <div style="margin-left: 5px;width: 28px">数量:</div>
              {{ qrForm.startqty }}
            </div>
            <div style="display: flex;height: 30px;justify-content: flex-start;align-items: center">
              <div style="margin-left: 5px;width: 42px">处理人:</div>
              {{ qrForm.operator }}
            </div>
          </div>
          <div style="width:190px;display: flex;flex-direction: column">
            <div
              style="display: flex;height: 25%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center;text-align: left"
              style="display: flex;height: 20%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width: 60px;margin-left: 5px;">工单编号:</div>
              <div>{{ qrForm.wo_code }}</div>
            </div>
            <div
              style="display: flex;height: 25%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center ;text-align: left"
              style="display: flex;height: 20%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center ;text-align: left"
            >
              <div style="width: 60px;margin-left: 5px;">产品编码:</div>
              <div>{{ qrForm.partcode }}</div>
            </div>
            <div
              style="display: flex;height: 25%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
              style="display: flex;height: 20%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width:60px;margin-left: 5px;">产品名称:</div>
              <div>{{ qrForm.partname }}</div>
            </div>
            <div style="display: flex;height: 25%;justify-content: flex-start;align-items: center;text-align: left">
              <div style="width: 60px;margin-left: 5px;">下道工序:</div>
            <div
              style="display: flex;height: 20%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width:60px;margin-left: 5px;">下道工序:</div>
              <div>{{ qrForm.nextstepname }}</div>
            </div>
            <div style="display: flex;height: 20%;justify-content: flex-start;align-items: center;text-align: left">
              <div style="width: 60px;margin-left: 5px;">处理时间:</div>
              <div>{{ qrForm.operatorTime }}</div>
            </div>
          </div>
@@ -930,6 +1007,21 @@
        </el-form-item>
        <el-form-item label="不良数量:">
          <div style="width: 200px">{{ badDialogForm.ng_qty }}</div>
        </el-form-item>
        <el-form-item label="维修人员:">
          <el-select
            v-model="badDialogForm.operation"
            style="width: 200px;"
            placeholder="请选择"
          >
            <el-option
              v-for="item in OperationArr"
              :key="item.usercode"
              :label="item.username"
              :value="item.usercode"
            />
          </el-select>
        </el-form-item>
      </el-form>
@@ -992,8 +1084,8 @@
          />
          <el-table-column
            prop="repair_qty"
            label="维修数量"
            width="90"
            label="维修合格数量"
            width="110"
          >
            <template slot-scope="{row}">
              <!--              {{ row.repair_qty }}-->
@@ -1032,7 +1124,12 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="badDialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="badDialogVisibleConfirm ">保 存/打 印</el-button>
          <el-button
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="badDialogVisibleConfirm "
          >保 存/打 印</el-button>
        </div>
      </span>
    </el-dialog>
@@ -1060,6 +1157,8 @@
} from '@/api/scgl'
import { urlAddRandomNo, webapp_ws_ajax_run, webapp_ws_autoupdate } from '@/utils/grwebapp'
import QRCode from 'qrcodejs2'
import { getCookie } from '@/utils/auth'
import { handleDatetime2 } from '@/utils/global'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
@@ -1140,7 +1239,7 @@
        taskqty: '', // 任务数量
        fqty: '', // 发料数量
        inuser: '', // 收料人员
        inuser: getCookie('navTabId'), // 收料人员
        sqty: '', // 收料数量
        ngqty: '', // 不良数量
        badcode: '', // 不良原因编码
@@ -1152,7 +1251,10 @@
        usergroupcode: '', // 班组编码
        reportuser: '', // 报工人员
        startqtySum: '' // 不能超过的数值
        startqtySum: '', // 不能超过的数值
        operation: getCookie('navTabId'), // 报工人(收料人)
        remarks: ''// 备注
      },
      ZZuserArr: [], // 自制用户所有
@@ -1240,24 +1342,43 @@
      badTableData: [], // 不良处理列表table数据
      badTotal: 0,
      badDialogVisible: false,
      badDialogForm: {},
      badTableDataDialog: []// 不良对话框table表格
      badDialogForm: {
        operation: getCookie('navTabId')
      },
      badTableDataDialog: [], // 不良对话框table表格
      OperationArr: [], // 人员数组
      sendButtonIsDisabled: false, // 下达按钮是否可点击
      judgeIsScanningArr: [], // 判断是否扫码数组
      countJudgeIsScanningInput: 0 // 判断扫码框的个数
    }
  },
  // computed: {
  //   qrLink: function() {
  //     return this.$store.getters.getPreviewUrl
  //   }
  // },
  // watch: {
  //   qrLink: function(newVal, oldNew) {
  //     if (newVal !== oldNew) {
  //       this.$nextTick(() => {
  //         this.bindQRCode(newVal)
  //       })
  //     }
  //   }
  // },
  watch: {
    // 'form.orderstepqrcode': {
    //   handler(newValue) {
    //     this.form.orderstepqrcode = newValue
    //
    //     // 在这里调用,并执行this.fnThrottle(this.search, 500, 2000)();
    //     this.fnThrottle(this.enterNative, 500, 2000, 'produceCode')()
    //   }
    // },
    // 'WXform.orderstepqrcode': {
    //   handler(newValue) {
    //     this.form.orderstepqrcode = newValue
    //
    //     // 在这里调用,并执行this.fnThrottle(this.search, 500, 2000)();
    //     this.fnThrottle(this.enterNative, 500, 2000, 'WXproduceCode')()
    //   }
    // },
    // 'badForm.orderstepqrcode': {
    //   handler(newValue) {
    //     this.form.orderstepqrcode = newValue
    //
    //     // 在这里调用,并执行this.fnThrottle(this.search, 500, 2000)();
    //     this.fnThrottle(this.enterNative, 500, 2000, 'badProduceCode')()
    //   }
    // }
  },
  created() {
    this.getMesOrderStepSearch()
    this.tabClick()
@@ -1272,8 +1393,11 @@
    })
    // webapp_urlprotocol_startup()
    // webapp_ws_autoupdate(true)
    this.getMesOrderSelectUserAll() // 获取所有人员
  },
  methods: {
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    },
@@ -1361,9 +1485,108 @@
        })
      }
    },
    // 防抖      //扫码用的是防抖
    fnThrottle(method, delay, duration, belong) {
      var that = this
      var timer = this.timer
      var begin = new Date().getTime()
      return function() {
        var current = new Date().getTime()
        clearTimeout(timer)
        if (current - begin >= duration) {
          // method()
          // that.VALUE()
          begin = current
        } else {
          that.timer = setTimeout(function() {
            // method()
            if (belong === 'produceCode') {
              that.enterNative(that.form.orderstepqrcode, belong)
            }
            if (belong === 'WXproduceCode') {
              that.enterNative(that.WXform.orderstepqrcode, belong)
            }
            if (belong === 'badProduceCode') {
              that.enterNative(that.badForm.orderstepqrcode, belong)
            }
          }, delay)
        }
      }
    },
    // 判断是否是扫码枪扫码
    judgeIsScanning2(e, belong) {
      if (belong === 'produceCode' && this.form.orderstepqrcode.toString().length === 0) {
        this.judgeIsScanningArr = []
        this.countJudgeIsScanningInput = 0
      }
      if (belong === 'WXproduceCode' && this.WXform.orderstepqrcode.toString().length === 0) {
        this.judgeIsScanningArr = []
        this.countJudgeIsScanningInput = 0
      }
      const timenow = e.timeStamp
      // console.log(timenow, 1)
      // let flag = true
      let flag = false
      this.judgeIsScanningArr.push(timenow)
      let i
      for (i in this.judgeIsScanningArr) {
        console.log(Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]))
        // flag = Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]) < 0.1
        if (Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]) < 0.1) {
          this.countJudgeIsScanningInput++
        }
        if (this.countJudgeIsScanningInput >= 3) {
          flag = true
        }
        if (i > 0 && this.judgeIsScanningArr.length === parseInt(i) + 1) {
          if (flag) {
            console.log(flag, 1)
            this.fnThrottle(this.enterNative, 500, 2000, belong)()
            return
          }
        }
      }
      // // for (i in this.judgeIsScanningArr) {
      // // console.log(i)
      // // console.log( this.judgeIsScanningArr)
      // console.log(Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]))
      // if (Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]) < 10) {
      //   this.countJudgeIsScanningInput++
      // }
      // if (this.countJudgeIsScanningInput > this.judgeIsScanningArr.length / 2) {
      //   flag = true
      // }
      // // flag = Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]) < 0.1
      // // if (i > 0 && this.judgeIsScanningArr.length === parseInt(i) + 1) {
      // if (flag) {
      //   console.log(flag, 2)
      //   this.fnThrottle(this.enterNative, 500, 2000, belong)()
      //   return
      // }
      // // }
      // // }
    },
    // 判断是否是扫码枪扫码
    judgeIsScanning(e, belong) {
      const timenow = e.timeStamp
      let flag = true
      this.judgeIsScanningArr.push(timenow)
      let i
      for (i in this.judgeIsScanningArr) {
        flag = Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]) < 0.1
        if (i > 0 && this.judgeIsScanningArr.length === parseInt(i) + 1) {
          if (flag) {
            this.fnThrottle(this.enterNative, 500, 2000, belong)()
            return
          }
        }
      }
    },
    // 扫码键盘回车事件
    async enterNative(val, belong) {
      console.log(val, belong)
      console.log(val, belong, 89898989)
      // 开工:code="200"  count=0
      // 报工:code="200"  count=1
      // 发料:code="200"  count=2
@@ -1461,13 +1684,8 @@
        // this.dialogForm.startqty = obj.startqty
        this.dialogForm.startqty = obj.noreportqty
        if (obj.nextstepname === null || obj.nextstepcode === '') {
          this.dialogForm.nextstepname = obj.stepname
          this.dialogForm.nextstepcode = obj.stepcode
        } else {
          this.dialogForm.nextstepname = obj.nextstepname
          this.dialogForm.nextstepcode = obj.nextstepcode
        }
        this.dialogForm.nextstepname = obj.nextstepname
        this.dialogForm.nextstepcode = obj.nextstepcode
        this.dialogForm.startqtySum = obj.noreportqty
      })
@@ -1526,13 +1744,10 @@
        this.dialogForm.reportqty = obj.reportqty
        this.dialogForm.noreportqty = obj.noreportqty
        this.dialogForm.stepcode = obj.stepcode
        if (obj.nextstepname === null || obj.nextstepcode === '') {
          this.dialogForm.nextstepname = obj.stepname
          this.dialogForm.nextstepcode = obj.stepcode
        } else {
          this.dialogForm.nextstepname = obj.nextstepname
          this.dialogForm.nextstepcode = obj.nextstepcode
        }
        this.dialogForm.nextstepname = obj.nextstepname
        this.dialogForm.nextstepcode = obj.nextstepcode
        this.dialogForm.noputqty = obj.noputqty
        this.dialogForm.stepseq = obj.seq
        this.dialogForm.sqty = obj.startqty
@@ -1546,7 +1761,7 @@
    // 生产班组下拉改变
    usergroupChange(val) {
      this.dialogForm.usergroupcode = val
      this.getUserTableData()
      this.getMesOrderSelectUserZZ2()
    },
    // 获取自制报工生产班组下拉列表
    async getMesOrderStepReportSelectUserGroup() {
@@ -1557,6 +1772,11 @@
    async getMesOrderSelectUserZZ() {
      const { data: res } = await MesOrderSelectUser({ usercode: this.dialogForm.usergroupcode })
      this.ZZuserArr = res
    },
    async getMesOrderSelectUserZZ2() {
      const { data: res } = await MesOrderSelectUser({ usercode: '' })
      this.ZZuserArr = res
      await this.getUserTableData()
    },
    // 获取自制生产设备下拉
    async getMesOrderStepStartSelectEqp() {
@@ -1595,9 +1815,16 @@
        item.isVisible = 0
        item.number = number
      })
      this.ZZuserArr = [...this.ZZuserArr].filter(x => [...this.userTableData].every(y => y.usercode !== x.usercode))
      this.$refs.tableDataRef.doLayout()
    },
    // 用户添加
    userAdd() {
      if (this.userTableData.find(i => i.isVisible === 1)) {
        return this.$message.info('请先保存当前行信息!')
      }
      let number = Math.random() * Math.random()// 作为删除时的标识符
      number = number === 0 ? (10 + Math.random()) : number
      console.log(this.userTableData, 6)
@@ -1605,6 +1832,11 @@
    },
    // 用户列表删除
    userDel(row) {
      this.ZZuserArr.splice(0, 0, {
        usercode: row.usercode,
        username: row.username
      })
      this.userTableData.forEach((item, index) => {
        if (item.number === row.number) {
          this.userTableData.splice(index, 1)
@@ -1617,6 +1849,13 @@
      if (row.usercode === '') {
        return this.$message.info('人员名称不能为空!')
      }
      this.ZZuserArr.forEach((item, index) => {
        if (item.usercode === row.usercode) {
          this.ZZuserArr.splice(index, 1)
        }
      })
      this.userTableData.forEach(item => {
        if (item.number === row.number) {
          item.isVisible = 0
@@ -1647,6 +1886,11 @@
    },
    // 对话框关闭事件
    handleClose() {
      this.judgeIsScanningArr = []
      this.form.orderstepqrcode = ''
      this.WXform.orderstepqrcode = ''
      this.badForm.orderstepqrcode = ''
      this.dialogForm.wo_code = '', // 工单编号
      this.dialogForm.partcode = '', // 产品编码
      this.dialogForm.partname = '', // 产品名称
@@ -1666,7 +1910,7 @@
      this.dialogForm.taskqty = '', // 任务数量
      this.dialogForm.fqty = '', // 发料数量
      this.dialogForm.inuser = '', // 收料人员
      this.dialogForm.inuser = getCookie('navTabId'), // 收料人员  默认登录人员
      this.dialogForm.sqty = '', // 收料数量
      this.dialogForm.ngqty = '', // 不良数量
      this.dialogForm.badcode = '', // 不良原因编码
@@ -1682,6 +1926,8 @@
      this.dialogForm.nextstepcode = '' // 下道工序编码
      this.dialogForm.remarks = '' // 备注
      this.dialogForm.operation = getCookie('navTabId') // 报工人(收料人)
      this.userTableData = [] // 人员列表
      this.$refs.dialogForm.clearValidate()
@@ -1709,11 +1955,13 @@
              taskqty: this.dialogForm.planqty, // 任务数量
              fqty: this.dialogForm.fqty // 发料数量
            }
            this.$store.state.app.buttonIsDisabled = true
            SavaMesOrderStepOut(data).then(res => {
              if (res.code === '200') {
                this.$message.success('发料成功!')
                this.dialogVisible = false
                this.$message.success('发料成功!')
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {
                this.$message.error('发料失败!')
              }
@@ -1740,19 +1988,21 @@
              inuser: this.dialogForm.inuser, // 发料人员
              taskqty: this.dialogForm.planqty, // 任务数量
              sqty: this.dialogForm.sqty, // 收料数量
              remarks: this.dialogForm.remarks, // 备注
              ngqty: this.dialogForm.noputqty === '' ? 0 : this.dialogForm.noputqty, // 不良数量
              badcode: this.dialogForm.badcode.length < 1 ? '' : this.dialogForm.badcode.join(';')// 不良原因
            }
            this.$store.state.app.buttonIsDisabled = true
            SavaMesOrderStepIn(data).then(res => {
              if (res.code === '200') {
                this.$message.success('收料成功!')
                this.dialogVisible = false
                if (this.dialogForm.nextstepcode !== '') {
                  this.WXprint2()
                this.$message.success('收料成功!')
                if (this.dialogForm.nextstepcode === '') {
                  this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.inuser).username)
                  this.dialogVisible2 = true
                }
                this.dialogVisible2 = true
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {
                this.$message.error('收料失败!')
              }
@@ -1769,11 +2019,13 @@
              taskqty: this.dialogForm.planqty, // 任务数量
              startqty: this.dialogForm.startqty// 开始数量
            }
            this.$store.state.app.buttonIsDisabled = true
            SavaMesOrderStepStart(data).then(res => {
              if (res.code === '200') {
                this.$message.success('开工成功!')
                this.dialogVisible = false
                this.$message.success('开工成功!')
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {
                this.$message.error('开工失败!')
              }
@@ -1814,21 +2066,21 @@
              startqty: this.dialogForm.reportqty, // 开工数量
              // reportqty: this.dialogForm.reportqty, // 报工数量
              reportqty: this.dialogForm.startqty, // 报工数量
              remarks: this.dialogForm.remarks, // 备注
              ngqty: this.dialogForm.noputqty === '' ? 0 : this.dialogForm.noputqty, // 不良数量
              badcode: this.dialogForm.badcode.length < 1 ? '' : this.dialogForm.badcode.join(';')// 不良原因
            }
            this.$store.state.app.buttonIsDisabled = true
            SavaMesOrderStepReport(data).then(res => {
              if (res.code === '200') {
                this.$message.success('报工成功!')
                this.dialogVisible = false
                console.log(this.dialogForm.nextstepcode, 1)
                if (this.dialogForm.nextstepcode !== '') {
                  this.ZZprint2()
                this.$message.success('报工成功!')
                if (this.dialogForm.nextstepcode === '') {
                  this.ZZprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
                  this.dialogVisible2 = true
                }
                this.dialogVisible2 = true
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {
                this.$message.error('报工失败!')
              }
@@ -1841,35 +2093,37 @@
    bindQRCode(text) {
      new QRCode(this.$refs.qrCodeDiv2, {
        text: text,
        width: 50,
        height: 50,
        // width: 50,
        width: 60,
        // height: 50,
        height: 60,
        colorDark: '#000', // 二维码颜色
        colorLight: '#ffffff', // 二维码背景色
        correctLevel: QRCode.CorrectLevel.L// 容错率,L/M/H
      })
    },
    ZZprint2() {
    ZZprint2(username) {
      this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
      this.qrForm.startqty = this.dialogForm.startqty
      this.qrForm.wo_code = this.dialogForm.wo_code
      this.qrForm.partcode = this.dialogForm.partcode
      this.qrForm.partname = this.dialogForm.partname
      this.qrForm.nextstepname = this.dialogForm.nextstepname
      this.qrForm.operator = username
      this.qrForm.operatorTime = handleDatetime2(new Date())
      this.$nextTick(() => {
        this.bindQRCode(this.qrForm.qrvalue)
        console.log(this.$refs.qrCodeDiv2, 123)
        // console.log(this.$refs.qrCodeDiv2.querySelectorAll('#qrCode2>img'), 1)
        // console.log(this.$refs.qrCodeDiv2.querySelectorAll('#qrCode2>canvas'), 2)
      })
    },
    WXprint2() {
    WXprint2(username) {
      this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
      this.qrForm.startqty = this.dialogForm.sqty
      this.qrForm.wo_code = this.dialogForm.wo_code
      this.qrForm.partcode = this.dialogForm.partcode
      this.qrForm.partname = this.dialogForm.partname
      this.qrForm.nextstepname = this.dialogForm.nextstepname
      this.qrForm.operator = username
      this.qrForm.operatorTime = handleDatetime2(new Date())
      this.$nextTick(() => {
        this.bindQRCode(this.qrForm.qrvalue)
      })
@@ -1881,7 +2135,9 @@
      this.qrForm.partcode = ''
      this.qrForm.partname = ''
      this.qrForm.nextstepname = ''
      this.$refs.qrCodeDiv2 = ''
      this.qrForm.operator = ''
      this.qrForm.operatorTime = ''
      // this.$refs.qrCodeDiv2 = ''
    },
    // 获取页面高度
@@ -1893,6 +2149,7 @@
        if (window.innerHeight < 769) {
          this.tableHeight = this.tableHeight - 50
        }
        this.$refs.tableDataRef.doLayout()
      })
    },
@@ -1909,25 +2166,29 @@
      const data = {
        Data: this.badTableDataDialog
      }
      // console.log(JSON.stringify(data), 1)
      // this.badPrint()
      // this.dialogVisible2 = true
      EditOrderNgStepSeave(data).then(res => {
      this.$store.state.app.buttonIsDisabled = true
      EditOrderNgStepSeave(data, this.badDialogForm.operation).then(res => {
        if (res.code === '200' || res.code === '301') {
          this.getBadList()
          this.badDialogVisible = false
          return this.$message.success('保存成功!')
          this.badPrint(this.OperationArr.find(item => item.usercode === this.badDialogForm.operation).username)
          this.dialogVisible2 = true
          this.$message.success('保存成功!')
          this.$store.state.app.buttonIsDisabled = false
        }
      })
    },
    badPrint() {
    badPrint(username) {
      this.qrForm.qrvalue = this.badDialogForm.wo_code + ';' + this.badDialogForm.nextstepcode
      this.qrForm.startqty = this.badDialogForm.plan_qty
      this.qrForm.wo_code = this.badDialogForm.wo_code
      this.qrForm.partcode = this.badDialogForm.partcode
      this.qrForm.partname = this.badDialogForm.partname
      this.qrForm.nextstepname = this.badDialogForm.nextstepname
      this.qrForm.operator = username
      this.qrForm.operatorTime = handleDatetime2(new Date())
      this.$nextTick(() => {
        this.bindQRCode(this.qrForm.qrvalue)
      })
@@ -1935,11 +2196,16 @@
    handleCloseBad() {
      this.badDialogForm = {}
      this.badDialogForm.operation = getCookie('navTabId')
      this.badTableDataDialog = []
      this.judgeIsScanningArr = []
    },
    // 点击维修处理按钮
    async getMesOrderSelectUserAll() {
      const { data: res } = await MesOrderSelectUser({ usercode: '' })
      this.OperationArr = res
    },
    // 点击维修处理按钮  或  扫描条码的扫描回车事件
    async repairHandle(row) {
      console.log(row)
      let data
      if (row.wo_code) {
        data = {
@@ -1971,6 +2237,8 @@
          item.repair_qty = 0
          item.bad_qty = 0
          item.isVisible = 0
          // item.defect_code = [...new Set(item.defect_code.split(','))].join(',')
          // item.defect_name = [...new Set(item.defect_name.split(','))].join(',')
        })
        console.log(this.badTableDataDialog, 321)
        this.badDialogVisible = true
@@ -2003,10 +2271,6 @@
      })
    },
    badSave(row) {
      console.log(row, 1)
      // console.log(parseFloat(row.bad_qty) + parseFloat(row.repair_qty), 2)
      // console.log(parseFloat(row.ng_qty), 2)
      // console.log(parseFloat(row.bad_qty) + parseFloat(row.repair_qty) > parseFloat(row.ng_qty), 2)
      if (parseFloat(row.bad_qty) + parseFloat(row.repair_qty) > parseFloat(row.ng_qty)) {
        this.badCancel(row)
        return this.$message.info('维修数量与报废数量之和不能大于不良数量!')
@@ -2014,8 +2278,8 @@
      this.badTableDataDialog.forEach((item, index) => {
        if (item.id === row.id && item.m_id === row.m_id) {
          this.badTableDataDialog.splice(index, 1, {
            bad_qty: row.bad_qty,
            repair_qty: row.repair_qty,
            bad_qty: parseFloat(row.bad_qty),
            repair_qty: parseFloat(row.repair_qty),
            isVisible: 0,
            defect_code: row.defect_code,
            defect_name: row.defect_name,
@@ -2219,6 +2483,15 @@
  margin-bottom: 0;
}
.tableFixed {
  ::v-deep .el-table__fixed-right {
    height: 100% !important;
  }
  ::v-deep .el-table__fixed {
    height: 100% !important;
  }
}
</style>
<style>