nayota-show-sdk 1.3.52 → 1.3.55
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 +8 -0
- package/api/attendanceRecord.js +201 -0
- package/api/workSchedule.js +173 -0
- package/index.js +4 -0
- package/package.json +1 -1
package/api/area.js
CHANGED
|
@@ -27,6 +27,8 @@ import { requestShow } from '../utils'
|
|
|
27
27
|
* @property {string} managerName - 管理人姓名
|
|
28
28
|
* @property {number} areaSize - 区域面积(平方米)
|
|
29
29
|
* @property {Array} centerCoordinate - 区域中心坐标 [x, y]
|
|
30
|
+
* @property {boolean} isPointDisplay - 是否显示点位
|
|
31
|
+
* @property {Object} pointJson - 点位样式自定义json
|
|
30
32
|
* @property {string} creator - 创建人id
|
|
31
33
|
* @property {string} linkType - 区域关联类型 'none'|'depart'|'device'|'link'|'scada'
|
|
32
34
|
* @property {string} targetDepartId - 关联部门ID(跳转楼栋/楼层)
|
|
@@ -49,6 +51,12 @@ import { requestShow } from '../utils'
|
|
|
49
51
|
"managerName": "张三",
|
|
50
52
|
"creator": "667d2ecc52d21700095b58b5",
|
|
51
53
|
"centerCoordinate": [116.404, 39.915],
|
|
54
|
+
"isPointDisplay": true,
|
|
55
|
+
"pointJson": {
|
|
56
|
+
"icon": "warning",
|
|
57
|
+
"color": "#ff5a36",
|
|
58
|
+
"size": 24
|
|
59
|
+
},
|
|
52
60
|
"linkType": "scada",
|
|
53
61
|
"targetDeviceId": "67073bfe463d6e00099becde",
|
|
54
62
|
"targetDeviceIds": ["67073bfe463d6e00099becde", "67073bfe463d6e00099becdf"],
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { requestShow } from '../utils'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file 考勤记录api
|
|
5
|
+
* @module 考勤记录接口
|
|
6
|
+
* @category 人员管理
|
|
7
|
+
* @import
|
|
8
|
+
* import { attendanceRecord } from 'nayota-show-sdk'
|
|
9
|
+
* const { list, create, getOne, updateOne, deleteOne, deleteMany } = attendanceRecord
|
|
10
|
+
* list({ page: 1, limit: 10 })
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} AttendanceLocation - 打卡定位
|
|
15
|
+
* @property {'Point'} type - GeoJSON 类型
|
|
16
|
+
* @property {Array<number>} coordinates - 经纬度数组,[经度, 纬度]
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Object} AttendanceRecord - 考勤记录
|
|
21
|
+
* @property {string} _id - 考勤记录id
|
|
22
|
+
* @property {string|Object} user - 关联用户
|
|
23
|
+
* @property {Date} date - 考勤日期
|
|
24
|
+
* @property {number} [shiftType] - 班次类型,1 早班,2 中班,3 晚班
|
|
25
|
+
* @property {Date} [clockInTime] - 上班打卡时间
|
|
26
|
+
* @property {Date} [clockOutTime] - 下班打卡时间
|
|
27
|
+
* @property {number} [clockInMethod] - 上班打卡方式,1 扫码拍照,2 GPS定位,3 人脸识别
|
|
28
|
+
* @property {number} [clockOutMethod] - 下班打卡方式,1 扫码拍照,2 GPS定位,3 人脸识别
|
|
29
|
+
* @property {string} [clockInPhoto] - 上班打卡照片
|
|
30
|
+
* @property {string} [clockOutPhoto] - 下班打卡照片
|
|
31
|
+
* @property {AttendanceLocation} [clockInLocation] - 上班打卡定位
|
|
32
|
+
* @property {AttendanceLocation} [clockOutLocation] - 下班打卡定位
|
|
33
|
+
* @property {string} [clockInAddress] - 上班打卡地址
|
|
34
|
+
* @property {string} [clockOutAddress] - 下班打卡地址
|
|
35
|
+
* @property {number} status - 考勤状态,0 未打卡,1 正常,2 迟到,3 早退,4 缺勤,5 迟到且早退
|
|
36
|
+
* @property {number} [workDuration] - 实际工作时长,单位分钟
|
|
37
|
+
* @property {boolean} isOvertime - 是否加班
|
|
38
|
+
* @property {number} [overtimeDuration] - 加班时长,单位分钟
|
|
39
|
+
* @property {string} [remark] - 备注
|
|
40
|
+
* @property {string} [creator] - 创建者
|
|
41
|
+
* @property {Date} createdAt - 创建时间
|
|
42
|
+
* @property {Date} updatedAt - 更新时间
|
|
43
|
+
* @example
|
|
44
|
+
* {
|
|
45
|
+
* "_id": "67f8f0000000000000000001",
|
|
46
|
+
* "user": "67f8f0000000000000000002",
|
|
47
|
+
* "date": "2026-03-31T00:00:00.000Z",
|
|
48
|
+
* "shiftType": 1,
|
|
49
|
+
* "clockInTime": "2026-03-31T00:03:00.000Z",
|
|
50
|
+
* "clockOutTime": "2026-03-31T08:02:00.000Z",
|
|
51
|
+
* "clockInMethod": 2,
|
|
52
|
+
* "clockOutMethod": 2,
|
|
53
|
+
* "clockInAddress": "浙江省宁波市鄞州区xxx",
|
|
54
|
+
* "clockOutAddress": "浙江省宁波市鄞州区xxx",
|
|
55
|
+
* "status": 1,
|
|
56
|
+
* "workDuration": 479,
|
|
57
|
+
* "isOvertime": false,
|
|
58
|
+
* "overtimeDuration": 0,
|
|
59
|
+
* "remark": "正常出勤",
|
|
60
|
+
* "creator": "67f8f0000000000000000003",
|
|
61
|
+
* "createdAt": "2026-03-31T08:05:00.000Z",
|
|
62
|
+
* "updatedAt": "2026-03-31T08:05:00.000Z"
|
|
63
|
+
* }
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 获取考勤记录列表
|
|
68
|
+
* @param {Object} query - 请求对象
|
|
69
|
+
* @param {number} [query.page] - 页码
|
|
70
|
+
* @param {number} [query.limit] - 每页数量
|
|
71
|
+
* @param {string} [query.label] - 模糊查询字段
|
|
72
|
+
* @param {string} [query.search] - 模糊查询值
|
|
73
|
+
* @param {string} [query.user] - 用户id
|
|
74
|
+
* @param {string|Date} [query.date] - 考勤日期
|
|
75
|
+
* @param {number} [query.shiftType] - 班次类型
|
|
76
|
+
* @param {number} [query.status] - 考勤状态
|
|
77
|
+
* @param {string} [query.sort] - 排序字段
|
|
78
|
+
* @returns {number} code - 返回码,0表示成功
|
|
79
|
+
* @returns {number} total - 总数
|
|
80
|
+
* @returns {Array<AttendanceRecord>} rows - 列表数据
|
|
81
|
+
*/
|
|
82
|
+
export function list(query) {
|
|
83
|
+
return requestShow({
|
|
84
|
+
url: '/attendance-records',
|
|
85
|
+
method: 'get',
|
|
86
|
+
params: query
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 新增考勤记录
|
|
92
|
+
* @param {Object} data - 请求体
|
|
93
|
+
* @param {string} data.user - 用户id
|
|
94
|
+
* @param {string|Date} data.date - 考勤日期
|
|
95
|
+
* @param {number} [data.shiftType] - 班次类型,1 早班,2 中班,3 晚班
|
|
96
|
+
* @param {string|Date|null} [data.clockInTime] - 上班打卡时间
|
|
97
|
+
* @param {string|Date|null} [data.clockOutTime] - 下班打卡时间
|
|
98
|
+
* @param {number} [data.clockInMethod] - 上班打卡方式
|
|
99
|
+
* @param {number} [data.clockOutMethod] - 下班打卡方式
|
|
100
|
+
* @param {string|null} [data.clockInPhoto] - 上班打卡照片
|
|
101
|
+
* @param {string|null} [data.clockOutPhoto] - 下班打卡照片
|
|
102
|
+
* @param {AttendanceLocation|null} [data.clockInLocation] - 上班打卡定位
|
|
103
|
+
* @param {AttendanceLocation|null} [data.clockOutLocation] - 下班打卡定位
|
|
104
|
+
* @param {string|null} [data.clockInAddress] - 上班打卡地址
|
|
105
|
+
* @param {string|null} [data.clockOutAddress] - 下班打卡地址
|
|
106
|
+
* @param {number} [data.status] - 考勤状态
|
|
107
|
+
* @param {number} [data.workDuration] - 实际工作时长,单位分钟
|
|
108
|
+
* @param {boolean} [data.isOvertime] - 是否加班
|
|
109
|
+
* @param {number} [data.overtimeDuration] - 加班时长,单位分钟
|
|
110
|
+
* @param {string|null} [data.remark] - 备注
|
|
111
|
+
* @returns {number} code - 返回码,0表示成功
|
|
112
|
+
* @returns {AttendanceRecord} data - 新增成功的数据
|
|
113
|
+
*/
|
|
114
|
+
export function create(data) {
|
|
115
|
+
return requestShow({
|
|
116
|
+
url: '/attendance-records',
|
|
117
|
+
method: 'post',
|
|
118
|
+
data
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 获取考勤记录详情
|
|
124
|
+
* @param {string} id - 考勤记录id
|
|
125
|
+
* @returns {number} code - 返回码,0表示成功
|
|
126
|
+
* @returns {AttendanceRecord} data - 详情对象
|
|
127
|
+
*/
|
|
128
|
+
export function getOne(id) {
|
|
129
|
+
return requestShow({
|
|
130
|
+
url: `/attendance-records/${id}`,
|
|
131
|
+
method: 'get'
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 编辑考勤记录
|
|
137
|
+
* @param {Object} data - 修改数据对象
|
|
138
|
+
* @param {string} data._id - 考勤记录id
|
|
139
|
+
* @param {string} [data.user] - 用户id
|
|
140
|
+
* @param {string|Date} [data.date] - 考勤日期
|
|
141
|
+
* @param {number} [data.shiftType] - 班次类型
|
|
142
|
+
* @param {string|Date|null} [data.clockInTime] - 上班打卡时间
|
|
143
|
+
* @param {string|Date|null} [data.clockOutTime] - 下班打卡时间
|
|
144
|
+
* @param {number} [data.clockInMethod] - 上班打卡方式
|
|
145
|
+
* @param {number} [data.clockOutMethod] - 下班打卡方式
|
|
146
|
+
* @param {string|null} [data.clockInPhoto] - 上班打卡照片
|
|
147
|
+
* @param {string|null} [data.clockOutPhoto] - 下班打卡照片
|
|
148
|
+
* @param {AttendanceLocation|null} [data.clockInLocation] - 上班打卡定位
|
|
149
|
+
* @param {AttendanceLocation|null} [data.clockOutLocation] - 下班打卡定位
|
|
150
|
+
* @param {string|null} [data.clockInAddress] - 上班打卡地址
|
|
151
|
+
* @param {string|null} [data.clockOutAddress] - 下班打卡地址
|
|
152
|
+
* @param {number} [data.status] - 考勤状态
|
|
153
|
+
* @param {number} [data.workDuration] - 实际工作时长,单位分钟
|
|
154
|
+
* @param {boolean} [data.isOvertime] - 是否加班
|
|
155
|
+
* @param {number} [data.overtimeDuration] - 加班时长,单位分钟
|
|
156
|
+
* @param {string|null} [data.remark] - 备注
|
|
157
|
+
* @returns {number} code - 返回码,0表示成功
|
|
158
|
+
* @returns {AttendanceRecord} data - 修改后的数据
|
|
159
|
+
*/
|
|
160
|
+
export function updateOne(data) {
|
|
161
|
+
return requestShow({
|
|
162
|
+
url: `/attendance-records/${data._id}`,
|
|
163
|
+
method: 'put',
|
|
164
|
+
data
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 删除考勤记录
|
|
170
|
+
* @param {string} id - 考勤记录id
|
|
171
|
+
* @returns {number} code - 返回码,0表示成功
|
|
172
|
+
* @returns {AttendanceRecord} data - 删除的数据
|
|
173
|
+
*/
|
|
174
|
+
export function deleteOne(id) {
|
|
175
|
+
return requestShow({
|
|
176
|
+
url: `/attendance-records/${id}`,
|
|
177
|
+
method: 'delete'
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* 批量删除考勤记录
|
|
183
|
+
* @param {Array<string>} ids - 考勤记录id数组
|
|
184
|
+
* @returns {number} code - 返回码,0表示成功
|
|
185
|
+
*/
|
|
186
|
+
export function deleteMany(ids) {
|
|
187
|
+
return requestShow({
|
|
188
|
+
url: '/attendance-records',
|
|
189
|
+
method: 'delete',
|
|
190
|
+
data: ids
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export default {
|
|
195
|
+
list,
|
|
196
|
+
create,
|
|
197
|
+
getOne,
|
|
198
|
+
updateOne,
|
|
199
|
+
deleteOne,
|
|
200
|
+
deleteMany
|
|
201
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { requestShow } from '../utils'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file 排班表api
|
|
5
|
+
* @module 排班表接口
|
|
6
|
+
* @category 人员管理
|
|
7
|
+
* @import
|
|
8
|
+
* import { workSchedule } from 'nayota-show-sdk'
|
|
9
|
+
* const { list, create, getOne, updateOne, deleteOne, deleteMany } = workSchedule
|
|
10
|
+
* list({ page: 1, limit: 10 })
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} WorkScheduleDetail - 排班明细
|
|
15
|
+
* @property {number} day - 日期,1-31
|
|
16
|
+
* @property {number} [shiftType] - 当日班次,1 早班,2 中班,3 晚班
|
|
17
|
+
* @property {boolean} isRestDay - 是否休息日
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} WorkSchedule - 排班表
|
|
22
|
+
* @property {string} _id - 排班表id
|
|
23
|
+
* @property {string|Object} user - 关联用户
|
|
24
|
+
* @property {number} year - 年份
|
|
25
|
+
* @property {number} month - 月份,1-12
|
|
26
|
+
* @property {number} shiftType - 默认班次类型,1 早班,2 中班,3 晚班
|
|
27
|
+
* @property {Array<WorkScheduleDetail>} scheduleDetails - 每日排班明细
|
|
28
|
+
* @property {number} status - 状态,0 草稿,1 已发布
|
|
29
|
+
* @property {string} [remark] - 备注
|
|
30
|
+
* @property {string} [creator] - 创建者
|
|
31
|
+
* @property {Date} createdAt - 创建时间
|
|
32
|
+
* @property {Date} updatedAt - 更新时间
|
|
33
|
+
* @example
|
|
34
|
+
* {
|
|
35
|
+
* "_id": "67f8f0000000000000000101",
|
|
36
|
+
* "user": "67f8f0000000000000000002",
|
|
37
|
+
* "year": 2026,
|
|
38
|
+
* "month": 3,
|
|
39
|
+
* "shiftType": 1,
|
|
40
|
+
* "scheduleDetails": [
|
|
41
|
+
* {
|
|
42
|
+
* "day": 8,
|
|
43
|
+
* "shiftType": 2,
|
|
44
|
+
* "isRestDay": false
|
|
45
|
+
* },
|
|
46
|
+
* {
|
|
47
|
+
* "day": 16,
|
|
48
|
+
* "isRestDay": true
|
|
49
|
+
* }
|
|
50
|
+
* ],
|
|
51
|
+
* "status": 1,
|
|
52
|
+
* "remark": "三月排班",
|
|
53
|
+
* "creator": "67f8f0000000000000000003",
|
|
54
|
+
* "createdAt": "2026-03-01T00:00:00.000Z",
|
|
55
|
+
* "updatedAt": "2026-03-20T00:00:00.000Z"
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 获取排班表列表
|
|
61
|
+
* @param {Object} query - 请求对象
|
|
62
|
+
* @param {number} [query.page] - 页码
|
|
63
|
+
* @param {number} [query.limit] - 每页数量
|
|
64
|
+
* @param {string} [query.label] - 模糊查询字段
|
|
65
|
+
* @param {string} [query.search] - 模糊查询值
|
|
66
|
+
* @param {string} [query.user] - 用户id
|
|
67
|
+
* @param {number} [query.year] - 年份
|
|
68
|
+
* @param {number} [query.month] - 月份
|
|
69
|
+
* @param {number} [query.shiftType] - 默认班次类型
|
|
70
|
+
* @param {number} [query.status] - 状态
|
|
71
|
+
* @param {string} [query.sort] - 排序字段
|
|
72
|
+
* @returns {number} code - 返回码,0表示成功
|
|
73
|
+
* @returns {number} total - 总数
|
|
74
|
+
* @returns {Array<WorkSchedule>} rows - 列表数据
|
|
75
|
+
*/
|
|
76
|
+
export function list(query) {
|
|
77
|
+
return requestShow({
|
|
78
|
+
url: '/work-schedules',
|
|
79
|
+
method: 'get',
|
|
80
|
+
params: query
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 新增排班表
|
|
86
|
+
* @param {Object} data - 请求体
|
|
87
|
+
* @param {string} data.user - 用户id
|
|
88
|
+
* @param {number} data.year - 年份
|
|
89
|
+
* @param {number} data.month - 月份,1-12
|
|
90
|
+
* @param {number} data.shiftType - 默认班次类型,1 早班,2 中班,3 晚班
|
|
91
|
+
* @param {Array<WorkScheduleDetail>|null} [data.scheduleDetails] - 每日排班明细
|
|
92
|
+
* @param {number} [data.status] - 状态,0 草稿,1 已发布
|
|
93
|
+
* @param {string|null} [data.remark] - 备注
|
|
94
|
+
* @returns {number} code - 返回码,0表示成功
|
|
95
|
+
* @returns {WorkSchedule} data - 新增成功的数据
|
|
96
|
+
*/
|
|
97
|
+
export function create(data) {
|
|
98
|
+
return requestShow({
|
|
99
|
+
url: '/work-schedules',
|
|
100
|
+
method: 'post',
|
|
101
|
+
data
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 获取排班表详情
|
|
107
|
+
* @param {string} id - 排班表id
|
|
108
|
+
* @returns {number} code - 返回码,0表示成功
|
|
109
|
+
* @returns {WorkSchedule} data - 详情对象
|
|
110
|
+
*/
|
|
111
|
+
export function getOne(id) {
|
|
112
|
+
return requestShow({
|
|
113
|
+
url: `/work-schedules/${id}`,
|
|
114
|
+
method: 'get'
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 编辑排班表
|
|
120
|
+
* @param {Object} data - 修改数据对象
|
|
121
|
+
* @param {string} data._id - 排班表id
|
|
122
|
+
* @param {string} [data.user] - 用户id
|
|
123
|
+
* @param {number} [data.year] - 年份
|
|
124
|
+
* @param {number} [data.month] - 月份,1-12
|
|
125
|
+
* @param {number} [data.shiftType] - 默认班次类型
|
|
126
|
+
* @param {Array<WorkScheduleDetail>|null} [data.scheduleDetails] - 每日排班明细
|
|
127
|
+
* @param {number} [data.status] - 状态,0 草稿,1 已发布
|
|
128
|
+
* @param {string|null} [data.remark] - 备注
|
|
129
|
+
* @returns {number} code - 返回码,0表示成功
|
|
130
|
+
* @returns {WorkSchedule} data - 修改后的数据
|
|
131
|
+
*/
|
|
132
|
+
export function updateOne(data) {
|
|
133
|
+
return requestShow({
|
|
134
|
+
url: `/work-schedules/${data._id}`,
|
|
135
|
+
method: 'put',
|
|
136
|
+
data
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 删除排班表
|
|
142
|
+
* @param {string} id - 排班表id
|
|
143
|
+
* @returns {number} code - 返回码,0表示成功
|
|
144
|
+
* @returns {WorkSchedule} data - 删除的数据
|
|
145
|
+
*/
|
|
146
|
+
export function deleteOne(id) {
|
|
147
|
+
return requestShow({
|
|
148
|
+
url: `/work-schedules/${id}`,
|
|
149
|
+
method: 'delete'
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 批量删除排班表
|
|
155
|
+
* @param {Array<string>} ids - 排班表id数组
|
|
156
|
+
* @returns {number} code - 返回码,0表示成功
|
|
157
|
+
*/
|
|
158
|
+
export function deleteMany(ids) {
|
|
159
|
+
return requestShow({
|
|
160
|
+
url: '/work-schedules',
|
|
161
|
+
method: 'delete',
|
|
162
|
+
data: ids
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export default {
|
|
167
|
+
list,
|
|
168
|
+
create,
|
|
169
|
+
getOne,
|
|
170
|
+
updateOne,
|
|
171
|
+
deleteOne,
|
|
172
|
+
deleteMany
|
|
173
|
+
}
|
package/index.js
CHANGED
|
@@ -38,6 +38,8 @@ import energyConsumption from "./api/energyConsumption";
|
|
|
38
38
|
import maintenancePlan from "./api/maintenancePlan";
|
|
39
39
|
import maintenanceRecord from "./api/maintenanceRecord";
|
|
40
40
|
import sensorStatusConfig from "./api/sensorStatusConfig";
|
|
41
|
+
import attendanceRecord from "./api/attendanceRecord";
|
|
42
|
+
import workSchedule from "./api/workSchedule";
|
|
41
43
|
const api = {
|
|
42
44
|
alarmRecord,
|
|
43
45
|
alarmProgress,
|
|
@@ -76,6 +78,8 @@ const api = {
|
|
|
76
78
|
maintenancePlan,
|
|
77
79
|
maintenanceRecord,
|
|
78
80
|
sensorStatusConfig,
|
|
81
|
+
attendanceRecord,
|
|
82
|
+
workSchedule,
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
export default {
|