春风项目四线(合箱线、总装线)
yyt
2024-02-19 0b14225915932f0f5c88bc3e44302bf1c309de1a
jcdm-ui/src/views/main/kb/cvt/index.vue
@@ -27,7 +27,7 @@
             <el-form ref="form" :model="form"  label-width="25%"   >
               <el-form-item prop="engineNo" style="margin-top: 16px">
              <span slot="label" style="font-size:22px;color:black;"><strong>发动机号</strong></span>
                 <el-input style="font-size:20px" v-model="form.engineNo" placeholder="请输入发动机号" clearable  @keyup.enter.native="EngineNohandleChange">
                 <el-input style="font-size:20px" v-model="form.engineNo" placeholder="请输入发动机号" clearable  @input="EngineNohandleChange">
                   <el-button slot="append" plain type="info" @click="EngineNohandleChange" icon="el-icon-search"></el-button>
                 </el-input>
               </el-form-item>
@@ -80,6 +80,7 @@
import { listOrderScheduling, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling";
import { listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection } from "@/api/main/da/passingStationCollection/passingStationCollection";
import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo";
import { setSNCode } from "@/api/main/da/opcuaconfig/opcuaconfig";
import {getIp, listStationConf} from "@/api/main/sc/stationConf";
export default {
@@ -95,6 +96,15 @@
      buttondisabled:true,
      locationCode: "未配置",
      locationName: "未配置工位",
      codeValue: "",
      code: "",
      lastTime: "",
      nextTime: "",
      lastCode: "",
      nextCode: "",
      dtmainId: "",
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -122,7 +132,36 @@
  },
  computed: {},
  watch: {},
  created() {},
  created() {
    window.document.onkeypress = (e) => {
      if (window.event) {
        this.nextCode = e.keyCode;
      } else if (e.which) {
        this.nextCode = e.which;
      }
      if (e.which === 13) {
        // 键盘回车事件
        if (this.code.length < 3) return; // 扫码枪的速度很快,手动输入的时间不会让code的长度大于2,所以这里不会对扫码枪有效
        this.parseQRCode(this.code); // 获取到扫码枪输入的内容,做别的操作
        this.lastCode = "";
        this.lastTime = "";
        return;
      }
      this.nextTime = new Date().getTime();
      if (!this.lastTime && !this.lastCode) {
        this.code = ""; // 清空上次的条形码
        this.code += e.key;
      }
      if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 500) {
        // 当扫码前有keypress事件时,防止首字缺失
        this.code = e.key;
      } else if (this.lastCode && this.lastTime) {
        this.code += e.key;
      }
      this.lastCode = this.nextCode;
      this.lastTime = this.nextTime;
    };
  },
  mounted() {
    this.getStationConf();
  },
@@ -154,7 +193,8 @@
    },
    EngineNohandleChange(){
      if(this.form.engineNo !== null && this.form.engineNo !== undefined){
        let OrderSchedulingParam = {engineNo: null}
        //let OrderSchedulingParam = {engineNo: null}
        setSNCode(this.form.engineNo,this.locationCode)
        //OrderSchedulingParam.engineNo = this.form.engineNo;
     /*   listOrderScheduling(OrderSchedulingParam).then(response => {
          if(response.total === 1 ){
@@ -202,7 +242,9 @@
      }
    },
    parseQRCode(code) {
      this.form.engineNo = code;
    },
  },
  }