Skip to content

gomeplusFED/DataPlatform

Repository files navigation

#美信数据平台#

开发文档

文档

部署文档

文档

##引入核心模板##

var main = require('../..../main');
module.exports = function(Router) {
    Router = new main(Router, options);

    return Router;
};

##创建表模板工具

let createModel = require("./utils/createModel");
createModel(options);

options

字段 是否必需 类型 默认值 注释
filename string 表格信息地址
writePath string 模板写入地址
author string 作者
tableName array [] 模板名
buffer string utf-8 编码
desc string 备注

##options配置##

  1. 路由
  2. 数据表名
  3. 查询数据后对应的数据名称
  4. 添加动态参数所用
  5. 添加动态参数,主用于需要查库添加参数所用
  6. 查库流程
  7. 支持sql查询
  8. 对应表是否分页
  9. 分页时每页条数
  10. 需要求和字段
  11. 排序字段
  12. 前端模块需查表完成
  13. 是否显示平台
  14. 是否显示渠道
  15. 是否显示版本
  16. 是否显示优惠券类型
  17. 是否有导出路径
  18. 按钮设置
  19. 是否显示时间
  20. 初始时间
  21. 联动菜单是否显示
  22. 联动菜单地址
  23. 查询字段名称
  24. 单选
  25. 数据过滤
  26. 搜索框
  27. 表格字段选择框
  28. 全局模块
- **router** --- 路由

设置了路由之后会默认生成三个路由,在router后添加后缀

  1. _json
  2. _jsonp
  3. _excel
{
    router : '/xxx/xxx' || '/xxx'
}
- **modelName** --- 数据表名

同一路由可以查询多个表

{
    modelName : ['xxx', 'xxx']
}

默认值

  1. first --- 查询第一个表之后数据对应的名称
  2. second --- 查询第二个表之后数据对应的名称
  3. third --- 查询第三个表之后数据对应的名称
  4. fourth --- 查询第四个表之后数据对应的名称
{
    dataName : ['first', 'second', 'third', 'fourth']
}
- **paramsName** --- 添加动态参数所用

默认值

  1. params --- 第一个表添加参数
  2. secondParams --- 第二个表添加参数
  3. thirdParams --- 第三个表添加参数
  4. fourthParams --- 第四个表添加参数
{
    paramsName : ['params', 'secondParams', 'thirdParams', 'fourthParams']
}
//使用方法实在options里边设置对应值
{
    params : {} || function(query, params, data){}
}
- **fixedName** --- 添加动态参数,主用于需要查库添加参数所用
{
    pixedName : fucntion(req, query, cb) {}
}

默认情况下分三种情况

{
    //不分页的情况
    procedure : [{
	find : 'params',
	order : ['xx', 'xx'],
	run : ''
    }]
    //分页且不需要对某些值求和
    procedure : [
	[
	    {
	 	find : 'params',
		offset : 'offset',
		limit : 'limit',
		order : ['xxx', 'xxx'],
		run : ''
	    },
	    {
		count : ''
	    }
	]
    ]
    //分页且需要对某些值求和
    procedure : [
	[
	    {
	 	find : 'params',
		offset : 'offset',
		limit : 'limit',
		order : ['xxx', 'xxx'],
		run : ''
	    },
	    {
		aggregate : 'params',
		sum : ['xxx', 'xxx'],
		get : ''
	    },
	    {
		count : ''
	    }
	]
    ]
}

默认值

{
    sql : ['firstSql', 'secondSql', 'thirdSql', 'fourthSql']
}
//不分页时 支持sql查询
{
    firstSql : function(query, params) {}
}
//分页时 支持sql查询 true 查询数据 false 查询总条数
{
    firstSql : function(query, params, true || false){}
}
{
    paging : [true, false]
}
{
    page : 20
}
{
    sum : ['xx', 'xxx']
}
{
    order : ['xx', 'xxx']
}
{
    selectFilter : function(req, cb) {}
}
{
    rows : [
	[
	    'xx', 'xx'
	]
    ]
}
{
    cols : [
	[
	    caption : '列名',
	    type : '类型',
	    help : '帮助信息'
	]
    ]
}

默认值

{
    platform : true
}

默认值

{
    channel : false
}

默认值

{
    version : false
}

默认值

{
    coupon : false
}

默认值

{
    excel_export : false
}
{
    flexible_btn : [{
        content: '导出',
        preMethods: ['excel_export']
    }]
}

默认值

{
    date_picker : true
}

默认值

{
    //可以选择多天 7 只能选择单天 1
    date_picker_data : 7
}

默认值

{
    level_select : false
}
{
    level_select_url : '/xxx/xxx'
}
{
    level_select_name : 'xxxx'
}
{
    filter_select : [{
        title: '标题',
        filter_key : '参数名',
        groups: [{
            key: '参数值',
            value: '参数显示名称'
        }]
    }]
}
{
    filter : function(data, query, dates, type) {}
}

默认值

{
    search : {
        show : false
    }
}

默认值

{
    control_table_col : false
}

默认值

{
    golbal_platform : {
        show : false,
        key : '参数名',
        list : [{
            key : '参数值',
            name : '名称'
        }]
    }
}

About

美信数据平台

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6