1.0.1 • Published 4 months ago
@tan./elpis v1.0.1
elpis
一个企业级应用框架,通过全栈实现
model配置
/**
* {
* mode: 'dashboard', // 模板类型,不同模板类型对应不同的数据结构
* name: '', // 名称
* desc: '', // 描述
* icon: '', // icon
* homePage: '', // 首页 (项目配置)
* // 头部菜单
* menu: [{
* key: '', // 菜单唯一描述
* name: '', // 菜单名称
* menuType: '', // 枚举值 group / module
*
* // menuType === group 时
* subMenu: [{
* // 可递归 menuItem
* }, ...],
*
* // menuType === module 时
* moduleType: '', // 枚举值: sider / iframe / custom / schema
*
* // 当 moduleType === sider 时
* siderConfig: {
* menu: [{
* // 可递归 menuItem (除 moduleType === sider)
* }, ...]
* }
*
* // 当 moduleType === iframe 时
* iframeConfig: {
* path: '', // iframe 路径
* },
*
* // 当 moduleType === custom 时
* customConfig: {
* path: '', // 自定义路由路径
* },
*
* // 当 moduleType === schema 时候
* schemaConfig: {
* api: '/api/user', // 数据源的 API (遵循 RESTFUL 规范)
* schema: { // 板块数据结构 jsonSchema 规范 + 部分 ui DSL 自定义字段
* type: 'object',
* properties: {
* key: {
* ...schema, // 标砖 schema 配置
* type: '', // 字段类型
* label: '' // 字段的中文名
* // 字段在 table 中的文字 element-ui table
* tableOption: {
* ...elTableColumConfig // 标准 el-table-column 配置
* toFixed: 0, // 保留小数点后几位
* visibility: ture // 是否显示 默认开启
* }
* // 字段在 search-bar 中的配置
* searchOption: {
* ...elComponentConfig // 标准 el-component-config 配置
* comType: '' // 配置控件类型 input / select / ...
* default: '', // 默认值,
*
* // 当 comType === select 时
* enumList: []
*
* // 当 comType === dynamicSelect
* api: 'xx'
* apiParams: {}
* },
* // 动态组件在不同字段中的特别表现
* // 如: componentConfig.createFrom, 这里必须对应的是 createFromOption
* // 字段在 createForm 中的配置
* createFormOption: {
* ...elComponentConfig // 标准 el-component-config 配置
* comType: "" // 控件类型 input / select / input-number
* visibility: true // 是否显示 默认开启
* disabled: false // 是否禁用 默认不禁用
*
* // comType === select
* enumList: [] // 枚举列表
* },
* // 字段在 editForm 中的配置
* editFormOption: {
* ...elComponentConfig // 标准 el-component-config 配置
* comType: "" // 控件类型 input / select / input-number
* visibility: true // 是否显示 默认开启
* disabled: false // 是否禁用 默认不禁用
*
* // comType === select
* enumList: [] // 枚举列表
* }
* // 字段在 detailPanel 的配置
* detailPanelOption: {
* ...elComponentConfig // 标准 el-component-config 配置
* }
* },
* ...
* },
* required: [] // 必填字段 key 值
* }
* },
* // table 相关配置
* tableConfig: {
* headerButton: [{
* label: '', // 按钮中文名
* eventKey: '', // 按钮事件名称
* eventOption: { // 按钮事件具体配置
* // 当 eventKey === showComponent
* comName: "" // 组件名称
* },
* ...elButtonConfig, // 标准的 el-button 配置
* }, ...],
* rowButtons: [{
* label: '' // 按钮中文名
* eventKey: '' // 按钮事件名
* eventOption: { // 按钮事件具体配置
* // 当 eventKey === 'remove' 将来可以无限拓展
* params: {
* // paramKey === 参数的键值
* // rowValueKey === 参数的值 (当格式为 schema::tableKey 的时候, 到 table 中找到对应的值)
* paramKey: rowValueKey
* }
* },
* ...elButtonConfig, // 标准的 el-button 配置
* }, ...]
* },
* // search-bar 相关配置
* searchConfig: {},
* // 动态组件相关配置
* componentConfig: {
* // create-form 表单相关配置
* creatForm: {
* title: "" // 表单名称
* saveBtnText: "" // 保存按钮名称
* },
* // edit-form 表单配置
* editForm: {
* mainKey: "" // 表单唯一值
* title: "" // 表单标题,
* saveBtnText: "" //保存按钮名称
* }
* // detail-panel 组件配置
* detailPanel: {
* mainKey: "" // 表单唯一值
* title: "" // 表单标题
* }
* ... // 支持用户动态拓展
* }
* }, ...]
* }
*/
服务端启动代码
const { serverStart } = require('@tan./elpis');
// 启动 elpis
const app = serverStart({});
自定义服务端
- router-schema
- router
- controller
- service
- extend
- config
前端构建启动方法
const { frontendBuild } = require('@tan./elpis');
frontendBuild(process.env._ENV);
自定义拓展页面
- 在
app/pages/
目录下的所有入口 entry.name.js
dashboard / custom-view 自定义拓展页面
- 在
app/pages/dashboard/xxx
下写页面
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/search-item-config.js