春风项目四线(合箱线、总装线)
yyt
2024-06-03 5030f3d30ccc1bd16db371c6970a48103aff9191
jcdm-ui/src/views/main/cfkb/tileMatchKb/index.vue
@@ -1,67 +1,119 @@
<template>
  <div class="app-container">
    <div style="height: 100%;width: 100%">
    <div style="width: 100%">
      <el-card class="box-card" >
        <el-form :model="queryParams" ref="queryForm" :inline="true" >
          <el-form-item  label="轴名称:" prop="axisName" >
            <el-input
              style="width: 160px"
              v-model="queryParams.axisName"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item  label="颈名称:" prop="neckName" >
            <el-input
              style="width: 160px"
              v-model="queryParams.neckName"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item  label="瓦名称:" prop="tileName" >
            <el-input
              style="width: 160px"
              v-model="queryParams.tileName"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-form>
      </el-card>
        <el-col :span="20">
      <el-card class="box-card" >
        <el-form :model="queryParams" ref="queryForm" :inline="true" >
        <el-form :model="from" ref="queryForm" :inline="true" >
          <el-form-item label="箱体码:" prop="scanObject1" >
            <el-input
              style=""
              v-model="queryParams.scanObject1"
              style="width: 350px"
              v-model="from.scanObject1"
              placeholder="请输入箱体码"
              clearable
              @keyup.enter.native="handleQuery"
              @input="handleQuery"
            />
          </el-form-item>
          <el-form-item label="曲轴码:" prop="scanObject2" >
            <el-input
              style=""
              v-model="queryParams.scanObject2"
              style="width: 350px"
              v-model="from.scanObject2"
              placeholder="请输入曲轴码"
              clearable
              @keyup.enter.native="handleQuery"
              @input="handleQuery"
            />
          </el-form-item>
        </el-form>
      </el-card>
        </el-col>
        <el-col :span="4">
          <el-card class="box-card" >
          <el-form :model="queryParams" ref="queryForm" :inline="true" >
          <el-form-item style="margin-left: 1%">
            <el-button type="primary" icon="el-icon-refresh" @click="handleQuery">查询</el-button>
        <el-form :model="from" ref="queryForm" :inline="true" >
          <el-form-item  label="机型:" prop="productSeries" >
            <el-select v-model="from.productSeries" placeholder="" clearable   style="width: 105px">
              <el-option
                v-for="dict in dict.type.productseries"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
                @keyup.enter.native="handleQuery"
              />
            </el-select>
          </el-form-item>
          </el-form>
          </el-card>
        </el-col>
          <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>
          <el-form-item  label="瓦名称:" prop="tileName" >
            <el-select v-model="from.tileName" placeholder="" clearable style="width: 125px" >
            <el-option
              v-for="dict in dict.type.tilename"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
              @keyup.enter.native="handleQuery"
            />
            </el-select>
          </el-form-item>
          <el-button type="primary" icon="el-icon-refresh" @click="handleQuery">查询</el-button>
        </el-form>
      </el-card>
<!--        <el-col :span="20">-->
<!--      <el-card class="box-card" >-->
<!--        <el-form :model="queryParams" ref="queryForm" :inline="true" >-->
<!--          <el-form-item label="箱体码:" prop="scanObject1" >-->
<!--            <el-input-->
<!--              style=""-->
<!--              v-model="queryParams.scanObject1"-->
<!--              placeholder="请输入箱体码"-->
<!--              clearable-->
<!--              @keyup.enter.native="handleQuery"-->
<!--            />-->
<!--          </el-form-item>-->
<!--          <el-form-item label="曲轴码:" prop="scanObject2" >-->
<!--            <el-input-->
<!--              style=""-->
<!--              v-model="queryParams.scanObject2"-->
<!--              placeholder="请输入曲轴码"-->
<!--              clearable-->
<!--              @keyup.enter.native="handleQuery"-->
<!--            />-->
<!--          </el-form-item>-->
<!--          <el-form-item  label="机型:" prop="productSeries" >-->
<!--            <el-input-->
<!--              style="width: 160px"-->
<!--              v-model="queryParams.productSeries"-->
<!--              clearable-->
<!--              @keyup.enter.native="handleQuery"-->
<!--            />-->
<!--          </el-form-item>-->
<!--        </el-form>-->
<!--      </el-card>-->
<!--        </el-col>-->
<!--        <el-col :span="4">-->
<!--          <el-card class="box-card" >-->
<!--          <el-form :model="queryParams" ref="queryForm" :inline="true" >-->
<!--          <el-form-item style="margin-left: 1%">-->
<!--          </el-form-item>-->
<!--          </el-form>-->
<!--          </el-card>-->
<!--        </el-col>-->
      <el-col :span="24" >
        <el-card class="bottom-card">
@@ -88,8 +140,12 @@
            <el-descriptions-item label="瓦名称">
              <span>{{queryParams.tileName}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="重量">
              <span>{{queryParams.weight}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="配瓦颜色">
              <span :style="{ backgroundColor: queryParams.tileColor }">{{queryParams.tileColor}}</span>
<!--          <span  style="color: #FFFFFF;"  :style="{ backgroundColor: queryParams.tileColor }">{{queryParams.tileColor}}</span>-->
              <span v-for="(word, index) in queryParams.words" :key="index" :style="{ backgroundColor: queryParams.colors[index],fontSize: '30px',}">{{ word }}</span>
            </el-descriptions-item>
          </el-descriptions>
          <el-divider></el-divider>
@@ -103,7 +159,7 @@
import { listTileMatchRules, getTileMatchRules, delTileMatchRules, addTileMatchRules, updateTileMatchRules } from "@/api/main/bs/tileMatchRules/tileMatchRules";
export default {
  name: "index",
  dicts: ['colour_hex'],
  dicts: ['colour_hex','productseries','axisname','neckname','tilename'],
  components: {
    VueQr,
  },
@@ -113,15 +169,16 @@
      tileMatchKbList: [],
      qrCode: '',
      // 查询参数
      queryParams: {
      from:{
        pageNum: 1,
        pageSize: 10,
        productSeries: null,
        scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
        scanObject2: 'P0SQ0-041000-1002;T2312020675;DAABBA;S500003',
        axisName: '中间主轴孔',
        neckName: '中间主轴颈',
        tileName: '中心主轴瓦',
        //scanObject1: null,
        scanObject1: 'ONYL01FZ0120003023123;1206B0026;D2212BA',
        scanObject2: 'P0NYK0410001000;T231107031;D2222232;S500003',
        axisName: null,
        neckName: null,
        tileName: null,
        axisParameterNoPosition: null,
        neckParameterPosition: null,
        axisValue: null,
@@ -130,42 +187,97 @@
        createUser: null,
        updateUser: null,
        state: null,
        weight: null,
      },
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        productSeries: null,
        scanObject1: null,
        // scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
        scanObject2: null,
        axisName: null,
        neckName: null,
        tileName: null,
        axisParameterNoPosition: null,
        neckParameterPosition: null,
        axisValue: null,
        neckValue: null,
        tileColor: "",
        words: ['一档   .', '二档  .', '三档  .', '四档  .'],
        colors: ['#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF'],
        createUser: null,
        updateUser: null,
        state: null,
        weight: null,
      },
    }
  },
  methods:{
    /** 搜索按钮操作 */
    handleQuery() {
      this.axisValueextracted();
      this.neckValueextracted();
      this.productSeriesextracted();
      this.getList();
      this.$message(response.row.tileColor)
    },
    axisValueextracted() {
      // 取箱体码第三段为配瓦值
      const parts1 = this.queryParams.scanObject1.split(";");
      if (parts1.length >= 3) {
        const axisValueextracted = parts1[2].substring(3,4);
        return this.queryParams.axisValue= axisValueextracted;
      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 !== ""
        && this.from.productSeries !== null && this.from.productSeries !== "")
      {
        this.axisValueextracted();
        this.neckValueextracted();
        if(this.queryParams.axisValue !== null && this.queryParams.neckValue !== null){
          this.insetFromToQueryParams();
          this.getList();
        }
        else{
          const h = this.$createElement;
          this.$message({
            message: h('p',null, [
              h('span', null, '警告 '),
              h('i', { style: 'color: black' }, '箱体码或曲轴码输入有误'),
              h()]),
            type: 'error',
            center: true,
            offset:300
          });
        }
      }
      else{
        const h = this.$createElement;
        this.$message({
          message: h('p',null, [
            h('span', null, '警告 '),
            h('i', { style: 'color: black' }, '请填写所有搜索条件'),
            h()]),
          type: 'error',
          center: true,
          offset:300
        });
      }
    },
    // 取箱体码第三段为配瓦值
    axisValueextracted() {
      const parts1 = this.from.scanObject1.split(";");
      if (parts1.length >= 3) {
        //const axisValueextracted = parts1[2].substring(3,4);
        const axisValueextracted = parts1[2];
        return this.queryParams.axisValue= axisValueextracted;
      }
    },
    //取曲轴码第三段为配瓦值
    neckValueextracted() {
      //取曲轴码第三段为配瓦值
      const parts2 = this.queryParams.scanObject2.split(";");
      const parts2 = this.from.scanObject2.split(";");
      if (parts2.length >= 3) {
        const neckValueextracted = parts2[2].substring(3,4);
        //const neckValueextracted = parts2[2].substring(3,4);
        const neckValueextracted = parts2[2];
        return this.queryParams.neckValue= neckValueextracted;
      }
    },
    productSeriesextracted() {
    const parts3 =this.queryParams.scanObject2.split(";");
    if(parts3.length >= 3) {
    const productSeriesextracted = parts3[0].substring(1, 5);
    return this.queryParams.productSeries = productSeriesextracted;
        }
    },
    //取配瓦颜色
    getList() {
      let queryParams = {
        productSeries : this.queryParams.productSeries,
@@ -177,10 +289,29 @@
      }
      console.log(queryParams)
      listTileMatchRules(queryParams).then(response => {
        this.queryParams.tileColor = response.rows[0].tileColor;
        this.queryParams.words= ['------', '------', '------', '------']
        this.queryParams.colors= ['#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF']
        for (var i=0;i<response.rows.length;i++){
          this.queryParams.colors[i]=response.rows[i].tileColor;
          this.queryParams.words[i]=response.rows[i].tileName;
        }
        console.log('颜色:',response)
      });
    },
},
    clear(){
      this.queryParams.axisValue=null;
      this.queryParams.neckValue=null;
    },
    insetFromToQueryParams(){
      this.queryParams.productSeries=this.from.productSeries;
      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;
    }
  },
}
</script>