You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
2 years ago
|
import { useStore } from 'vuex';
|
||
|
// const {
|
||
|
// state: { dict },
|
||
|
// } = useStore();
|
||
|
const dict = {};
|
||
|
|
||
|
export const getValue = (
|
||
|
row: any,
|
||
|
column: string,
|
||
|
value: any,
|
||
|
index?: number
|
||
|
) => {
|
||
|
if ((value == null || value == '') && value !== 0) {
|
||
|
return '--';
|
||
|
}
|
||
|
return value;
|
||
|
};
|
||
|
|
||
|
export const formatter = (row: any, column: any, value: any, index: number) => {
|
||
|
return formatterByDist(row.scheme + '_' + column.property, value);
|
||
|
};
|
||
|
|
||
|
export const formatterByDist = (dictKey, value) => {
|
||
|
if (!dictKey) {
|
||
|
return getValue(null, '', value);
|
||
|
}
|
||
|
const mapping = dict[dictKey];
|
||
|
if (mapping == null) {
|
||
|
return getValue(null, '', value);
|
||
|
}
|
||
|
return mapping[value] == null ? value : mapping[value];
|
||
|
};
|
||
|
|
||
|
// export const formartLink = (row) => {
|
||
|
// const up = row.ambr.uplink;
|
||
|
// const down = row.ambr.downlink;
|
||
|
// return (
|
||
|
// down.value + dict.units[down.unit] + '/' + up.value + dict.units[up.unit]
|
||
|
// );
|
||
|
// };
|
||
|
|
||
|
// export const formartApn = (row, index) => {
|
||
|
// const session = row.slice[0].session[index];
|
||
|
// if (session) {
|
||
|
// return session.name + '-' + session.qos.index;
|
||
|
// } else {
|
||
|
// return '';
|
||
|
// }
|
||
|
// };
|