'use strict';

/**
 * 权限数据
 *
 * @author CaiAoLin
 * @date 2018/2/5
 * @version
 */
const permission = {
    // 创建标段
    CREATE_TENDER: 1,
    // 查看所有标段
    VIEW_ALL_TENDER: 2,
    // 仅查看我参与的标段
    VIEW_MY_TENDER: 3,
    // 编制台账
    EDIT_LEDGER: 4,
    // 审批台账
    APPROVAL_LEDGER: 5,
    // 编制变更
    EDIT_APPROVAL: 6,
    // 审批变更
    CHANGE_APPROVAL: 7,
    // 查看台账
    VIEW_LEDGER: 8,
    // 编制中间计量
    EDIT_MIDDLE_MEASURE: 9,
    // 审批中间计量
    APPROVAL_MIDDLE_MEASURE: 10,
    // 查阅标段下所有中间计量
    VIEW_MIDDLE_MEASURE: 11,
    // 编制期计量
    EDIT_STAGE_MEASURE: 12,
    // 审批期计量
    APPROVAL_STAGE_MEASURE: 13,
    // 查阅标段下所有期计量
    VIEW_STAGE_MEASURE: 14,
};

const permissionList = {
    tenderManager: {
        name: '标段管理',
        icon: 'fa-list-ul',
        permission: [
            { name: '创建标段', value: permission.CREATE_TENDER },
            { name: '查看项目下所有标段', value: permission.VIEW_ALL_TENDER },
            { name: '仅查看我参与的（创建、审批）', value: permission.VIEW_MY_TENDER },
        ],
    },
    ledgerExplode: {
        name: '台帐分解（台帐管理）',
        icon: 'fa-list-alt',
        permission: [
            { name: '编制台帐', value: permission.EDIT_LEDGER },
            { name: '审批台帐', value: permission.APPROVAL_LEDGER },
        ],
    },
    ledgerChange: {
        name: '台帐变更（台帐管理）',
        icon: 'fa-list-alt',
        permission: [
            { name: '编制变更', value: permission.EDIT_APPROVAL },
            { name: '审批变更', value: permission.CHANGE_APPROVAL },
        ],
    },
    measureLedger: {
        name: '计量台帐（台帐管理）',
        icon: 'fa-list-alt',
        permission: [
            { name: '查看', value: permission.VIEW_LEDGER },
        ],
    },
    middleMeasure: {
        name: '中间计量（计量管理）',
        icon: 'fa-calendar-check-o',
        permission: [
            { name: '编制中间计量', value: permission.EDIT_MIDDLE_MEASURE },
            { name: '审批中间计量', value: permission.APPROVAL_MIDDLE_MEASURE },
            { name: '查阅标段下所有中间计量', value: permission.VIEW_MIDDLE_MEASURE },
        ],
    },
    stageMeasure: {
        name: '期计量（计量管理）',
        icon: 'fa-calendar-check-o',
        permission: [
            { name: '编制期计量', value: permission.EDIT_STAGE_MEASURE },
            { name: '审批期计量', value: permission.APPROVAL_STAGE_MEASURE },
            { name: '查阅标段下所有期计量', value: permission.VIEW_STAGE_MEASURE },
        ],
    },

};

const permissionString = [];
permissionString[permission.CREATE_TENDER] = '创建标段';
permissionString[permission.VIEW_ALL_TENDER] = '查看项目下所有标段';
permissionString[permission.VIEW_MY_TENDER] = '仅查看我参与的（创建、审批）';
permissionString[permission.EDIT_LEDGER] = '编制台帐';
permissionString[permission.APPROVAL_LEDGER] = '审批台帐';
permissionString[permission.EDIT_APPROVAL] = '编制变更';
permissionString[permission.CHANGE_APPROVAL] = '审批变更';
permissionString[permission.VIEW_LEDGER] = '查看';
permissionString[permission.EDIT_MIDDLE_MEASURE] = '编制中间计量';
permissionString[permission.APPROVAL_MIDDLE_MEASURE] = '审批中间计量';
permissionString[permission.VIEW_MIDDLE_MEASURE] = '查阅标段下所有中间计量';
permissionString[permission.EDIT_STAGE_MEASURE] = '编制期计量';
permissionString[permission.APPROVAL_STAGE_MEASURE] = '审批期计量';
permissionString[permission.VIEW_STAGE_MEASURE] = '查阅标段下所有期计量';

module.exports = {
    permission,
    permissionList,
    permissionString,
};
