春风项目四线(合箱线、总装线)
yyt
2024-06-06 45f4602070d7219fe00b098b6c0471ca42a8553f
提交 | 用户 | 时间
1c7036 1 <template>
Y 2   <div class="app-container">
3     <div style="width: 100%">
4       <el-card class="box-card" >
45f460 5         <el-form :model="from" size="large" :inline="true" label-width="78px" @submit.native.prevent>
Y 6           <el-form-item label="曲轴码:" prop="scanObject1" >
1c7036 7             <el-input
Y 8               style="width: 350px"
9               v-model="from.scanObject1"
45f460 10               placeholder="请输曲轴码"
1c7036 11               clearable
Y 12               @keyup.enter.native="handleQuery"
13               @input="handleQuery"
14             />
15           </el-form-item>
45f460 16           <el-form-item label-width="200" label="托盘码" :prop="from.scanObject3"  style="align-content: center">
Y 17             <input v-model="from.scanObject3"
18                    ref="inputdata2"
19                    style="height: 39px; width: 300px"
20                    placeholder="请输入托盘码"
21             />
22           </el-form-item>
5030f3 23           <el-form-item label-width="200" label="连杆码" :prop="from.scanObject2"  style="align-content: center">
Y 24             <input v-model="from.scanObject2"
45f460 25                    ref="inputdata1"
5030f3 26                    style="height: 39px; width: 300px"
Y 27                    placeholder="请输入连杆码"
1c7036 28             />
Y 29           </el-form-item>
30         </el-form>
31         <el-form :model="from" ref="queryForm" :inline="true" >
32           <el-form-item  label="机型:" prop="productSeries" >
33             <el-select v-model="from.productSeries" placeholder="" clearable   style="width: 105px">
34               <el-option
35
36                 v-for="dict in dict.type.productseries"
37                 :key="dict.value"
38                 :label="dict.label"
39                 :value="dict.value"
40               />
41             </el-select>
42           </el-form-item>
43           <el-form-item  label="瓦名称:" prop="tileName" >
44             <el-select v-model="from.tileName" placeholder="" clearable style="width: 125px" >
45               <el-option
46                 v-for="dict in dict.type.tilename"
47                 :key="dict.value"
48                 :label="dict.label"
49                 :value="dict.value"
50               />
51             </el-select>
52           </el-form-item>
53           <el-button type="primary" icon="el-icon-refresh" @click="handleQuery">查询</el-button>
54         </el-form>
55       </el-card>
56       <el-col :span="24" >
57         <el-card class="bottom-card">
58           <div slot="header" class="clearfix">
59             <i class="el-icon-tickets"></i>
60             <span style="font-weight: bold">当前产品信息</span>
61           </div>
62           <el-descriptions :column="1"  :label-style="{'font-size': '20px'}" border  :content-style="{'min-width': '300px'}">
63             <el-descriptions-item label="机型">
64               <span>{{queryParams.productSeries}}</span>
65             </el-descriptions-item>
45f460 66             <el-descriptions-item label="发动机编号">
Y 67               <span>{{queryParams.sfcCode}}</span>
68             </el-descriptions-item>
69             <el-descriptions-item label="托盘码">
70               <span>{{queryParams.scanObject3}}</span>
71             </el-descriptions-item>
5030f3 72             <el-descriptions-item label="曲轴码">
1c7036 73               <span>{{queryParams.scanObject1}}</span>
Y 74             </el-descriptions-item>
5030f3 75             <el-descriptions-item label="连杆码">
1c7036 76               <span>{{queryParams.scanObject2}}</span>
Y 77             </el-descriptions-item>
78             <el-descriptions-item label="瓦名称">
79               <span>{{queryParams.tileName}}</span>
80             </el-descriptions-item>
45f460 81             <el-descriptions-item label="缸体编号">
5030f3 82               <span>{{queryParams.axisName}}</span>
1c7036 83             </el-descriptions-item>
Y 84             <el-descriptions-item label="配瓦颜色">
85               <span  style="color: #FFFFFF;"  :style="{ backgroundColor: queryParams.tileColor }">{{queryParams.tileColor}}</span>
86             </el-descriptions-item>
87           </el-descriptions>
88           <el-divider></el-divider>
89         </el-card>
90       </el-col>
91     </div>
92   </div>
93 </template>
94 <script>
95 import VueQr from 'vue-qr'
5030f3 96 import {setBarcode} from "@/api/main/da/tileMatchMiddleware/tileMatchMiddleware";
Y 97 import {listTileMatchRules, getTileMatchRules, delTileMatchRules, addTileMatchRules, updateTileMatchRules} from "@/api/main/bs/tileMatchRules/tileMatchRules";
1c7036 98 export default {
Y 99   name: "index",
100   dicts: ['colour_hex','productseries','axisname','neckname','tilename'],
101   components: {
102     VueQr,
103   },
104   data(){
105     return{
5030f3 106       scannerFlag: false,
1c7036 107       loading: true,
Y 108       tileMatchKbList: [],
109       qrCode: '',
110       // 查询参数
111       from:{
112         pageNum: 1,
113         pageSize: 10,
5030f3 114         productSeries:'380Y',
1c7036 115         scanObject1: null,
5030f3 116         scanObject2: null,
45f460 117         scanObject3: null,
1c7036 118         axisName: null,
Y 119         neckName: null,
5030f3 120         tileName: '连杆瓦',
1c7036 121         axisParameterNoPosition: null,
Y 122         neckParameterPosition: null,
123         axisValue: null,
124         neckValue: null,
125         tileColor: null,
126         createUser: null,
127         updateUser: null,
128         state: null,
129         weight: null,
130       },
131       queryParams: {
132         pageNum: 1,
133         pageSize: 10,
134         productSeries: null,
135         scanObject1: null,
136         scanObject2: null,
45f460 137         scanObject3: null,
1c7036 138         axisName: null,
Y 139         neckName: null,
140         tileName: null,
141         axisParameterNoPosition: null,
142         neckParameterPosition: null,
143         axisValue: null,
144         neckValue: null,
145         tileColor: null,
146         createUser: null,
147         updateUser: null,
148         state: null,
149         weight: null,
45f460 150         sfcCode:null,
1c7036 151       },
Y 152     }
153   },
5030f3 154   mounted() {
45f460 155     this.setFocus1()
Y 156     this.setFocus2()
157     this.$refs.inputdata1.addEventListener('keydown',this.handleScannerInput1)
158     this.$refs.inputdata2.addEventListener('keydown',this.handleScannerInput2)
5030f3 159   },
Y 160   beforeDestroy() {
45f460 161     this.$refs.inputdata1.removeEventListener('keydown',this.handleScannerInput1)
Y 162     this.$refs.inputdata2.removeEventListener('keydown',this.handleScannerInput2)
5030f3 163   },
1c7036 164   methods:{
5030f3 165     refresh() {
Y 166       location.reload();
167     },
45f460 168     setFocus1(){
5030f3 169       this.$nextTick(()=>{
45f460 170         this.$refs.inputdata1.focus()
5030f3 171       })
Y 172     },
45f460 173     setFocus2(){
Y 174       this.$nextTick(()=>{
175         this.$refs.inputdata2.focus()
176       })
177     },
178     handleScannerInput1(event){
5030f3 179       if (this.scannerFlag){
Y 180         this.from.scanObject2 = ''
45f460 181         this.$refs.inputdata1.value = ''
5030f3 182         this.scannerFlag = false
Y 183       }
184       const input = event.target
185       const inputValue = input.value
186       this.from.scanObject2 = inputValue
187       if (event.key === 'Enter'){
188         this.scannerFlag = true
189         //console.log('条码:',this.from.scanObject2)
45f460 190         this.$refs.inputdata2.focus();
5030f3 191         //扫描完成
Y 192         if (typeof this.from.scanObject2 !== 'undefined') {
45f460 193           setBarcode({barcode:this.from.scanObject2,locationCode:this.from.scanObject3}).then(res =>{
5030f3 194             console.log('res',res)
45f460 195             this.queryParams.sfcCode=res.sfcCode;
Y 196             this.from.scanObject1=res.crankshaftNo;
5030f3 197             this.queryParams.axisName=res.cylinder;
45f460 198             this.handleQuery()
Y 199             //this.from.scanObject2=this.from.scanObject2
200             //this.queryParams.scanObject1=this.from.scanObject1
5030f3 201           })
Y 202         }
203         this.handleQuery()
45f460 204       }
Y 205     },
206     handleScannerInput2(event){
207       if (this.scannerFlag){
208         this.from.scanObject3 = ''
209         this.$refs.inputdata2.value = ''
210         this.scannerFlag = false
211       }
212       const input = event.target
213       const inputValue = input.value
214       this.from.scanObject3= inputValue
215       if (event.key === 'Enter'){
216         this.scannerFlag = true
217         console.log('条码2:',this.from.scanObject3)
218         this.$refs.inputdata1.focus();
219         this.from.scanObject2 = ''
220         //扫描完成
5030f3 221       }
Y 222     },
1c7036 223     /** 搜索按钮操作 */
Y 224     handleQuery() {
225       this.clear();
226
45f460 227       if(this.from.scanObject3 !== null && this.from.scanObject2 !== null
1c7036 228         && this.from.productSeries !== null && this.from.productSeries !== "")
Y 229       {
230         this.axisValueextracted();
231         this.neckValueextracted();
232         if(this.queryParams.axisValue !== null && this.queryParams.neckValue !== null){
233           this.insetFromToQueryParams();
234           this.getList();
235         }
236         else{
237           const h = this.$createElement;
238           this.$message({
239             message: h('p',null, [
240               h('span', null, '警告 '),
241               h('i', { style: 'color: black' }, '箱体码或曲轴码输入有误'),
242               h()]),
243             type: 'error',
244             center: true,
245             offset:300
246           });
247         }
248       }
249       else{
250         const h = this.$createElement;
251         this.$message({
252           message: h('p',null, [
253             h('span', null, '警告 '),
254             h('i', { style: 'color: black' }, '请填写所有搜索条件'),
255             h()]),
256           type: 'error',
257           center: true,
258           offset:300
259         });
260       }
261     },
262
263     // 取箱体码第三段为配瓦值
264     axisValueextracted() {
5030f3 265       const parts1 = this.from.scanObject2.split(";");
1c7036 266       if (parts1.length >= 3) {
Y 267         //const axisValueextracted = parts1[2].substring(3,4);
268         const axisValueextracted = parts1[2];
269         return this.queryParams.axisValue= axisValueextracted;
270
271       }
272     },
273
274     //取曲轴码第三段为配瓦值
275     neckValueextracted() {
5030f3 276       const parts2 = this.from.scanObject1.split(";");
1c7036 277       if (parts2.length >= 3) {
Y 278         //const neckValueextracted = parts2[2].substring(3,4);
279         const neckValueextracted = parts2[2];
280         return this.queryParams.neckValue= neckValueextracted;
281       }
282     },
283     //取配瓦颜色
284     getList() {
285       let queryParams = {
286         productSeries : this.queryParams.productSeries,
287         axisName : this.queryParams.axisName,
5030f3 288         // neckName : this.queryParams.neckName,
1c7036 289         tileName : this.queryParams.tileName,
Y 290         axisValue: this.queryParams.axisValue,
291         neckValue: this.queryParams.neckValue,
292       }
5030f3 293       console.log('参数:',queryParams)
1c7036 294       listTileMatchRules(queryParams).then(response => {
Y 295         this.queryParams.tileColor = response.rows[0].tileColor;
296       });
297     },
298     clear(){
299       this.queryParams.axisValue=null;
300       this.queryParams.neckValue=null;
301     },
302     insetFromToQueryParams(){
303       this.queryParams.productSeries=this.from.productSeries;
5030f3 304       //this.queryParams.axisName=this.from.axisName;
1c7036 305       this.queryParams.neckName=this.from.neckName;
Y 306       this.queryParams.tileName=this.from.tileName;
307       this.queryParams.scanObject1=this.from.scanObject1;
308       this.queryParams.scanObject2=this.from.scanObject2;
45f460 309       this.queryParams.scanObject3=this.from.scanObject3;
1c7036 310     }
Y 311
312   },
313 }
314 </script>
315
316 <style scoped>
317 ::v-deep .el-form-item__label{
318   font-size: large;
319 }
320 ::v-deep .el-card__body{
321   padding: 15px 20px 0px 20px;
322 }
323 ::v-deep .el-input .el-input--medium .el-input--suffix{
324   width: 200px;
325 }
326
327 </style>