春风项目四线(合箱线、总装线)
wujian
2024-07-24 49ca7cac33b124324250f307b12ce84370daa2f3
jcdm-ui/src/views/main/cfkb/connectingRodUp/index.vue
@@ -8,17 +8,17 @@
          </div>
        </template>
      </el-card>
      <el-card class="query-card" >
        <el-form :model="from" size="large" :inline="true" label-width="78px" @submit.native.prevent>
          <el-form-item label-width="200" label="连杆码" :prop="from.connectCode"  style="align-content: center">
            <input v-model="from.connectCode"
                   ref="inputdata1"
                   style="height: 39px; width: 300px"
                   placeholder="请扫描连杆码"
            />
          </el-form-item>
        </el-form>
      </el-card>
<!--      <el-card class="query-card" >-->
<!--        <el-form :model="from" size="large" :inline="true" label-width="78px" @submit.native.prevent>-->
<!--          <el-form-item label-width="200" label="连杆码" :prop="from.connectCode"  style="align-content: center">-->
<!--            <input v-model="from.connectCode"-->
<!--                   ref="inputdata1"-->
<!--                   style="height: 39px; width: 300px"-->
<!--                   placeholder="请扫描连杆码"-->
<!--            />-->
<!--          </el-form-item>-->
<!--        </el-form>-->
<!--      </el-card>-->
      <!--      <el-card class="box-card" >-->
      <!--        <el-form :model="from" size="large" :inline="true" label-width="68px" @submit.native.prevent>-->
      <!--          <el-form-item label-width="200" label="活塞连杆托盘码" :prop="from.scanObject2"  style="align-content: center">-->
@@ -126,63 +126,63 @@
    }
  },
  mounted() {
    this.setFocus1()
    this.$refs.inputdata1.addEventListener('keydown',this.handleScannerInput1)
    // this.setFocus1()
    // this.$refs.inputdata1.addEventListener('keydown',this.handleScannerInput1)
    this.getStationConf()
    this.getWebUrl()
    this.getDetailMessage()
  },
  beforeDestroy() {
    this.$refs.inputdata1.removeEventListener('keydown',this.handleScannerInput1)
  },
  // beforeDestroy() {
  //   this.$refs.inputdata1.removeEventListener('keydown',this.handleScannerInput1)
  // },
  methods:{
    setFocus1(){
      this.$nextTick(()=>{
        this.$refs.inputdata1.focus()
      })
    },
    handleScannerInput1(event) {
      if (this.scannerFlag) {
        this.$refs.inputdata1.value = ''
        this.scannerFlag = false
      }
      const input = event.target
      const inputValue = input.value
      this.from.connectCode = inputValue
      if (event.key === 'Enter') {
        this.scannerFlag = true
        //扫描完成
        console.log('sssss', this.from.connectCode)
        getSfcCodeByConnectCode({connectCode:this.from.connectCode}).then(res => {
          console.log('res',res)
          if (res.code === 200){
            this.queryParams.scanObject2 = res.data.sfcCode
            if (this.queryParams.scanObject1 !== null && this.queryParams.scanObject1 !== ''
              && this.queryParams.scanObject2 !== null && this.queryParams.scanObject2 !== ''){
              if (this.queryParams.scanObject1 === this.queryParams.scanObject2){
                this.queryParams.words = "配对成功"
                this.queryParams.tileColor = "#3dcc1d"
                //请求出站
                // this.passStation()
              }else {
                this.queryParams.words = "配对失败"
                this.queryParams.tileColor = "#f50909"
              }
            }
            this.$message({
              message: '查询成功',
              type: 'success'
            });
          } else {
            this.$message({
              message: '查询失败',
              type: 'error'
            });
          }
        })
      }
    },
    // setFocus1(){
    //   this.$nextTick(()=>{
    //     this.$refs.inputdata1.focus()
    //   })
    // },
    // handleScannerInput1(event) {
    //   if (this.scannerFlag) {
    //     this.$refs.inputdata1.value = ''
    //     this.scannerFlag = false
    //   }
    //   const input = event.target
    //   const inputValue = input.value
    //   this.from.connectCode = inputValue
    //   if (event.key === 'Enter') {
    //     this.scannerFlag = true
    //     //扫描完成
    //     console.log('sssss', this.from.connectCode)
    //     getSfcCodeByConnectCode({connectCode:this.from.connectCode}).then(res => {
    //       console.log('res',res)
    //       if (res.code === 200){
    //         this.queryParams.scanObject2 = res.data.sfcCode
    //
    //         if (this.queryParams.scanObject1 !== null && this.queryParams.scanObject1 !== ''
    //           && this.queryParams.scanObject2 !== null && this.queryParams.scanObject2 !== ''){
    //           if (this.queryParams.scanObject1 === this.queryParams.scanObject2){
    //             this.queryParams.words = "配对成功"
    //             this.queryParams.tileColor = "#3dcc1d"
    //             //请求出站
    //             // this.passStation()
    //           }else {
    //             this.queryParams.words = "配对失败"
    //             this.queryParams.tileColor = "#f50909"
    //           }
    //         }
    //         this.$message({
    //           message: '查询成功',
    //           type: 'success'
    //         });
    //       } else {
    //         this.$message({
    //           message: '查询失败',
    //           type: 'error'
    //         });
    //       }
    //     })
    //   }
    // },
    getWebUrl(){
      getUrl().then(res=>{
        this.websocketUrl = res+"OP050"