riku
2024-11-13 af930887f9972b7dd21c80599e697e44f5e5a579
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
const RiskTypes = [
  { value: null, label: '全部' },
  { value: '0', label: '低风险' },
  { value: '1', label: '中风险' },
  { value: '2', label: '高风险' },
];
 
function toLabel(value) {
  let r = RiskTypes.find(item => {
    return item.value == value;
  });
  if (!r) r = RiskTypes[0]
  return r.label
}
 
function toLabel2(value) {
  let l = toLabel(value)
  if (l == RiskTypes[0].label) {
    l = '/'
  }
  return l
}
 
function toValue(label) {
  const r = RiskTypes.find(item => {
    return item.label == label;
  });
  return r.value
}
 
export { RiskTypes, toLabel, toLabel2, toValue };