#
vincentlu
昨天 9f658fb63d1c219ae65ffcf13af6efbff5179b00
zy-acs-flow/src/page/loc/compDirect.js
@@ -1,21 +1,15 @@
const compDirectMap = {
    1: 'page.loc.enums.compDirect.left',
    2: 'page.loc.enums.compDirect.right',
    3: 'page.loc.enums.compDirect.forward',
};
export const compDirectChoices = [
    { id: 1, name: compDirectMap[1] },
    { id: 2, name: compDirectMap[2] },
    { id: 3, name: compDirectMap[3] },
    { id: 1, name: 'page.loc.enums.compDirect.left' },
    { id: 2, name: 'page.loc.enums.compDirect.right' },
    { id: 3, name: 'page.loc.enums.compDirect.forward' },
];
export const getCompDirectLabel = (translate, compDirect, fallback = '-') => {
    const key = compDirectMap[compDirect];
    if (!key) {
    const choice = compDirectChoices.find((item) => item.id === compDirect);
    if (!choice) {
        return fallback;
    }
    return typeof translate === 'function'
        ? translate(key, { _: fallback })
        : key;
        ? translate(choice.name, { _: fallback })
        : choice.name;
};