1.0.0 • Published 8 months ago

@qkccc/elpis v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

#elpis

一个企业级全栈应用框架

model配置

 {
  mode: 'dashboard', // 模板类型,不同版本类型对应不一样的模板数据结构
  name: '',
  desc: '',
  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 遵从RESTFUL规范
        schema: { // 板块数据结构
          type: 'object',
          properties: {
            key: {
              ...schema, // 标准schema配置
              type: '', // 字段类型
              label: '', // 字段中文名
              // 字段在table中的配置
              tableOptions: {
                ...elTableColumnConfig, // 标准el-table-column配置
                visible: true, // 是否显示
                toFixed: 0, // 小数位数
              },
              // 字段在search-bar中的配置
              searchOptions: {
                ...elComponentConfig, // 标准el-component-column配置
                comType: '', // 组件类型
                default: '', // 默认值

                // 当comType = select时,可填
                enumList: [
                  {
                    label: '',
                    value: '',
                  },
                ],

                // 当comType = dynamicSelect时,可填
                api: '', // 数据源API 遵从RESTFUL规范
              },
              // 字段在不同component中的配置,前缀对应componentConfig中的键值
              // 例如 componentConfig.createForm. 这里对应createFormOption
              createFormOption: {
                // 字段在create-form表单中的配置
                ...elComponentConfig, // 标准el-component配置
                comType: '', // 组件类型
                visible: true, // 是否显示
                disabled: false, // 是否禁用
                default: '', // 默认值

                // comType = select时,可填
                enumList: [
                  {
                    label: '',
                    value: '',
                  },
                ],
                
              },
              // edit-form表单中的配置
              editFormOption: {
                ...elComponentConfig, // 标准el-component配置
                comType: '', // 组件类型
                visible: true, // 是否显示
                disabled: false, // 是否禁用
                default: '', // 默认值

                // comType = select时,可填
                enumList: [
                  {
                    label: '',
                    value: '',
                  },
                ],
              },
              // detail-panel详情面板中的配置
              detailPanelOption: {
                ...elComponentConfig, // 标准el-component配置
              },
            },
            required: [], // 必填字段
            ...
          },
          tableConfig: {
            headerButtons: [
              {
                label: '', // 按钮名称
                eventKey:'', // 按钮事件名
                // 按钮具体配置
                eventOption: {
                  // 当eventKey === 'showComponent'时,可填
                  comName: '', // 组件名称
                },
                ...elButtonConfig, // 标准el-button配置
              },
              ...
            ], // 头部按钮
            rowButtons: [
              {
                label: '', // 按钮名称
                eventKey:'', // 按钮事件名
                eventOption: {
                  // 例如 eventKey = 'remove'
                  params: {
                    // paramKey: 参数的键
                    // rowValueKey: 参数的值(当格式为schema::tableKey时,到table中找相应的字段)
                    paramKey: rowValueKey,
                    // user_id: 'schema::user_id',
                  }
                }, // 按钮具体配置
                ...elButtonConfig, // 标准el-button配置
              },
              ...
            ], // 行按钮
          }, // table相关配置
          searchConfig: {}, // search-bar相关配置
          // 动态组件配置
          componentConfig: {
            // create-form表单相关配置 
            createForm: {
              title: '', // 表单标题
              saveBtnText: '', // 保存按钮文本
            },
            // edit-form表单相关配置
            editForm: {
              mainKey: '', // 主键 用于唯一标识要修改的对象
              title: '', // 表单标题
              saveBtnText: '', // 保存按钮文本
            },
            // detail-panel详情面板相关配置
            detailPanel: {
              mainKey: '', // 主键 用于唯一标识要修改的对象
              title: '', // 详情面板标题
            },
          },
          components: {}, // 模块组件
        }
      },
    },
    ...
  ]
 }

服务端启动

const { serverStart } = require('@qkccc/elpis');

// 启动elpis服务
const app = serverStart({})

自定义服务端

  • router-schema
  • router
  • controller
  • service
  • extend
  • config

前端构建

const { frontendBuildStart } = require('@qkccc/elpis');

// 启动前端构建
frontendBuildStart(process.env._ENV);

自定义页面扩展

  • app/pages目录下写entry.xxx.js

dashboard/custom-view 自定义页面扩展

  • app/pages/dashboard/xxx目录下写页面

dashboard/schema-view/components 动态组件扩展

  1. app/pages/dashboard/complex-view/schema-view/components目录下写组件
  2. 配置在app/pages/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