1.0.7 • Published 6 months ago
@s1mpleniko/elpis v1.0.7
#elpis
一个企业级应用框架,通过全栈实现。
model 配置
{
mode: 'dsahboard', // 模板类型, 不同模板类型对应不同的模板
name: '', //名称
desc: '', //描述
icon: '',// icon
hpmePage: '', // 首页(项目配置)
menu: [{
key: '', // 菜单唯一描述
name: '', // 菜单名称,
menuType: '',// 枚举值:group / module
// 当menuType == group时,可填
subMenu: [{
// 可递归 menuItem
}, ...],
// 当menuType == module时,可填
moduleType: '', // sider/iframe/custom/schema
// 当 moduleType == sider 时
siderConfig: {
menu: [{
// 可递归munu下的item
}, ...]
},
// 当 moduleType === iframe 时
iframeConfig: {
path: ''
},
// 当 moduleType === custom
customConfig: {
path: '' // 自定义路径
},
// 当 moduleType === schema
schemaConfig: {
api: '', // 数据源 api (遵循 RESTFUL 规范 (GET,PUL,DELETE,POST) ) /api/user
schema: {
type: 'object',
properties: {
key: {
...schema, // 标准的scema 配置
type: '', // 字段类型
label: '', //字段中文名
// 字段在 table 中的相关配置
tableOption: {
...elTableColumnConfig, // 标准 el-tabel-column 配置
toFixed: 0,
visible: true // 默认为 true (false 或者不配置,表示隐藏该字段)
},
searchOption: {
...eleComponentConfig, // 标准 el-comment-colum 配置
comType: '', // 配置组件类型 input/select/...
default: '', // 默认值
// comType === 'select'
enumList: [], // 下拉框可选
// comType === 'dynamicSelect'
api: ''
},
createFormOption: {
...eleComponentConfig, // 标准 el-comment-colum 配置
comType: '', // 配置组件类型 input/select/...
visible: true, // 默认为 true (false 或者不配置,表示隐藏该字段)
disabled: false, // 是否禁用(true/false),默认为false
default: '', // 默认值
// comType === 'select'
enumList: [], // 下拉框可选
},
editFormOption: {
...eleComponentConfig, // 标准 el-comment-colum 配置
comType: '', // 配置组件类型 input/select/...
visible: true, // 默认为 true (false 或者不配置,表示隐藏该字段)
disabled: false, // 是否禁用(true/false),默认为false
default: '', // 默认值
// comType === 'select'
enumList: [], // 下拉框可选
},
detailPanelOption:{
...eleComponentConfig, // 标准 el-comment-colum 配置
}
},
},
...
required: [] // 必填字段
},
// table 配置
tableConfig: {
headerButtons: [{
label: '', // 按钮中文名
eventKey: '', // 按钮事件名
// 按钮事件配置
eventOption: {
// 当 eventKey === 'showComponent'
comName: '' // 组件名称
},
...elButtonConfig // 标准 el-button 配置
}, ...],
rowButtons: [{
label: '', // 按钮中文名
eventKey: '', // 按钮事件名
eventOption: {
// 当 eventKey === 'remove' 时
params: {
// 当 eventKey === 'showComponent'
comName: '', // 组件名称
// paramKey = 参数的键值
// rowValueKey = 参数值(当格式为 schema::tableKey 时 ,去table中找tableKey的value)
paramKey: rowValueKey
},
},
// 按钮事件配置
...elButtonConfig, // 标准 el-button 配置
}, ...]
},
searachConfig: {}, // 过滤条件配置
// 模块组件
componentConfig: {
// create-form 表单相关配置
createForm: {
title: '', // 表单标题
saveBtnText: '' // 保存按钮文案
},
// edit-form 表单相关配置
editForm: {
mainKey: '', // 查询详情、保存时需要的key
title: '',// 表单标题
saveBtnText: ''// 保存按钮文案
},
detailPanel: {
mainKey: '', // 查询详情、保存时需要的key
title: '',// 表单标题
}
// ...支持用户动态扩展
}
},
}
}, ...]
}服务端启动
const { serverStart } = require("@zhiwei123/elpis");
// 启动 elpis 服务,
// @params
// * options {
// * name :'项目名称',
// * homePage :项目首页
// * }
const app = serverStart({});自定义服务端
- router-schema
- router
- controller
- service
- extend
- config
前端架构
const { frontendBuild } = require("@zhiwei123/elpis");
// 编译构建前端工程
frontendBuild(process.env._ENV);自定义页面扩展
- 在
app/pages目录下写入口 entry.xxx.js
import elpisBoot from "$elpisBoot";
import xxx from "xxx.vue";
elpisBoot(xxx);- 在
app/pages目录下写页面组件 xxx.vue
dashboard / custom-view 自定义页面
- 在
app/pages/dashboard/xxx/xxx.vue下写页面 在
app/pages/dsahboard/router.js下定义路由 function 接受两个参数,第一个为一级路由,第二个为 sider 路由module.exports = ({ routes, siderRoutes}) => { // 头部路由 routes.push({ path: '/view/dashboard/todo', component: () => import('./todo/todo.vue') }) // 侧边路由 siderRoutes.push({ path: 'todo', component: () => import('./todo/todo.vue') }) }
dashboard / schema-view / components 动态组件扩展
- 在
app/pages/dashboard/complex-view/schema-view/components下写组件 配置到
app/pages/dashboard/complex-view/schema-view/components/component-config.jsimport xxxx from './xxxx/xxxx.vue'; const componentConfig = { xxxx: { component: xxxx } } export default { componentConfig }
schema-form 控件扩展
- 在
app/widgets/schema-form/complex-view下写控件 配置到
app/widgets/schema-form/form-item-config.jsimport xxxx from './xxxx/xxxx.vue'; const componentConfig = { xxxx: { component: xxxx } } export default { componentConfig }
schema-search-bar 控件扩展
- 在
app/widgets/schema-search-bar/complex-view下写控件 配置到
app/widgets/schema-search-bar/search-item-config.jsimport xxxx from './xxxx/xxxx.vue'; const componentConfig = { xxxx: { component: xxxx } } export default { componentConfig }