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