zant-admin 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +6 -0
- package/.env.development +3 -0
- package/.env.production +1 -0
- package/.env.test +1 -0
- package/.gitignore +36 -0
- package/.prettierrc.json +9 -0
- package/README.en.md +461 -272
- package/README.md +4 -3
- package/bin/cli.js +1 -1
- package/eslint.config.js +30 -0
- package/index.html +13 -0
- package/jsconfig.json +8 -0
- package/package.json +11 -3
- package/src/App.vue +16 -16
- package/src/api/methods/logError.js +8 -8
- package/src/api/methods/logOperation.js +8 -8
- package/src/api/methods/login.js +6 -6
- package/src/api/methods/quartz.js +36 -36
- package/src/api/methods/region.js +16 -16
- package/src/api/methods/sysAccount.js +29 -29
- package/src/api/methods/sysDict.js +29 -29
- package/src/api/methods/sysDictItem.js +26 -26
- package/src/api/methods/sysMenu.js +42 -42
- package/src/api/methods/sysRole.js +35 -35
- package/src/api/methods/sysUser.js +25 -25
- package/src/api/methods/system.js +15 -15
- package/src/api/request.js +225 -225
- package/src/assets/css/zcui.css +1023 -1023
- package/src/components/IconPicker.vue +351 -351
- package/src/components/MainPage.vue +838 -838
- package/src/components/details/logErrorDetails.vue +58 -58
- package/src/components/details/logOperationDetails.vue +76 -76
- package/src/components/edit/QuartzEdit.vue +221 -221
- package/src/components/edit/SysAccountEdit.vue +185 -185
- package/src/components/edit/SysDictEdit.vue +116 -116
- package/src/components/edit/SysDictItemEdit.vue +136 -136
- package/src/components/edit/SysRoleEdit.vue +111 -111
- package/src/config/index.js +74 -74
- package/src/directives/permission.js +49 -49
- package/src/main.js +37 -37
- package/src/stores/config.js +43 -43
- package/src/stores/dict.js +33 -33
- package/src/stores/menu.js +81 -81
- package/src/stores/user.js +21 -21
- package/src/utils/baseEcharts.js +661 -661
- package/src/utils/dictTemplate.js +26 -26
- package/src/utils/regionUtils.js +173 -173
- package/src/utils/useFormCRUD.js +59 -59
- package/src/views/baiscstatis/center.vue +474 -474
- package/src/views/baiscstatis/iframePage.vue +29 -29
- package/src/views/baiscstatis/notFound.vue +192 -192
- package/src/views/console.vue +821 -821
- package/src/views/demo/button.vue +269 -269
- package/src/views/demo/importexport.vue +119 -119
- package/src/views/demo/region.vue +322 -322
- package/src/views/demo/statistics.vue +214 -214
- package/src/views/home.vue +6 -6
- package/src/views/operations/log/logError.vue +78 -78
- package/src/views/operations/log/logLogin.vue +66 -66
- package/src/views/operations/log/logOperation.vue +103 -103
- package/src/views/operations/log/logQuartz.vue +56 -56
- package/src/views/operations/quartz.vue +179 -179
- package/src/views/operations/serviceMonitoring.vue +134 -134
- package/src/views/system/sysAccount.vue +128 -128
- package/src/views/system/sysDict.vue +159 -159
- package/src/views/system/sysDictItem.vue +118 -118
- package/src/views/system/sysMenu.vue +225 -225
- package/src/views/system/sysRole.vue +207 -207
- package/vite.config.js +33 -0
package/README.en.md
CHANGED
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
<div align="center">
|
|
7
7
|
|
|
8
|
-

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
10
11
|

|
|
11
12
|

|
|
12
13
|
|
|
13
|
-
[Live Demo](http://106.13.37.129:8123) | [Backend Project](https://gitee.com/zchty/zant-core)
|
|
14
|
+
[Live Demo](http://106.13.37.129:8123) | [Backend Project](https://gitee.com/zchty/zant-core) | [Changelog](./CHANGELOG.md)
|
|
14
15
|
|
|
15
16
|
</div>
|
|
16
17
|
|
|
@@ -21,405 +22,593 @@
|
|
|
21
22
|
- [Project Structure](#project-structure)
|
|
22
23
|
- [Quick Start](#quick-start)
|
|
23
24
|
- [Core Features](#core-features)
|
|
24
|
-
- [Project
|
|
25
|
-
- [
|
|
25
|
+
- [Project Highlights](#project-highlights)
|
|
26
|
+
- [API Interface](#api-interface)
|
|
27
|
+
- [Browser Support](#browser-support)
|
|
28
|
+
- [Contributing](#contributing)
|
|
26
29
|
- [License](#license)
|
|
27
30
|
|
|
28
31
|
## Introduction
|
|
29
32
|
|
|
30
|
-
ZAntAdmin is a modern frontend management system built with Vue 3.5 + Vite + Ant Design Vue 4.2.6
|
|
31
|
-
|
|
32
|
-
###
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
ZAntAdmin is a modern frontend management system built with **Vue 3.5 + Vite + Ant Design Vue 4.2.6**. It adopts the latest frontend technology stack and provides comprehensive features including user authentication, permission management, dynamic routing, data visualization, and more — ideal for rapid development of enterprise-level management systems.
|
|
34
|
+
|
|
35
|
+
### ✨ Key Features
|
|
36
|
+
|
|
37
|
+
- 🚀 **Latest Tech Stack** - Built with Vue 3.5, Vite 7, Ant Design Vue 4 and other cutting-edge technologies
|
|
38
|
+
- 🔐 **Robust Permission System** - Token-based authentication, dynamic routing, role-based access control
|
|
39
|
+
- 📦 **Rich Component Library** - Encapsulated common business components like FormTable, IconPicker, etc.
|
|
40
|
+
- 🎨 **Modern UI** - Enterprise-grade design system based on Ant Design Vue
|
|
41
|
+
- 📱 **Responsive Design** - Adapts to desktop, tablet and other devices
|
|
42
|
+
- 🛠️ **CLI Scaffold** - Quick project generation tool with multiple template options
|
|
43
|
+
- 📊 **Data Visualization** - Integrated ECharts library with rich data display capabilities
|
|
44
|
+
- 🌍 **i18n Ready** - Reserved internationalization interfaces for multi-language extension
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### 🖼️ Preview
|
|
48
|
+
|
|
49
|
+
<table>
|
|
50
|
+
<tr>
|
|
51
|
+
<td align="center">
|
|
52
|
+
<img src="./src/assets/imgs/md/login.png" alt="Login Page" width="280">
|
|
53
|
+
<br>Login Page
|
|
54
|
+
</td>
|
|
55
|
+
<td align="center">
|
|
56
|
+
<img src="./src/assets/imgs/md/console.png" alt="Dashboard" width="280">
|
|
57
|
+
<br>Dashboard
|
|
58
|
+
</td>
|
|
59
|
+
<td align="center">
|
|
60
|
+
<img src="./src/assets/imgs/md/serviceMonitoring.png" alt="Service Monitoring" width="280">
|
|
61
|
+
<br>Service Monitoring
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
<tr>
|
|
65
|
+
<td align="center">
|
|
66
|
+
<img src="./src/assets/imgs/md/statistics.png" alt="Statistics" width="280">
|
|
67
|
+
<br>Statistics
|
|
68
|
+
</td>
|
|
69
|
+
<td align="center">
|
|
70
|
+
<img src="./src/assets/imgs/md/menu.png" alt="Menu Management" width="280">
|
|
71
|
+
<br>Menu Management
|
|
72
|
+
</td>
|
|
73
|
+
</tr>
|
|
74
|
+
</table>
|
|
41
75
|
|
|
42
76
|
## Technical Architecture
|
|
43
77
|
|
|
44
78
|
### Core Framework
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
|
|
80
|
+
| Technology | Version | Description |
|
|
81
|
+
|------------|---------|-------------|
|
|
82
|
+
| [Vue](https://vuejs.org/) | 3.5.13 | Progressive JavaScript framework with Composition API and `<script setup>` syntax |
|
|
83
|
+
| [Vite](https://vitejs.dev/) | 7.0.6 | Next-generation frontend build tool with blazing fast dev experience |
|
|
84
|
+
| [Vue Router](https://router.vuejs.org/) | 4.4.5 | Official router supporting dynamic routing and navigation guards |
|
|
85
|
+
| [Pinia](https://pinia.vuejs.org/) | 2.2.6 | Vue's officially recommended state management solution, replacing Vuex |
|
|
49
86
|
|
|
50
87
|
### UI Framework
|
|
51
|
-
|
|
52
|
-
|
|
88
|
+
|
|
89
|
+
| Technology | Version | Description |
|
|
90
|
+
|------------|---------|-------------|
|
|
91
|
+
| [Ant Design Vue](https://antdv.com/) | 4.2.6 | Enterprise-class UI design language and component library |
|
|
92
|
+
| [@ant-design/icons-vue](https://github.com/ant-design/ant-design-icons) | 7.0.1 | Official Ant Design icon library |
|
|
53
93
|
|
|
54
94
|
### Utility Libraries
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
95
|
+
|
|
96
|
+
| Technology | Version | Description |
|
|
97
|
+
|------------|---------|-------------|
|
|
98
|
+
| [Alova](https://alova.js.org/) | 3.2.6 | Next-generation request tool with powerful request management |
|
|
99
|
+
| [Dayjs](https://day.js.org/) | 1.11.13 | Lightweight date library, alternative to Moment.js |
|
|
100
|
+
| [ECharts](https://echarts.apache.org/) | 6.0.0 | Open-source visualization library with rich chart types |
|
|
101
|
+
| [file-saver](https://github.com/eligrey/FileSaver.js) | 2.0.5 | File saving utility for client-side file downloads |
|
|
102
|
+
| [pinia-plugin-persist](https://github.com/Seb-L/pinia-plugin-persist) | 1.0.0 | Pinia state persistence plugin |
|
|
60
103
|
|
|
61
104
|
### Development Tools
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
105
|
+
|
|
106
|
+
| Tool | Version | Description |
|
|
107
|
+
|------|---------|-------------|
|
|
108
|
+
| [ESLint](https://eslint.org/) | 9.12.0 | Code quality checking and linting |
|
|
109
|
+
| [Prettier](https://prettier.io/) | 3.3.3 | Code formatting tool |
|
|
110
|
+
| [vite-plugin-clean](https://github.com/zjxxxxxxxxx/vite-plugin-clean) | 2.0.1 | Plugin to clean old files during build |
|
|
65
111
|
|
|
66
112
|
## Project Structure
|
|
67
113
|
|
|
68
114
|
```
|
|
69
|
-
|
|
70
|
-
├──
|
|
71
|
-
├──
|
|
72
|
-
│ ├──
|
|
115
|
+
zant-admin/
|
|
116
|
+
├── bin/ # CLI scaffold tool
|
|
117
|
+
│ ├── cli.js # CLI entry point
|
|
118
|
+
│ ├── generator.js # Project generator
|
|
119
|
+
│ ├── prompts.js # Interactive prompts
|
|
120
|
+
│ └── utils.js # Utility functions
|
|
121
|
+
├── public/ # Static assets (not processed by build)
|
|
122
|
+
│ └── logo.png # Project logo
|
|
123
|
+
├── src/ # Source code
|
|
124
|
+
│ ├── api/ # API layer
|
|
73
125
|
│ │ ├── methods/ # Module API methods
|
|
74
|
-
│ │
|
|
126
|
+
│ │ │ ├── department.js # Department management API
|
|
127
|
+
│ │ │ ├── employee.js # Employee management API
|
|
128
|
+
│ │ │ ├── login.js # Authentication API
|
|
129
|
+
│ │ │ ├── sysAccount.js # Account management API
|
|
130
|
+
│ │ │ ├── sysDict.js # Dictionary management API
|
|
131
|
+
│ │ │ ├── sysMenu.js # Menu management API
|
|
132
|
+
│ │ │ ├── sysRole.js # Role management API
|
|
133
|
+
│ │ │ └── ... # Other APIs
|
|
134
|
+
│ │ └── request.js # Request configuration
|
|
75
135
|
│ ├── assets/ # Static resources
|
|
76
|
-
│ │ ├── css/ #
|
|
136
|
+
│ │ ├── css/ # Stylesheets
|
|
137
|
+
│ │ │ ├── style.css # Global styles
|
|
138
|
+
│ │ │ └── zcui.css # Custom UI styles
|
|
77
139
|
│ │ └── imgs/ # Image resources
|
|
78
140
|
│ ├── components/ # Common components
|
|
79
141
|
│ │ ├── details/ # Detail components
|
|
80
142
|
│ │ ├── edit/ # Edit components
|
|
81
|
-
│ │
|
|
143
|
+
│ │ │ ├── organizationalStructure/ # Org structure editors
|
|
144
|
+
│ │ │ ├── SysAccountEdit.vue # Account editor
|
|
145
|
+
│ │ │ ├── SysRoleEdit.vue # Role editor
|
|
146
|
+
│ │ │ └── ...
|
|
147
|
+
│ │ ├── FormTable.vue # Universal form table component
|
|
148
|
+
│ │ ├── IconPicker.vue # Icon picker component
|
|
149
|
+
│ │ └── MainPage.vue # Main page layout component
|
|
82
150
|
│ ├── config/ # Configuration files
|
|
83
151
|
│ ├── directives/ # Custom directives
|
|
152
|
+
│ │ └── permission.js # Permission directive v-permission
|
|
84
153
|
│ ├── router/ # Router configuration
|
|
85
|
-
│
|
|
154
|
+
│ │ └── index.js # Router entry
|
|
155
|
+
│ ├── stores/ # Pinia state management
|
|
156
|
+
│ │ ├── config.js # Config state
|
|
157
|
+
│ │ ├── dict.js # Dictionary state
|
|
158
|
+
│ │ ├── menu.js # Menu state
|
|
159
|
+
│ │ └── user.js # User state
|
|
86
160
|
│ ├── utils/ # Utility functions
|
|
161
|
+
│ │ ├── baseEcharts.js # ECharts base configuration
|
|
162
|
+
│ │ ├── dictTemplate.js # Dictionary template utility
|
|
163
|
+
│ │ ├── regionUtils.js # Region utility functions
|
|
164
|
+
│ │ └── useFormCRUD.js # Form CRUD composable
|
|
87
165
|
│ ├── views/ # Page views
|
|
166
|
+
│ │ ├── baiscstatis/ # Basic statistics pages
|
|
167
|
+
│ │ ├── demo/ # Demo pages
|
|
168
|
+
│ │ ├── operations/ # Operations management
|
|
169
|
+
│ │ ├── organizationalStructure/ # Org structure
|
|
170
|
+
│ │ ├── system/ # System management
|
|
171
|
+
│ │ ├── console.vue # Console
|
|
172
|
+
│ │ ├── home.vue # Home page
|
|
173
|
+
│ │ └── login.vue # Login page
|
|
88
174
|
│ ├── App.vue # Root component
|
|
89
175
|
│ └── main.js # Entry file
|
|
176
|
+
├── templates/ # CLI project templates
|
|
90
177
|
├── .env.development # Development environment variables
|
|
91
178
|
├── .env.production # Production environment variables
|
|
92
179
|
├── .env.test # Test environment variables
|
|
93
180
|
├── eslint.config.js # ESLint configuration
|
|
94
181
|
├── .prettierrc.json # Prettier configuration
|
|
95
|
-
├──
|
|
96
|
-
|
|
97
|
-
└── vite.config.js # Vite configuration
|
|
182
|
+
├── vite.config.js # Vite configuration
|
|
183
|
+
└── package.json # Project dependencies
|
|
98
184
|
```
|
|
99
185
|
|
|
100
186
|
## Core Features
|
|
101
187
|
|
|
102
|
-
### 1.
|
|
103
|
-
- Token-based user authentication
|
|
104
|
-
- Dynamic permission control
|
|
105
|
-
- Role management
|
|
106
|
-
- Permission directives (`v-permission`)
|
|
107
|
-
|
|
108
|
-
### 2. Dynamic Routing System
|
|
109
|
-
- Dynamic route loading based on backend menu configuration
|
|
110
|
-
- Route guards for access control
|
|
111
|
-
- Multi-level menu support
|
|
112
|
-
- Route cache control
|
|
113
|
-
|
|
114
|
-
### 3. Data Management
|
|
115
|
-
- Common CRUD operation encapsulation
|
|
116
|
-
- Form validation
|
|
117
|
-
- Data import/export
|
|
118
|
-
- File upload/download
|
|
119
|
-
|
|
120
|
-
### 4. System Management
|
|
121
|
-
- User management
|
|
122
|
-
- Role management
|
|
123
|
-
- Menu management
|
|
124
|
-
- Dictionary management
|
|
125
|
-
- System monitoring
|
|
126
|
-
- Log management
|
|
127
|
-
|
|
128
|
-
### 5. Data Visualization
|
|
129
|
-
- Chart display based on ECharts
|
|
130
|
-
- Statistical analysis pages
|
|
131
|
-
- Data dashboard
|
|
188
|
+
### 🔐 1. Authentication & Permission Management
|
|
132
189
|
|
|
133
|
-
|
|
190
|
+
- **Token-based Authentication** - Stateless authentication via JWT Token
|
|
191
|
+
- **Dynamic Permission Control** - Dynamically assign permissions based on user roles
|
|
192
|
+
- **Role Management** - Support multi-role configuration and permission assignment
|
|
193
|
+
- **Permission Directive** - Custom `v-permission` directive for button-level access control
|
|
194
|
+
- **Route Guards** - Global route guards for access control
|
|
134
195
|
|
|
135
|
-
###
|
|
136
|
-
- Node.js >= 16.0.0 (LTS recommended)
|
|
137
|
-
- npm >= 7.0.0
|
|
196
|
+
### 🛣️ 2. Dynamic Routing System
|
|
138
197
|
|
|
139
|
-
|
|
198
|
+
- **Backend-configured Routes** - Dynamically generate routes from backend menu configuration
|
|
199
|
+
- **Lazy Loading** - On-demand loading of page components for optimized initial load
|
|
200
|
+
- **Multi-level Menu Support** - Support for unlimited menu nesting levels
|
|
201
|
+
- **Route Caching** - Page cache configuration for improved navigation performance
|
|
202
|
+
- **Breadcrumb Navigation** - Auto-generated breadcrumb navigation
|
|
140
203
|
|
|
141
|
-
|
|
204
|
+
### 📊 3. Data Management
|
|
142
205
|
|
|
143
|
-
|
|
206
|
+
- **Universal CRUD** - [useFormCRUD](src/utils/useFormCRUD.js) composable for simplified CRUD operations
|
|
207
|
+
- **Form Validation** - Form validation based on Ant Design Vue
|
|
208
|
+
- **Data Import/Export** - Excel file import and export support
|
|
209
|
+
- **File Upload/Download** - Encapsulated file upload and download functionality
|
|
210
|
+
- **Paginated Queries** - Unified pagination handling
|
|
144
211
|
|
|
145
|
-
|
|
146
|
-
# Install scaffold globally
|
|
147
|
-
npm install -g zant-admin
|
|
212
|
+
### ⚙️ 4. System Management
|
|
148
213
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
214
|
+
| Module | Description |
|
|
215
|
+
|--------|-------------|
|
|
216
|
+
| **User Management** | User CRUD, status management, password reset |
|
|
217
|
+
| **Role Management** | Role configuration, permission assignment, role-user association |
|
|
218
|
+
| **Menu Management** | Menu configuration, permission identifiers, route settings |
|
|
219
|
+
| **Dictionary Management** | Data dictionary maintenance, dictionary item management |
|
|
220
|
+
| **Department Management** | Organizational structure, department hierarchy |
|
|
221
|
+
| **Position Management** | Position information, position-employee association |
|
|
222
|
+
| **Employee Management** | Employee information, employee status management |
|
|
223
|
+
| **System Monitoring** | Service monitoring, online users, data monitoring |
|
|
224
|
+
| **Log Management** | Operation logs, login logs, error logs, scheduled task logs |
|
|
152
225
|
|
|
153
|
-
|
|
226
|
+
### 📈 5. Data Visualization
|
|
154
227
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
228
|
+
- **ECharts Charts** - Integrated ECharts 6.x with multiple chart types
|
|
229
|
+
- **Statistical Analysis Pages** - Data statistics and analysis views
|
|
230
|
+
- **Data Dashboard** - Visual data display panels
|
|
231
|
+
- **Real-time Monitoring** - Live service status monitoring
|
|
159
232
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
233
|
+
## Quick Start
|
|
234
|
+
|
|
235
|
+
### Requirements
|
|
236
|
+
|
|
237
|
+
Before you begin, make sure your environment meets the following requirements:
|
|
238
|
+
|
|
239
|
+
| Environment | Version | Notes |
|
|
240
|
+
|-------------|---------|-------|
|
|
241
|
+
| Node.js | >= 16.0.0 | LTS version recommended |
|
|
242
|
+
| npm | >= 7.0.0 | Or yarn, pnpm |
|
|
243
|
+
| Browser | Modern browsers | Latest Chrome, Firefox, Edge, Safari |
|
|
244
|
+
|
|
245
|
+
### Install CLI Scaffold (Recommended)
|
|
166
246
|
|
|
167
|
-
##### Command Line Arguments
|
|
168
247
|
```bash
|
|
169
|
-
#
|
|
170
|
-
zant-admin create my-project
|
|
248
|
+
# Quick start with npx (Recommended, no global installation needed)
|
|
249
|
+
npx zant-admin create my-project
|
|
171
250
|
|
|
172
|
-
#
|
|
173
|
-
|
|
251
|
+
# Or install globally first
|
|
252
|
+
npm install -g zant-admin
|
|
253
|
+
zant-admin create my-project
|
|
174
254
|
|
|
175
|
-
#
|
|
176
|
-
|
|
255
|
+
# Enter project directory
|
|
256
|
+
cd my-project
|
|
177
257
|
|
|
178
|
-
#
|
|
179
|
-
|
|
258
|
+
# Start development server
|
|
259
|
+
npm run dev
|
|
180
260
|
```
|
|
181
261
|
|
|
182
|
-
|
|
262
|
+
For more scaffold usage, refer to the [CLI Scaffold Tool](#cli-scaffold-tool) section.
|
|
183
263
|
|
|
184
|
-
|
|
185
|
-
Create a new ZAnt Admin project.
|
|
264
|
+
### CLI Scaffold Tool
|
|
186
265
|
|
|
187
|
-
|
|
188
|
-
- `<project-name>`: Project name (required)
|
|
266
|
+
ZAntAdmin provides a powerful CLI scaffold tool to help you quickly create projects.
|
|
189
267
|
|
|
190
|
-
|
|
191
|
-
- `-t, --template <template>`: Project template (default: "default")
|
|
192
|
-
- `-d, --description <description>`: Project description
|
|
193
|
-
- `-a, --author <author>`: Author name
|
|
194
|
-
- `--skip-install`: Skip dependency installation
|
|
195
|
-
- `--no-interactive`: Disable interactive mode
|
|
196
|
-
|
|
197
|
-
##### list-templates Command
|
|
198
|
-
Show available project templates.
|
|
268
|
+
#### Global Installation
|
|
199
269
|
|
|
200
270
|
```bash
|
|
201
|
-
zant-admin
|
|
271
|
+
npm install -g zant-admin
|
|
202
272
|
```
|
|
203
273
|
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
zant-admin --help
|
|
207
|
-
```
|
|
274
|
+
#### Available Commands
|
|
208
275
|
|
|
209
|
-
|
|
276
|
+
| Command | Description | Example |
|
|
277
|
+
|---------|-------------|---------|
|
|
278
|
+
| `create <project-name>` | Create a new project | `zant-admin create my-project` |
|
|
279
|
+
| `list-templates` | List available templates | `zant-admin list-templates` |
|
|
280
|
+
| `--help` | Show help information | `zant-admin --help` |
|
|
281
|
+
| `--version` | Show version number | `zant-admin --version` |
|
|
210
282
|
|
|
211
|
-
#### Project
|
|
283
|
+
#### Create Project Options
|
|
212
284
|
|
|
213
|
-
|
|
214
|
-
-
|
|
215
|
-
|
|
216
|
-
|
|
285
|
+
```bash
|
|
286
|
+
zant-admin create <project-name> [options]
|
|
287
|
+
|
|
288
|
+
Options:
|
|
289
|
+
-t, --template <template> Select project template (default: "default")
|
|
290
|
+
-d, --description <desc> Project description
|
|
291
|
+
-a, --author <author> Author name
|
|
292
|
+
--skip-install Skip dependency installation
|
|
293
|
+
--no-interactive Disable interactive mode
|
|
294
|
+
```
|
|
217
295
|
|
|
218
|
-
|
|
219
|
-
- Contains only core functions
|
|
220
|
-
- Suitable for projects requiring high customization
|
|
221
|
-
- Includes basic pages like login, dashboard, console
|
|
296
|
+
#### Project Templates
|
|
222
297
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
298
|
+
| Template | Description |
|
|
299
|
+
|----------|-------------|
|
|
300
|
+
| `default` | Default template with complete management system features |
|
|
301
|
+
| `basic` | Basic template with core features only, suitable for high customization |
|
|
302
|
+
| `full` | Full template with all example pages and advanced features |
|
|
227
303
|
|
|
228
|
-
####
|
|
304
|
+
#### Interactive Creation Example
|
|
229
305
|
|
|
230
|
-
|
|
306
|
+
```bash
|
|
307
|
+
$ zant-admin create my-project --interactive
|
|
231
308
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
309
|
+
? Enter project description: My management system
|
|
310
|
+
? Enter author name: zc
|
|
311
|
+
? Select project template: default
|
|
312
|
+
? Skip dependency installation? (y/N) N
|
|
236
313
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
- Permission configuration
|
|
240
|
-
- Access control
|
|
314
|
+
✔ Project created successfully!
|
|
315
|
+
✔ Dependencies installed!
|
|
241
316
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
- Dashboard display
|
|
317
|
+
cd my-project
|
|
318
|
+
npm run dev
|
|
319
|
+
```
|
|
246
320
|
|
|
247
|
-
|
|
248
|
-
- Image upload
|
|
249
|
-
- File management
|
|
250
|
-
- Upload progress display
|
|
321
|
+
### Manual Clone
|
|
251
322
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
- Language package management
|
|
323
|
+
```bash
|
|
324
|
+
# Clone the project
|
|
325
|
+
git clone https://gitee.com/your-username/zant-admin.git
|
|
256
326
|
|
|
257
|
-
|
|
327
|
+
# Enter project directory
|
|
328
|
+
cd zant-admin
|
|
258
329
|
|
|
259
|
-
|
|
330
|
+
# Install dependencies
|
|
331
|
+
npm install
|
|
260
332
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
├── public/ # Static resources
|
|
264
|
-
├── src/
|
|
265
|
-
│ ├── api/ # API requests
|
|
266
|
-
│ ├── assets/ # Static resources
|
|
267
|
-
│ ├── components/ # Common components
|
|
268
|
-
│ ├── config/ # Configuration files
|
|
269
|
-
│ ├── locales/ # Internationalization files (if selected)
|
|
270
|
-
│ ├── router/ # Router configuration
|
|
271
|
-
│ ├── stores/ # State management
|
|
272
|
-
│ ├── utils/ # Utility functions
|
|
273
|
-
│ ├── views/ # Page views
|
|
274
|
-
│ ├── App.vue # Root component
|
|
275
|
-
│ └── main.js # Entry file
|
|
276
|
-
├── package.json # Project configuration
|
|
277
|
-
├── vite.config.js # Vite configuration
|
|
278
|
-
└── README.md # Project documentation
|
|
333
|
+
# Start development server
|
|
334
|
+
npm run dev
|
|
279
335
|
```
|
|
280
336
|
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
npm install
|
|
284
|
-
```
|
|
337
|
+
### Common Commands
|
|
285
338
|
|
|
286
|
-
#### Start Development Server
|
|
287
339
|
```bash
|
|
340
|
+
# Start development server (default port 8080)
|
|
288
341
|
npm run dev
|
|
289
|
-
```
|
|
290
342
|
|
|
291
|
-
|
|
292
|
-
```bash
|
|
343
|
+
# Build for production (output to dist/)
|
|
293
344
|
npm run build
|
|
294
|
-
```
|
|
295
345
|
|
|
296
|
-
|
|
297
|
-
```bash
|
|
346
|
+
# Preview production build
|
|
298
347
|
npm run preview
|
|
299
|
-
```
|
|
300
348
|
|
|
301
|
-
#
|
|
349
|
+
# Lint and auto-fix code
|
|
302
350
|
npm run lint
|
|
303
351
|
|
|
304
|
-
#
|
|
352
|
+
# Format code
|
|
305
353
|
npm run format
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Environment Configuration
|
|
357
|
+
|
|
358
|
+
The project supports multi-environment configuration via `.env` files:
|
|
359
|
+
|
|
360
|
+
| File | Description |
|
|
361
|
+
|------|-------------|
|
|
362
|
+
| `.env.development` | Development environment |
|
|
363
|
+
| `.env.test` | Test environment |
|
|
364
|
+
| `.env.production` | Production environment |
|
|
306
365
|
|
|
307
366
|
### Development Standards
|
|
308
367
|
|
|
309
|
-
####
|
|
368
|
+
#### Vue Component Standards
|
|
369
|
+
|
|
370
|
+
1. Use Composition API (`<script setup>`) syntax
|
|
371
|
+
2. Use PascalCase for component naming
|
|
372
|
+
3. Use `.vue` extension for component files
|
|
373
|
+
4. Use `scoped` styles to avoid global pollution
|
|
310
374
|
|
|
311
|
-
|
|
375
|
+
#### JavaScript Standards
|
|
312
376
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
377
|
+
1. Use ES6+ syntax
|
|
378
|
+
2. Use `import/export` for modularization
|
|
379
|
+
3. Prefer `const`, then `let`, avoid `var`
|
|
380
|
+
4. Use arrow functions to simplify code
|
|
381
|
+
|
|
382
|
+
#### CSS Standards
|
|
383
|
+
|
|
384
|
+
1. Use kebab-case for CSS class names
|
|
385
|
+
2. Use `scoped` for component styles to avoid global pollution
|
|
318
386
|
|
|
319
|
-
|
|
387
|
+
#### Commit Standards
|
|
388
|
+
|
|
389
|
+
1. Follow [Conventional Commits](https://www.conventionalcommits.org/) specification
|
|
390
|
+
2. Ensure ESLint check passes before committing
|
|
320
391
|
|
|
321
392
|
```bash
|
|
322
|
-
|
|
393
|
+
# Examples
|
|
394
|
+
feat: add user management feature
|
|
395
|
+
fix: fix login page styling issue
|
|
396
|
+
docs: update README documentation
|
|
397
|
+
style: format code
|
|
398
|
+
refactor: refactor permission control logic
|
|
323
399
|
```
|
|
324
400
|
|
|
325
|
-
|
|
401
|
+
## Project Highlights
|
|
326
402
|
|
|
327
|
-
|
|
328
|
-
|
|
403
|
+
### 🧩 1. Modular Design
|
|
404
|
+
|
|
405
|
+
The project adopts a highly modular design where functional modules are independent, facilitating maintenance and extension:
|
|
406
|
+
- Clear directory structure with separation of concerns
|
|
407
|
+
- Component-based development for improved reusability
|
|
408
|
+
- Low coupling between modules for easy extension
|
|
409
|
+
|
|
410
|
+
### 🧰 2. Common Component Library
|
|
411
|
+
|
|
412
|
+
Rich set of common business components to boost development efficiency:
|
|
413
|
+
|
|
414
|
+
| Component | Path | Description |
|
|
415
|
+
|-----------|------|-------------|
|
|
416
|
+
| **FormTable** | [src/components/FormTable.vue](src/components/FormTable.vue) | Universal form table with search, pagination, operations |
|
|
417
|
+
| **IconPicker** | [src/components/IconPicker.vue](src/components/IconPicker.vue) | Icon picker integrated with Ant Design icons |
|
|
418
|
+
| **MainPage** | [src/components/MainPage.vue](src/components/MainPage.vue) | Main page layout for unified page structure |
|
|
419
|
+
| **DepartmentEdit** | [src/components/edit/...](src/components/edit/organizationalStructure/DepartmentEdit.vue) | Department edit dialog component |
|
|
420
|
+
| **SysRoleEdit** | [src/components/edit/...](src/components/edit/SysRoleEdit.vue) | Role edit dialog component |
|
|
421
|
+
|
|
422
|
+
### 🛠️ 3. Utility Function Library
|
|
423
|
+
|
|
424
|
+
Encapsulated common utility functions to simplify business logic:
|
|
425
|
+
|
|
426
|
+
| Utility | Path | Description |
|
|
427
|
+
|---------|------|-------------|
|
|
428
|
+
| **useFormCRUD** | [src/utils/useFormCRUD.js](src/utils/useFormCRUD.js) | Form CRUD operations composable |
|
|
429
|
+
| **regionUtils** | [src/utils/regionUtils.js](src/utils/regionUtils.js) | Region (province/city/district) utility |
|
|
430
|
+
| **dictTemplate** | [src/utils/dictTemplate.js](src/utils/dictTemplate.js) | Dictionary data template utility |
|
|
431
|
+
| **baseEcharts** | [src/utils/baseEcharts.js](src/utils/baseEcharts.js) | ECharts base configuration |
|
|
432
|
+
|
|
433
|
+
### 📱 4. Responsive Design
|
|
434
|
+
|
|
435
|
+
Responsive design based on Ant Design Vue, adapting to different screen sizes:
|
|
436
|
+
- Adaptive layout supporting desktop, tablet, and mobile
|
|
437
|
+
- Collapsible sidebar for optimized small-screen experience
|
|
438
|
+
- Responsive tables and forms
|
|
439
|
+
|
|
440
|
+
### 🌍 5. i18n Ready
|
|
441
|
+
|
|
442
|
+
Reserved internationalization interfaces for future multi-language extension:
|
|
443
|
+
- Vue I18n based internationalization solution
|
|
444
|
+
- Clear language pack structure, easy to maintain
|
|
445
|
+
- Support for dynamic language switching
|
|
446
|
+
|
|
447
|
+
### 🚀 6. Performance Optimization
|
|
448
|
+
|
|
449
|
+
- **Route Lazy Loading** - On-demand loading of page components
|
|
450
|
+
- **On-demand Component Import** - Reduced bundle size
|
|
451
|
+
- **Pinia Persistence** - Local storage for state data
|
|
452
|
+
- **Vite Build Optimization** - Fast development and build experience
|
|
453
|
+
|
|
454
|
+
## API Interface
|
|
455
|
+
|
|
456
|
+
The project organizes API interfaces in a modular fashion under `src/api/methods/`:
|
|
457
|
+
|
|
458
|
+
### API Modules
|
|
459
|
+
|
|
460
|
+
| Module | File | Description |
|
|
461
|
+
|--------|------|-------------|
|
|
462
|
+
| **Authentication** | `login.js` | Login, logout, get user info |
|
|
463
|
+
| **Account Management** | `sysAccount.js` | Account CRUD, password management |
|
|
464
|
+
| **Role Management** | `sysRole.js` | Role CRUD, permission assignment |
|
|
465
|
+
| **Menu Management** | `sysMenu.js` | Menu CRUD, route configuration |
|
|
466
|
+
| **Dictionary Management** | `sysDict.js` / `sysDictItem.js` | Dictionary types and items |
|
|
467
|
+
| **Department Management** | `department.js` | Department organizational structure |
|
|
468
|
+
| **Position Management** | `position.js` | Position information management |
|
|
469
|
+
| **Employee Management** | `employee.js` | Employee information management |
|
|
470
|
+
| **Log Management** | `logOperation.js` / `logError.js` / `logLogin.js` | Operation, error, login logs |
|
|
471
|
+
| **Scheduled Tasks** | `quartz.js` | Scheduled task management |
|
|
472
|
+
| **Region Data** | `region.js` | Province/city/district data |
|
|
473
|
+
|
|
474
|
+
### Request Encapsulation
|
|
475
|
+
|
|
476
|
+
The request core configuration is in [src/api/request.js](src/api/request.js), built on Alova:
|
|
477
|
+
|
|
478
|
+
```javascript
|
|
479
|
+
// Example: Using encapsulated request methods
|
|
480
|
+
import { getUserList, addUser, updateUser, deleteUser } from '@/api/methods/sysUser.js'
|
|
481
|
+
|
|
482
|
+
// Get user list
|
|
483
|
+
const { data } = await getUserList({ page: 1, size: 10 })
|
|
484
|
+
|
|
485
|
+
// Add user
|
|
486
|
+
await addUser({ username: 'admin', nickname: 'Administrator' })
|
|
329
487
|
```
|
|
330
488
|
|
|
331
|
-
|
|
489
|
+
## Browser Support
|
|
490
|
+
|
|
491
|
+
| Browser | Version |
|
|
492
|
+
|---------|---------|
|
|
493
|
+
| Chrome | >= 80 |
|
|
494
|
+
| Firefox | >= 75 |
|
|
495
|
+
| Safari | >= 13 |
|
|
496
|
+
| Edge | >= 80 |
|
|
497
|
+
|
|
498
|
+
> IE is not supported
|
|
499
|
+
|
|
500
|
+
## Deployment
|
|
501
|
+
|
|
502
|
+
### Build for Production
|
|
332
503
|
|
|
333
504
|
```bash
|
|
334
|
-
|
|
505
|
+
# Run build command
|
|
506
|
+
npm run build
|
|
507
|
+
|
|
508
|
+
# Build output is in the dist/ directory
|
|
335
509
|
```
|
|
336
510
|
|
|
337
|
-
|
|
511
|
+
### Deployment Methods
|
|
338
512
|
|
|
339
|
-
|
|
340
|
-
- **Vite**: Next Generation Frontend Tooling
|
|
341
|
-
- **Ant Design Vue**: Enterprise-class UI Design Language
|
|
342
|
-
- **Pinia**: Vue State Management
|
|
343
|
-
- **Vue Router**: Official Vue Router
|
|
344
|
-
- **ESLint + Prettier**: Code Linting and Formatting
|
|
513
|
+
#### Method 1: Static Server Deployment
|
|
345
514
|
|
|
346
|
-
|
|
515
|
+
Deploy files from the `dist` directory to any static web server:
|
|
347
516
|
|
|
348
|
-
|
|
349
|
-
|
|
517
|
+
```bash
|
|
518
|
+
# Nginx example
|
|
519
|
+
server {
|
|
520
|
+
listen 80;
|
|
521
|
+
server_name your-domain.com;
|
|
522
|
+
root /path/to/dist;
|
|
523
|
+
index index.html;
|
|
524
|
+
|
|
525
|
+
location / {
|
|
526
|
+
try_files $uri $uri/ /index.html;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
location /api {
|
|
530
|
+
proxy_pass http://your-backend-server;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
```
|
|
350
534
|
|
|
351
|
-
|
|
352
|
-
A: Try using `--skip-install` to skip installation, then manually run `npm install`.
|
|
535
|
+
#### Method 2: Docker Deployment
|
|
353
536
|
|
|
354
|
-
|
|
355
|
-
|
|
537
|
+
```dockerfile
|
|
538
|
+
FROM nginx:alpine
|
|
539
|
+
COPY dist/ /usr/share/nginx/html/
|
|
540
|
+
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
541
|
+
EXPOSE 80
|
|
542
|
+
```
|
|
356
543
|
|
|
357
|
-
|
|
358
|
-
A: Current version mainly supports JavaScript, TypeScript support will be added in future versions.
|
|
544
|
+
### Environment Variables
|
|
359
545
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
546
|
+
| Variable | Description | Default |
|
|
547
|
+
|----------|-------------|---------|
|
|
548
|
+
| `VITE_APP_BASE_API` | API base path | `/api` |
|
|
549
|
+
| `VITE_APP_TITLE` | Application title | `ZAntAdmin` |
|
|
550
|
+
| `VITE_APP_PORT` | Dev server port | `8080` |
|
|
365
551
|
|
|
366
|
-
#### JavaScript Standards
|
|
367
|
-
1. Use ES6+ syntax
|
|
368
|
-
2. Use `import/export` for modularization
|
|
369
|
-
3. Prefer `const`, then `let`, avoid `var`
|
|
370
|
-
4. Use arrow functions to simplify code
|
|
371
552
|
|
|
372
|
-
|
|
373
|
-
1. Use kebab-case for CSS class names
|
|
374
|
-
2. Use `scoped` for component styles to avoid global pollution
|
|
553
|
+
## Contributing
|
|
375
554
|
|
|
376
|
-
|
|
377
|
-
1. Follow conventional commit specification
|
|
378
|
-
2. Ensure ESLint check passes before commit
|
|
555
|
+
We welcome Issues and Pull Requests to help improve this project!
|
|
379
556
|
|
|
380
|
-
|
|
557
|
+
### Submit an Issue
|
|
381
558
|
|
|
382
|
-
|
|
383
|
-
|
|
559
|
+
- Clearly describe the reproduction steps
|
|
560
|
+
- Provide relevant code snippets or screenshots
|
|
561
|
+
- Note the version and environment information
|
|
384
562
|
|
|
385
|
-
###
|
|
386
|
-
Provides rich common components, such as form tables, icon selectors, etc., improving development efficiency.
|
|
563
|
+
### Submit a Pull Request
|
|
387
564
|
|
|
388
|
-
|
|
389
|
-
|
|
565
|
+
1. Fork this repository
|
|
566
|
+
2. Create a feature branch: `git checkout -b feature/AmazingFeature`
|
|
567
|
+
3. Commit your changes: `git commit -m 'feat: Add some AmazingFeature'`
|
|
568
|
+
4. Push to branch: `git push origin feature/AmazingFeature`
|
|
569
|
+
5. Submit a Pull Request to the main repository
|
|
390
570
|
|
|
391
|
-
###
|
|
392
|
-
Responsive design based on Ant Design Vue, adapting to devices of different screen sizes.
|
|
571
|
+
### Development Notes
|
|
393
572
|
|
|
394
|
-
|
|
395
|
-
|
|
573
|
+
- Ensure code passes ESLint check: `npm run lint`
|
|
574
|
+
- Maintain consistent code style
|
|
575
|
+
- Follow Conventional Commits for commit messages
|
|
576
|
+
- Update related documentation if necessary
|
|
396
577
|
|
|
397
|
-
##
|
|
578
|
+
## License
|
|
398
579
|
|
|
399
|
-
|
|
400
|
-
The project supports multi-environment configuration, managing variables for different environments via `.env` files:
|
|
401
|
-
- `.env.development`: Development environment
|
|
402
|
-
- `.env.test`: Test environment
|
|
403
|
-
- `.env.production`: Production environment
|
|
580
|
+
This project is open-sourced under the [MIT](LICENSE) License.
|
|
404
581
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
582
|
+
```
|
|
583
|
+
MIT License
|
|
584
|
+
|
|
585
|
+
Copyright (c) 2024 zc
|
|
586
|
+
|
|
587
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
588
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
589
|
+
in the Software without restriction, including without limitation the rights
|
|
590
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
591
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
592
|
+
furnished to do so, subject to the following conditions:
|
|
593
|
+
|
|
594
|
+
The above copyright notice and this permission notice shall be included in all
|
|
595
|
+
copies or substantial portions of the Software.
|
|
596
|
+
|
|
597
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
598
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
599
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
600
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
601
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
602
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
603
|
+
SOFTWARE.
|
|
604
|
+
```
|
|
409
605
|
|
|
410
|
-
|
|
606
|
+
---
|
|
411
607
|
|
|
412
|
-
|
|
413
|
-
- Submit Issue describing the problem or suggestion
|
|
414
|
-
- Provide relevant code snippets or screenshots
|
|
608
|
+
<div align="center">
|
|
415
609
|
|
|
416
|
-
|
|
417
|
-
- Fork this project
|
|
418
|
-
- Create feature branch (`git checkout -b feature/AmazingFeature`)
|
|
419
|
-
- Commit changes (`git commit -m 'Add some AmazingFeature'`)
|
|
420
|
-
- Push to branch (`git push origin feature/AmazingFeature`)
|
|
421
|
-
- Submit Pull Request
|
|
610
|
+
**If you find this project helpful, please give it a Star ⭐**
|
|
422
611
|
|
|
423
|
-
|
|
612
|
+
[Back to Top](#table-of-contents)
|
|
424
613
|
|
|
425
|
-
|
|
614
|
+
</div>
|