Compare commits

..
3 Commits
Author SHA1 Message Date
wenjianzhang 1c0060fd14 Merge pull request #429 from go-admin-team/1.3.x
fix🐛 修复查询bug
2021-05-28 17:28:12 +08:00
wenjianzhang 7d7fc530d1 Merge pull request #427 from go-admin-team/1.3.x
fix🐛 修复参数根据id获取功能
2021-05-23 18:23:13 +08:00
wenjianzhang 5e10b631f6 fix🐛 修复部门数据权限 2021-05-22 23:34:44 +08:00
21 changed files with 437 additions and 479 deletions
-289
View File
@@ -1,289 +0,0 @@
# go-admin
<img align="right" width="320" src="https://gitee.com/mydearzwj/image/raw/master/img/go-admin.svg">
[![Build Status](https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg)](https://github.com/go-admin-team/go-admin)
[![Release](https://img.shields.io/github/release/go-admin-team/go-admin.svg?style=flat-square)](https://github.com/go-admin-team/go-admin/releases)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/go-admin-team/go-admin)
[English](https://github.com/go-admin-team/go-admin/blob/master/README.md) | 简体中文
基于Gin + Vue + Element UI的前后端分离权限管理系统,系统初始化极度简单,只需要配置文件中,修改数据库连接,系统支持多指令操作,迁移指令可以让初始化数据库信息变得更简单,服务指令可以很简单的启动api服务
[在线文档](https://doc.go-admin.dev)
[github在线文档](https://wenjianzhang.github.io)
[gitee在线文档](http://mydearzwj.gitee.io/go-admin-doc/)
[前端项目](https://github.com/go-admin-team/go-admin-ui)
[视频教程](https://space.bilibili.com/565616721/channel/detail?cid=125737)
## ✨ 特性
- 遵循 RESTful API 设计规范
- 基于 GIN WEB API 框架,提供了丰富的中间件支持(用户认证、跨域、访问日志、追踪ID等)
- 基于Casbin的 RBAC 访问控制模型
- JWT 认证
- 支持 Swagger 文档(基于swaggo)
- 基于 GORM 的数据库存储,可扩展多种类型数据库
- 配置文件简单的模型映射,快速能够得到想要的配置
- 代码生成工具
- 表单构建工具
- 多指令模式
- TODO: 单元测试
## 🎁 内置
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识,接口权限等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
9. 登录日志:系统登录日志记录查询包含登录异常。
1. 接口文档:根据业务代码自动生成相关的api接口文档。
1. 代码生成:根据数据表结构生成对应的增删改查相对应业务,全程可视化操作,让基本业务可以零代码实现。
1. 表单构建:自定义页面样式,拖拉拽实现页面布局。
1. 服务监控:查看一些服务器的基本信息。
1. 内容管理:demo功能,下设分类管理、内容管理。可以参考使用方便快速入门。
## 准备工作
你需要在本地安装 [go] [gin] [node](http://nodejs.org/) 和 [git](https://git-scm.com/)
同时配套了系列教程包含视频和文档,如何从下载完成到熟练使用,强烈建议大家先看完这些教程再来实践本项目!!!
### 轻松实现go-admin写出第一个应用 - 文档教程
[步骤一 - 基础内容介绍](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial01.html)
[步骤二 - 实际应用 - 编写增删改查](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial02.html)
### 手把手教你从入门到放弃 - 视频教程
[如何启动go-admin](https://www.bilibili.com/video/BV1z5411x7JG)
[使用生成工具轻松实现业务](https://www.bilibili.com/video/BV1Dg4y1i79D)
[v1.1.0版本代码生成工具-释放双手](https://www.bilibili.com/video/BV1N54y1i71P) [进阶]
[多命令启动方式讲解以及IDE配置](https://www.bilibili.com/video/BV1Fg4y1q7ph)
[go-admin菜单的配置说明](https://www.bilibili.com/video/BV1Wp4y1D715) [必看]
[如何配置菜单信息以及接口信息](https://www.bilibili.com/video/BV1zv411B7nG) [必看]
[go-admin权限配置使用说明](https://www.bilibili.com/video/BV1rt4y197d3) [必看]
[go-admin数据权限使用说明](https://www.bilibili.com/video/BV1LK4y1s71e) [必看]
**如有问题请先看上述使用文档和文章,若不能满足,欢迎 issue 和 pr ,视频教程和文档持续更新中**
## 📦 本地开发
### 开发目录创建
```bash
# 创建开发目录
mkdir goadmin
cd goadmin
```
### 获取代码
> 重点注意:两个项目必须放在同一文件夹下;
```bash
# 获取后端代码
git clone https://github.com/go-admin-team/go-admin.git
# 获取前端代码
git clone https://github.com/go-admin-team/go-admin-ui.git
```
### 启动说明
#### 服务端启动说明
```bash
# 进入 go-admin 后端项目
cd ./go-admin
# 编译项目
go build
# 修改配置
# 文件路径 go-admin/config/settings.yml
vi ./config/setting.yml
# 1. 配置文件中修改数据库信息
# 注意: settings.database 下对应的配置数据
# 2. 确认log路径
```
:::tip ⚠️注意 在windows环境如果没有安装中CGO,会出现这个问题;
```bash
E:\go-admin>go build
# github.com/mattn/go-sqlite3
cgo: exec /missing-cc: exec: "/missing-cc": file does not exist
```
or
```bash
D:\Code\go-admin>go build
# github.com/mattn/go-sqlite3
cgo: exec gcc: exec: "gcc": executable file not found in %PATH%
```
[解决cgo问题进入](https://doc.go-admin.dev/guide/other/faq.html#_5-cgo-exec-missing-cc-exec-missing-cc-file-does-not-exist)
:::
#### 初始化数据库,以及服务启动
``` bash
# 首次配置需要初始化数据库资源信息
# macOS or linux 下使用
$ ./go-admin migrate -c=config/settings.dev.yml
# ⚠️注意:windows 下使用
$ go-admin.exe migrate -c=config/settings.dev.yml
# 启动项目,也可以用IDE进行调试
# macOS or linux 下使用
$ ./go-admin server -c config/settings.yml
# ⚠️注意:windows 下使用
$ go-admin.exe server -c config/settings.yml
```
#### 使用docker 编译启动
```shell
# 编译镜像
docker build -t go-admin .
# 启动容器,第一个go-admin是容器名字,第二个go-admin是镜像名称
# -v 映射配置文件 本地路径:容器路径
docker run --name go-admin -p 8000:8000 -v /config/settings.yml:/config/settings.yml -d go-admin-server
```
#### 文档生成
```bash
go generate
```
#### 交叉编译
```bash
# windows
env GOOS=windows GOARCH=amd64 go build main.go
# or
# linux
env GOOS=linux GOARCH=amd64 go build main.go
```
### UI交互端启动说明
```bash
# 安装依赖
npm install
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npm.taobao.org
# 启动服务
npm run dev
```
## 🎬 在线体验
> admin / 123456
演示地址:[http://www.go-admin.dev](http://www.go-admin.dev/#/login)
## 📨 互动
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/wx.png" width="180px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq2.png" width="200px"></td>
</tr>
<tr>
<td>微信</td>
<td>此群已满</td>
<td><a target="_blank" href="https://shang.qq.com/wpa/qunwpa?idkey=0f2bf59f5f2edec6a4550c364242c0641f870aa328e468c4ee4b7dbfb392627b"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流乙号" title="go-admin技术交流乙号"></a></td>
</tr>
</table>
## 💎 主要成员
<a href="https://github.com/wenjianzhang"> <img src="https://avatars.githubusercontent.com/u/3890175?s=460&u=20eac63daef81588fbac611da676b99859319251&v=4" width="80px"></a>
<a href="https://github.com/lwnmengjing"> <img src="https://avatars.githubusercontent.com/u/12806223?s=400&u=a89272dce50100b77b4c0d5c81c718bf78ebb580&v=4" width="80px"></a>
<a href="https://github.com/chengxiao"> <img src="https://avatars.githubusercontent.com/u/1379545?s=460&u=557da5503d0ac4a8628df6b4075b17853d5edcd9&v=4" width="80px"></a>
<a href="https://github.com/bing127"> <img src="https://avatars.githubusercontent.com/u/31166183?s=460&u=c085bff88df10bb7676c8c0351ba9dcd031d1fb3&v=4" width="80px"></a>
## JetBrains 开源证书支持
`go-admin` 项目一直以来都是在 JetBrains 公司旗下的 GoLand 集成开发环境中进行开发,基于 **free JetBrains Open Source license(s)** 正版免费授权,在此表达我的谢意。
<a href="https://www.jetbrains.com/?from=kubeadm-ha" target="_blank"><img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/jetbrains/jetbrains-variant-4.png" width="250" align="middle"/></a>
## 🤝 特别感谢
1. [chengxiao](https://github.com/chengxiao)
2. [gin](https://github.com/gin-gonic/gin)
2. [casbin](https://github.com/casbin/casbin)
2. [spf13/viper](https://github.com/spf13/viper)
2. [gorm](https://github.com/jinzhu/gorm)
2. [gin-swagger](https://github.com/swaggo/gin-swagger)
2. [jwt-go](https://github.com/dgrijalva/jwt-go)
2. [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
2. [ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue)
2. [form-generator](https://github.com/JakHuang/form-generator)
## 🤟 打赏
> 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink:
<img class="no-margin" src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/pay.png" height="200px" >
## 🤝 链接
[Go开发者成长线路图](http://www.golangroadmap.com/)
## 🔑 License
[MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md)
Copyright (c) 2020 wenjianzhang
+221
View File
@@ -0,0 +1,221 @@
# go-admin
![build](https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg) ![license](https://img.shields.io/github/license/mashape/apistatus.svg)
English | [简体中文](./README.zh-CN.md)
##### Gin + Vue + Element UI based scaffolding for front and back separation management system
## ✨ Feature
- Follow RESTful API design specifications
- Provides rich middleware support based on GIN WEB API framework (user authentication, cross domain, access log, tracking ID, etc.)
- Casbin-based RBAC access control model
- JWT certification
- Support Swagger documentation (based on swaggo)
- GORM-based database storage that can expand many types of databases
- Simple model mapping of configuration files to quickly get the desired configuration
- Form builder
- Multi command mode
- TODO: unit test
## 🎁 Built-in functions
1. User management: The user is the system operator. This function mainly completes the system user configuration.
2. Department management: configure the system organization (company, department, group), and display the tree structure to support data permissions.
3. Post management: Configure system users to hold positions.
4. Menu management: configure system menus, operation permissions, button permission labels, etc.
5. Role management: role menu permissions assignment, setting roles to divide data range permissions by organization.
6. Dictionary management: to maintain some fixed data often used in the system.
7. Parameter management: Dynamically configure common parameters for the system.
8. Operation log: system normal operation log record and query; system exception information log record and query.
9. Login log: The system login log record query contains login exceptions.
10. System interface: Automatically generate related api interface documents according to business code.
11. Multi command mode code generation: according to the data table structure to generate the corresponding business, all visual programming, basic business can be 0 code.
12. Form construction: Customize page style, drag and drop to achieve page layout.
13. Service monitoring: view the basic information of some servers.
## 🗞 System architecture
<p align="center">
<img src="https://gitee.com/mydearzwj/image/raw/d9f59ea603e3c8a3977491a1bfa8f122e1a80824/img/go-admin-system.png" width="936px" height="491px">
</p>
## 📦 Local development
### Create development directory
```bash
mkdir goadmin
cd goadmin
```
### Get code
> Key points: two projects must be placed in the same folder;
```bash
# Get backend code
git clone https://github.com/go-admin-team/go-admin.git
# Get front end code
git clone https://github.com/go-admin-team/go-admin-ui.git
```
### Start up instructions
#### Server startup instructions
```bash
# Enter the go-admin backend project
cd ./go-admin
# Compile project
go build
# Configuration
# file path go-admin/config/settings.yml
vi ./config/setting.yml
# 1. Modifying database information in configuration file
# settings.database Corresponding configuration data under
# 2. Confirm log path
```
#### Initialize the database and start the service
```
# The first configuration needs to initialize the database resource information
./go-admin migrate -c config/settings.yml
# Start the project, you can also debug with IDE
./go-admin server -c config/settings.yml
```
#### Using docker to compile and start
```shell
# Compile image
docker build -t go-admin .
# Start the container. The first go admin is the container name and the second go admin is the image name
docker run --name go-admin -p 8000:8000 -v /config/settings.yml:/config/settings.yml -d go-admin
```
#### Document generation
```bash
go generate
```
#### Cross compiling
```bash
env GOOS=windows GOARCH=amd64 go build main.go
# or
env GOOS=linux GOARCH=amd64 go build main.go
```
### UI interactive terminal startup description
```bash
# Installation dependency
npm install
# It is recommended that you do not use cnpm to install dependencies directly. There will be all kinds of weird bugs. The problem of slow download speed of NPM can be solved by the following operations
npm install --registry=https://registry.npm.taobao.org
# Start the service
npm run dev
```
## 🎬 Online Demo
> admin / 123456
Demo:[http://www.go-admin.dev](http://www.go-admin.dev/#/login)
## 📨 Interaction
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/wx.png" width="180px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq2.png" width="200px"></td>
</tr>
<tr>
<td>WeChat</td>
<td>This QQ group is full</td>
<td><a target="_blank" href="https://shang.qq.com/wpa/qunwpa?idkey=0f2bf59f5f2edec6a4550c364242c0641f870aa328e468c4ee4b7dbfb392627b"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流乙号" title="go-admin技术交流乙号"></a></td>
</tr>
</table>
## 💎 Member
<a href="https://github.com/wenjianzhang"> <img src="https://avatars.githubusercontent.com/u/3890175?s=460&u=20eac63daef81588fbac611da676b99859319251&v=4" width="80px"></a>
<a href="https://github.com/lwnmengjing"> <img src="https://avatars.githubusercontent.com/u/12806223?s=400&u=a89272dce50100b77b4c0d5c81c718bf78ebb580&v=4" width="80px"></a>
<a href="https://github.com/chengxiao"> <img src="https://avatars.githubusercontent.com/u/1379545?s=460&u=557da5503d0ac4a8628df6b4075b17853d5edcd9&v=4" width="80px"></a>
<a href="https://github.com/bing127"> <img src="https://avatars.githubusercontent.com/u/31166183?s=460&u=c085bff88df10bb7676c8c0351ba9dcd031d1fb3&v=4" width="80px"></a>
## JetBrains Open source certificate support
The go admin project has always been developed in the GoLand integrated development environment of JetBrains company, based on the * * free JetBrains open source license (s) * * genuine free license. I would like to express my thanks.
<a href="https://www.jetbrains.com/?from=kubeadm-ha" target="_blank"><img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/jetbrains/jetbrains-variant-4.png" width="250" align="middle"/></a>
## 🤝 Open source projects used
[gin](https://github.com/gin-gonic/gin)
[casbin](https://github.com/casbin/casbin)
[spf13/viper](https://github.com/spf13/viper)
[gorm](https://github.com/jinzhu/gorm)
[gin-swagger](https://github.com/swaggo/gin-swagger)
[jwt-go](https://github.com/dgrijalva/jwt-go)
[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
[ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue)
## 🤝 Thanks
2. [chengxiao](https://github.com/chengxiao)
## License
[MIT](https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md)
Copyright (c) 2020 wenjianzhang
[中文]qq technical exchange group: 74520518
+155 -120
View File
@@ -1,141 +1,164 @@
# go-admin
<img align="right" width="320" src="https://gitee.com/mydearzwj/image/raw/master/img/go-admin.svg">
<p align="center">
<img width="320" src="https://gitee.com/mydearzwj/image/raw/master/img/go-admin.svg">
</p>
[![Build Status](https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg)](https://github.com/go-admin-team/go-admin)
[![Release](https://img.shields.io/github/release/go-admin-team/go-admin.svg?style=flat-square)](https://github.com/go-admin-team/go-admin/releases)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/go-admin-team/go-admin)
English | [简体中文](https://github.com/go-admin-team/go-admin/blob/master/README.Zh-cn.md)
The front-end and back-end separation authority management system based on Gin + Vue + Element UI is extremely simple to initialize the system. You only need to modify the database connection in the configuration file. The system supports multi-instruction operations. Migration instructions can make it easier to initialize database information. Service instructions It's easy to start the api service.
[documentation](https://doc.go-admin.dev)
[Front-end project](https://github.com/go-admin-team/go-admin-ui)
[Video tutorial](https://space.bilibili.com/565616721/channel/detail?cid=125737)
## ✨ Feature
- Follow RESTful API design specifications
- Based on the GIN WEB API framework, it provides rich middleware support (user authentication, cross-domain, access log, tracking ID, etc.)
- RBAC access control model based on Casbin
- JWT authentication
- Support Swagger documents (based on swaggo)
- Database storage based on GORM, which can expand multiple types of databases
- Simple model mapping of configuration files to quickly get the desired configuration
- Code generation tool
- Form builder
- Multi-command mode
- TODO: unit test
<p align="center">
<a href="https://github.com/wenjianzhang/go-admin">
<img src="https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg" alt="go-admin">
</a>
<a href="https://github.com/wenjianzhang/go-admin">
<img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="license">
</a>
<a href="http://doc.zhangwj.com/go-admin-site/donate/">
<img src="https://img.shields.io/badge/%24-donate-ff69b4.svg" alt="donate">
</a>
</p>
## 🎁 Internal
[English](https://github.com/go-admin-team/go-admin/blob/master/README.en.md) | 简体中文
1. User management: The user is the system operator, this function mainly completes the system user configuration.
2. Department management: configure the system organization (company, department, group), and display the tree structure to support data permissions.
3. Position management: configure the positions of system users.
4. Menu management: configure the system menu, operation authority, button authority identification, interface authority, etc.
5. Role management: Role menu permission assignment and role setting are divided into data scope permissions by organization.
6. Dictionary management: Maintain some relatively fixed data frequently used in the system.
7. Parameter management: dynamically configure common parameters for the system.
8. Operation log: system normal operation log record and query; system abnormal information log record and query.
9. Login log: The system login log record query contains login exceptions.
1. Interface documentation: Automatically generate related api interface documents according to the business code.
1. Code generation: According to the data table structure, generate the corresponding addition, deletion, modification, and check corresponding business, and the whole process of visual operation, so that the basic business can be implemented with zero code.
1. Form construction: Customize the page style, drag and drop to realize the page layout.
1. Service monitoring: View the basic information of some servers.
1. Content management: demo function, including classification management and content management. You can refer to the easy to use quick start.
## Ready to work
##### 基于Gin + Vue + Element UI的前后端分离权限管理系统
You need to install locally [go] [gin] [node](http://nodejs.org/) 和 [git](https://git-scm.com/)
系统初始化极度简单,只需要配置文件中,修改数据库连接,系统启动后会自动初始化数据库信息以及必须的基础数据
At the same time, a series of tutorials including videos and documents are provided. How to complete the downloading to the proficient use, it is strongly recommended that you read these tutorials before you practice this project! ! !
[在线文档](https://doc.go-admin.dev)
### Easily implement go-admin to write the first application-documentation tutorial
[github在线文档](https://wenjianzhang.github.io)
[Step 1 - basic content introduction](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial01.html)
[gitee在线文档](http://mydearzwj.gitee.io/go-admin-doc/)
[Step 2 - Practical application - writing database operations](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial02.html)
[前端项目](https://github.com/go-admin-team/go-admin-ui)
### Teach you from getting started to giving up-video tutorial
[视频教程](https://space.bilibili.com/565616721/channel/detail?cid=125737)
[How to start go-admin](https://www.bilibili.com/video/BV1z5411x7JG)
## ✨ 特性
[Easily implement business using build tools](https://www.bilibili.com/video/BV1Dg4y1i79D)
- 遵循 RESTful API 设计规范
[v1.1.0 version code generation tool-free your hands](https://www.bilibili.com/video/BV1N54y1i71P) [Advanced]
- 基于 GIN WEB API 框架,提供了丰富的中间件支持(用户认证、跨域、访问日志、追踪ID等)
[Explanation of multi-command startup mode and IDE configuration](https://www.bilibili.com/video/BV1Fg4y1q7ph)
- 基于Casbin的 RBAC 访问控制模型
[Configuration instructions for go-admin menu](https://www.bilibili.com/video/BV1Wp4y1D715) [Must see]
- JWT 认证
[How to configure menu information and interface information](https://www.bilibili.com/video/BV1zv411B7nG) [Must see]
- 支持 Swagger 文档(基于swaggo)
[go-admin permission configuration instructions](https://www.bilibili.com/video/BV1rt4y197d3) [Must see]
- 基于 GORM 的数据库存储,可扩展多种类型数据库
[Instructions for use of go-admin data permissions](https://www.bilibili.com/video/BV1LK4y1s71e) [Must see]
- 配置文件简单的模型映射,快速能够得到想要的配置
**If you have any questions, please read the above-mentioned usage documents and articles first. If you are not satisfied, welcome to issue and pr. Video tutorials and documents are being updated continuously.**
- 代码生成工具
## 📦 Local development
- 表单构建工具
### Development directory creation
- 多命令模式
- TODO: 单元测试
## 🎁 内置
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
9. 登录日志:系统登录日志记录查询包含登录异常。
10. 系统接口:根据业务代码自动生成相关的api接口文档。
11. 代码生成:根据数据表结构生成对应的增删改查相对应业务,全部可视化编程,基本业务可以0代码实现。
12. 表单构建:自定义页面样式,拖拉拽实现页面布局。
13. 服务监控:查看一些服务器的基本信息。
## 准备工作
你需要在本地安装 [go] [gin] [node](http://nodejs.org/) 和 [git](https://git-scm.com/)
同时配套了系列教程包含视频和文档,如何从下载完成到熟练使用,强烈建议大家先看完这些教程再来实践本项目!!!
### 轻松实现go-admin写出第一个应用 - 文档教程
[步骤一 - 基础内容介绍](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial01.html)
[步骤二 - 实际应用 - 编写增删改查](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial02.html)
### 手把手教你从入门到放弃 - 视频教程
[如何启动go-admin](https://www.bilibili.com/video/BV1z5411x7JG)
[使用生成工具轻松实现业务](https://www.bilibili.com/video/BV1Dg4y1i79D)
[v1.1.0版本代码生成工具-释放双手](https://www.bilibili.com/video/BV1N54y1i71P) [进阶]
[多命令启动方式讲解以及IDE配置](https://www.bilibili.com/video/BV1Fg4y1q7ph)
[go-admin菜单的配置说明](https://www.bilibili.com/video/BV1Wp4y1D715) [必看]
[如何配置菜单信息以及接口信息](https://www.bilibili.com/video/BV1zv411B7nG) [必看]
[go-admin权限配置使用说明](https://www.bilibili.com/video/BV1rt4y197d3) [必看]
[go-admin数据权限使用说明](https://www.bilibili.com/video/BV1LK4y1s71e) [必看]
**如有问题请先看上述使用文档和文章,若不能满足,欢迎 issue 和 pr ,视频教程和文档持续更新中**
## 🗞 系统架构
<p align="center">
<img src="https://gitee.com/mydearzwj/image/raw/d9f59ea603e3c8a3977491a1bfa8f122e1a80824/img/go-admin-system.png" width="936px" height="491px">
</p>
## 📦 本地开发
### 开发目录创建
```bash
# Create a development directory
# 创建开发目录
mkdir goadmin
cd goadmin
```
### Get the code
### 获取代码
> Important note: the two projects must be placed in the same folder;
> 重点注意:两个项目必须放在同一文件夹下;
```bash
# Get backend code
# 获取后端代码
git clone https://github.com/go-admin-team/go-admin.git
# Get the front-end code
# 获取前端代码
git clone https://github.com/go-admin-team/go-admin-ui.git
```
### Startup instructions
#### Server startup instructions
### 启动说明
#### 服务端启动说明
```bash
# Enter the go-admin backend project
# 进入 go-admin 后端项目
cd ./go-admin
# Compile the project
# 编译项目
go build
# Change setting
# File path go-admin/config/settings.yml
# 修改配置
# 文件路径 go-admin/config/settings.yml
vi ./config/setting.yml
# 1. Modify the database information in the configuration file
# Note: The corresponding configuration data under settings.database
# 2. Confirm the log path
# 1. 配置文件中修改数据库信息
# 注意: settings.database 下对应的配置数据
# 2. 确认log路径
```
:::tip ⚠️Note that this problem will occur if CGO is not installed in the windows environment;
:::tip ⚠️注意 在windows环境如果没有安装中CGO,会出现这个问题;
```bash
E:\go-admin>go build
@@ -151,49 +174,50 @@ D:\Code\go-admin>go build
cgo: exec gcc: exec: "gcc": executable file not found in %PATH%
```
[Solve the cgo problem and enter](https://doc.go-admin.dev/guide/other/faq.html#_5-cgo-exec-missing-cc-exec-missing-cc-file-does-not-exist)
[解决cgo问题进入](https://doc.go-admin.dev/guide/other/faq.html#_5-cgo-exec-missing-cc-exec-missing-cc-file-does-not-exist)
:::
#### Initialize the database, and start the service
#### 初始化数据库,以及服务启动
``` bash
# The first configuration needs to initialize the database resource information
# Use under macOS or linux
# 首次配置需要初始化数据库资源信息
# macOS or linux 下使用
$ ./go-admin migrate -c=config/settings.dev.yml
# ⚠️Note: Use under windows
# ⚠️注意:windows 下使用
$ go-admin.exe migrate -c=config/settings.dev.yml
# Start the project, you can also use the IDE for debugging
# Use under macOS or linux
# 启动项目,也可以用IDE进行调试
# macOS or linux 下使用
$ ./go-admin server -c config/settings.yml
# ⚠️Note: Use under windows
# ⚠️注意:windows 下使用
$ go-admin.exe server -c config/settings.yml
```
#### Use docker to compile and start
#### 使用docker 编译启动
```shell
# Compile the image
# 编译镜像
docker build -t go-admin .
# Start the container, the first go-admin is the container name, and the second go-admin is the image name
# -v Mapping configuration file Local path: container path
# 启动容器,第一个go-admin是容器名字,第二个go-admin是镜像名称
# -v 映射配置文件 本地路径:容器路径
docker run --name go-admin -p 8000:8000 -v /config/settings.yml:/config/settings.yml -d go-admin-server
```
#### Generation Document
#### 文档生成
```bash
go generate
```
#### Cross compile
#### 交叉编译
```bash
# windows
env GOOS=windows GOARCH=amd64 go build main.go
@@ -203,36 +227,41 @@ env GOOS=windows GOARCH=amd64 go build main.go
env GOOS=linux GOARCH=amd64 go build main.go
```
### UI interactive terminal startup instructions
### UI交互端启动说明
```bash
# Installation dependencies
npm install # or cnpm install
# 安装依赖
npm install
# Start service
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npm.taobao.org
# 启动服务
npm run dev
```
## 🎬 Online Demo
## 🎬 在线体验
> admin / 123456
演示地址:[http://www.go-admin.dev](http://www.go-admin.dev/#/login)
## 📨 Interactive
## 📨 互动
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/wx.png" width="180px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq2.png" width="200px"></td>
</tr>
<tr>
<td>Wechat</td>
<td>微信</td>
<td>此群已满</td>
<td><a target="_blank" href="https://shang.qq.com/wpa/qunwpa?idkey=0f2bf59f5f2edec6a4550c364242c0641f870aa328e468c4ee4b7dbfb392627b"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流乙号" title="go-admin技术交流乙号"></a></td>
</tr>
</table>
## 💎 Members
## 💎 主要成员
<a href="https://github.com/wenjianzhang"> <img src="https://avatars.githubusercontent.com/u/3890175?s=460&u=20eac63daef81588fbac611da676b99859319251&v=4" width="80px"></a>
<a href="https://github.com/lwnmengjing"> <img src="https://avatars.githubusercontent.com/u/12806223?s=400&u=a89272dce50100b77b4c0d5c81c718bf78ebb580&v=4" width="80px"></a>
@@ -241,14 +270,14 @@ npm run dev
## JetBrains open source certificate support
## JetBrains 开源证书支持
The `go-admin` project has always been developed in the GoLand integrated development environment under JetBrains, based on the **free JetBrains Open Source license(s)** genuine free license. I would like to express my gratitude.
`go-admin` 项目一直以来都是在 JetBrains 公司旗下的 GoLand 集成开发环境中进行开发,基于 **free JetBrains Open Source license(s)** 正版免费授权,在此表达我的谢意。
<a href="https://www.jetbrains.com/?from=kubeadm-ha" target="_blank"><img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/jetbrains/jetbrains-variant-4.png" width="250" align="middle"/></a>
## 🤝 Thanks
## 🤝 特别感谢
1. [chengxiao](https://github.com/chengxiao)
2. [gin](https://github.com/gin-gonic/gin)
2. [casbin](https://github.com/casbin/casbin)
@@ -258,19 +287,25 @@ The `go-admin` project has always been developed in the GoLand integrated develo
2. [jwt-go](https://github.com/dgrijalva/jwt-go)
2. [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
2. [ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue)
2. [form-generator](https://github.com/JakHuang/form-generator)
## 🤟 Sponsor Us
## 🤟 打赏
> 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink:
> If you think this project helped you, you can buy a glass of juice for the author to show encouragement :tropical_drink:
<img class="no-margin" src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/pay.png" height="200px" >
## 🤝 Link
[Go developer growth roadmap](http://www.golangroadmap.com/)
## ❤️ 赞助者
> 有部分是微信名称
zhuqiyun LLL狐 星星之火 cjj770 Sam 唐*i 晓聪 aLong *渊 海马 魏镇坪 + 111 *哥 我的宇哥哥 *声 *节
## 🤝 链接
[Go开发者成长线路图](http://www.golangroadmap.com/)
## 🔑 License
[MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md)
Copyright (c) 2020 wenjianzhang
Copyright (c) 2020 wenjianzhang
+1 -1
View File
@@ -24,7 +24,7 @@ func (e SysJob) RemoveJobForService(c *gin.Context) {
return
}
var v dto.GeneralDelDto
err = c.BindUri(&v)
err = c.Bind(&v)
if err != nil {
log.Warnf("参数验证错误, error: %s", err)
e.Error(http.StatusUnprocessableEntity, err, "参数验证失败")
+3 -7
View File
@@ -2,7 +2,6 @@ package service
import (
"errors"
common "go-admin/common/models"
"gorm.io/gorm"
@@ -72,13 +71,10 @@ func (e *SysChinaAreaData) InsertSysChinaAreaData(model *models.SysChinaAreaData
// UpdateSysChinaAreaData 修改SysChinaAreaData对象
func (e *SysChinaAreaData) UpdateSysChinaAreaData(c *models.SysChinaAreaData, p *actions.DataPermission) error {
db := e.Orm.Model(&models.SysChinaAreaData{
Model: common.Model{
Id: c.GetId().(int),
}}).
db := e.Orm.Model(c).
Scopes(
actions.Permission(c.TableName(), p),
).Updates(c)
).Where(c.GetId()).Updates(c)
if err := db.Error; err != nil {
e.Log.Errorf("Service UpdateSysChinaAreaData error: %s", err)
return err
@@ -107,4 +103,4 @@ func (e *SysChinaAreaData) RemoveSysChinaAreaData(d *dto.SysChinaAreaDataById, p
return errors.New("无权删除该数据")
}
return nil
}
}
+5 -6
View File
@@ -5,7 +5,6 @@ import (
"go-admin/app/admin/models/system"
"go-admin/app/admin/service/dto"
cDto "go-admin/common/dto"
common "go-admin/common/models"
"go-admin/common/service"
"gorm.io/gorm"
)
@@ -85,9 +84,8 @@ func (e *SysConfig) InsertSysConfig(model *system.SysConfig) error {
func (e *SysConfig) UpdateSysConfig(c *system.SysConfig) error {
var err error
db := e.Orm.Model(&system.SysConfig{Model: common.Model{
Id: c.GetId().(int),
}}).Updates(c)
db := e.Orm.Model(c).
Where(c.GetId()).Updates(c)
err = db.Error
if err != nil {
e.Log.Errorf("Service UpdateSysConfig error:%s", err)
@@ -105,7 +103,8 @@ func (e *SysConfig) RemoveSysConfig(d *dto.SysConfigById, c *system.SysConfig) e
var err error
var data system.SysConfig
db := e.Orm.Model(&data).Delete(c, d.Ids)
db := e.Orm.Model(&data).
Where(d.Ids).Delete(c)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Service RemoveSysConfig error:%s", err)
@@ -130,4 +129,4 @@ func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigControl) error {
}
return nil
}
}
+9 -4
View File
@@ -4,6 +4,7 @@ import (
"errors"
log "github.com/go-admin-team/go-admin-core/logger"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
"gorm.io/gorm"
"go-admin/app/admin/models/system"
@@ -84,9 +85,9 @@ func (e *SysDept) InsertSysDept(model *system.SysDept) error {
// UpdateSysDept 修改SysDept对象
func (e *SysDept) UpdateSysDept(c *system.SysDept) error {
var err error
db := e.Orm.Model(&system.SysDept{
DeptId: c.GetId().(int),
}).
var data system.SysDept
db := e.Orm.Model(&data).
Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error:%s", err)
@@ -96,6 +97,9 @@ func (e *SysDept) UpdateSysDept(c *system.SysDept) error {
return errors.New("无权更新该数据")
}
//参数1:是要修改的数据
//参数2:是修改的数据
return nil
}
@@ -104,7 +108,8 @@ func (e *SysDept) RemoveSysDept(d *dto.SysDeptById) error {
var err error
var data system.SysDept
db := e.Orm.Model(&data).Delete(&data, d.GetId())
db := e.Orm.Model(&data).
Where(d.GetId()).Delete(&data)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
+6 -4
View File
@@ -71,9 +71,10 @@ func (e *SysDictData) Insert(model *system.SysDictData) error {
// Update 修改对象
func (e *SysDictData) Update(c *system.SysDictData) error {
var err error
db := e.Orm.Model(&system.SysDictData{
DictCode: c.GetId().(int),
}).Updates(c)
var data system.SysDictData
db := e.Orm.Model(&data).
Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error: %s", err)
return err
@@ -90,7 +91,8 @@ func (e *SysDictData) Remove(d *dto.SysDictDataById, c *system.SysDictData) erro
var err error
var data system.SysDictData
db := e.Orm.Model(&data).Delete(c, d.GetId())
db := e.Orm.Model(&data).
Where(d.GetId()).Delete(c)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
+6 -4
View File
@@ -71,9 +71,10 @@ func (e *SysDictType) Insert(model *system.SysDictType) error {
// Update 修改对象
func (e *SysDictType) Update(c *system.SysDictType) error {
var err error
db := e.Orm.Model(&system.SysDictType{
ID: c.GetId().(int),
}).Updates(c)
var data system.SysDictType
db := e.Orm.Model(&data).
Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error: %s", err)
return err
@@ -90,7 +91,8 @@ func (e *SysDictType) Remove(d *dto.SysDictTypeById, c *system.SysDictType) erro
var err error
var data system.SysDictType
db := e.Orm.Model(&data).Delete(c, d.GetId())
db := e.Orm.Model(&data).
Where(d.GetId()).Delete(c)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
+3 -4
View File
@@ -3,7 +3,6 @@ package service
import (
"errors"
"fmt"
"go-admin/app/admin/models/system"
"gorm.io/gorm"
@@ -92,10 +91,10 @@ func (e *SysFileDir) UpdateSysFileDir(c *dto.SysFileDirControl, p *actions.DataP
var err error
data, _ := c.GenerateM()
db := e.Orm.Model(&system.SysRole{RoleId: c.GetId().(int)}).
db := e.Orm.
Scopes(
actions.Permission(data.TableName(), p),
).Updates(data)
).Where(c.ID).Updates(data)
if db.Error != nil {
e.Log.Errorf("db error: %s", err)
return err
@@ -114,7 +113,7 @@ func (e *SysFileDir) RemoveSysFileDir(d *dto.SysFileDirById, p *actions.DataPerm
db := e.Orm.Model(&data).
Scopes(
actions.Permission(data.TableName(), p),
).Delete(&data, d.Id)
).Where(d.Id).Delete(&data)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
+3 -6
View File
@@ -2,7 +2,6 @@ package service
import (
"errors"
common "go-admin/common/models"
"gorm.io/gorm"
@@ -90,12 +89,10 @@ func (e *SysFileInfo) UpdateSysFileInfo(c *dto.SysFileInfoControl, p *actions.Da
e.Log.Errorf("db error: %s", err)
return err
}
err = e.Orm.Debug().Model(&models.SysFileInfo{Model: common.Model{
Id: c.ID,
}}).
err = e.Orm.Debug().Model(&data).
Scopes(
actions.Permission(data.TableName(), p),
).Updates(&data).Error
).Where("id = ?", c.ID).Updates(&data).Error
if err != nil {
e.Log.Errorf("db error: %s", err)
return err
@@ -115,7 +112,7 @@ func (e *SysFileInfo) RemoveSysFileInfo(d *dto.SysFileInfoById, p *actions.DataP
db := e.Orm.Model(&data).
Scopes(
actions.Permission(data.TableName(), p),
).Delete(&data, d.GetId())
).Where(d.GetId()).Delete(&data)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
+2 -1
View File
@@ -19,7 +19,8 @@ type SysJob struct {
func (e *SysJob) RemoveJob(c *dto.GeneralDelDto) error {
var err error
var data models.SysJob
err = e.Orm.Table(data.TableName()).First(&data, c.Id).Error
data.JobId = c.Id
err = e.Orm.Table(data.TableName()).First(&data).Error
if err != nil {
e.Log.Errorf("db error: %s", err)
return err
+3 -2
View File
@@ -75,7 +75,7 @@ func (e *SysLoginLog) UpdateSysLoginLog(c common.ActiveRecord) error {
var data system.SysLoginLog
db := e.Orm.Model(&data).
Where("id = ?", c.GetId()).Updates(c)
Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error:%s", err)
return err
@@ -92,7 +92,8 @@ func (e *SysLoginLog) RemoveSysLoginLog(d *dto.SysLoginLogById, c common.ActiveR
var err error
var data system.SysLoginLog
db := e.Orm.Model(&data).Delete(c, d.Ids)
db := e.Orm.Model(&data).
Where(d.Ids).Delete(c)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
+3 -2
View File
@@ -107,7 +107,7 @@ func (e *SysMenu) UpdateSysMenu(c *system.SysMenu) error {
var data system.SysMenu
db := e.Orm.Model(&data).
Where("menu_id = ?", c.GetId()).Updates(c)
Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error:%s", err)
return err
@@ -124,7 +124,8 @@ func (e *SysMenu) RemoveSysMenu(d *dto.SysMenuById) error {
var err error
var data system.SysMenu
db := e.Orm.Model(&data).Delete(&data, d.GetId())
db := e.Orm.Model(&data).
Where(d.GetId()).Delete(&data)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
+4 -6
View File
@@ -5,7 +5,6 @@ import (
"go-admin/app/admin/models/system"
"go-admin/app/admin/service/dto"
cDto "go-admin/common/dto"
common "go-admin/common/models"
"go-admin/common/service"
"gorm.io/gorm"
)
@@ -69,9 +68,8 @@ func (e *SysOperaLog) InsertSysOperaLog(model *system.SysOperaLog) error {
func (e *SysOperaLog) UpdateSysOperaLog(c *system.SysOperaLog) error {
var err error
db := e.Orm.Model(&system.SysOperaLog{Model: common.Model{
Id: c.GetId().(int),
}}).Updates(c)
db := e.Orm.Model(c).
Where(c.GetId()).Updates(c)
if err = db.Error; err != nil {
e.Log.Errorf("Service UpdateSysOperaLog error:%s", err.Error())
return err
@@ -88,7 +86,7 @@ func (e *SysOperaLog) RemoveSysOperaLog(d *dto.SysOperaLogById) error {
var err error
var data system.SysOperaLog
db := e.Orm.Model(&data).Delete(&data, d.Ids)
db := e.Orm.Model(&data).Where(d.Ids).Delete(&data)
if err = db.Error; err != nil {
e.Log.Errorf("Service RemoveSysOperaLog error:%s", err.Error())
return err
@@ -97,4 +95,4 @@ func (e *SysOperaLog) RemoveSysOperaLog(d *dto.SysOperaLogById) error {
return errors.New("无权删除该数据")
}
return nil
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ func (e *SysPost) UpdateSysPost(c *system.SysPost) error {
var data system.SysPost
db := e.Orm.Model(&data).
Where("post_id = ?", c.GetId()).Updates(c)
Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error:%s", err)
return err
+2 -2
View File
@@ -104,7 +104,7 @@ func (e *SysRole) UpdateSysRole(c *system.SysRole) error {
}
}()
db := tx.Model(&c).
Where(" role_id = ?", c.GetId()).Updates(c)
Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error:%s", err)
return err
@@ -221,4 +221,4 @@ func (e *SysRole) UpdateDataScope(c *system.SysRole) (err error) {
}
}
return err
}
}
+4 -4
View File
@@ -83,7 +83,7 @@ func (e *SysUser) UpdateSysUser(c common.ActiveRecord, p *actions.DataPermission
db := e.Orm.Model(c).
Scopes(
actions.Permission(c.TableName(), p),
).Where("user_id = ?", c.GetId()).Updates(c)
).Where(c.GetId()).Updates(c)
if db.Error != nil {
e.Log.Errorf("db error: %s", err)
return err
@@ -103,7 +103,7 @@ func (e *SysUser) RemoveSysUser(d cDto.Control, c common.ActiveRecord, p *action
db := e.Orm.Model(&data).
Scopes(
actions.Permission(data.TableName(), p),
).Delete(c, d.GetId())
).Where(d.GetId()).Delete(c)
if db.Error != nil {
err = db.Error
e.Log.Errorf("Delete error: %s", err)
@@ -128,7 +128,7 @@ func (e *SysUser) UpdateSysUserPwd(id int, oldPassword, newPassword string, p *a
err = e.Orm.Model(c).
Scopes(
actions.Permission(c.TableName(), p),
).Where("user_id = ?", id).Select("UserId", "Password", "Salt").First(c).Error
).Where(id).Select("UserId", "Password", "Salt").First(c).Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return errors.New("无权更新该数据")
@@ -148,7 +148,7 @@ func (e *SysUser) UpdateSysUserPwd(id int, oldPassword, newPassword string, p *a
return err
}
c.Password = newPassword
db := e.Orm.Model(c).Where("user_id = ?", id).Select("Password", "Salt").Updates(c)
db := e.Orm.Model(c).Where(id).Select("Password", "Salt").Updates(c)
if err = db.Error; err != nil {
e.Log.Errorf("db error: %s", err)
return err
-3
View File
@@ -82,9 +82,6 @@ func setup() {
log.Fatalf("queue setup error, %s\n", err.Error())
}
sdk.Runtime.SetQueueAdapter(queueAdapter)
defer func() {
go queueAdapter.Run()
}()
}
//7. 设置分布式锁
+1 -1
View File
@@ -2,7 +2,7 @@ package global
const (
// Version go-admin Version Info
Version = "1.3.10"
Version = "1.3.7"
)
var (
+5 -12
View File
@@ -9,8 +9,8 @@
{{- if ($x) -}}
<el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}">
{{- if ne .FkTableName "" -}}
<el-select v-model="queryParams.{{.JsonField}}"
placeholder="请选择" clearable size="small" {{if eq .IsEdit "false" -}} :disabled="isEdit" {{- end }}>
<el-select v-model="form.{{.JsonField}}"
placeholder="请选择" {{if eq .IsEdit "false" -}} :disabled="isEdit" {{- end }}>
<el-option
v-for="dict in {{.JsonField}}Options"
:key="dict.key"
@@ -101,17 +101,9 @@
{{- end -}}
{{- if eq .DictType "" -}}
{{- if eq .HtmlType "datetime" -}}
<el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}"
:show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ "{{" }} parseTime(scope.row.{{.JsonField}}) {{"}}"}}</span>
</template>
</el-table-column>
{{- else -}}
<el-table-column label="{{.ColumnComment}}" align="center" prop="{{.JsonField}}"
:show-overflow-tooltip="true"/>
{{- end -}}
{{- end -}}
{{- end -}}
{{- end }}
@@ -294,7 +286,8 @@
// 表单校验
rules: {
{{- range .Columns -}}
{{- if eq .IsRequired "1" -}}
{{- $x := .IsQuery -}}
{{- if ($x) -}}
{{.JsonField}}:
[
{required: true, message: '{{.ColumnComment}}不能为空', trigger: 'blur'}