'use strict';

/**
 * 前端所需js
 *
 * {String} webPath: 记录 合并压缩后的 文件存放的路径
 * {String[]} commonFiles: 所有页面通用的js包文件
 * {Object} controller: 根据controller和action来区分不同的页面数据
 *  -   files: 当前页面所需的js包文件
 *  -   mergeFiles: 当前页面所需 合并压缩的 js文件
 *  -   mergeFile: 合并压缩后 生成的js文件名
 *
 *  在app中运行合并压缩代码，运行后数据为app.jsFiles，示例（ledger）如下：
 *  app.jsFiles = {
 *      common: String[]
 *      controller1: {
 *          action1: String[]
 *          action2: String[]
 *      }
 *  }
 *
 *  在Controller中使用时，需添加到renderData.jsFiles中，并调用Layout方法
 *  没有该值时，Layout方法会自动加载app.jsFiles.common
 *  有该值时，例如台账审核页面，renderData.jsFiles = app.jsFiles.ledger.audit = ['/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js', '/public/js/web/ledger_audit.min.1.0.0.js']
 *  则layout方法会同时加载app.jsFiles.common与renderData.jsFiles
 *  加载位置为head
 *
 *  如果页面无需合并压缩js文件，可以直接添加到JsFiles.controller.controller1.action1.files，也可以直接添加到调用的ejs模板中
 *
 * @author Mai
 * @date 2019/1/10
 * @version
 */
const JsFiles = {
    webPath: "/public/js/web/",
    commonFiles: [
        "/public/js/jquery/jquery-3.2.1.min.js",
        "/public/js/jquery/jquery-ui.js",
        "/public/js/jquery/jquery.validate.js",
        "/public/js/messages_zh.js",
        "/public/js/popper/popper.min.js",
        "/public/js/bootstrap/bootstrap.min.js",
        "/public/js/vue/vue.js",
        "/public/js/component/input.js",
        "/public/js/cookies.js",
        "/public/js/jquery-contextmenu/jquery.ui.position.min.js",
        "/public/js/jquery-contextmenu/jquery.contextMenu.min.js",
        "/public/js/lodash.js",
        "/public/js/lz-string/lz-string.js",
        "/public/js/number-precision.js",
        "/public/js/global.js",
    ],
    controller: {
        tender: {
            list: {
                files: [
                    "/public/js/ztree/jquery.ztree.core.js",
                    "/public/js/ztree/jquery.ztree.exedit.js",
                ],
                mergeFiles: [
                    "/public/js/tender_list.js"
                ],
                mergeFile: 'tender_list',
            },
            progress: {
                files: [
                    "/public/js/ztree/jquery.ztree.core.js",
                    "/public/js/ztree/jquery.ztree.exedit.js",
                ],
                mergeFiles: ["/public/js/tender_list_progress.js"],
                mergeFile: 'tender_list_progress',
            },
            manage: {
                files: [
                    "/public/js/ztree/jquery.ztree.core.js",
                    "/public/js/ztree/jquery.ztree.exedit.js",
                    "/public/js/moment/moment.min.js",
                ],
                mergeFiles: ["/public/js/tender_list_manage.js"],
                mergeFile: 'tender_list_manage',
            },
            info: {
                files: [
                    "/public/js/echarts/echarts.min.js",
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                ],
                mergeFiles: [
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/change_calculation.js",
                    "/public/js/tender.js",
                ],
                mergeFile: 'tender',
            }
        },
        ledger: {
            explode: {
                files: [
                    "/public/js/js-xlsx/xlsx.full.min.js",
                    "/public/js/js-xlsx/xlsx.utils.js",
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                ],
                mergeFiles: [
                    "/public/js/div_resizer.js",
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/ledger_tree_col.js",
                    "/public/js/ledger.js",
                ],
                mergeFile: 'explode',
            },
            audit: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                ],
                mergeFiles: [
                    "/public/js/div_resizer.js",
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/ledger_audit.js",
                ],
                mergeFile: 'ledger_audit',
            },
            revise: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                ],
                mergeFiles: [
                    "/public/js/div_resizer.js",
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/revise.js",
                ],
                mergeFile: 'revise',
            }
        },
        stage: {
            // 本期计量台账
            index: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                    "/public/js/toastr.min.js",
                ],
                mergeFiles: [
                    "/public/js/div_resizer.js",
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/stage.js",
                    "/public/js/stage_audit.js",
                ],
                mergeFile: 'stage',
            },
            detail: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                    "/public/js/html2canvas/html2canvas.min.js",
                    "/public/js/html2canvas/canvas2image.js",
                ],
                mergeFiles: [
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/stage_im.js",
                    "/public/js/stage_detail.js",
                    "/public/js/stage_audit.js",
                ],
                mergeFile: 'stage_detail',
            },
            pay: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                ],
                mergeFiles: [
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/stage_pay.js",
                    "/public/js/stage_audit.js",
                ],
                mergeFile: 'stage_pay',
            },
            change: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                ],
                mergeFiles: [
                    "/public/js/div_resizer.js",
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/stage_change.js",
                ],
                mergeFile: 'stage_change',
            },
            gather: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                ],
                mergeFiles: [
                    "/public/js/div_resizer.js",
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/gcl_gather.js",
                    "/public/js/stage_gather.js",
                ],
                mergeFile: 'stage_gather',
            },
            compare: {
                files: [
                    "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",
                    "/public/js/decimal.min.js",
                ],
                mergeFiles: [
                    "/public/js/div_resizer.js",
                    "/public/js/spreadjs_rela/spreadjs_zh.js",
                    "/public/js/zh_calc.js",
                    "/public/js/path_tree.js",
                    "/public/js/stage_compare.js",
                ],
                mergeFile: 'stage_compare',
            }
        }
    }

};

module.exports = JsFiles;
