nayota-show-sdk 1.2.2 → 1.2.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/api/area.js +159 -0
- package/api/line.js +0 -1
- package/index.js +4 -1
- package/package.json +1 -1
package/api/area.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { requestShow } from '../utils'
|
|
2
|
+
/**
|
|
3
|
+
* @file 区域设置api
|
|
4
|
+
* @module 区域设置接口
|
|
5
|
+
* @category 区域设置
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} Area - 区域
|
|
11
|
+
* @property {string} _id - 区域id
|
|
12
|
+
* @property {string} name - 区域名称
|
|
13
|
+
* @property {string} imageUrl - 区域图片
|
|
14
|
+
* @property {string} depart - 可视化层级的id
|
|
15
|
+
* @property {boolean} visible - 是否显示
|
|
16
|
+
* @property {number} opacity - 透明度
|
|
17
|
+
* @property {string} type - 区域类型
|
|
18
|
+
* @property {Array} bounds - 区域边界点
|
|
19
|
+
* @property {Array} statisticsComponent - 统计组件名称数组
|
|
20
|
+
* @property {Object} statisticsJson - 统计组件自定义json
|
|
21
|
+
* @example
|
|
22
|
+
* {
|
|
23
|
+
"_id": "67073bfe463d6e00099becdd",
|
|
24
|
+
"name": "办公区",
|
|
25
|
+
"imageUrl": "https://images.pexels.com/photos/67473/pexels-photo-67473.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
|
|
26
|
+
"depart": "667d2ecc52d21700095b58b4",
|
|
27
|
+
"visible": true,
|
|
28
|
+
"opacity": 1,
|
|
29
|
+
"type": "办公区",
|
|
30
|
+
"bounds": [
|
|
31
|
+
[
|
|
32
|
+
116.404,
|
|
33
|
+
39.915
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
116.404,
|
|
37
|
+
39.915
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
116.404,
|
|
41
|
+
39.915
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
116.404,
|
|
45
|
+
39.915
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
116.404,
|
|
49
|
+
39.915
|
|
50
|
+
]
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 获取区域列表
|
|
58
|
+
* @param {Object} query - 请求对象
|
|
59
|
+
* @param {number} query.page - 页码
|
|
60
|
+
* @param {number} query.limit - 每页数量
|
|
61
|
+
* @example
|
|
62
|
+
* {
|
|
63
|
+
* "page": 1,
|
|
64
|
+
* "limit": 10
|
|
65
|
+
* }
|
|
66
|
+
* @returns {number} code - 返回码,0表示成功
|
|
67
|
+
* @returns {number} total - 页面总数
|
|
68
|
+
* @returns {Array} rows - 页面数组见表结构area定义
|
|
69
|
+
* @example
|
|
70
|
+
*
|
|
71
|
+
* {
|
|
72
|
+
"code": 0,
|
|
73
|
+
"total": 1,
|
|
74
|
+
"rows": [见表结构area定义]
|
|
75
|
+
}
|
|
76
|
+
*/
|
|
77
|
+
export function list(query) {
|
|
78
|
+
return requestShow({
|
|
79
|
+
url: '/areas',
|
|
80
|
+
method: 'get',
|
|
81
|
+
params: query
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 新增区域
|
|
87
|
+
* @param {Object} data - 包含区域的请求体 属性见表结构area定义。
|
|
88
|
+
* @returns {number} code - 返回码,0表示成功
|
|
89
|
+
* @returns {string} data - 新增成功的数据 见表结构area定义
|
|
90
|
+
*/
|
|
91
|
+
export function create(data) {
|
|
92
|
+
return requestShow({
|
|
93
|
+
url: '/areas',
|
|
94
|
+
method: 'post',
|
|
95
|
+
data
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 获取区域
|
|
101
|
+
* @param {string} id - 区域id
|
|
102
|
+
* @returns {number} code - 返回码,0表示成功。
|
|
103
|
+
* @returns {Object} data - 区域对象 见表结构area定义
|
|
104
|
+
*/
|
|
105
|
+
export function getOne(id) {
|
|
106
|
+
return requestShow({
|
|
107
|
+
url: `/areas/${id}`,
|
|
108
|
+
method: 'get'
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 修改区域
|
|
114
|
+
* @param {Object} data - 包含区域的请求体 属性见表结构area定义。
|
|
115
|
+
* @returns {number} code - 返回码,0表示成功
|
|
116
|
+
* @returns {string} data - 修改成功的数据 见表结构area定义
|
|
117
|
+
*/
|
|
118
|
+
export function updateOne(data) {
|
|
119
|
+
return requestShow({
|
|
120
|
+
url: `/areas/${data._id}`,
|
|
121
|
+
method: 'put',
|
|
122
|
+
data
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 删除区域
|
|
127
|
+
* @param {string} id - 删除的区域id。
|
|
128
|
+
* @returns {number} code - 返回码,0表示成功
|
|
129
|
+
* @returns {string} data - 删除成功的数据 见表结构area定义
|
|
130
|
+
*/
|
|
131
|
+
export function deleteOne(id) {
|
|
132
|
+
return requestShow({
|
|
133
|
+
url: `/areas/${id}`,
|
|
134
|
+
method: 'delete'
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 批量删除区域
|
|
140
|
+
* @param {Array} ids - 删除的区域ids。
|
|
141
|
+
* @returns {number} code - 返回码,0表示成功
|
|
142
|
+
*/
|
|
143
|
+
export function deleteMany(ids) {
|
|
144
|
+
return requestShow({
|
|
145
|
+
url: '/areas',
|
|
146
|
+
method: 'delete',
|
|
147
|
+
data: ids // delete传递主体要包含在data里
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export default {
|
|
152
|
+
list,
|
|
153
|
+
create,
|
|
154
|
+
updateOne,
|
|
155
|
+
deleteOne,
|
|
156
|
+
deleteMany,
|
|
157
|
+
getOne
|
|
158
|
+
}
|
|
159
|
+
|
package/api/line.js
CHANGED
package/index.js
CHANGED
|
@@ -25,6 +25,8 @@ import inspectionPoints from './api/inspectionPoints'
|
|
|
25
25
|
import inspectionTask from './api/inspectionTask'
|
|
26
26
|
import inspectionTaskSub from './api/inspectionTaskSub'
|
|
27
27
|
import product from './api/product'
|
|
28
|
+
import area from './api/area'
|
|
29
|
+
|
|
28
30
|
const api = {
|
|
29
31
|
alarmRecord,
|
|
30
32
|
alarmProgress,
|
|
@@ -49,7 +51,8 @@ const api = {
|
|
|
49
51
|
inspectionPoints,
|
|
50
52
|
inspectionTask,
|
|
51
53
|
inspectionTaskSub,
|
|
52
|
-
product
|
|
54
|
+
product,
|
|
55
|
+
area
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
export default {
|