0.1.0 • Published 3 years ago

rock-admin v0.1.0

Weekly downloads
136
License
MIT
Repository
-
Last release
3 years ago

RockAdmin

rock-admin 是基于 Vue3, element-plus, vue-admin-template 的配置化后台构建工具, 核心概念是配置化渲染, 页面根据后端下发的 PageSchema 自动渲染, 辅助可视化PageSchema构造工具, 使常见的后台页面可以无代码实现.

目标

打造一套完整的低代码后台构建工具集, 包含前端和后端的完整链路, 通过可视化搭建, 即可实现常见的后台功能.

体验站点 | 详细文档

也可本地启动示例项目

git clone https://github.com/daodao97/rock-admin.git
cd rock-admin/exmaple
yarn
yarn serve

生态项目

快速上手

使用本项目提供的模板快速创建本地项目

vue create --preset daodao97/rock-admin my-admin
cd my-admin
yarn serve

此时即可得到一个完整功能的后台了

xm4lCR

运行机制

Y66eHA

启动配置项

默认配置可见 src/options

{
  ElementPlus: {
    size: 'small',
    zIndex: 3000,
    locale: locale
  },
  nav: [],
  routes: [],
  globalComps: [],
  mock: { enable: false, apis: [], baseURI: '', defaultMockApi: true },
  use: [],
  config: {
    title: 'RockAdmin',
    fixedHeader: false,
    sidebarLogo: true,
    logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png',
    closeNavNotice: false,
    navBarNotice: '顶部消息提示',
    hasNewMessage: true,
    showPageJsonSchema: true,
    loginTips: '登录信息提示',
    sso: [],
    axios: {
      baseURL: '/api'
    }
  }
}
  • ElementPluselement-plus 默认配置, 文档
  • nav 为 页面顶部导航按钮,
  • routes 为 本地 vue-router 路由
  • globalComps 为 注册到全局的组件
  • mockapi 模拟数据配置
    • enable 是否启用 mock
    • apis 需要注入的本地模拟接口
    • defaultMockApi 是否启动底层的模拟接口
  • use 底层为 app.use
  • config 为站点配置
    • title 站点名称
    • fixedHeader 顶部导航栏装态
    • sidebarLogo 是否显示logo
    • logo 项目 logo图片地址
    • navBarNotice 项目打开的消息提示
    • showPageJsonSchema 是否显示页面的配置
    • loginTips 登录页面提交表单的提示文字
    • sso 企业微信和钉钉的登录配置
    • axios

组件

VForm 表单组件

props

参数说明类型默认值可选值
modelValue表单各字段默认值Object{}
formItems表单字段配置, 具体见下方Array[]
infoApi表单schema拉取接口, 不为空是将覆盖本地属性String空字符串
saveApi表单保存接口String
options表单配置Object见下方
afterSubmit表单提交后动作Stringgoback/reload
afterReset变动取消按钮点击后动作Stringgoback/reload

options默认值, 其他配置参见 element-plus/form

{
  inline: false, // 行模式
  labelPosition: 'right', 
  labelWidth: '100px',
  submitButton: { // false时则隐藏提交按钮
    show: true,
    type: 'primary',
    text: '提交'
  },
  cancelButton: { // false时则隐藏取消按钮
    show: true,
    type: 'info',
    text: '取消'
  }
}

formItems 表单控件配置

可查看 example 完整样例,

表单控件各项配置说明

[
  {
    type: "input", // 字段类型
    field: "field_name", // 字段名
    label: "展示名",
    value: "", // 字段值, 默认undefind
    info: "表单控件提示信息", // 支持html
    rules: [], // 字段校验规则
    props: {}, // element-plush 组件原生的属性, 如 https://element-plus.gitee.io/#/input-attributes
    options: [], // select/radio/checkbox 等组件的备选项
    col: { span: 12 }, // 控件布局
    section: "" // 表单分片
  }
]
完整控件列表
  • input
  • number
  • number-range
  • select
  • radio
  • checkbox
  • image
  • upload
  • witch
  • icon-select
  • date
  • datetime
  • sub-form
  • cascader
  • cascader-panel
  • codemirror
  • slider
  • transfer
  • color
  • rate

form event

事件名说明回调参数
submit表单提交事件formData
reset表单取消事件
fieldchange字段变动事件function(field, value)
update:modelValue更新事件formData
mounted组件挂载

表单布局

数据版本

VTable 表格组件

props

参数说明类型默认值可选值
filter表单过滤项, 同formItemsArray[]
headers表头Array[]
list默认列表数据Array[]
listApi列表数据拉取接口String
infoApi组件属性拉取接口String
batchButton批量操作按钮Array[]
normalButton表单操作按钮Array[]
rowButton行操作按钮Array[]
showPagination是否显示分页组件Boolentrue
selectedNotice批量选中时的提示文案String/Object
listIncrease编辑模式, 新增行按钮Boolen/Objectfalse
tablePropsElementPlus 表格原始属性 文档Object{ "border":true, "stripe":true, "size":"mini", "rowKey":"id", "lazy":true, "defaultExpandAll":false}

table event

事件名说明回调参数
cell-change行变动事件{index, field, value}

VButton 按钮

props

参数说明类型默认值可选值
text按钮文案String
tips提示文案, 按钮形式是可用String
type按钮类型, 可为 页面跳转/接口请求/表单/列表Stringjump/api/form/list
target目标, 可为 vue-router/path , url, apiString
apitype为api时, 如 {method: 'POST', url: '/test_api’}Object{}
formtype为form时可用, 表单属性Object{}
tabletype为list时可用, 列表属性Object{}

event

事件名说明回调参数
click点击事件function(bnt)
actionapi请求成功事件function(payload)

VButtonGroup 按钮组

props

参数说明类型默认值可选值
type展示类型Stringbuttonbutton/link
buttons按钮配置Array[]

event

事件名说明回调参数
click点击事件function(bnt)
actionapi请求成功事件function(payload)

权限控制

/user/info 接口返回当前用户的resource,

/user/routes 接口返回系统可用资源

系统将在 src/store/modules/user.js line 174 行对可用资源做过滤, 仅保留当前用户有权限的资源列表.

接口协议

接口请求中会统一添加 header 头 Authorization, 值为当前用户 token

响应结构

// 正常情况
{
	code: 0
	payload: {}
}

// 错误情况
{
	code: 400, // 非零
	message: "错误信息"
}

响应码

类似项目

0.1.0

3 years ago

0.0.13-rc

3 years ago

0.0.12-rc

3 years ago

0.0.11-rc

3 years ago

0.0.10-rc

3 years ago

0.0.9-rc

3 years ago

0.0.8-rc

3 years ago

0.0.7-rc

3 years ago

0.0.6-rc

3 years ago

0.0.5-rc

3 years ago

0.0.4-rc

3 years ago

0.0.3-rc

3 years ago

0.0.2-rc

3 years ago

0.0.1-rc

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago