| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 | 'use strict';/** * * * @author Zhong * @date 2019/8/14 * @version *//** 不同运行环境下(CommonJS、浏览器)的费用定额功能模块配置* 如果运行环境使用了CommonJS,通过module.exports工厂函数返回内容* 否则将工厂函数返回内容挂载在浏览器宿主对象* @param  {Object}root 浏览器宿主对象 *        {String}overWriteUrl 费用定额重写路径(eg:/web/over_write/js/chongqing_2018.js) *        {Function}factory 工厂函数* @return {Object}* */(function (root, overWriteUrl, factory) {    if (typeof module !== 'undefined') {        module.exports = factory(overWriteUrl);    } else {        root._compilationConfig = factory(overWriteUrl);    }}(window, overWriteUrl, function (url) {    if (!url) {        return {};    }    const COMPILATION_MAP = {        chongqing_2018: 1,        neimenggu_2017: 2,        jiangxi_2017: 3,        guangdong_2018: 4,        gansu_2013: 5    };    // 费用定额定制需求配置    let config = {        // 定额工作内容列可下拉选择(0关闭、1开启)(广东)        dynamicRationWorkContent: 0    };    // 提取重写路径中的关键信息 eg: chongqing_2018    let compilation = url.split('/').pop().slice(0, -3),        compilationNum = COMPILATION_MAP[compilation];    if (!compilationNum) {        return {};    }    // 广东18    if (compilationNum === COMPILATION_MAP.guangdong_2018) {        config.dynamicRationWorkContent = 1;    }    return config;}));
 |