mixdashboards 1.0.2 → 1.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/README.md +337 -73
- package/dist/mixdashboards.cjs +3935 -0
- package/dist/mixdashboards.css +1 -1
- package/dist/mixdashboards.js +100155 -0
- package/package.json +66 -78
- package/dist/mixdashboards.es.js +0 -51074
- package/dist/mixdashboards.umd.js +0 -3896
package/README.md
CHANGED
|
@@ -1,73 +1,337 @@
|
|
|
1
|
-
# MixDashboards
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
# MixDashboards
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/mixdashboards)
|
|
6
|
+
[](https://github.com/mixlinker/mixdashboards/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
MixDashboards - 新一代企业级可视化组件库
|
|
9
|
+
|
|
10
|
+
专为工业物联网和数据可视化场景设计的 Vue 3 组件库
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## ✨ 特性
|
|
17
|
+
|
|
18
|
+
- 🎯 **开箱即用** - 内置丰富的图表和可视化组件
|
|
19
|
+
- 🚀 **实时数据** - 基于 WebSocket 的实时数据推送
|
|
20
|
+
- 🎨 **高度可定制** - 灵活的配置系统,满足各种业务需求
|
|
21
|
+
- 📱 **响应式设计** - 完美适配桌面和大屏展示
|
|
22
|
+
- 🔧 **Vue 3 + TypeScript** - 基于最新技术栈构建
|
|
23
|
+
- 🌐 **多场景支持** - Pro、Show、App、Pad 四种展示模式
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 📦 安装
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 使用 npm
|
|
31
|
+
npm install mixdashboards vue element-plus
|
|
32
|
+
|
|
33
|
+
# 使用 pnpm
|
|
34
|
+
pnpm add mixdashboards vue element-plus
|
|
35
|
+
|
|
36
|
+
# 使用 yarn
|
|
37
|
+
yarn add mixdashboards vue element-plus
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 依赖要求
|
|
41
|
+
|
|
42
|
+
- Vue 3.5+
|
|
43
|
+
- Element Plus 2.11+
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install vue@^3.5.0 element-plus@^2.11.0
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🚀 快速开始
|
|
52
|
+
|
|
53
|
+
### 方式一:按需引入(推荐)
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
import { DesignPro } from 'mixdashboards'
|
|
58
|
+
import 'mixdashboards/dist/style.css'
|
|
59
|
+
import 'element-plus/dist/index.css'
|
|
60
|
+
|
|
61
|
+
const config = {
|
|
62
|
+
name: "销售数据看板",
|
|
63
|
+
type: "pro",
|
|
64
|
+
version: "2.0.0",
|
|
65
|
+
sheets: [
|
|
66
|
+
{
|
|
67
|
+
name: "概览",
|
|
68
|
+
components: [
|
|
69
|
+
{
|
|
70
|
+
type: "bar",
|
|
71
|
+
name: "月度销售额",
|
|
72
|
+
common: {
|
|
73
|
+
object_id: "3713089264" // 数据对象ID
|
|
74
|
+
},
|
|
75
|
+
data: [{
|
|
76
|
+
fv: "sales_amount", // 数据字段
|
|
77
|
+
name: "销售额"
|
|
78
|
+
}]
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<DesignPro
|
|
88
|
+
:script="config"
|
|
89
|
+
uid="sales-dashboard"
|
|
90
|
+
:enableWebSocket="true"
|
|
91
|
+
/>
|
|
92
|
+
</template>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 方式二:完整引入
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// main.ts
|
|
99
|
+
import { createApp } from 'vue'
|
|
100
|
+
import ElementPlus from 'element-plus'
|
|
101
|
+
import 'element-plus/dist/index.css'
|
|
102
|
+
import MixDashboards from 'mixdashboards'
|
|
103
|
+
import 'mixdashboards/dist/style.css'
|
|
104
|
+
import App from './App.vue'
|
|
105
|
+
|
|
106
|
+
const app = createApp(App)
|
|
107
|
+
app.use(ElementPlus)
|
|
108
|
+
app.use(MixDashboards)
|
|
109
|
+
app.mount('#app')
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
然后在组件中直接使用:
|
|
113
|
+
|
|
114
|
+
```vue
|
|
115
|
+
<template>
|
|
116
|
+
<DesignPro :script="config" uid="dashboard-001" />
|
|
117
|
+
</template>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 📚 组件说明
|
|
123
|
+
|
|
124
|
+
### DesignPro - 专业版仪表盘
|
|
125
|
+
|
|
126
|
+
功能最完整的仪表盘组件,支持实时数据、交互操作等。
|
|
127
|
+
|
|
128
|
+
**Props**
|
|
129
|
+
|
|
130
|
+
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|
|
131
|
+
|------|------|--------|------|------|
|
|
132
|
+
| `script` | `Object` | - | ✅ | 仪表盘配置对象 |
|
|
133
|
+
| `uid` | `String` | - | ✅ | 唯一标识符,用于区分不同实例 |
|
|
134
|
+
| `enableWebSocket` | `Boolean` | `false` | ❌ | 是否启用 WebSocket 实时数据 |
|
|
135
|
+
|
|
136
|
+
**使用示例**
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<DesignPro
|
|
140
|
+
:script="dashboardConfig"
|
|
141
|
+
uid="prod-dashboard-001"
|
|
142
|
+
:enableWebSocket="true"
|
|
143
|
+
/>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### DesignShow - 展示版
|
|
149
|
+
|
|
150
|
+
只读展示模式,适合大屏展示场景。
|
|
151
|
+
|
|
152
|
+
```vue
|
|
153
|
+
<DesignShow :script="config" uid="show-001" />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### DesignApp - 应用版
|
|
159
|
+
|
|
160
|
+
移动端优化版本。
|
|
161
|
+
|
|
162
|
+
```vue
|
|
163
|
+
<DesignApp :script="config" uid="app-001" />
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
### DesignPad - 平板版
|
|
169
|
+
|
|
170
|
+
平板设备优化版本。
|
|
171
|
+
|
|
172
|
+
```vue
|
|
173
|
+
<DesignPad :script="config" uid="pad-001" />
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 🔌 WebSocket 实时数据
|
|
179
|
+
|
|
180
|
+
### 启用实时数据
|
|
181
|
+
|
|
182
|
+
设置 `enableWebSocket="true"` 即可启用实时数据推送:
|
|
183
|
+
|
|
184
|
+
```vue
|
|
185
|
+
<DesignPro
|
|
186
|
+
:script="config"
|
|
187
|
+
uid="dashboard"
|
|
188
|
+
:enableWebSocket="true"
|
|
189
|
+
/>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 用户认证
|
|
193
|
+
|
|
194
|
+
组件会自动从 localStorage 读取用户信息进行认证:
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
// 在组件挂载前设置用户信息
|
|
198
|
+
localStorage.setItem('user', JSON.stringify({
|
|
199
|
+
token: 'YOUR_AUTH_TOKEN',
|
|
200
|
+
id: 1,
|
|
201
|
+
username: 'admin'
|
|
202
|
+
}))
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 数据订阅
|
|
206
|
+
|
|
207
|
+
在组件配置中指定 `object_id` 和 `fv` 字段来订阅数据:
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
{
|
|
211
|
+
type: "bar",
|
|
212
|
+
common: {
|
|
213
|
+
object_id: "3713089264" // 数据对象ID
|
|
214
|
+
},
|
|
215
|
+
data: [{
|
|
216
|
+
fv: "temperature", // 要订阅的字段
|
|
217
|
+
name: "温度"
|
|
218
|
+
}]
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## 配置结构
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
interface DashboardConfig {
|
|
226
|
+
name: string // 仪表盘名称
|
|
227
|
+
type: 'pro' | 'show' // 类型
|
|
228
|
+
version: string // 版本号
|
|
229
|
+
sheets: Sheet[] // 页面列表
|
|
230
|
+
currentPage: number // 当前页码
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface Sheet {
|
|
234
|
+
name: string // 页面名称
|
|
235
|
+
components: Component[] // 组件列表
|
|
236
|
+
background?: string // 背景设置
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface Component {
|
|
240
|
+
type: string // 组件类型(如 'bar', 'line', 'pie' 等)
|
|
241
|
+
name: string // 组件名称
|
|
242
|
+
options: object // 组件配置
|
|
243
|
+
data: DataItem[] // 数据配置
|
|
244
|
+
common: CommonConfig // 通用配置
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 💡 开发模式
|
|
251
|
+
|
|
252
|
+
### 静态数据模式(开发调试)
|
|
253
|
+
|
|
254
|
+
```vue
|
|
255
|
+
<!-- 适合开发调试,不需要后端连接 -->
|
|
256
|
+
<DesignPro :script="config" uid="dev-001" />
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 实时数据模式(生产环境)
|
|
260
|
+
|
|
261
|
+
```vue
|
|
262
|
+
<!-- 连接后端实时数据推送 -->
|
|
263
|
+
<DesignPro :script="config" uid="prod-001" :enableWebSocket="true" />
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## 🎨 支持的图表类型
|
|
269
|
+
|
|
270
|
+
- 📊 **柱状图 (bar)** - 横向/纵向柱状图
|
|
271
|
+
- 📈 **折线图 (line)** - 单线/多线图
|
|
272
|
+
- 🥧 **饼图 (pie)** - 饼图/环形图
|
|
273
|
+
- 📉 **散点图 (scatter)** - 散点分布图
|
|
274
|
+
- 🎯 **仪表盘 (gauge)** - 仪表盘图表
|
|
275
|
+
- 🗺️ **地图 (map)** - 地理数据可视化
|
|
276
|
+
- 📊 **竞赛条图 (raceBar)** - 动态排名图
|
|
277
|
+
- 🔢 **数字 (number)** - 数值展示组件
|
|
278
|
+
- 📝 **表格 (table)** - 数据表格
|
|
279
|
+
- 还有更多...
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## ❓ 常见问题
|
|
284
|
+
|
|
285
|
+
### 1. 样式没有生效?
|
|
286
|
+
|
|
287
|
+
确保导入了样式文件:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import 'mixdashboards/dist/style.css'
|
|
291
|
+
import 'element-plus/dist/index.css'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### 2. WebSocket 连接失败?
|
|
295
|
+
|
|
296
|
+
检查以下几点:
|
|
297
|
+
1. 确保设置了 `enableWebSocket="true"`
|
|
298
|
+
2. 确保 localStorage 中有用户 token
|
|
299
|
+
3. 检查网络连接和后端服务状态
|
|
300
|
+
|
|
301
|
+
### 3. 图表不显示数据?
|
|
302
|
+
|
|
303
|
+
确保配置中包含:
|
|
304
|
+
- `common.object_id` - 数据对象ID
|
|
305
|
+
- `data[].fv` - 数据字段名
|
|
306
|
+
|
|
307
|
+
### 4. 如何自定义主题?
|
|
308
|
+
|
|
309
|
+
可以通过 CSS 变量覆盖默认样式:
|
|
310
|
+
|
|
311
|
+
```css
|
|
312
|
+
:root {
|
|
313
|
+
--primary-color: #409EFF;
|
|
314
|
+
--background-color: #1a1a1a;
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## 🔗 相关链接
|
|
321
|
+
|
|
322
|
+
- [在线文档](https://docs.mixlinker.com/mixdashboards)
|
|
323
|
+
- [GitHub 仓库](http://192.168.88.6/mixiot/v8/frontend/newui/mixdashboards)
|
|
324
|
+
- [更新日志](./CHANGELOG.md)
|
|
325
|
+
- [问题反馈](http://192.168.88.6/mixiot/v8/frontend/newui/mixdashboards/issues)
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## 📄 许可证
|
|
330
|
+
|
|
331
|
+
MIT © 2025 Mixlinker Technical Team
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
<div align="center">
|
|
336
|
+
Made with ❤️ by Mixlinker
|
|
337
|
+
</div>
|