songshankun
2023-11-02 634883b481643c3d3d78278639cbce096d891cb1
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
<template>
  <div class="color-info">
    <div v-if="type == 1" class="color-one">
      加工数({{ activeTask?.Order?.unit ?? '--' }})
      <span>{{ plcInfo?.finishNumber ?? 0 }}</span>
    </div>
    <div v-else class="color-two">
      目标({{ activeTask?.Order?.unit ?? '--' }})
      <span> {{ plcInfo?.totalNumber ?? 0 }}</span>
    </div>
  </div>
</template>
<script setup lang="ts">
import { toRefs } from 'vue'
import { usePLCStore } from '@/stores/plc'
import { storeToRefs } from 'pinia'
import { useTasksStore } from '@/stores/tasks'
 
export interface ColorInfoProps {
  /** 1加工数 2目标数*/
  type?: 1 | 2
}
 
const props = defineProps<ColorInfoProps>()
const { type } = toRefs(props)
 
const plcStore = usePLCStore()
const { plcInfo } = storeToRefs(plcStore)
const taskStore = useTasksStore()
const { activeTask } = storeToRefs(taskStore)
</script>
 
<style scoped lang="scss">
$status-default: #13235a;
$status-running: #f76c0f;
$status-ready: #13235a;
$status-done: #0059ffd0;
$status-star: yellow;
 
.color-info {
  width: calc(50% - 5px);
  height: 120px;
  line-height: 40px;
  margin-top: 10px;
  border-radius: 4px;
  color: #fff;
  overflow: hidden;
  float: left;
  text-align: center;
  font-size: 15px;
 
  .color-one {
    background: $status-running;
    height: 100%;
    width: 100%;
    margin-right: 10px;
    span {
      width: 100%;
      display: inline-block;
      font-weight: 600;
      font-size: 30px;
      margin-top: 15px;
    }
  }
  .color-two {
    background: $status-done;
    margin-left: 10px;
    height: 100%;
    width: 100%;
    span {
      width: 100%;
      display: inline-block;
      font-weight: 600;
      font-size: 30px;
      margin-top: 15px;
    }
  }
}
</style>