1.0.0 • Published 7 months ago
@codewy/elpis v1.0.0
elpis
这是一个基于Nodejs Koa Vue Webpack 的全栈项目 哈哈
model配置
export default {
mode: 'dashboard', // 仪表盘 模版类型 不同的模版类型 对应不一样的模版数据结构
name: '', // 名称
desc: '', // 描述
icon: '', // icon
home: '', // 首页(项目配置)
menu: [
{
key: '', // 菜单ID
name: '', // 菜单名称
menuType: '', // 枚举值: group | module
subMenu: [
{
// 可递归menuItem
}
],
// 当 menuType === module 时 可填入
moduleType: '', // 枚举值: side | iframe|custom|schema
// 当moduleType === side 时
sideConfig: {
menu: [
{
// 可递归 menuItem (除了moduleType === side )
}
]
},
// 当moduleType === iframe 时
iframeConfig: {
path: '', // iframe路径
},
// 当moduleType === custom 时
customConfig: {
path: '', // custom 自定义路径
},
// 当moduleType === schema 时
schemaConfig: {
api: '', // 数据源 遵循RESTFUL规范
// 板块的数据结构
schema: {
type: 'object',
properties: {
key: {
...schema, // 标准的schema配置
type: '', // 字段类型
label: '', // 字段中文名
// 2 在这里加配置
// 字段在 table 中的相关配置
tableOption: {
...elTableColumnConfig, // 标准的element 的 el-table-column配置
toFixed: 0, // 保留几位小数
visible: true, // 默认为 true (为真显示 为假隐藏)
},
// 字段在 tableOption 中的相关配置
searchOption: {
...eleComponentConfig, // 标准的element 的 el-table-column配置
comType: '', // 配置组件类型 input select ...
default: '', // 默认值
// comType === 'select'
enumList: [], // 下拉框选项
// comType === 'dynamicSelect'
api: '',
},
// 字段 在不同的动态组件中相关配置 前缀对应componentConfig中的键值
// 如:componentConfig.createForm >>>对应>>> createFormOption
createFormOption: {
...eleComponentConfig,
comType: '', // 控件类型 比如 input select input-number
visible: true, // 是否展示 默认true
disable: false, // 是否禁用 默认false 不禁用
default: '', // 默认值
// comType === 'select'
enumList: [], // 下拉框选项 枚举列表
},
// 字段在 editForm 表单中的相关配置
editFormOption: {
...eleComponentConfig,
comType: '', // 控件类型 比如 input select input-number
visible: true, // 是否展示 默认true
disable: false, // 是否禁用 默认false 不禁用
default: '', // 默认值
// comType === 'select'
enumList: [], // 下拉框选项 枚举列表
},
detailPanelOption: {
...eleComponentConfig, // 标准的element 的 el-component 配置
}
//
},
// ...
},
required: [], // 标记哪些字段 是必填项
},
// table 相关配置
tableConfig: {
headerButtons: [
{
label: '',
eventKey: '', // 按钮的事件回调名
// 按钮的具体配置
eventOption: {
// 当事件名为 'showComponent' 时
comName: '', // 组件名
},
...elButtonConfig, // 标准的 el-button 配置
}
],
rowButtons: [
{
label: '', // 按钮的中文名
eventKey: '', // 按钮事件名
// 按钮事件具体配置
eventOption: {
comName: '', // 组件名
// 当事件名是remove时 eventKey === 'remove'
paramKey: {
// parmaKey = 参数的键值
// rowValueKey = 参数值 当格式为 schema::tableKey的时候 到table中找到相应的字段
parmaKey: rowValueKey,
}
},
...elButtonConfig, // 标准的 el-button 配置
},
// ...
],
},
// search-bar 相关配置
searchConfig: {
},
// 动态组件相关配置
componentConfig: {
// createForm 表单标题
createForm: {
title: '', // 表单标题
saveBtnText: '', // 保存按钮文案
},
// editForm 表单相关配置
editForm: {
mainKey: '', // 表单主键 用于唯一标识要修改的数据对象
title: '', // 表单标题
saveBtnText: '', // 保存按钮文本
},
// detail-panel 表单相关配置
detailPanel: {
mainKey: '', // 表单主键 用于唯一标识要修改的数据对象
title: '', // 表单标题
saveBtnText: '', // 保存按钮文本
}
// 1 首先在这里加组件配置
// comA: {}, 组件A
// comB: {}, 组件B
// comC: {}, 组件C
// ...支持用户动态扩展
},
},
}
]
}
服务端启动代码
const { serverStart } = require('@codewy/elpis');
// 启动服务
const app = serverStart({
name: 'xxx',
homePage: '/'
});
自定义服务端
- router-schema
- router
- controller
- service
- extend
- config
前端构建
const { frontendBuild } = require('@codewy/elpis');
// 编译构建前端工程
frontendBuild(process.env._ENV);
自定义页面扩展
- 在
app/pages/
目录下写入口 entry.xxx.js
dashboard/custom-view 自定义页面扩展
- 在
app/pages/dashboard/xxxx
目录下写界面
dashboard/schema-view/components 动态组件扩展
- 在
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/form-item-config.js
1.0.0
7 months ago