@befool/elpis
v1.0.1
Published
## 一个企业级
Readme
elpis
一个企业级
model 配置
{
// 模板类型,不同模板类型对应不一样的模板数据结构
mode: 'dashboard',
// 名称
name:'',
// 描述
desc:'',
// icon
icon:'',
// 首页配置
homePage:'',
// 头部菜单
menu: [{
// 菜单唯一值
key:'',
// 菜单名称
name:'',
// 枚举值,group/module
menuType:'',
// 当menuType为group时,subMenu为子菜单
subMenu:[{
// 可递归MenuItem
}, ...],
// 当menuType为module时,选择模块类型
moduleType:'',// 枚举值, sider/iframe/custom/schema
// 当moduleType为sider时,siderConfig为sider配置
siderConfig:{
menu:[{
// 可递归MenuItem(除moduleType === module)
}, ...]
},
// 当moduleType为iframe时,iframeConfig为iframe配置
iframeConfig:{
path: ''// iframe路径
},
// 当moduleType为custom时,customConfig为配置
customConfig:{
path: '',// 自定义组件路径
},
// 当moduleType为schema时,schemaConfig为schema配置
schemaConfig:{
api:'',// 数据源API(遵循RESTFUL规范)(GET获取,POST新增,PUT修改,DELETE删除)
schema:{ // 板块数据结构
type:'object',
properties:{
key:{
...schema,// 标准的shema配置
type:'',// 字段类型
label:'',// 字段的中文名
// 字段在 table中的相关配置
tableOptions:{
...elTableColumnConfig,// 标准的el-table-column配置
visible: true,// 是否在表单中显示,默认为true
toFixed: 0// 保留小数点后几位
},
// 字段在search-bar中的相关配置
searchOptions:{
...eleComponentConfig,// 标准的el-component-column配置
comType: '',// 配置组件类型,input/select/...
default: '',// 默认值
// 当comType === 'select'时,enumList为select配置
enumList:[{}] // 下拉框选项
// 当comType === 'dynamicSelect'时
api:'' // 下拉框选项的接口
},
// 字段在不同动态 component 中的相关配置,前缀对应 componentConfig 中的键值
// 如: componentConfig.createForm, 这里对应 createFormOption
// 字段在 createForm 中相关配置
createFormOptions: {
...eleComponentConfig,// 标准的el-component配置
comType: '', // 空间类型 input/select/input-number
visible: true, // 是否展示(true/flase), 默认为true
disable: false, // 是否禁用
default: '', // 默认值
// comType === 'select' 时生效
enumList: [], // 枚举列表
},
// 字段在 editForm 中相关配置
editFormOptions: {
...eleComponentConfig,// 标准的el-component配置
comType: '', // 空间类型 input/select/input-number
visible: true, // 是否展示(true/flase), 默认为true
disable: false, // 是否禁用
default: '', // 默认值
// comType === 'select' 时生效
enumList: [], // 枚举列表
},
detailPanelOptions: {
...eleComponentConfig,// 标准的el-component配置
}
},
...
},
required: [], // 标记哪些字段是必填项
},
// table相关配置
tableConfig:{
headerButtons:[{
label: '',// 按钮名称
eventKey: '',// 按钮事件key
// 按钮事件具体配置
eventOptions:{
// 当 eventKey === 'showComponent' 时生效
comName: '' // 组件名称
}
...elButtonConfig,// 标准的el-button配置
},...],// table头部按钮
rowButtons:[{
label: '',// 按钮名称
eventKey: '',// 按钮事件key
eventOptions:{
// 当 eventKey === 'showComponent' 时生效
comName: '' // 组件名称
// 当eventKey === 'remove'
params:{
// paramsKey = 参数的键值
// rowValueKey = 参数的值( 当格式为 schema::tableKeys时,到table中找响应字段 )
paramsKey: rowValueKey
}
} // 按钮事件具体配置
...elButtonConfig,// 标准的el-button配置
},...],// table行按钮
},
// search-bar相关配置
searchConfig:{},
// 动态组件相关配置
componentConfig:{
// create-from 表单相关配置
createForm: {
title: '', // 表单标题
saveBtnText: '', // 保存按钮文案
},
editForm: {
mainKey: '', // 表单主键,用于唯一标识要修改的数据对象
title: '', // 表单标题
saveBtnText: '', // 保存按钮文案
},
// detail-panel相关设置
detailPanel: {
mainKey: '', // 主键,用于唯一标识要查看的数据对象
title: '', // 标题
}
// ...支持用户动态扩展
},
},
}, ...],
};服务端启动
const { serverStart } = require('@befool/elpis');
// 启动 elpis 服务
const app = serverStart({});自定义服务端
- router-schema
- router
- controller
- service
- extend
- config
前端构建
const { frontendBuild } = require('@befool/elpis');
// 编译构建前端工程
frontendBuild(process.env._ENV);自定义页面扩展
- 在
app/pages/目录写入口 entry.xxx.js
dashboard / custom-view 自定义页面扩展
- 在
app/pages/dashboard/complex-view/schema-view/components下写组件 - 配置到
app/pages/dashboard/complex-view/schema-view/components/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/seach-item-config.js
