yangfeng
2023-12-04 bee7d8cb692d00ab4f4ed5d31686838eff5f39e7
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<template>
  <div class="work-order-progress">
    <div class="bar-contents">
      <div class="top-view">
        <img src="/cockpitPage/work-order-top.png" alt="" />
        <div class="top-title">
          <span>工单进度统计</span>
          <span class="top-rate">{{ "60%" }}</span>
        </div>
      </div>
      <div class="table-box">
        <el-table
          ref="table"
          :data="tableData"
          style="width: 100%"
          height="100%"
        >
          <el-table-column
            prop="workOrderId"
            label="工单编号"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            prop="product"
            label="产品"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            prop="productSpecs"
            label="产品规格"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            prop="amount"
            label="生产数量"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            prop="planTime"
            label="计划时间"
            align="center"
            min-width="100"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column label="完成进度" align="center" min-width="160">
            <template slot-scope="scope">
              <div class="progerss-bg">
                <div
                  v-for="item in scope.row.completeProgerss"
                  class="progerss"
                  :class="
                    item.status == 1
                      ? 'complete'
                      : item.status == 2
                      ? 'producing'
                      : 'noStart'
                  "
                  :style="`width: ${
                    (1 / scope.row.completeProgerss.length) * 100
                  }%`"
                ></div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="延期预警" align="center">
            <template slot-scope="scope">
              <div v-show="scope.row.delayWarning > 0" class="round-view">
                <div class="round red-bg"></div>
                <div class="title red-color">
                  {{ scope.row.delayWarning + "天" }}
                </div>
              </div>
              <div v-show="scope.row.delayWarning < 0" class="round-view">
                <div class="round green-bg"></div>
                <div class="title green-color">
                  {{ scope.row.delayWarning + "天" }}
                </div>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      tableData: [
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 3,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 1 },
            { status: 1 },
            { status: 1 },
            { status: 1 },
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 2,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: -2,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
        {
          workOrderId: "A5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
        {
          workOrderId: "BA5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
        {
          workOrderId: "BA5435",
          product: "产品1",
          productSpecs: "规格",
          amount: "2000",
          planTime: "02-23~05-23",
          completeProgerss: [
            { status: 1 },
            { status: 1 },
            { status: 2 },
            { status: 0 },
          ],
          delayWarning: 0,
        },
      ],
    };
  },
  mounted() {
    this.setAutoScroll();
  },
  watch: {},
  methods: {
    // 实现自动滚动的方法
    setAutoScroll() {
      // 拿到表格挂载后的真实DOM
      const table = this.$refs.table;
      // 拿到表格中承载数据的div元素
      const divData = table.bodyWrapper;
      // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
      setInterval(() => {
        // 元素自增距离顶部1像素
        divData.scrollTop += 1;
        // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
        if (divData.clientHeight + divData.scrollTop == divData.scrollHeight) {
          // 重置table距离顶部距离
          divData.scrollTop = 0;
        }
      }, 200); // 滚动速度
    },
  },
};
</script>
 
<style scoped lang="scss">
.work-order-progress {
  width: 100%;
  height: calc(100% - 10px);
  .bar-contents {
    width: calc(100% - 5px);
    height: 100%;
    border: 1px solid #00ffff;
    box-sizing: border-box;
    position: relative;
    .top-view {
      width: 33%;
      margin-top: -1px;
      margin-left: -1px;
      position: relative;
      .top-title {
        width: 100%;
        position: absolute;
        top: 20%;
        left: 0;
        margin: auto;
        color: #01f7fd;
        font-size: 14px;
        font-family: "Arial Negreta", "Arial Normal", "Arial";
        font-weight: 700;
        padding-left: 30px;
        .top-rate {
          margin-left: 15px;
          color: #fec718;
        }
      }
    }
    .table-box {
      padding: 20px 15px;
      height: calc(100% - 75px);
      overflow: hidden;
      .progerss-bg {
        width: 100%;
        height: 22px;
        background: #364459;
        display: flex;
        border: 1px solid #00ffff;
        .progerss {
          background: #fec718;
          height: 100%;
          border-right: 1px solid #00ffff;
          &:last-child {
            border-right: 0px;
          }
        }
        .complete {
          background: #00cc0077;
        }
        .producing {
          background: #33ccff77;
        }
        .noStart {
          background-color: transparent;
        }
      }
      .round-view {
        display: flex;
        justify-content: center;
 
        .round {
          width: 22px;
          height: 22px;
          border-radius: 11px;
 
          margin-right: 5px;
        }
        .red-bg {
          background: #ff0000;
        }
        .green-bg {
          background: #00cc00;
        }
        .red-color {
          color: #ff0000;
        }
        .green-color {
          color: #00cc00;
        }
      }
    }
  }
}
::v-deep {
  //修改表头的背景颜色横向渐变色
  .el-table {
    thead {
      color: #fff;
      font-weight: 500;
      background: linear-gradient(to right, #081630, #076c80) !important;
      & th {
        background-color: transparent;
        padding: 6px 0;
      }
      & tr {
        background-color: transparent;
        padding: 6px 0;
      }
    }
  }
  // 修改表格字体颜色
  .el-table__body td {
    color: #00ffff;
    padding: 8px 0;
  }
  // 设置表格背景透明
  .el-table th {
    background-color: transparent !important;
    &:hover {
      background-color: transparent !important;
    }
  }
  .el-table tr {
    background-color: transparent !important;
    &:hover {
      background-color: transparent !important;
    }
  }
  .el-table--enable-row-transition .el-table__body td,
  .el-table .cell {
    background-color: transparent;
  }
  .el-table,
  .el-table__expanded-cell {
    background-color: transparent;
  }
  .el-table__body tr:hover > td {
    background-color: transparent !important;
  }
  // 修改横线颜色
  .el-table td.el-table__cell,
  .el-table th.el-table__cell.is-leaf {
    border-bottom: 1px solid #364459;
  }
  // 去掉底部多余横线
  .el-table::before {
    display: none;
  }
  // 保留垂直滚动且隐藏滚动条
  .el-table__body-wrapper::-webkit-scrollbar {
    width: 0px;
    height: 0px;
  }
}
</style>