nayota-show-sdk 0.0.7 → 0.0.9
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/bmsRole.js +107 -0
- package/api/bmsRouter.js +119 -0
- package/api/router.js +1 -1
- package/index.js +7 -1
- package/package.json +1 -1
package/api/bmsRole.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { requestShow } from '../utils'
|
|
2
|
+
/**
|
|
3
|
+
* @file BMS角色api
|
|
4
|
+
* @module BMS角色接口
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 角色类型枚举
|
|
10
|
+
* @readonly
|
|
11
|
+
* @enum {number}
|
|
12
|
+
*/
|
|
13
|
+
var userType = {
|
|
14
|
+
主角色: 0,
|
|
15
|
+
副角色: 1
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {*} query
|
|
20
|
+
* @param {number} query.page - 页码
|
|
21
|
+
* @param {number} query.limit - 每页数量
|
|
22
|
+
* @returns {number} code - 返回码,0表示成功
|
|
23
|
+
* @returns {number} total - 角色总数
|
|
24
|
+
* @returns {Array} rows - 角色数组
|
|
25
|
+
* @returns {string} rows._id - 角色id
|
|
26
|
+
* @returns {string} rows.name - 角色名称必须唯一
|
|
27
|
+
* @returns {number} rows.sort - 排序序号
|
|
28
|
+
* @returns {string} rows.desc - 角色描述
|
|
29
|
+
* @returns {Object} rows.users - 关联的用户列表
|
|
30
|
+
* @returns {number} rows.type - 角色通用类型默认为-0
|
|
31
|
+
* @returns {number} rows.userType - 查看枚举userType
|
|
32
|
+
* @returns {Array} rows.userIds - 关联的用户id列表
|
|
33
|
+
* @returns {boolean} rows.control - 是否可控制默认为true
|
|
34
|
+
* @returns {Array} rows.routers - 拥有的权限列表
|
|
35
|
+
* @returns {string} rows.routers.subject - 权限主题
|
|
36
|
+
* @returns {Array} rows.routers.actions - 权限列表
|
|
37
|
+
* @returns {Array} rows.routers.children - 路由列表
|
|
38
|
+
*/
|
|
39
|
+
export function list(query) {
|
|
40
|
+
return requestShow({
|
|
41
|
+
url: '/bms-roles',
|
|
42
|
+
method: 'get',
|
|
43
|
+
params: query
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 新增路由
|
|
49
|
+
* @param {Object} data - 包含路由的请求体 属性见list返回字段。
|
|
50
|
+
* @returns {number} code - 返回码,0表示成功
|
|
51
|
+
* @returns {string} data - 新增成功的数据 跟list返回字段一致
|
|
52
|
+
*/
|
|
53
|
+
export function create(data) {
|
|
54
|
+
return requestShow({
|
|
55
|
+
url: '/bms-roles',
|
|
56
|
+
method: 'post',
|
|
57
|
+
data
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 修改路由
|
|
63
|
+
* @param {Object} data - 包含路由的请求体 属性见list返回字段。
|
|
64
|
+
* @returns {number} code - 返回码,0表示成功
|
|
65
|
+
* @returns {string} data - 修改成功的数据 跟list返回字段一致
|
|
66
|
+
*/
|
|
67
|
+
export function updateOne(data) {
|
|
68
|
+
return requestShow({
|
|
69
|
+
url: `/bms-roles/${data._id}`,
|
|
70
|
+
method: 'put',
|
|
71
|
+
data
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 删除路由
|
|
76
|
+
* @param {string} id - 删除的路由id。
|
|
77
|
+
* @returns {number} code - 返回码,0表示成功
|
|
78
|
+
* @returns {string} data - 删除成功的数据 跟list返回字段一致
|
|
79
|
+
*/
|
|
80
|
+
export function deleteOne(id) {
|
|
81
|
+
return requestShow({
|
|
82
|
+
url: `/bms-roles/${id}`,
|
|
83
|
+
method: 'delete'
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 批量删除路由
|
|
89
|
+
* @param {Array} ids - 删除的路由ids。
|
|
90
|
+
* @returns {number} code - 返回码,0表示成功
|
|
91
|
+
*/
|
|
92
|
+
export function deleteMany(ids) {
|
|
93
|
+
return requestShow({
|
|
94
|
+
url: '/bms-roles',
|
|
95
|
+
method: 'delete',
|
|
96
|
+
data: ids // delete传递主体要包含在data里
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
list,
|
|
102
|
+
create,
|
|
103
|
+
updateOne,
|
|
104
|
+
deleteOne,
|
|
105
|
+
deleteMany
|
|
106
|
+
}
|
|
107
|
+
|
package/api/bmsRouter.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { requestShow } from '../utils'
|
|
2
|
+
/**
|
|
3
|
+
* @file BMS路由api
|
|
4
|
+
* @module BMS路由接口
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 路由method枚举
|
|
10
|
+
* @readonly
|
|
11
|
+
* @enum {string}
|
|
12
|
+
*/
|
|
13
|
+
var method = {
|
|
14
|
+
all: 'all',
|
|
15
|
+
get: 'get',
|
|
16
|
+
post: 'post',
|
|
17
|
+
put: 'put',
|
|
18
|
+
delete: 'delete'
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param {*} query
|
|
23
|
+
* @param {number} query.page - 页码
|
|
24
|
+
* @param {number} query.limit - 每页数量
|
|
25
|
+
* @returns {number} code - 返回码,0表示成功
|
|
26
|
+
* @returns {number} total - 路由总数
|
|
27
|
+
* @returns {Array} rows - 路由数组
|
|
28
|
+
* @returns {string} rows._id - 路由id
|
|
29
|
+
* @returns {string} rows.type - 路由类型
|
|
30
|
+
* @returns {string} rows.name - 路由名称
|
|
31
|
+
* @returns {string} rows.path - 路由路径
|
|
32
|
+
* @returns {number} rows.level - 路由等级
|
|
33
|
+
* @returns {number} rows.sort - 排序序号
|
|
34
|
+
* @returns {Array} rows.children - 子路由列表
|
|
35
|
+
* @returns {string} rows.method - 查看枚举method
|
|
36
|
+
* @returns {string} rows.desc - 路由描述
|
|
37
|
+
* @returns {Array} rows.roles - 关联的角色列表
|
|
38
|
+
* @returns {Array} rows.actions - 关联的功能列表
|
|
39
|
+
* @returns {string} rows.actions.name - 功能名称
|
|
40
|
+
* @returns {string} rows.actions.code - 功能编码
|
|
41
|
+
* @returns {string} rows.subject - 主题
|
|
42
|
+
* @returns {Array} rows.deviceClass - 关联的设备类型
|
|
43
|
+
* @returns {string} rows.deviceClass.name - 设备类型名称
|
|
44
|
+
* @returns {string} rows.deviceClass.icon - 设备类型图标
|
|
45
|
+
* @returns {string} rows.deviceClass.code - 设备类型编码
|
|
46
|
+
* @returns {string} rows.deviceClass.departTag - 设备类型层级标签
|
|
47
|
+
* @returns {Object} rows.deviceClass.uis - 设备类型ui信息
|
|
48
|
+
* @returns {string} rows.customJson - 自定义json
|
|
49
|
+
* @returns {string} rows.icon - 图标
|
|
50
|
+
*/
|
|
51
|
+
export function list(query) {
|
|
52
|
+
return requestShow({
|
|
53
|
+
url: '/bms-routers',
|
|
54
|
+
method: 'get',
|
|
55
|
+
params: query
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 新增路由
|
|
61
|
+
* @param {Object} data - 包含路由的请求体 属性见list返回字段。
|
|
62
|
+
* @returns {number} code - 返回码,0表示成功
|
|
63
|
+
* @returns {string} data - 新增成功的数据 跟list返回字段一致
|
|
64
|
+
*/
|
|
65
|
+
export function create(data) {
|
|
66
|
+
return requestShow({
|
|
67
|
+
url: '/bms-routers',
|
|
68
|
+
method: 'post',
|
|
69
|
+
data
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 修改路由
|
|
75
|
+
* @param {Object} data - 包含路由的请求体 属性见list返回字段。
|
|
76
|
+
* @returns {number} code - 返回码,0表示成功
|
|
77
|
+
* @returns {string} data - 修改成功的数据 跟list返回字段一致
|
|
78
|
+
*/
|
|
79
|
+
export function updateOne(data) {
|
|
80
|
+
return requestShow({
|
|
81
|
+
url: `/bms-routers/${data._id}`,
|
|
82
|
+
method: 'put',
|
|
83
|
+
data
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 删除路由
|
|
88
|
+
* @param {string} id - 删除的路由id。
|
|
89
|
+
* @returns {number} code - 返回码,0表示成功
|
|
90
|
+
* @returns {string} data - 删除成功的数据 跟list返回字段一致
|
|
91
|
+
*/
|
|
92
|
+
export function deleteOne(id) {
|
|
93
|
+
return requestShow({
|
|
94
|
+
url: `/bms-routers/${id}`,
|
|
95
|
+
method: 'delete'
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 批量删除路由
|
|
101
|
+
* @param {Array} ids - 删除的路由ids。
|
|
102
|
+
* @returns {number} code - 返回码,0表示成功
|
|
103
|
+
*/
|
|
104
|
+
export function deleteMany(ids) {
|
|
105
|
+
return requestShow({
|
|
106
|
+
url: '/bms-routers',
|
|
107
|
+
method: 'delete',
|
|
108
|
+
data: ids // delete传递主体要包含在data里
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default {
|
|
113
|
+
list,
|
|
114
|
+
create,
|
|
115
|
+
updateOne,
|
|
116
|
+
deleteOne,
|
|
117
|
+
deleteMany
|
|
118
|
+
}
|
|
119
|
+
|
package/api/router.js
CHANGED
|
@@ -3,6 +3,7 @@ import { requestShow } from '../utils'
|
|
|
3
3
|
* @file 路由api
|
|
4
4
|
* @module 路由接口
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
8
9
|
* @param {*} query
|
|
@@ -20,7 +21,6 @@ import { requestShow } from '../utils'
|
|
|
20
21
|
* @returns {('all'|'get'|'post'|'put'|'delete')} rows.method - HTTP请求方法
|
|
21
22
|
* @returns {string} rows.desc - 路由描述
|
|
22
23
|
* @returns {Array<mongoose.Schema.Types.ObjectId>} rows.roles - 关联的角色列表
|
|
23
|
-
* @returns {string} rows.icon - 路由图标
|
|
24
24
|
*/
|
|
25
25
|
export function list(query) {
|
|
26
26
|
return request({
|
package/index.js
CHANGED
|
@@ -5,11 +5,17 @@ import alarmRecord from './api/alarmRecord'
|
|
|
5
5
|
import alarmProgress from './api/alarmProgress'
|
|
6
6
|
import systeminfo from './api/systeminfo'
|
|
7
7
|
import router from './api/router'
|
|
8
|
+
import departs from './api/departs'
|
|
9
|
+
import bmsRole from './api/bmsRole'
|
|
10
|
+
import bmsRouter from './api/bmsRouter'
|
|
8
11
|
const api = {
|
|
9
12
|
alarmRecord,
|
|
10
13
|
alarmProgress,
|
|
11
14
|
systeminfo,
|
|
12
|
-
router
|
|
15
|
+
router,
|
|
16
|
+
departs,
|
|
17
|
+
bmsRole,
|
|
18
|
+
bmsRouter
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
export default { config: options => {
|