hdy
2024-07-13 d9502f15ba2829816b466385df558ce266a8e197
提交 | 用户 | 时间
0cceb6 1 <template>
Y 2   <div class="app-container">
3     <el-row :gutter="3">
4       <el-col :span="6">
5         <el-card shadow="always" class="boxSize">
6           <div class="centerImg">
7             <img style="width: 140px;height: 30px;" src="@/assets/logo/jcdm2.png" alt="dark">
8             <!--            <span class="nextLine" style="font-weight: bold">{{currentTime}}</span>-->
9           </div>
10
11         </el-card>
12       </el-col>
13       <el-col :span="3">
14         <el-card shadow="always" class="boxSize">
15           <span class="centerText" style="height: 60px">{{locationCode}}</span>
16         </el-card>
17       </el-col>
18       <el-col :span="15">
19         <el-card shadow="always" class="boxSize">
20           <span class="centerText" >{{locationName}}</span>
21         </el-card>
22       </el-col>
23     </el-row>
d9502f 24     <el-row :gutter="0"  >
H 25       <el-col :span="14">
26         <el-card   class="box-card" style="margin-top: 5px" >
27           <el-form ef="form" label-width="25%" :model="form"  :inline="true" style="margin-top: 80px;margin-block: 80px" @submit.native.prevent>
28             <el-form-item   :prop="form.engineNo"  style="align-content: center">
29               <span  slot="label" style="font-size:22px;color:black"><strong>工单编号</strong></span>
30               <input v-model="form.engineNo"
31                      ref="inputdata"
32                      style="height: 40px; width: 300px;font-size:18px"
33                      placeholder="请输入发动机码"
34               />
35             </el-form-item>
36           </el-form>
37 <!--                       <el-form ref="form" :model="form"  label-width="25%"  >-->
38 <!--                         <el-form-item   prop="productType"style="margin-top: 30px" >-->
39 <!--                            <span slot="label" style="font-size:22px;color:black"><strong>机型</strong></span>-->
40 <!--                           <el-input disabled style="font-size:20px"  value="form.productType" v-model="form.productType" placeholder="" />-->
41 <!--                         </el-form-item>-->
42 <!--                       </el-form>-->
43           <!--             <el-form ref="form" :model="form"  label-width="25%"  >-->
44           <!--               <el-form-item   prop="orderNo" style="margin-top: 30px">-->
45           <!--               <span  slot="label" style="font-size:22px;color:black"><strong>工单编号</strong></span>-->
46           <!--                 <el-input disabled style="font-size:20px" v-model="form.orderNo" placeholder="" />-->
47           <!--               </el-form-item>-->
48           <!--             </el-form>-->
49           <!--             <el-form ref="form" :model="form"  label-width="25%"  >-->
50           <!--               <el-form-item   prop="currentWorkstation" style="margin-top: 30px">-->
51           <!--               <span slot="label" style="font-size:22px;color:black"><strong>质量状态</strong></span>-->
52           <!--                 <el-input disabled style="font-size:20px" v-model:value="form.add" placeholder="" />-->
53           <!--               </el-form-item>-->
54           <!--             </el-form>-->
55           <el-divider></el-divider>
0cceb6 56
d9502f 57           <el-row :gutter="10" class="mb8" type="flex" justify="center"  style="text-align: center">
H 58             <el-col :span="1.5">
59               <el-button plain  @click="ScannerInput" type="primary" style="width:400px;height:160px" v-hasPermi="['bs:formula:add']">
60                 <span   class="el-icon-thumb"   style="font-size:40px;color:black"></span>
61                 <span style="font-size:45px;color:black"><strong>手动扫码上线</strong></span>
62               </el-button>
63             </el-col>
64           </el-row>
65         </el-card>
66       </el-col>
0cceb6 67
d9502f 68       <el-col :span="10"  inline style="margin-top: 5px">
H 69         <el-card class="custom-content" style="height: 453px" >
70           <el-col :span="14"style="  ">
71             <span style="font-size:25px"><strong>结果数据</strong></span>
72             <el-divider></el-divider>
73             {{this.form.engineCheckList}}
74           </el-col>
75         </el-card>
76       </el-col>
77     </el-row>
0cceb6 78   </div>
Y 79 </template>
80 <script>
d9502f 81
0cceb6 82
Y 83 import { listOrderScheduling, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling";
8069b5 84 import {listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection,initializedData } from "@/api/main/da/passingStationCollection/passingStationCollection";
0cceb6 85 import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo";
Y 86 import {getIp, listStationConf} from "@/api/main/sc/stationConf";
d9502f 87 import {time} from "echarts";
0cceb6 88
Y 89 export default {
90   components: { },
91   options: [],
92   props: [],
93   data() {
94     return {
95       options: [],
96       total: 0,
97       engineCheckList:[],
98       showFlag:false,
99       buttondisabled:true,
a4362d 100       locationCode: "未配置IP",
0cceb6 101       locationName: "未配置工位",
Y 102
ada5f3 103       scannerFlag: false,
Y 104       barcode: "",
0cceb6 105
Y 106       // 查询参数
107       queryParams: {
108         pageNum: 1,
109         pageSize: 10,
110         engineNo: null,
111         productType:null,
112         orderNo:null,
113         qualityStatus:null,
114         currentWorkstation: null,
115         add: null,
116         engineCheckList:'暂无数据',
117       },
118       // 表单参数
119       form: {
120         engineNo: null,
121         productType:null,
122         orderNo:null,
123         qualityStatus:null,
124         currentWorkstation: null,
125         add: null,
126         engineCheckList:'暂无数据',
127       },
128       add: null,
129     };
130   },
131   computed: {},
132   watch: {},
ada5f3 133
Y 134   beforeDestroy() {
135     this.$refs.inputdata.removeEventListener('keydown',this.handleScannerInput)
0cceb6 136   },
Y 137   mounted() {
ada5f3 138     this.setFocus()
Y 139     this.$refs.inputdata.addEventListener('keydown',this.handleScannerInput)
0cceb6 140     this.getStationConf();
Y 141   },
142   methods: {
ada5f3 143
Y 144     refresh() {
145       location.reload();
146     },
147     setFocus(){
148       this.$nextTick(()=>{
149         this.$refs.inputdata.focus()
150       })
151     },
152     handleScannerInput(event){
153       if (this.scannerFlag){
154         this.form.engineNo = ''
155         this.$refs.inputdata.value = ''
156         this.scannerFlag = false
157       }
158       const input = event.target
159       const inputValue = input.value
160       this.form.engineNo = inputValue
161       if (event.key === 'Enter'){
162         this.scannerFlag = true
163         console.log("条码:",this.form.engineNo)
d9502f 164         console.log("条码2:",this.locationCode)
H 165         if(this.form.engineNo !== null && this.form.engineNo !== '') {
166
167           console.log("条码3:",this.form.engineCheckList)
8069b5 168             initializedData({sfcCode:this.form.engineNo,locationCode:this.locationCode}).then(res =>{
a4362d 169               if(res.code===500){
H 170                   this.$createElement;
171               }else {
d9502f 172
a4362d 173                 addPassingStationCollection({sfcCode:this.form.engineNo,locationCode:this.locationCode}).then(res =>{
d9502f 174                   console.log("rrrrr",res)}
H 175                 )
a4362d 176                 this.$message({
H 177                   message: '扫码成功',
178                   type: 'success'
179                 });
d9502f 180                 this.scanResult();
a4362d 181               }
8069b5 182             })
ada5f3 183         }else{
d9502f 184           this.$message({
H 185             message: '未完成扫码',
186             type: 'error'
187           });
ada5f3 188           this.reset();
Y 189           this.buttondisabled = true
d9502f 190         }
H 191       }
192
193     },
194
195
196
197     ScannerInput(){
198         console.log("条码:",this.form.engineNo)
199         console.log("条码2:",this.locationCode)
200         if(this.form.engineNo !== null && this.form.engineNo !==  '') {
201           initializedData({sfcCode:this.form.engineNo,locationCode:this.locationCode}).then(res =>{
202             if(res.code===500){
203               this.$createElement;
204             }else {
205               addPassingStationCollection({sfcCode:this.form.engineNo,locationCode:this.locationCode}).then(res =>{
206                 console.log("rrrrr",res)})
207               this.$message({
208                 message: '扫码成功',
209                 type: 'success'
210               });
211               this.scanResult();
212             }
213           })
214         }
215         else {
ada5f3 216           this.$message({
d9502f 217             message: '未完成扫码',
H 218             type: 'error'
ada5f3 219           });
Y 220         }
221     },
222
d9502f 223     scanResult(){
H 224       this.currentDate = new Date().toLocaleDateString();
225       this.currentTime = new Date().toLocaleTimeString();
226       this.form.engineCheckList = "条码:"+this.form.engineNo +"\n扫码时间:" + this.currentDate+"/"+this.currentTime ;
8069b5 227     },
ada5f3 228
0cceb6 229     getStationConf() {
Y 230       getIp().then(response => {
231         let queryParams = {
232           ipAddress: response.msg,
233         }
234         listStationConf(queryParams).then(response => {
235           this.locationName = response.rows[0].processesName
236           this.locationCode = response.rows[0].processesCode
237         });
238
239       });
240
241     },
242     reset() {
243       this.form = {
244         engineNo:null,
245         productType:null,
246         orderNo:null,
247         qualityStatus:null,
248         currentWorkstation: null,
249         add: null,
d9502f 250         engineCheckList:'',
0cceb6 251       };
Y 252       this.resetForm("form");
253     },
254     EngineNohandleChange(){
ada5f3 255       console.log('条码:',this.form.engineNo)
0cceb6 256       if(this.form.engineNo !== null && this.form.engineNo !== undefined){
Y 257         setSNCode(this.form.engineNo,this.locationCode)
258       }
259     },
260
261   },
262   }
263
264 </script>
265 <style scoped>
266 ::v-deep .el-input__inner{
267   height: 40px;
268 }
269 ::v-deep .el-form-item__label {
270   line-height: 40px;
271 }
272 .custom-content {
273   height: 50%; /* 设置高度为50% */
274 }
275
276 .boxSize{
277   height: 60px;
278 }
279 .centerText{
280   color: black;
281   font-weight: bold;
282   font-size: 20px;
283   display: flex;
284   justify-content: center;
285   margin-top: 5px
286 }
8069b5 287
0cceb6 288 </style>