春风项目四线(合箱线、总装线)
yyt
2024-06-06 45f4602070d7219fe00b098b6c0471ca42a8553f
jcdm-ui/src/views/main/cfkb/connectingRod/index.vue
@@ -2,25 +2,29 @@
  <div class="app-container">
    <div style="width: 100%">
      <el-card class="box-card" >
        <el-form :model="from" ref="queryForm" :inline="true" >
          <el-form-item label="托盘码:" prop="scanObject1" >
        <el-form :model="from" size="large" :inline="true" label-width="78px" @submit.native.prevent>
          <el-form-item label="曲轴码:" prop="scanObject1" >
            <el-input
              style="width: 350px"
              v-model="from.scanObject1"
              placeholder="请输入托盘码"
              placeholder="请输曲轴码"
              clearable
              @keyup.enter.native="handleQuery"
              @input="handleQuery"
            />
          </el-form-item>
          <el-form-item label="连杆码:" prop="scanObject2" >
            <el-input
              style="width: 350px"
              v-model="from.scanObject2"
              placeholder="请输入连杆码"
              clearable
              @keyup.enter.native="handleQuery"
              @input="handleQuery"
          <el-form-item label-width="200" label="托盘码" :prop="from.scanObject3"  style="align-content: center">
            <input v-model="from.scanObject3"
                   ref="inputdata2"
                   style="height: 39px; width: 300px"
                   placeholder="请输入托盘码"
            />
          </el-form-item>
          <el-form-item label-width="200" label="连杆码" :prop="from.scanObject2"  style="align-content: center">
            <input v-model="from.scanObject2"
                   ref="inputdata1"
                   style="height: 39px; width: 300px"
                   placeholder="请输入连杆码"
            />
          </el-form-item>
        </el-form>
@@ -33,29 +37,6 @@
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
                @keyup.enter.native="handleQuery"
              />
            </el-select>
          </el-form-item>
          <el-form-item  label="轴名称:" prop="axisName" >
            <el-select v-model="from.axisName" placeholder="" clearable style="width: 125px">
              <el-option
                v-for="dict in dict.type.axisname"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
                @keyup.enter.native="handleQuery"
              />
            </el-select>
          </el-form-item>
          <el-form-item  label="颈名称:" prop="neckName" >
            <el-select v-model="from.neckName" placeholder="" clearable style="width: 125px">
              <el-option
                v-for="dict in dict.type.neckname"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
                @keyup.enter.native="handleQuery"
              />
            </el-select>
          </el-form-item>
@@ -66,7 +47,6 @@
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
                @keyup.enter.native="handleQuery"
              />
            </el-select>
          </el-form-item>
@@ -83,23 +63,23 @@
            <el-descriptions-item label="机型">
              <span>{{queryParams.productSeries}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="箱体码">
              <span>{{queryParams.scanObject1}}</span>
            <el-descriptions-item label="发动机编号">
              <span>{{queryParams.sfcCode}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="托盘码">
              <span>{{queryParams.scanObject3}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="曲轴码">
              <span>{{queryParams.scanObject1}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="连杆码">
              <span>{{queryParams.scanObject2}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="轴名称">
              <span>{{queryParams.axisName}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="颈名称">
              <span>{{queryParams.neckName}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="瓦名称">
              <span>{{queryParams.tileName}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="重量">
              <span>{{queryParams.weight}}</span>
            <el-descriptions-item label="缸体编号">
              <span>{{queryParams.axisName}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="配瓦颜色">
              <span  style="color: #FFFFFF;"  :style="{ backgroundColor: queryParams.tileColor }">{{queryParams.tileColor}}</span>
@@ -113,7 +93,8 @@
</template>
<script>
import VueQr from 'vue-qr'
import { listTileMatchRules, getTileMatchRules, delTileMatchRules, addTileMatchRules, updateTileMatchRules } from "@/api/main/bs/tileMatchRules/tileMatchRules";
import {setBarcode} from "@/api/main/da/tileMatchMiddleware/tileMatchMiddleware";
import {listTileMatchRules, getTileMatchRules, delTileMatchRules, addTileMatchRules, updateTileMatchRules} from "@/api/main/bs/tileMatchRules/tileMatchRules";
export default {
  name: "index",
  dicts: ['colour_hex','productseries','axisname','neckname','tilename'],
@@ -122,6 +103,7 @@
  },
  data(){
    return{
      scannerFlag: false,
      loading: true,
      tileMatchKbList: [],
      qrCode: '',
@@ -129,13 +111,13 @@
      from:{
        pageNum: 1,
        pageSize: 10,
        productSeries: null,
        productSeries:'380Y',
        scanObject1: null,
        //scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
        scanObject2: 'P0SQ0-041000-1002;T2312020675;DAABBA;S500003',
        scanObject2: null,
        scanObject3: null,
        axisName: null,
        neckName: null,
        tileName: null,
        tileName: '连杆瓦',
        axisParameterNoPosition: null,
        neckParameterPosition: null,
        axisValue: null,
@@ -151,8 +133,8 @@
        pageSize: 10,
        productSeries: null,
        scanObject1: null,
        // scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
        scanObject2: null,
        scanObject3: null,
        axisName: null,
        neckName: null,
        tileName: null,
@@ -165,18 +147,84 @@
        updateUser: null,
        state: null,
        weight: null,
        sfcCode:null,
      },
    }
  },
  mounted() {
    this.setFocus1()
    this.setFocus2()
    this.$refs.inputdata1.addEventListener('keydown',this.handleScannerInput1)
    this.$refs.inputdata2.addEventListener('keydown',this.handleScannerInput2)
  },
  beforeDestroy() {
    this.$refs.inputdata1.removeEventListener('keydown',this.handleScannerInput1)
    this.$refs.inputdata2.removeEventListener('keydown',this.handleScannerInput2)
  },
  methods:{
    refresh() {
      location.reload();
    },
    setFocus1(){
      this.$nextTick(()=>{
        this.$refs.inputdata1.focus()
      })
    },
    setFocus2(){
      this.$nextTick(()=>{
        this.$refs.inputdata2.focus()
      })
    },
    handleScannerInput1(event){
      if (this.scannerFlag){
        this.from.scanObject2 = ''
        this.$refs.inputdata1.value = ''
        this.scannerFlag = false
      }
      const input = event.target
      const inputValue = input.value
      this.from.scanObject2 = inputValue
      if (event.key === 'Enter'){
        this.scannerFlag = true
        //console.log('条码:',this.from.scanObject2)
        this.$refs.inputdata2.focus();
        //扫描完成
        if (typeof this.from.scanObject2 !== 'undefined') {
          setBarcode({barcode:this.from.scanObject2,locationCode:this.from.scanObject3}).then(res =>{
            console.log('res',res)
            this.queryParams.sfcCode=res.sfcCode;
            this.from.scanObject1=res.crankshaftNo;
            this.queryParams.axisName=res.cylinder;
            this.handleQuery()
            //this.from.scanObject2=this.from.scanObject2
            //this.queryParams.scanObject1=this.from.scanObject1
          })
        }
        this.handleQuery()
      }
    },
    handleScannerInput2(event){
      if (this.scannerFlag){
        this.from.scanObject3 = ''
        this.$refs.inputdata2.value = ''
        this.scannerFlag = false
      }
      const input = event.target
      const inputValue = input.value
      this.from.scanObject3= inputValue
      if (event.key === 'Enter'){
        this.scannerFlag = true
        console.log('条码2:',this.from.scanObject3)
        this.$refs.inputdata1.focus();
        this.from.scanObject2 = ''
        //扫描完成
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.clear();
      if(this.from.scanObject1 !== null && this.from.scanObject2 !== null
        && this.from.axisName !== null && this.from.axisName !== ""
        && this.from.neckName !== null && this.from.neckName !== ""
        && this.from.tileName !== null && this.from.tileName !== ""
      if(this.from.scanObject3 !== null && this.from.scanObject2 !== null
        && this.from.productSeries !== null && this.from.productSeries !== "")
      {
        this.axisValueextracted();
@@ -214,7 +262,7 @@
    // 取箱体码第三段为配瓦值
    axisValueextracted() {
      const parts1 = this.from.scanObject1.split(";");
      const parts1 = this.from.scanObject2.split(";");
      if (parts1.length >= 3) {
        //const axisValueextracted = parts1[2].substring(3,4);
        const axisValueextracted = parts1[2];
@@ -225,7 +273,7 @@
    //取曲轴码第三段为配瓦值
    neckValueextracted() {
      const parts2 = this.from.scanObject2.split(";");
      const parts2 = this.from.scanObject1.split(";");
      if (parts2.length >= 3) {
        //const neckValueextracted = parts2[2].substring(3,4);
        const neckValueextracted = parts2[2];
@@ -237,12 +285,12 @@
      let queryParams = {
        productSeries : this.queryParams.productSeries,
        axisName : this.queryParams.axisName,
        neckName : this.queryParams.neckName,
        // neckName : this.queryParams.neckName,
        tileName : this.queryParams.tileName,
        axisValue: this.queryParams.axisValue,
        neckValue: this.queryParams.neckValue,
      }
      console.log(queryParams)
      console.log('参数:',queryParams)
      listTileMatchRules(queryParams).then(response => {
        this.queryParams.tileColor = response.rows[0].tileColor;
      });
@@ -253,11 +301,12 @@
    },
    insetFromToQueryParams(){
      this.queryParams.productSeries=this.from.productSeries;
      this.queryParams.axisName=this.from.axisName;
      //this.queryParams.axisName=this.from.axisName;
      this.queryParams.neckName=this.from.neckName;
      this.queryParams.tileName=this.from.tileName;
      this.queryParams.scanObject1=this.from.scanObject1;
      this.queryParams.scanObject2=this.from.scanObject2;
      this.queryParams.scanObject3=this.from.scanObject3;
    }
  },