@guanjishun/elpis
v1.0.1
Published
这个是一个基于vue+node项目
Readme
这个是一个基于vue+node项目
插件的作用
validate-commit-msg —> 校验git 提交
ghooks -> 能够监听git提交校验等的钩子
nodemon:自动化执行node index.js
cross-env:兼容window系统的设置环境变量 koaStatic:可配置访问路径
koa-bodyparser: Koa 中间件,用于解析 HTTP 请求体(RequesttBody),将 JSON、表单数据(application/x-www-form-urlencoded)、文本等格式的请求体自动解析为 JavaScript 对象,方便在 Koa 应用中直接访问。
log4js:logger.js文件非本地dev环境下日志输出到指定文件
json-schema:用于注释和验证 JSON 文档的结构、约束和数据类型 ajv:校验json-schema准确性
里程2 webpack stats:选项让你更精确地控制 bundle 信息该怎么显示。https://webpack.docschina.org/configuration/stats/
https://cn.vuejs.org/api/compile-time-flags.html#webpack
VUE_OPTIONS_API: 'true',//启用/禁用选项式 API 支持。禁用此功能将减小打包结果的体积,但如果第三方库依赖选项式 API,则可能影响兼容性。 VUE_PROD_DEVTOOLS:'false',//在生产环境中启用/禁用开发者工具支持。启用会在打包结果中包含更多代码,因此建议仅在调试时启用此功能。 VUE_PROD_HYDRATION_MISMATCH_DETAILS: 'false',//启用/禁用生产环境构建下激活 (hydration) 不匹配的详细警告。启用会在打包结果中包含更多代码,因此建议仅在调试时启用此功能。
model配置
{
mode: 'dashboard',//不同模板类型对应不一样的模板数据结构
name: '',//名称
desc: '',//描述
icon: '',//icon
homePage: '',//首页(配置)
menu: [{
key: '',//菜单唯一描述
name: '',//菜单名称
menuType: '',//头部菜单枚举值,group/module
//当menuType==group时(tab栏下拉),可填
subMenu: [{
//可递归 menuItem
}, ...],
// 当menuType==module时(普通tab栏),可填
moduleType: '',//枚举值:sider(侧边菜单)/iframe/custom/schema
//当moduleType == sider时
siderConfig: {
menu: [{
//可递归 menuItem(除moduleType===sider)
}]
},
//当moduleType == iframe时
iframeConfig: {
path: '',//路径
},
//当moduleType == custom时
customConfig: {
path: '',//路径
},
//当moduleType == schema时
schemaConfig: {
api: '',//数据源api(遵循restful规范)
schema: {//模块数据结构
type: 'object',
properties: {
key: {
...schema,//标准schema配置
type: '',//字段类型
label: '',//字段中文名
//字段在table中的相关配置
tableOption: {
...elTableColumnConfig,//标准的el-table-column配置
toFixed: 2,//两位小数
visible: true,//默认true
},
//字段在search bar中的相关配置
searchOption: {
...eleComponentConfig,//标准el-table-column配置
comType: "",//组件类型input/select/dynamiSelect等
default: "",//默认值
enumList: [],//可选下拉comType:select
api: "",//comType=dynamiSelect选择
},
//字段在不同状态component中的相关配置,前缀对应componentConfig中的键值
//如:componentConfig.createForm对应createFormOption
//字段在createForm中相关配置
createFormOption: {
...eleComponentConfig,//标准el-component配置
comType: "",//控件类型,input/select/input-number等等
visible: true,//默认true
disabled: false,//是否禁用。默认false
default: "",//默认值
//comType=select时生效
enumList: [],//枚举列表
},
editFormOption: {
...eleComponentConfig,//标准el-component配置
comType: "",//控件类型,input/select/input-number等等
visible: true,//默认true
disabled: false,//是否禁用。默认false
default: "",//默认值
//comType=select时生效
enumList: [],//枚举列表
},
detailPanelOption: {
...eleComponentConfig,//标准el-component配置
}
},
...
},
required: []
},
//table相关配置
tableConfig: {
headerButtons: [{
label: '',//按钮名称
eventKey: "",//事件名
eventOption: {
//当eventKey=showComponent
comName: "",//组件名称
},
...elButtonConfig,//标准的el-button配置
}, ...],
rowButtons: [{
label: '',//按钮名称
eventKey: "remove",//事件名
eventOption: {
//当eventKey=showComponent
comName: "",//组件名称
params: {
//当paramKey==="remove"
//当rowValueKey===参数值(当格式为schema::tableKey的时候,到table中找相应的字段)
//如传参数 user_id: schema:: user_id
paramKey: rowValueKey
}
},
...elButtonConfig,//标准的el-button配置
}, ...]
},
//seach_bar相关配置
searchConfig: {},
//动态组件相关配置
componentConfig: {
//create-form表单相关配置
createForm: {
title: "",//表单标题
saveBtnText: "",//保存按钮文案
},
//编辑表单相关配置
editForm: {
mainKey: "",//主键id
title: "",//表单标题
saveBtnText: "",//保存按钮文案
},
detailPanel: {
mainKey: "",//主键id
title: "",//表单标题
saveBtnText: "",//保存按钮文案
}
//...支持用户动态拓展
}
},
}, ...]
}服务端启动
const {serverStart}=require("@guanjishun/elpis");
//启动elpis服务
const app = serverStart({})自定义服务端
- router-schema
- router
- controller
- service
- extend
- config
前端构建
const {frontendBuild}=require("@guanjishun/elpis")
//编译构建前端工程
frontendBuild(process.env._ENV)自定义页面拓展
- 在
app/pages/目录下写入口entry.xxx.js
dashboard/custom-view 自定义页面扩展(菜单目录等布局)
- 在
app/pages/dashboard/xxxx下写页面
dashboard/shcema-view/components 动态组件扩展
1.在 app/pages/dashboard/complex-view/schema-view/components下写组件
2.配置到 app/p@ges/dashboard/complex-view/schema-view/components/component-config.js
schema-form 控件扩展
1.在 app/widgets/schema-form/complex-view下写控件
2.配置到 app/widgets/schema-form/form-item-config.js
schema-search-bar 控件扩展
1.在app/widgets/schema-search-bar/complex-view下写控件
2.配置到 ‘app/widgets/schema-search-bar/search-item-config.js
