Blame view

HHECS.Web/src/utils/enums.js 3.51 KB
胡菁 authored
1
import i18n from "@/i18n";
胡菁 authored
2
3
// 获取普通枚举
export function getEnumText(par) {
胡菁 authored
4
  if (par == null) {
胡菁 authored
5
6
7
    return i18n.t("main.device.notObtained");
  } else if (par === "") {
    return i18n.t("main.device.noData");
胡菁 authored
8
  } else {
胡菁 authored
9
    return par;
胡菁 authored
10
  }
胡菁 authored
11
12
13
}
// 获取普通枚举颜色
export function getEnumColor(par) {
胡菁 authored
14
  return par == null ? "danger" : par;
胡菁 authored
15
16
17
}
// 获取普通枚举
export function getEnum(par, color) {
18
  return { text: getEnumText(i18n.t(par)), color: getEnumColor(color) };
胡菁 authored
19
20
21
22
23
}

// 获取操作模式
export function getEnumOperationModel(par) {
  const enums = {
24
25
26
27
28
29
    0: "main.label.stop",
    1: "main.label.maintenance",
    2: "main.label.manual",
    3: "main.label.onboardOperation",
    4: "main.label.singleAutomatic",
    5: "main.label.online",
胡菁 authored
30
  };
胡菁 authored
31
  const enumsColor = {
32
    0: "",  
胡菁 authored
33
34
35
36
37
38
39
    1: "",
    2: "",
    3: "",
    4: "",
    5: "",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
40
}
胡菁 authored
41
胡菁 authored
42
43
44
// 获取是否转轨模式
export function getEnumExpendMode(par) {
  const enums = {
45
46
    True: "main.label.transition",
    False: "main.label.normal",
胡菁 authored
47
  };
胡菁 authored
48
  const enumsColor = {
胡菁 authored
49
50
51
52
    True: "",
    False: "",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
53
}
胡菁 authored
54
胡菁 authored
55
56
57
// 获取货叉标志
export function getEnumWCSForkFlag(par) {
  const enums = {
58
59
60
61
    0: "main.label.noHave",
    1: "main.label.fork1",
    2: "main.label.fork2",
    3: "main.label.simultaneousAction",
胡菁 authored
62
  };
胡菁 authored
63
  const enumsColor = {
胡菁 authored
64
65
66
67
68
69
    0: "",
    1: "",
    2: "",
    3: "",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
70
}
胡菁 authored
71
胡菁 authored
72
73
74
// 获取故障
export function getEnumTotalError(par) {
  const enums = {
75
76
    True: "main.label.malfunction",
    False: "main.label.noMalfunction",
胡菁 authored
77
  };
胡菁 authored
78
  const enumsColor = {
胡菁 authored
79
80
81
82
    True: "danger",
    False: "",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
83
}
胡菁 authored
84
胡菁 authored
85
86
87
// 获取货叉是否有货
export function getEnumForkHasPallet(par) {
  const enums = {
88
89
    True: "main.label.inStock",
    False: "main.label.notInStock",
胡菁 authored
90
  };
胡菁 authored
91
  const enumsColor = {
胡菁 authored
92
93
94
95
    True: "",
    False: "",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
96
}
胡菁 authored
97
胡菁 authored
98
99
100
// 获取货叉是否在中心
export function getEnumForkCenter(par) {
  const enums = {
101
102
    True: "main.label.atTheCenter",
    False: "main.label.notAtTheCenter",
胡菁 authored
103
  };
胡菁 authored
104
  const enumsColor = {
105
106
    True: "main.label.atTheCenter",
    False: "main.label.notAtTheCenter",
胡菁 authored
107
108
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
109
}
胡菁 authored
110
胡菁 authored
111
112
113
// 获取货叉任务执行状态
export function getEnumForkTaskExcuteStatus(par) {
  const enums = {
114
115
116
117
118
119
    0: "main.label.stop",
    1: "main.label.standby",
    2: "main.label.taskPerforming",
    3: "main.label.taskCompleted",
    4: "main.label.taskInterrupts_Error",
    5: "main.label.taskIssuanceError",
胡菁 authored
120
  };
胡菁 authored
121
  const enumsColor = {
胡菁 authored
122
123
124
125
126
127
128
129
    0: "danger",
    1: "",
    2: "",
    3: "",
    4: "danger",
    5: "danger",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
130
}
胡菁 authored
131
胡菁 authored
132
133
134
// 获取货叉任务类型
export function getEnumForkTaskType(par) {
  const enums = {
135
136
137
138
139
140
141
    0: "main.label.noTask",
    1: "main.label.walk",
    2: "main.label.pickUpGoods",
    3: "main.label.putDownGoods",
    4: "main.label.pickUpAndPutDownGoods",
    6: "main.label.deleteTask",
    10: "main.label.completeTask",
胡菁 authored
142
  };
胡菁 authored
143
  const enumsColor = {
胡菁 authored
144
145
146
147
148
149
150
151
152
    0: "",
    1: "",
    2: "",
    3: "",
    4: "",
    6: "",
    10: "",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
153
}
胡菁 authored
154
胡菁 authored
155
156
157
// 获取货叉屏蔽
export function getEnumForkBlock(par) {
  const enums = {
158
159
    True: "main.label.shield",
    False: "main.label.unshielded",
胡菁 authored
160
  };
胡菁 authored
161
  const enumsColor = {
胡菁 authored
162
163
164
165
    True: "",
    False: "",
  };
  return getEnum(enums[par], enumsColor[par]);
胡菁 authored
166
}