春风项目四线(合箱线、总装线)
yyt
2024-01-23 28cd73a27061f684feda88d2d3e5f26794bbd591
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<template>
  <div class="app-container">
    <el-row :gutter="3">
      <el-col :span="6">
        <el-card shadow="always">
          <img style="width: 200px;height: 50px; margin-left: 40px; margin-top: 0px" src="@/assets/logo/jcdm2.png" alt="dark">
          <span style="margin-left: 66px; font-weight: bold">{{currentTime}}</span>
        </el-card>
      </el-col>
      <el-col :span="3">
        <el-card shadow="always">
          <span class="centerText" style="margin-top: 26px">{{locationCode}}</span>
        </el-card>
      </el-col>
      <el-col :span="15">
        <el-card shadow="always">
          <span class="centerText">{{locationName}}</span>
        </el-card>
      </el-col>
    </el-row>
    <el-row :gutter="3" style="margin-top: 5px">
      <el-col :span="6">
        <div style="height: 600px;overflow: auto;">
          <div  class="container" style="height: 50px;background-color: #00afff;margin-bottom: 10px">
            <span class="centered">作业流程</span>
          </div>
          <div v-for="(item,index) in tableData" :key="item.index" class="outerDiv" :id="'outerDiv'+index">
            <div class="innerDiv1">
              <div class="innerDiv2">
                <span class="content_left">{{ index+1 }}</span>
              </div>
              <div class="content_right">{{ item.address }}</div>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="18">
        <el-col :span="20">
          <el-card style="height: 600px" shadow="always">
            <el-row style="height: 100px">
              <span style="color: #31b431;font-size: 30px;font-weight: bold">{{address}}</span>
            </el-row>
            <el-row style="height: 400px">
              <el-image style="height: 390px;width: 960px" :src="src"></el-image>
<!--              {{src}}-->
            </el-row>
            <el-row style="height: 100px">
              <el-button type="primary" @click="backClick()" style="height: 50px; width: 130px; font-size: 20px; float: left" icon="el-icon-d-arrow-left">上一步</el-button>
              <el-button type="primary" @click="nextStep()" style="height: 50px; width: 130px; font-size: 20px; float: right">下一步<i class="el-icon-d-arrow-right"></i></el-button>
            </el-row>
          </el-card>
        </el-col>
        <el-col :span="4">
          <el-card style="height: 600px" shadow="always">
            <el-row style="height: 100px;margin-top: 100px">
              <el-button type="primary" @click="processDocuments()" style="height: 50px; width: 130px; font-size: 20px; float: left" icon="el-icon-folder-opened">工艺文件</el-button>
            </el-row>
            <el-row style="height: 80px;margin-top: 5px">
              <el-button type="info" @click="changeProducts('2V91')" :class="{ 'active': isClickd === '2V91' }" style="height: 50px; width: 130px; font-size: 20px; float: left" icon="el-icon-s-unfold">2V91</el-button>
            </el-row>
            <el-row style="height: 80px;">
              <el-button type="info" @click="changeProducts('191')" :class="{ 'active': isClickd === '191' }" style="height: 50px; width: 130px; font-size: 20px; float: left" icon="el-icon-s-unfold">191</el-button>
            </el-row>
            <el-row style="height: 80px;">
              <el-button type="info" @click="changeProducts('0JWF')" :class="{ 'active': isClickd === '0JWF' }" style="height: 50px; width: 130px; font-size: 20px; float: left" icon="el-icon-s-unfold">0JWF</el-button>
            </el-row>
          </el-card>
        </el-col>
 
      </el-col>
    </el-row>
    <div>
      <el-dialog
        title="工艺文件"
        :visible.sync="dialogVisible"
        width="70%"
        lock-scroll="false"
        @close="closeMethod"
 
      >
        <div><el-image style="height: 1090px;width: 960px;margin-left: 33px" :src="mainProcessSrc"></el-image></div>
        <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
      </el-dialog>
    </div>
  </div>
 
</template>
 
<script>
import {getMainProductProcess, getProductProcess} from "@/api/main/bs/formulaChild/formulaChild";
import {listStationConf,getIp} from "@/api/main/sc/stationConf";
 
export default {
  name: "index",
  data() {
    return {
      dialogVisible: false,
      mainProcessSrc: '',
      mainProcess: [],
      isClickd: '', // 初始化为未点击状态
      locationCode: "未配置",
      locationName: "未配置工位",
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        productCode: null,
      },
      currentTime:'',
      productCode: '2V91',
      tableData: [{
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        img: 'htts://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        img: '222222222222',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
        sort: '2',
        address: '上海市普陀区金沙江路 1516 弄'
      }],
      address: '',
      // src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
      // src: 'file:///D:/img/qt.jpg'
 
      intervalId: null,
 
    };
  },
  created() {
    this.tableData = []
  },
  mounted() {
    this.getStationConf()
    // this.changeProducts(this.productCode)
    // this.changeProducts("2V91")
    this.getNowTime()
    // this.autoShow()
  },
  // computed: {
  //   currentTime:
  // },
  methods: {
    /** 查询工位终端配置列表 */
    getStationConf() {
      getIp().then(response => {
        let queryParams = {
          ipAddress: response.msg,
        }
        listStationConf(queryParams).then(response => {
          this.locationName = response.rows[0].processesName
          this.locationCode = response.rows[0].processesCode
          console.log('llllll',this.locationCode)
          this.changeProducts("2V91")
        });
 
      });
 
    },
    closeMethod(){
      this.mainProcessSrc = ''
    },
    //获取当前时间
    getNowTime () {
      let speed = 1000
      let that = this
      let theNowTime = function () {
        that.currentTime = that.timeNumber()
      }
      setInterval(theNowTime, speed)
    },
    timeNumber () {
      let today = new Date()
      let date = today.getFullYear() + '-' + this.twoDigits(today.getMonth() + 1) + '-' + this.twoDigits(today.getDate())
      let time = this.twoDigits(today.getHours()) + ':' + this.twoDigits(today.getMinutes()) + ':' + this.twoDigits(today.getSeconds())
      return date + '  ' + time
    },
    twoDigits (val) {
      if (val < 10) return '0' + val
      return val
    },
    // 定时触发
    autoShow() {
      const _this = this
      this.intervalId = setInterval(() => {
        _this.setBg()
      }, 10000)
    },
    setImg(index) {
      this.address = this.tableData[index].address
      this.src = this.tableData[index].img
    },
    cleanImg(){
      this.address = ''
      this.src = ''
    },
    setBg() {
      if (document.getElementById('outerDiv' + (this.tableData.length - 1)).style.background === 'yellow') {
        this.setImg(0)
        document.getElementById('outerDiv0').style.background = 'yellow'
        for (let j = 1; j < this.tableData.length; j++) {
          document.getElementById('outerDiv' + j).style.background = 'white'
        }
        return;
      }
      for (let i = 0; i < this.tableData.length - 1; i++) {
        if (document.getElementById('outerDiv' + i).style.background === 'yellow') {
          this.setImg(i+1)
          document.getElementById('outerDiv' + i).style.background = 'lightgreen'
          document.getElementById('outerDiv' + (i+1)).style.background = 'yellow'
          return;
        }
      }
    },
    getUpOrDown(index) {
      for (let i = 0; i < this.tableData.length; i++) {
        if (document.getElementById('outerDiv' + i).style.background === 'yellow') {
          this.setImg(i + index)
          document.getElementById('outerDiv' + i).style.background = index < 0 ? 'white' : 'lightgreen'
          document.getElementById('outerDiv' + (i + index)).style.background = 'yellow'
          return;
        }
      }
    },
    backClick(){
      this.getUpOrDown(-1)
    },
    nextStep(){
      this.getUpOrDown(1)
    },
    processDocuments(){
      getMainProductProcess(this.queryParams).then(res => {
        this.mainProcess = res.rows
        if (res.rows!=null && res.rows.length>0){
          this.mainProcessSrc = res.rows[0].img
        }
      })
      this.dialogVisible = true
    },
    changeProducts(val){
 
 
      console.log("------更换图片",val)
      console.log("------目录==============",this.tableData)
      console.log("locationCode",this.locationCode)
      this.productCode = val
      const _this = this
 
      this.isClickd = val; // 切换isClicked的值
      /** 查询配方配置子信息列表 */
      this.queryParams.productCode = val;
      this.queryParams.processesCode = this.locationCode
      getProductProcess(this.queryParams).then(response => {
        this.tableData = [];
        this.cleanImg()
        this.tableData = response.rows;
        this.$nextTick(() => {
          clearInterval(this.intervalId);
          document.getElementById('outerDiv0').style.background = 'yellow'
          for (let i = 1; i < this.tableData.length; i++){
            document.getElementById('outerDiv' + i).style.background =  'white'
          }
          this.setImg(0)
          this.autoShow()
        })
 
 
      });
    },
  },
}
</script>
 
<style scoped>
.outerDiv {
  width: fit-content;
  min-width: 102%;
  /*width: 300px;*/
  height: 50px;
  margin-bottom: 10px;
}
 
.innerDiv1 {
  /*width: 79%;*/
  height: 100%;
  display: flex;
  align-items: center;
  border: 1px solid black;
}
 
.innerDiv2 {
  /*width: 20%;*/
  width: 50px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid black;
}
 
.content_left {
  font-weight: bold;
}
.content_right {
  white-space: nowrap;
  padding-left: 5px;
  padding-right: 5px;
}
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px; /* 设置div的高度,可根据实际情况调整 */
}
 
.centered {
  text-align: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
}
.centerText{
  color: black;
  font-weight: bold;
  font-size: 40px;
  display: flex;
  justify-content: center;
  margin-top: 20px
}
::v-deep .el-card__body{
  height: 100px;
}
.active {
  background-color: #31b431; /* 点击后的背景色 */
}
::v-deep .el-dialog {
  height: 90%;
  overflow-y: auto;
}
::v-deep .el-dialog__footer{
  margin-top: 10px;
}
 
</style>