nayota-show-sdk 1.3.34 → 1.3.35

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.
Files changed (2) hide show
  1. package/api/devices.js +138 -115
  2. package/package.json +1 -1
package/api/devices.js CHANGED
@@ -5,8 +5,6 @@ import { requestShow } from '../utils'
5
5
  * @category 设备管理
6
6
  */
7
7
 
8
-
9
-
10
8
  /**
11
9
  * @typedef {Object} device - 设备
12
10
  * @property {string} _id - 设备id
@@ -51,80 +49,79 @@ import { requestShow } from '../utils'
51
49
  * @property {array} multiPositions - 多点位
52
50
  * @example
53
51
  * {
54
- "hash": [],
55
- "latLng": [],
56
- "mapLatLng": [],
57
- "deviceStatus": 0,
58
- "_id": "667d2efa52d21700095b58d5",
59
- "name": "A楼1层烟感1",
60
- "n_device": "667d2ee28aaf514ab9bcbca5",
61
- "deviceClass": {
62
- "_id": "667d2efa52d21700095b58d3",
63
- "name": "独立烟感",
64
- "code": "19",
65
- "deviceUI": "667cd27ea50c768b7234f58b",
66
- "creator": "6678e31ff340dfdecd9e1a28",
67
- "attributes": [
52
+ 'hash': [],
53
+ 'latLng': [],
54
+ 'mapLatLng': [],
55
+ 'deviceStatus': 0,
56
+ '_id': '667d2efa52d21700095b58d5',
57
+ 'name': 'A楼1层烟感1',
58
+ 'n_device': '667d2ee28aaf514ab9bcbca5',
59
+ 'deviceClass': {
60
+ '_id': '667d2efa52d21700095b58d3',
61
+ 'name': '独立烟感',
62
+ 'code': '19',
63
+ 'deviceUI': '667cd27ea50c768b7234f58b',
64
+ 'creator': '6678e31ff340dfdecd9e1a28',
65
+ 'attributes': [
68
66
  {
69
- "dataDimension": "day",
70
- "lineTime": 4,
71
- "_id": "673ed6cd9f45440009c27d7f",
72
- "name": "浓度",
73
- "key": "浓度",
74
- "type": "check"
67
+ 'dataDimension': 'day',
68
+ 'lineTime': 4,
69
+ '_id': '673ed6cd9f45440009c27d7f',
70
+ 'name': '浓度',
71
+ 'key': '浓度',
72
+ 'type': 'check'
75
73
  },
76
74
  {
77
- "dataDimension": "day",
78
- "lineTime": 4,
79
- "_id": "673ed6cd9f45440009c27d80",
80
- "name": "电量",
81
- "key": "电量",
82
- "type": "check"
75
+ 'dataDimension': 'day',
76
+ 'lineTime': 4,
77
+ '_id': '673ed6cd9f45440009c27d80',
78
+ 'name': '电量',
79
+ 'key': '电量',
80
+ 'type': 'check'
83
81
  },
84
82
  {
85
- "dataDimension": "day",
86
- "lineTime": 4,
87
- "_id": "673ed6cd9f45440009c27d81",
88
- "name": "温度",
89
- "key": "温度",
90
- "type": "check"
83
+ 'dataDimension': 'day',
84
+ 'lineTime': 4,
85
+ '_id': '673ed6cd9f45440009c27d81',
86
+ 'name': '温度',
87
+ 'key': '温度',
88
+ 'type': 'check'
91
89
  },
92
90
  {
93
- "dataDimension": "day",
94
- "lineTime": 4,
95
- "_id": "673ed6cd9f45440009c27d82",
96
- "name": "信号",
97
- "key": "信号",
98
- "type": "check"
91
+ 'dataDimension': 'day',
92
+ 'lineTime': 4,
93
+ '_id': '673ed6cd9f45440009c27d82',
94
+ 'name': '信号',
95
+ 'key': '信号',
96
+ 'type': 'check'
99
97
  }
100
98
  ],
101
- "relations": [],
102
- "uis": [
99
+ 'relations': [],
100
+ 'uis': [
103
101
  {
104
- "type": "ba_card",
105
- "attrs": [],
106
- "_id": "66c457c3b582b00009f9681b",
107
- "uiId": "66c45769b582b00009f967a6",
108
- "uiName": "BA独立烟感",
109
- "uiCode": "NaSmokeDetectionCard"
102
+ 'type': 'ba_card',
103
+ 'attrs': [],
104
+ '_id': '66c457c3b582b00009f9681b',
105
+ 'uiId': '66c45769b582b00009f967a6',
106
+ 'uiName': 'BA独立烟感',
107
+ 'uiCode': 'NaSmokeDetectionCard'
110
108
  }
111
109
  ],
112
- "createdAt": "2024-06-27T09:20:58.118Z",
113
- "updatedAt": "2024-11-21T06:44:29.408Z",
114
- "__v": 2,
115
- "isSimulation": true,
116
- "icon": "消防系统"
110
+ 'createdAt': '2024-06-27T09:20:58.118Z',
111
+ 'updatedAt': '2024-11-21T06:44:29.408Z',
112
+ '__v': 2,
113
+ 'isSimulation': true,
114
+ 'icon': '消防系统'
117
115
  },
118
- "creator": "6678e31ff340dfdecd9e1a28",
119
- "attribute": [],
120
- "props": [],
121
- "__v": 0,
122
- "createdAt": "2024-06-27T09:20:58.138Z",
123
- "updatedAt": "2024-06-27T09:20:58.138Z"
116
+ 'creator': '6678e31ff340dfdecd9e1a28',
117
+ 'attribute': [],
118
+ 'props': [],
119
+ '__v': 0,
120
+ 'createdAt': '2024-06-27T09:20:58.138Z',
121
+ 'updatedAt': '2024-06-27T09:20:58.138Z'
124
122
  }
125
123
  */
126
124
 
127
-
128
125
  /**
129
126
  * 获取设备列表
130
127
  * @param {Object} query - 请求对象
@@ -161,8 +158,8 @@ export function create(data) {
161
158
  /**
162
159
  * 获取设备详情
163
160
  * @param {string} id - 设备id
164
- * @returns {number} code - 返回码,0表示成功。
165
- * @returns {Object} data - 设备对象 字段见表结构
161
+ * @returns {number} code - 返回码,0表示成功。
162
+ * @returns {Object} data - 设备对象 字段见表结构
166
163
  */
167
164
  export function getOne(id) {
168
165
  return requestShow({
@@ -215,12 +212,12 @@ export function deleteMany(ids) {
215
212
  * @param {Array} query.ids - 删除的设备ids。
216
213
  * @example
217
214
  * {
218
- * "ids": ["667d2efa52d21700095b58d5"]
215
+ * 'ids': ['667d2efa52d21700095b58d5']
219
216
  * }
220
217
  * @returns {number} code - 返回码,0表示成功
221
218
  * @example
222
219
  * {
223
- * "code": 0
220
+ * 'code': 0
224
221
  * }
225
222
  */
226
223
  export function deleteAllDevice(query) {
@@ -231,7 +228,6 @@ export function deleteAllDevice(query) {
231
228
  })
232
229
  }
233
230
 
234
-
235
231
  /**
236
232
  * 获取简易设备列表
237
233
  * @param {Object} data - 请求对象
@@ -242,54 +238,54 @@ export function deleteAllDevice(query) {
242
238
  * @returns {Array} rows - 设备数组
243
239
  * @example
244
240
  * {
245
- "total": 1,
246
- "rows": [
241
+ 'total': 1,
242
+ 'rows': [
247
243
  {
248
- "mapLatLng": [],
249
- "_id": "667bd16992f8ed0009c55dcf",
250
- "name": "1层空调2",
251
- "n_device": "667bd128a50c768b72308edc",
252
- "deviceClass": "667bd16992f8ed0009c55dcc",
253
- "depart": "667bc7bb92f8ed0009c55bd0",
254
- "order": 1,
255
- "props": [
244
+ 'mapLatLng': [],
245
+ '_id': '667bd16992f8ed0009c55dcf',
246
+ 'name': '1层空调2',
247
+ 'n_device': '667bd128a50c768b72308edc',
248
+ 'deviceClass': '667bd16992f8ed0009c55dcc',
249
+ 'depart': '667bc7bb92f8ed0009c55bd0',
250
+ 'order': 1,
251
+ 'props': [
256
252
  {
257
- "code": "最高温度",
258
- "propType": "Check",
259
- "prop": null
253
+ 'code': '最高温度',
254
+ 'propType': 'Check',
255
+ 'prop': null
260
256
  },
261
257
  {
262
- "code": "最低温度",
263
- "propType": "Check",
264
- "prop": null
258
+ 'code': '最低温度',
259
+ 'propType': 'Check',
260
+ 'prop': null
265
261
  },
266
262
  {
267
- "code": "运行时长",
268
- "propType": "Check",
269
- "isImport": true,
270
- "prop": null
263
+ 'code': '运行时长',
264
+ 'propType': 'Check',
265
+ 'isImport': true,
266
+ 'prop': null
271
267
  },
272
268
  {
273
- "code": "空调风速",
274
- "propType": "Operate",
275
- "prop": null
269
+ 'code': '空调风速',
270
+ 'propType': 'Operate',
271
+ 'prop': null
276
272
  },
277
273
  {
278
- "code": "空调温度",
279
- "propType": "Operate",
280
- "isNumber": true,
281
- "prop": null
274
+ 'code': '空调温度',
275
+ 'propType': 'Operate',
276
+ 'isNumber': true,
277
+ 'prop': null
282
278
  },
283
279
  {
284
- "code": "空调模式",
285
- "propType": "Operate",
286
- "isStatus": true,
287
- "prop": null
280
+ 'code': '空调模式',
281
+ 'propType': 'Operate',
282
+ 'isStatus': true,
283
+ 'prop': null
288
284
  },
289
285
  {
290
- "code": "空调开关",
291
- "propType": "Operate",
292
- "prop": null
286
+ 'code': '空调开关',
287
+ 'propType': 'Operate',
288
+ 'prop': null
293
289
  }
294
290
  ]
295
291
  }
@@ -313,8 +309,8 @@ export function easyList(data) {
313
309
  * @param {Array} data.deviceClasses - 设备类型数组
314
310
  * @example
315
311
  * {
316
- "date":"2025-01-09",
317
- "deviceClasses":["6714dcb69252b10009982dba"]
312
+ 'date':'2025-01-09',
313
+ 'deviceClasses':['6714dcb69252b10009982dba']
318
314
  }
319
315
  * @returns {number} code - 返回码,0表示成功
320
316
  * @returns {Array} rows - 记录数组
@@ -324,24 +320,51 @@ export function easyList(data) {
324
320
  * @returns {string} rows.recordTime - 记录时间
325
321
  * @example
326
322
  * {
327
- "code": 0,
328
- "rows": [
323
+ 'code': 0,
324
+ 'rows': [
329
325
  {
330
- "_id": "6735c82b0fe66c8560bbf579",
331
- "value": 9,
332
- "valueStr": null,
333
- "recordTime": "2025-01-09T01:00:03.344Z"
326
+ '_id': '6735c82b0fe66c8560bbf579',
327
+ 'value': 9,
328
+ 'valueStr': null,
329
+ 'recordTime': '2025-01-09T01:00:03.344Z'
334
330
  }
335
331
  ]
336
332
  }
337
333
  */
338
334
  export function getPropHistoryData(data) {
339
- return requestShow({
340
- url: '/devices/getPropHistoryData',
341
- method: 'post',
342
- data
343
- })
344
- }
335
+ return requestShow({
336
+ url: '/devices/getPropHistoryData',
337
+ method: 'post',
338
+ data
339
+ })
340
+ }
341
+
342
+ /**
343
+ * 批量更新设备层级
344
+ * @param {Object} data - 请求对象
345
+ * @param {Array} data.deviceIds - 设备ID数组
346
+ * @param {string} data.depart - 目标层级ID
347
+ * @example
348
+ * {
349
+ * 'deviceIds': ['667d2efa52d21700095b58d5', '667d2efa52d21700095b58d6'],
350
+ * 'depart': '667bc7bb92f8ed0009c55bd0'
351
+ * }
352
+ * @returns {number} code - 返回码,0表示成功
353
+ * @returns {string} message - 返回信息
354
+ * @example
355
+ * {
356
+ * 'code': 0,
357
+ * 'message': '更新成功'
358
+ * }
359
+ */
360
+ export function updateDepart(data) {
361
+ return requestShow({
362
+ url: '/devices/updateDepart',
363
+ method: 'post',
364
+ data
365
+ })
366
+ }
367
+
345
368
  export default {
346
369
  list,
347
370
  create,
@@ -351,6 +374,6 @@ export default {
351
374
  deleteAllDevice,
352
375
  getOne,
353
376
  easyList,
354
- getPropHistoryData
377
+ getPropHistoryData,
378
+ updateDepart
355
379
  }
356
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nayota-show-sdk",
3
- "version": "1.3.34",
3
+ "version": "1.3.35",
4
4
  "description": "nayota-show-server rest-api",
5
5
  "type": "module",
6
6
  "main": "index.js",