nayota-show-sdk 1.2.4 → 1.2.6
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/api/area.js +6 -1
- package/api/areaClass.js +269 -0
- package/api/bmsRouter.js +2 -0
- package/index.js +3 -1
- package/package.json +1 -1
package/api/area.js
CHANGED
|
@@ -2,7 +2,12 @@ import { requestShow } from '../utils'
|
|
|
2
2
|
/**
|
|
3
3
|
* @file 区域设置api
|
|
4
4
|
* @module 区域设置接口
|
|
5
|
-
* @category
|
|
5
|
+
* @category 区域管理
|
|
6
|
+
* @categoryOrder 9
|
|
7
|
+
* @import
|
|
8
|
+
* import { area } from 'nayota-show-sdk'
|
|
9
|
+
* const { list, create, updateOne, deleteOne, deleteMany, getOne } = area
|
|
10
|
+
* list({ page: 1, limit: 50 })
|
|
6
11
|
*/
|
|
7
12
|
|
|
8
13
|
|
package/api/areaClass.js
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { requestShow } from '../utils'
|
|
2
|
+
/**
|
|
3
|
+
* @file 区域类型api
|
|
4
|
+
* @module 区域类型接口
|
|
5
|
+
* @category 区域管理
|
|
6
|
+
* @import
|
|
7
|
+
* import { areaClass } from 'nayota-show-sdk'
|
|
8
|
+
* const { list, create, updateOne, deleteOne, deleteMany, getOne } = areaClass
|
|
9
|
+
* list({ page: 1, limit: 50 })
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} AreaClass - 区域类型
|
|
15
|
+
* @property {string} _id - 区域类型id
|
|
16
|
+
* @property {string} name - 区域类型名称
|
|
17
|
+
* @property {array} deviceClasses - 区域设备类型
|
|
18
|
+
* @property {string} colorRules - 区域颜色规则
|
|
19
|
+
* @property {Array} statisticsComponent - 统计组件名称数组
|
|
20
|
+
* @property {Object} statisticsJson - 统计组件自定义json
|
|
21
|
+
* @example
|
|
22
|
+
* {
|
|
23
|
+
"_id": "67073bfe463d6e00099becdd",
|
|
24
|
+
"name": "办公区",
|
|
25
|
+
"deviceClasses": [
|
|
26
|
+
"67073bfe463d6e00099becdd"
|
|
27
|
+
],
|
|
28
|
+
"colorRules": "red",
|
|
29
|
+
"statisticsComponent": [
|
|
30
|
+
"人数"
|
|
31
|
+
],
|
|
32
|
+
"statisticsJson": {
|
|
33
|
+
"type": "count",
|
|
34
|
+
"field": "deviceClasses",
|
|
35
|
+
"value": "67073bfe463d6e00099becdd"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 获取区域类型列表
|
|
43
|
+
* @param {Object} query - 请求对象
|
|
44
|
+
* @param {number} query.page - 页码
|
|
45
|
+
* @param {number} query.limit - 每页数量
|
|
46
|
+
* @example
|
|
47
|
+
* {
|
|
48
|
+
* "page": 1,
|
|
49
|
+
* "limit": 10
|
|
50
|
+
* }
|
|
51
|
+
* @returns {number} code - 返回码,0表示成功
|
|
52
|
+
* @returns {number} total - 页面总数
|
|
53
|
+
* @returns {Array} rows - 页面数组见表结构areaClass定义
|
|
54
|
+
* @example
|
|
55
|
+
*
|
|
56
|
+
* {
|
|
57
|
+
"code": 0,
|
|
58
|
+
"total": 1,
|
|
59
|
+
"rows": [见表结构areaClass定义]
|
|
60
|
+
}
|
|
61
|
+
*/
|
|
62
|
+
export function list(query) {
|
|
63
|
+
return requestShow({
|
|
64
|
+
url: '/area-classes',
|
|
65
|
+
method: 'get',
|
|
66
|
+
params: query
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 新增区域类型
|
|
72
|
+
* @param {Object} data - 包含区域类型的请求体 属性见表结构areaClass定义。
|
|
73
|
+
* @example
|
|
74
|
+
* {
|
|
75
|
+
"name": "办公区",
|
|
76
|
+
"deviceClasses": [
|
|
77
|
+
"67073bfe463d6e00099becdd"
|
|
78
|
+
],
|
|
79
|
+
"colorRules": "red",
|
|
80
|
+
"statisticsComponent": [
|
|
81
|
+
"人数"
|
|
82
|
+
],
|
|
83
|
+
"statisticsJson": {
|
|
84
|
+
"type": "count",
|
|
85
|
+
"field": "deviceClasses",
|
|
86
|
+
"value": "67073bfe463d6e00099becdd"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
* @returns {number} code - 返回码,0表示成功
|
|
90
|
+
* @returns {string} data - 新增成功的数据 见表结构areaClass定义
|
|
91
|
+
* @example
|
|
92
|
+
* {
|
|
93
|
+
"code": 0,
|
|
94
|
+
"data": {
|
|
95
|
+
"_id": "67073bfe463d6e00099becdd",
|
|
96
|
+
"name": "办公区",
|
|
97
|
+
"deviceClasses": [
|
|
98
|
+
"67073bfe463d6e00099becdd"
|
|
99
|
+
],
|
|
100
|
+
"colorRules": "red",
|
|
101
|
+
"statisticsComponent": [
|
|
102
|
+
"人数"
|
|
103
|
+
],
|
|
104
|
+
"statisticsJson": {
|
|
105
|
+
"type": "count",
|
|
106
|
+
"field": "deviceClasses",
|
|
107
|
+
"value": "67073bfe463d6e00099becdd"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
*/
|
|
112
|
+
export function create(data) {
|
|
113
|
+
return requestShow({
|
|
114
|
+
url: '/area-classes',
|
|
115
|
+
method: 'post',
|
|
116
|
+
data
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 获取区域类型
|
|
122
|
+
* @param {string} id - 区域类型id
|
|
123
|
+
* @example
|
|
124
|
+
* 67073bfe463d6e00099becdd
|
|
125
|
+
* @returns {number} code - 返回码,0表示成功。
|
|
126
|
+
* @returns {Object} data - 区域类型对象 见表结构areaClass定义
|
|
127
|
+
* @example
|
|
128
|
+
*
|
|
129
|
+
* {
|
|
130
|
+
"code": 0,
|
|
131
|
+
"data": {
|
|
132
|
+
"_id": "67073bfe463d6e00099becdd",
|
|
133
|
+
"name": "办公区",
|
|
134
|
+
"deviceClasses": [
|
|
135
|
+
"67073bfe463d6e00099becdd"
|
|
136
|
+
],
|
|
137
|
+
"colorRules": "red",
|
|
138
|
+
"statisticsComponent": [
|
|
139
|
+
"人数"
|
|
140
|
+
],
|
|
141
|
+
"statisticsJson": {
|
|
142
|
+
"type": "count",
|
|
143
|
+
"field": "deviceClasses",
|
|
144
|
+
"value": "67073bfe463d6e00099becdd"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
*/
|
|
149
|
+
export function getOne(id) {
|
|
150
|
+
return requestShow({
|
|
151
|
+
url: `/area-classes/${id}`,
|
|
152
|
+
method: 'get'
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 修改区域类型
|
|
158
|
+
* @param {Object} data - 包含区域类型的请求体 属性见表结构areaClass定义。
|
|
159
|
+
* @example
|
|
160
|
+
* {
|
|
161
|
+
"_id": "67073bfe463d6e00099becdd",
|
|
162
|
+
"name": "办公区",
|
|
163
|
+
"deviceClasses": [
|
|
164
|
+
"67073bfe463d6e00099becdd"
|
|
165
|
+
],
|
|
166
|
+
"colorRules": "red",
|
|
167
|
+
"statisticsComponent": [
|
|
168
|
+
"人数"
|
|
169
|
+
],
|
|
170
|
+
"statisticsJson": {
|
|
171
|
+
"type": "count",
|
|
172
|
+
"field": "deviceClasses",
|
|
173
|
+
"value": "67073bfe463d6e00099becdd"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
* @returns {number} code - 返回码,0表示成功
|
|
178
|
+
* @returns {string} data - 修改成功的数据 见表结构areaClass定义
|
|
179
|
+
* @example
|
|
180
|
+
* {
|
|
181
|
+
"code": 0,
|
|
182
|
+
"data": {
|
|
183
|
+
"_id": "67073bfe463d6e00099becdd",
|
|
184
|
+
"name": "办公区",
|
|
185
|
+
"deviceClasses": [
|
|
186
|
+
"67073bfe463d6e00099becdd"
|
|
187
|
+
],
|
|
188
|
+
"colorRules": "red",
|
|
189
|
+
"statisticsComponent": [
|
|
190
|
+
"人数"
|
|
191
|
+
],
|
|
192
|
+
"statisticsJson": {
|
|
193
|
+
"type": "count",
|
|
194
|
+
"field": "deviceClasses",
|
|
195
|
+
"value": "67073bfe463d6e00099becdd"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
*/
|
|
200
|
+
export function updateOne(data) {
|
|
201
|
+
return requestShow({
|
|
202
|
+
url: `/area-classes/${data._id}`,
|
|
203
|
+
method: 'put',
|
|
204
|
+
data
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* 删除区域类型
|
|
209
|
+
* @param {string} id - 删除的区域类型id。
|
|
210
|
+
* @example
|
|
211
|
+
* 67073bfe463d6e00099becdd
|
|
212
|
+
* @returns {number} code - 返回码,0表示成功
|
|
213
|
+
* @returns {string} data - 删除成功的数据 见表结构areaClass定义
|
|
214
|
+
* @example
|
|
215
|
+
* {
|
|
216
|
+
"code": 0,
|
|
217
|
+
"data": {
|
|
218
|
+
"_id": "67073bfe463d6e00099becdd",
|
|
219
|
+
"name": "办公区",
|
|
220
|
+
"deviceClasses": [
|
|
221
|
+
"67073bfe463d6e00099becdd"
|
|
222
|
+
],
|
|
223
|
+
"colorRules": "red",
|
|
224
|
+
"statisticsComponent": [
|
|
225
|
+
"人数"
|
|
226
|
+
],
|
|
227
|
+
"statisticsJson": {
|
|
228
|
+
"type": "count",
|
|
229
|
+
"field": "deviceClasses",
|
|
230
|
+
"value": "67073bfe463d6e00099becdd"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
*/
|
|
235
|
+
export function deleteOne(id) {
|
|
236
|
+
return requestShow({
|
|
237
|
+
url: `/area-classes/${id}`,
|
|
238
|
+
method: 'delete'
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 批量删除区域类型
|
|
244
|
+
* @param {Array} ids - 删除的区域类型ids。
|
|
245
|
+
* @example
|
|
246
|
+
* ['67073bfe463d6e00099becdd', '67073bfe463d6e00099becde']
|
|
247
|
+
* @returns {number} code - 返回码,0表示成功
|
|
248
|
+
* @example
|
|
249
|
+
* {
|
|
250
|
+
"code": 0
|
|
251
|
+
}
|
|
252
|
+
*/
|
|
253
|
+
export function deleteMany(ids) {
|
|
254
|
+
return requestShow({
|
|
255
|
+
url: '/area-classes',
|
|
256
|
+
method: 'delete',
|
|
257
|
+
data: ids // delete传递主体要包含在data里
|
|
258
|
+
})
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export default {
|
|
262
|
+
list,
|
|
263
|
+
create,
|
|
264
|
+
updateOne,
|
|
265
|
+
deleteOne,
|
|
266
|
+
deleteMany,
|
|
267
|
+
getOne
|
|
268
|
+
}
|
|
269
|
+
|
package/api/bmsRouter.js
CHANGED
|
@@ -28,6 +28,7 @@ import { requestShow } from '../utils'
|
|
|
28
28
|
* @property {string} icon - 图标
|
|
29
29
|
* @property {String} statisticsComponent - 统计组件
|
|
30
30
|
* @property {String} statisticsJson - 统计组件自定义json
|
|
31
|
+
* @property {array} areaClass - 区域类型id数组
|
|
31
32
|
* @example
|
|
32
33
|
* {
|
|
33
34
|
"children": [],
|
|
@@ -109,6 +110,7 @@ import { requestShow } from '../utils'
|
|
|
109
110
|
"type": "页面",
|
|
110
111
|
"icon": null,
|
|
111
112
|
"path": "models-universal-device-subject",
|
|
113
|
+
"areaClass": ["67073bfe463d6e00099becdd"],
|
|
112
114
|
"createdAt": "2024-10-31T06:32:39.736Z",
|
|
113
115
|
"updatedAt": "2024-11-11T08:05:54.442Z",
|
|
114
116
|
"__v": 3
|
package/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import inspectionTask from './api/inspectionTask'
|
|
|
26
26
|
import inspectionTaskSub from './api/inspectionTaskSub'
|
|
27
27
|
import product from './api/product'
|
|
28
28
|
import area from './api/area'
|
|
29
|
+
import areaClass from './api/areaClass'
|
|
29
30
|
|
|
30
31
|
const api = {
|
|
31
32
|
alarmRecord,
|
|
@@ -52,7 +53,8 @@ const api = {
|
|
|
52
53
|
inspectionTask,
|
|
53
54
|
inspectionTaskSub,
|
|
54
55
|
product,
|
|
55
|
-
area
|
|
56
|
+
area,
|
|
57
|
+
areaClass
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
export default {
|