元数据设计

Posted 袜子破了

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了元数据设计相关的知识,希望对你有一定的参考价值。

var mdList = [
    {
        name: ‘employee_info‘,
        collection:‘employee_info‘,
        text: ‘员工信息‘,
        group: ‘employee‘,
        items: [
            {
                name: ‘empName‘,
                text: ‘员工姓名‘,
                db: ‘string‘,//bool,number,date,string
                format: ‘${value}‘,
                input: ‘text‘,
                validator: ["required", "length:1-10"]
            },
            {
                name: ‘empBirthday‘,
                text: ‘出生日期‘,
                db: ‘date‘,
                format: ‘CommonDateFormat(${value},"yyyy-mm-dd")‘,
                input: ‘datePicker‘,
                validator: ["DateValidator:yyyy-mm-dd"]
            },
            {
                name: ‘empAge‘,
                text: ‘年龄‘,
                db: null,//不存储,
                format: ‘CommonAgeFormat(${entity},"empBirthday")‘,
                input: ‘readonly‘,
                validator: []
            },
            {
                name: ‘empBelongOrg‘,
                text: ‘所属组织‘,
                db: ‘string‘,
                format: ‘OrgFormat(${value})‘,
                input: ‘selector:OrgSelector(${value},${entity})‘,
                validator: []
            },
            {
                name: ‘empBelongOrg‘,
                text: ‘所属组织‘,
                db: ‘string‘,
                format: ‘OrgFormat(${value})‘,
                input: ‘selector:OrgSelector(${value},${entity}):target.id‘,
                validator: []
            },
            {
                name: ‘empSalaryBase‘,
                text: ‘基本工资‘,
                db: ‘number‘,
                format: ‘${value} 元‘,
                input: ‘text‘,
                validator: [‘number‘]
            },
            {
                name: ‘empNation‘,
                text: ‘民族‘,
                db: ‘string‘,
                format: ‘${value}‘,
                input: ‘select:SelectEnum("Nation"):target‘,
                validator: [‘number‘]
            },
            {
                name: ‘empPosition‘,
                text: ‘担任岗位‘,
                db: ‘string‘,
                format: ‘${value}‘,
                input: ‘select:SelectDataSource("Position"):target.id‘,
                validator: [‘number‘]
            }
        ]
    },


    {
        name: ‘employee_family‘,
        collection:‘employee_family‘,
        text: ‘家庭成员‘,
        group: ‘employee‘,
        items: [
            {
                name: ‘familyName‘,
                text: ‘姓名‘,
                db: ‘string‘,//bool,number,date,string
                format: ‘${value}‘,
                input: ‘text‘,
                validator: ["required", "length:1-10"]
            },
            {
                name: ‘familyBirthday‘,
                text: ‘出生日期‘,
                db: ‘date‘,
                format: ‘CommonDateFormat(${value},"yyyy-mm-dd")‘,
                input: ‘datePicker‘,
                validator: ["DateValidator:yyyy-mm-dd"]
            }
        ]
    }




];

  

以上是关于元数据设计的主要内容,如果未能解决你的问题,请参考以下文章

Express实战 - 应用案例- realworld-API - 路由设计 - mongoose - 数据验证 - 密码加密 - 登录接口 - 身份认证 - token - 增删改查API(代码片段

23种设计模式之享元模式代码实例

js设计模式-享元模式

学习设计模式之享元模式

是否有在单个活动中处理多个片段的 Android 设计模式?

十条实用的jQuery代码片段