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