@currywyh/elpis
v1.0.0
Published
\#elpis
Downloads
16
Readme
#elpis
##一个企业级应用,通过全栈实现。
model 配置
Javascript
{ mode: 'dashboard'; // 模板类型,不同模板类型对应不一样的模板数据结构 name: ''; // 名称 desc: ''; // 描述 icon: ''; // icon homePage: ''; // 首页(项目配置) // 头部菜单 menu: [{ ...schema, // 标准 schema 配置 key: '', // 菜单唯一描述, name: '', // 菜单名称 menuType: '', // 枚举值, group / module
// 当 menuType == group时 , 可填
subMenu: [{
// 可递归 menuItem
}],
// 当 menuType == module 时,
moduleType: '', // 枚举值: iframe/custom/schema
// 当 menuType == sider 时
siderConfig: {
menu: [{
// 可递归 menuItem(除 moduleType === sider)
}]
},
// 当 menuType == iframe 时
iframeConfig: {
path: '', // iframe路径
},
// 当 menuType == custom 时
customConfig: {
path: '', // 自定义路由路径
},
// 当 menuType == schema 时
schemaConfig: {
api: '/api/user', // 数据源API (遵循 RESTFUL规范)
schema: { // 板块数据结构
type: 'object',
properties: {
key: {
...schema, // 标准 schema 配置
type: '', // 字段类型
label: '', // 字段的中文名
// 字段在 table 中的相关配置
tableOption: {
...elTableColumnConfig, // 标准 el-table-column 配置
toFixed: 0, // 小数点保留
visiable: true, // 默认为 true (false 或者 不配置表示不在表单中显示)
},
// 字段到 search-bar 中的相关配置
searchOption: {
...eleComponentConfig, // 标准 el-component-column配置
comType: '', // 配置组件类型 input/selecr=t/....
default: '', // 默认值
//comType === 'dynamicSelect'
api: ''
},
// 字段到不同动态 component 中的相关配置,前缀对应 componentComfig中的键值
// 如:componentConfig.createForm, 这里对应 createFormOption
// 字段在 createForm 中相关配置
createFormOption: {
...eleComponentConfig, // 标准 el-component 配置
comType: '', // 控件类型 input/selet/input-number
visiable: true, // 是否显示(true/false),默认为true
disabled: false, // 是否禁用(true/false),默认为false
default: '', // 默认值
//comType === 'select 时生效
enumLists: [] //枚举列表
},
// 字段在 editForm 表单中得相关配置
editFormOption: {
...eleComponentConfig, // 标准 el-component 配置
comType: '', // 控件类型 input/selet/input-number
visiable: true, // 是否显示(true/false),默认为true
disabled: false, // 是否禁用(true/false),默认为false
default: '', // 默认值
//comType === 'select 时生效
enumLists: [] //枚举列表
},
detailPanelOption: {
...eleComponentConfig // 标准 el-component 配置
}
},
}
},
require: [], // 标记必填项字段
},
// table 相关配置
tableConfig: {
headerButtons: [{
label: '', // 按钮名称
eventKey: '', // 按钮事件名
eventOption: {
// 当 eventKey === 'showComponent'
comName: '', // 组件名称
// 当 eventKey === 'remove'
params: {
// paramKey = 参数的键值
// rowValueKey = 参数值, 格式为 schema::tableKey, 到table中找相应的字段
paramKey: rowValueKey
}
}, // 按钮事件具体配置
...elButtonConfig // 标准 el-button
}],
rowButtons: [{
label: '', //按钮名称
eventKey: '', // 按钮事件名
eventOption: {
// 当 eventKey === 'remove
params: {
// paramKey = 参数得键值
// rowValueKey = 参数值(当格式为shema:xxx 需要到table中找相应得字段)
paramKey: rowValueKey
}
}, // 按钮事件具体配置
...elButtonConfig // 标准 el-button
}]
},
// serach-bar 相关配置
searchConfig: {},
// 动态组件 相关配置
componentConfig: {
// create-form 表单相关配置
createForm: {
title: '', // 表单标题
saveBtnText: '', // 保存按钮文案
},
// edit-form 表单相关配置
editForm: {
mainKey: '', // 表单主键,用于唯一标识要修改得数据对象
title: '', // 表单标题
saveBtnText: '', // 保存按钮文案
},
// detail-panel 相关配置
detailPanel: {
mainKey: '', // 表单主键,用于唯一标识要修改得数据对象
title: '', // 表单标题
}
// ...支持用户动态扩展
},
}]}
服务端启动
javascript const { serverStart } = require('@currywyh/elpis');
// 启动 elpis 服务 const app = serverStart({});
自定义服务器
- router-schema
- router
- controller
- service
- extend
- config
前端构建
、、、javaScript const { frontendBuild } = require('@fsiaonma/elpis');
// 编译构建前端工程 frontendBUild(process.env._ENV);
自定义页面扩展
- 在 app/pages/ 目录下写入 entry.xxx.js
dashboard / custom-view 自定义页面扩展
- 在 app/pages/dashboard/xxx 下写页面
dashboadr / schema-view / components 动态组件扩展
1.在 app/pages/dashboard/complex/schema-view/components 下写组件
- 配置到 app/pages/dashboard/complex-view/shema-view/componenys/component-config.js
schema-form 空间配置
- 在 app/widgets/schema-form/complex-view 下写控件
- 配置到 app/widgets/schema-form/form-item-config.js
schema-search-bar 控件扩展
- 在 app/widgets/schema-search-bar/complex-view 下写控件
- 配置到 app/widgets/schema-search-bar/search-item-confg.js
