@eric_0331/elpis
v1.0.3
Published
```javascript { mode: "dashboard", name: "我的仪表盘", desc: "我的仪表盘", icon: "dashboard", // 图标 homePath: "/home", // 首页路径 // 菜单配置 menu: [ { key: "home", // 菜单key name: "首页", // 菜单名称 menuType: "group", //菜单类型 grou
Readme
##一个企业级框架,通过全栈实现,包括前端、后端、数据库、服务器部署等
module配置
{
mode: "dashboard",
name: "我的仪表盘",
desc: "我的仪表盘",
icon: "dashboard", // 图标
homePath: "/home", // 首页路径
// 菜单配置
menu: [
{
key: "home", // 菜单key
name: "首页", // 菜单名称
menuType: "group", //菜单类型 group or module
// 子菜单 只有在menuType为group时才有效 menuList
subMenu: [],
// 只有在menuType为module时才有效
moduleType: "", // 模块类型sidebar or iframe or custom or schema
// 模块配置 moduleType == sidebar 时有效
sidebarConfig: {
menu: [], // 侧边栏菜单列表 menuList 除了moduleType == sidebar
},
// 模块配置 moduleType == iframe 时有效
iframeConfig: {
path: "", // iframe路径
},
// 模块配置 moduleType == custom 时有效
customConfig: {
path: "", // 自定义模块路径
},
// 模块配置 moduleType == schema 时有效
schemaConfig: {
api: "", // 数据源Api 遵循 RESTful规范 GET POST PUT DELETE get/xxx/list
method: "GET", // 数据源Api 请求方法
schema: {
// 板块数据结构
type: "object",
properties: {
key: {
// ...schema 标准字段
type: "",
label: "",
// 字段在table中的相关配置
tableConfig: {
// ...标准 el-table-column 组件配置
toFixed: 2, // 字段 保留小数位数
visible: true, // 字段 是否在表格中显示 默认为true
},
// 字段在search-bar搜索中的相关配置
searchOption: {
// ...eleComponentConfig 标准 el 中的组件配置
comType: "input", //配置组件类型 input or select or radio or checkbox or date or datetime or time or week or month or year
default: "", //默认值
enumList: [], // 下拉选项列表
api: "", // 下拉选项列表Api 遵循 RESTful规范 GET POST PUT DELETE get/xxx/list
},
},
// 不同动态组件 的相关配置、按前缀命名
// 如 componentConfig.createForm 对应 createFormOption
createFormOption: {
// ...eleComponentConfig 标准 el 中的组件配置
comType: "input", //配置组件类型 input or select or radio or checkbox or date or datetime or time or week or month or year
visible: true, // 字段 是否在表格中显示 默认为true
disabled: false, // 字段 是否禁用 默认为false
default: "", //默认值
//comType 为select时,enumList 为下拉选项列表
enumList: [], // 下拉选项列表
api: "", // 下拉选项列表Api 遵循 RESTful规范 GET POST PUT DELETE get/xxx/list
},
// 编辑表单相关配置
editFormOption: {
// ...eleComponentConfig 标准 el 中的组件配置
comType: "input", //配置组件类型 input or select or radio or checkbox or date or datetime or time or week or month or year
visible: true, // 字段 是否在表格中显示 默认为true
disabled: false, // 字段 是否禁用 默认为false
default: "", //默认值
//comType 为select时,enumList 为下拉选项列表
enumList: [], // 下拉选项列表
api: "", // 下拉选项列表Api 遵循 RESTful规范 GET POST PUT DELETE get/xxx/list
},
detailPanelOption: {
// ...eleComponentConfig 标准 el 中的组件配置
},
},
required: [], // 必填字段
},
tableConfig: {
headerButton: [
{
label: "", // 按钮标签
eventKey: "", // 按钮事件key
eventOption: {
// 当eventKey为showComponent时,params为组件配置
comName: "createForm", // 组件名称
params: {
// params参数 键值key
// 当格式为 schema::fieldName 时,会自动从rowData中获取该字段值作为参数值
paramKey: "rowValueKey",
},
}, // 按钮事件参数
// ...标准 el-button 组件配置
},
], // 表格头部按钮配置
rowButton: [
{
label: "", // 按钮标签
eventKey: "", // 按钮事件key
eventOption: {
params: {
// params参数 键值key
// 当格式为 schema::fieldName 时,会自动从rowData中获取该字段值作为参数值
paramKey: "schema::id",
},
}, // 按钮事件参数
// ...标准 el-button 组件配置
},
], // 表格行按钮配置
}, // schema数据表格配置
// schema数据搜索配置 search-bar组件配置
searchConfig: {},
// 动态组件 相关配置
componentConfig: {
createForm: {
title: "", // 表单标题
saveBtnText: "保存", // 保存按钮文本
},
editForm: {
mainKey: "id",
title: "", // 表单标题
saveBtnText: "保存", // 保存按钮文本
},
detailPanel: {
mainKey: "id",
title: "", // 详情面板标题
},
},
},
},
],
}服务端启动
const { serverStart } = require("@eric_0331/elpis");
// 启动服务器
const app = serverStart({
name: "elpis-demo",
homePath: "/view/project-list",
});自定义服务端
- router-schema
- router
- controller
- service
- extend
- config
前端构建
const { frontendBuild } = require("@eric_0331/elpis");
// 前端工程化构建
frontendBuild(process.cwd());自定义页面扩展
- 在
app/pages目录下创建自定义页面目录 - 在自定义页面目录下创建
index.js文件 - 在
index.js文件中导出自定义页面组件
dashboard / custom-view 自定义页面扩展
- 在
app/pages/dashboard目录下创建自定义页面目录 - 在自定义页面目录下创建
index.js文件 - 在
index.js文件中导出自定义页面组件
自定义组件扩展
- 在
app/pages/widgets目录下创建自定义组件目录 - 在自定义组件目录下创建
index.js文件 - 在
index.js文件中导出自定义组件组件
schema-form 自定义组件扩展
- 在
app/pages/widgets/schema-form目录下创建自定义组件目录 - 在自定义组件目录下创建
index.js文件 - 在
index.js文件中导出自定义组件组件
schema-search-bar 自定义组件扩展
- 在
app/pages/widgets/schema-search-bar目录下创建自定义组件目录 - 在自定义组件目录下创建
index.js文件 - 在
index.js文件中导出自定义组件组件
