The Smart-API Work Order System is a backend management system developed in Go, featuring a front-end and back-end separation. The back-end uses the Gin framework, while the front-end uses Vue.js and Element UI. This system aims to efficiently handle work order management, including task allocation, execution monitoring, and real-time updates.
简体中文 | English
Based on Gin + Vue + Element UI (or Arco Design/Ant Design), the Smart-API system is a front-end and back-end separated work order management system. Initialization is simple, with just minor database connection configuration needed. The system supports multiple command operations, including database migration commands for simplified initialization.
- S: Specific - Clear and well-defined goals, not ambiguous or vague.
- M: Measurable - Quantifiable metrics to evaluate progress.
- A: Achievable - Realistic and feasible to accomplish.
- R: Relevant - Aligned with work priorities and able to drive outcomes.
- T: Time-bound - Defined timeframe to ensure completion within deadlines.
Default login:
admin
/123456
- Follows RESTful API design standards
- Built on the Gin framework with middleware support (user authentication, CORS, access logs, trace IDs, etc.)
- Casbin-based RBAC access control model
- JWT authentication
- Swagger documentation support (via swaggo)
- GORM-based database storage, with support for multiple databases
- Simple config file mapping for quick setup
- Code generation tool
- Form building tool
- Multi-command mode
- Multi-tenancy support
- TODO: Unit tests
- Custom Work Order Forms: Create custom forms for various work order types.
- Custom Approval Processes: Flexible assignment of approvers and multi-person collaborative approval.
- LDAP Login Support: Compatible with enterprise internal LDAP authentication.
- Work Order Favorites: Multiple users can save frequently used work orders.
- Work Order Management: Comprehensive management of task creation, assignment, tracking, and execution status.
- Work Order Reminders: Send notification messages, including integration with third-party platforms (e.g., Feishu, DingTalk).
- Real-Time Task Monitoring: Real-time updates of task execution status using WebSocket.
- Role-Based Access Control: Fine-grained role and permission management based on Casbin.
- Ratings and Comments: After task completion, users can rate and comment on the work order.
- Log Recording: Detailed operation and task execution logs for auditing and analysis.
- Charts and Stats: Visualized work order statistics, including weekly and monthly reports, and personal submission rankings.
- Multi-Tenancy: Supports multi-tenancy by separating databases for each tenant.
- User Management: Configure system user settings.
- Department Management: Organize company departments and teams.
- Role Management: Manage role-based access control and data permissions.
- Menu Management: Configure system menus, button permissions, and API access.
- Dictionary Management: Manage commonly used fixed data in the system.
- Parameter Management: Dynamically configure system parameters.
- Operation Logs: Record and query system operation logs and error logs.
- Login Logs: Record and query login logs, including abnormal login events.
- API Documentation: Automatically generate API documentation based on business logic.
- Code Generation: Visualized code generation based on database tables for CRUD operations.
- Form Building: Customizable drag-and-drop page layout for forms.
- Service Monitoring: View basic server information.
- Content Management: Demo content management module for quick reference.
- Scheduled Tasks: Automate task execution, supporting both API and function calls.
- User Management: Manage user information and permission assignment.
- Task Center: Manage work order assignment, tracking, and monitoring.
- Work Order Center: Submit and view work orders.
- Process Center: Customize work order types, forms, and approval workflows.
- Role Management: Fine-grained permission control via roles.
- Log Management: Manage system operation and task execution logs.
- Service Monitoring: Real-time monitoring of server performance and status.
- Ratings and Comments: Provide ratings and feedback for completed tasks.
- Backend: Go, Gin, GORM, JWT, Casbin
- Frontend: Vue.js, Element UI, Axios, WebSocket
- Database: MySQL / PostgreSQL / SQLite
- Tools: Docker, Swagger, Git
You need to have Go, Gin, Node.js, and Git installed locally.
- Go 1.18 or later
- Node.js v14.16.0 or later
- npm version 6.14.11 or later
- MySQL or another compatible database
- Docker, Kubernetes (optional)
-
Clone the project:
git clone https://github.com/sunwenbo/smart-api.git cd smart-api
-
Install dependencies:
go mod tidy
-
Configure database connection:
cp config/settings.full.yml config/settings.yml
⚠️ : Modify the database connection information in config/settings.yml to ensure that the database configuration is correct. Create the database manually before you initialize it.- Modify the database information in the configuration file
- Note the configuration data in settings.database
- Confirm the log path
-
Compile
go build -o smart-api main.go
-
Initialize the Database:
# The first configuration requires initializing the database resource information. # Use on macOS or Linux $ ./smart-api migrate -c config/settings.yml # ⚠️ Note: Use on Windows $ smart-api.exe migrate -c config/settings.yml # Start the project; you can also debug it using an IDE. # Use on macOS or Linux $ ./smart-api server -c config/settings.yml # ⚠️ Note: Use on Windows $ smart-api.exe server -c config/settings.yml
-
How to Add Data to the
sys_api
Table:# When the project starts, using `-a true` will automatically add missing interface data. ./smart-api server -c config/settings.yml -a true
-
Update Swagger Documentation Generation:
go generate
-
Start Service:
./smart-api server -c config/settings.yml
-
Local Development Database Migration:
Generate migration files: go run main.go migrate -g true -c config/settings.yml Generate migration files -- system-related: go run main.go migrate -g true -a true -c config/settings.yml After modifying the migration files, execute the command below to start changes: go run main.go migrate -c config/settings.yml Interface management generation: go run main.go server -c config/settings.yml -a false
# windows
env GOOS=windows GOARCH=amd64 go build main.go
# or
# linux
env GOOS=linux GOARCH=amd64 go build main.go
-
Clone the frontend project:
git clone https://github.com/sunwenbo/smart-ui.git cd smart-ui
-
Install dependencies:
npm config set registry https://registry.npmmirror.com/ npm config get registry npm install --legacy-peer-deps
-
Start the development server:
npm run dev
-
Access the address:
Open your browser and visit
http://localhost:9527
to view the frontend interface.
If not deploying locally, you need to initialize the database data first. You can use the locally compiled binary file to execute the following command.
settings.yml
file.
./smart-api migrate -c config/settings.yml
If you are on an ARM architecture locally but want to build an x86 architecture image:
# Build the image
docker buildx build --platform linux/amd64 -t registry.cn-beijing.aliyuncs.com/sunwenbo/smart-api:latest . --load
# Push to the image repository
docker push registry.cn-beijing.aliyuncs.com/sunwenbo/smart-api:latest
# Start the backend service, mount the settings.yml file
docker run -itd \
-p 8000:8000 \
-v /data/config/:/home/service/config/ \
--name smart-api \
registry.cn-beijing.aliyuncs.com/sunwenbo/smart-api:latest
# Build the image
docker buildx build --platform linux/amd64 -t registry.cn-beijing.aliyuncs.com/sunwenbo/smart-ui:latest . --load
# Push to the image repository
docker push registry.cn-beijing.aliyuncs.com/sunwenbo/smart-ui:latest
# Start the frontend service, mount the Nginx configuration file
docker run -itd \
-p 80:80 \
-v /data/default.conf:/etc/nginx/conf.d/default.conf \
--name smart-ui \
registry.cn-beijing.aliyuncs.com/sunwenbo/smart-ui:latest
The method to initialize data is as mentioned above ☝️
cd smart-api/scripts/
bash install.sh
cd smart-ui/scripts/
# Before executing deployment, modify the configurations in the yaml file, such as ingress
bash install.sh
kubectl get cm -n sre
kubectl get pod -n sre
kubectl get ingress -n sre
- Log into the system: Use the default admin account
admin
to log in. - Create a work order: Go to the task management page, click "Create Work Order", fill in the relevant information and assign a handler.
- Task execution monitoring: Through the system's task execution interface, you can view the execution status, results, and logs in real time.
- Work order rating and comments: After the work order is completed, users can rate the work order and use the comment function to record feedback on the processing of the work order.
We welcome community developers to contribute code or provide feedback. If you would like to participate in this project, please follow these steps:
-
Fork this repository: Click the
Fork
button in the upper right corner to copy the project to your GitHub account. -
Clone your fork: Run the following command in the terminal to clone the project to your local machine:
git clone https://github.com/your-username/smart-api-backend.git
-
Create a branch: In the cloned project directory, create a new branch for development:
git checkout -b feature-branch-name
-
Commit your changes: After development, use
git add
andgit commit
to submit your code changes.git add . git commit -m "Describe your changes"
-
Submit a Pull Request: Submit a Pull Request on GitHub, ensuring your code passes all tests and adheres to coding standards.
Database configurations are stored in config/settings.yml
. You can modify the database
configuration items according to your needs.
Create new handling logic in the api
directory and register that route in the router
. The service layer logic should be placed in the service
directory.
During task execution, the system pushes task status updates to the frontend via WebSocket. The frontend uses the WebSocket
interface to receive and dynamically display task execution logs.
The Smart-API work order system is open-sourced under the MIT License. Personal and commercial use and modifications are welcome.
Personal WeChat | WeChat Group 🔥🔥🔥 |
Thanks to the following developers for their contributions to this project:
If you have any questions or suggestions, please submit an issue.
The smart-api
project has always been developed using JetBrains' GoLand IDE, based on free JetBrains Open Source license(s). Thank you for your support.
- go-admin # 非常强大的后端开发框架、内置功能非常丰富
- wfd-vue # 流程设计器
- VForm 一款高效的Vue 2 / Vue3 的低代码表单可视化设计,一键生成源码
- ant-design
- ant-design-pro
- arco-design
- arco-design-pro
- gin
- casbin
- spf13/viper
- gorm
- gin-swagger
- jwt-go
- vue-element-admin
- ruoyi-vue
- form-generator
If you find this project helpful, you can buy the author a cup of ☕️ as encouragement:
Copyright (c) 2022 sunwenbo