dataplatform.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import { PaginationRequest, PaginationResponse } from '@/types/common/type';
  2. import { http } from '@/utils/http/axios';
  3. /**
  4. * @description: 获取用户访问记录接口参数
  5. */
  6. export interface UserAccessRecordQueryParams {
  7. /** 查询员工姓名 */
  8. nickname?: string;
  9. /** 查询工号 */
  10. staffNo?: string;
  11. /** 查询部门ID */
  12. deptId?: string;
  13. /** 设置排序字段 */
  14. sortKey?: string;
  15. /** 设置排序方式 */
  16. sortType?: string;
  17. }
  18. /**
  19. * @description: 用户访问记录列表数据
  20. */
  21. export interface UserAccessRecord {
  22. /** 系统分配id */
  23. userId: number;
  24. /** 登录账户名 */
  25. username: string;
  26. /** 工号 */
  27. staffNo: string;
  28. /** 姓名 */
  29. nickname: string;
  30. deptId: number;
  31. deptName: string;
  32. statisticDay: number;
  33. statisticMonth: number;
  34. statisticAll: number;
  35. }
  36. /**
  37. * @description: 用户访问记录数据
  38. */
  39. export interface UserAccessRecordList {
  40. list: UserAccessRecord[];
  41. pageNumber: number;
  42. pageSize: number;
  43. total: number;
  44. }
  45. /**
  46. * @description: 获取用户访问记录
  47. */
  48. export const getUserAccessRecords = (
  49. data: PaginationRequest & { queryParam: UserAccessRecordQueryParams },
  50. ) => {
  51. return http.request<PaginationResponse<UserAccessRecord>>({
  52. url: '/admin/userRecord/getList',
  53. method: 'post',
  54. data,
  55. });
  56. };
  57. /**
  58. * @description: 绘图时间段&员工&车间查询参数
  59. */
  60. export interface ChartQuery {
  61. /** 开始时间 */
  62. startTime?: string;
  63. /** 结束时间 */
  64. endTime?: string;
  65. /** 员工id */
  66. userId?: string;
  67. /** 车间id */
  68. workshopList?: number[];
  69. }
  70. /**
  71. * @description: 车间被访问次数数据
  72. */
  73. export interface WorkshopVisitedTimes {
  74. workshopId: number;
  75. workshopName: string;
  76. count: number;
  77. }
  78. /**
  79. * @description: 获取车间被访问次数数据
  80. */
  81. export const getWorkshopVisitedTimes = (params: ChartQuery) => {
  82. return http.request<WorkshopVisitedTimes[]>({
  83. url: '/admin/userRecord/statisticByWorkshop',
  84. method: 'get',
  85. params,
  86. });
  87. };
  88. /**
  89. * @description: 相机被访问次数数据
  90. */
  91. export interface CameraVisitedTimes {
  92. cameraCode: string;
  93. cameraName: string;
  94. count: number;
  95. }
  96. export interface CameraVisitedTimeItem {
  97. workshopId: number;
  98. workshopCode: string;
  99. workshopName: string;
  100. cameraCounts: CameraVisitedTimes[];
  101. }
  102. /**
  103. * @description: 获取相机被访问次数数据
  104. */
  105. export const getCameraVisitedTimes = (body: ChartQuery) => {
  106. return http.request<CameraVisitedTimeItem[]>({
  107. url: '/admin/userRecord/statisticByCamera',
  108. method: 'post',
  109. data: body,
  110. });
  111. };
  112. /**
  113. * @description: 获取员工访问车间次数数据
  114. */
  115. export const getUserVisitTimes = (params: ChartQuery) => {
  116. return http.request<WorkshopVisitedTimes[]>({
  117. url: '/admin/userRecord/statisticByWorkshopPerUser',
  118. method: 'get',
  119. params,
  120. });
  121. };
  122. /**
  123. * @description: 员工日访问车间次数数据
  124. */
  125. export interface UserDailyVisitTimes {
  126. time: string[];
  127. data: { counts: number; workshopId: number; workshopName: string }[];
  128. }
  129. /**
  130. * @description: 获取员工日访问车间次数数据
  131. */
  132. export const getUserDailyVisitTimes = (body: ChartQuery) => {
  133. return http.request<UserDailyVisitTimes>({
  134. url: '/admin/userRecord/statisticByWorkshopPerDay',
  135. method: 'post',
  136. data: body,
  137. });
  138. };
  139. /** 获取积分列表请求体 */
  140. export interface ScoreTableQueryBody {
  141. /** 页码 */
  142. pageNumber: number;
  143. /** 页面大小 */
  144. pageSize: number;
  145. /** 查询姓名 */
  146. nickname?: string;
  147. /** 查询工号 */
  148. staffNo?: string;
  149. /** 查询部门ID */
  150. deptId?: string;
  151. /** 设置排序字段 */
  152. order?: number;
  153. /**设置排序方式 */
  154. }
  155. /** 条件获取分页积分 */
  156. export const getScoreTable = (body: ScoreTableQueryBody) => {
  157. return http.request<ScoreTableRecord>({
  158. url: '/admin/scoreManagement/getScorePageByCondition',
  159. method: 'post',
  160. data: body,
  161. });
  162. };
  163. /** 用户访问记录列表数据 */
  164. export interface ScoreTableRecordList {
  165. staffNo: string;
  166. nickname: string;
  167. deptId: number;
  168. deptName: string;
  169. score: number;
  170. }
  171. /** 用户访问记录数据 */
  172. export interface ScoreTableRecord {
  173. records: ScoreTableRecordList[];
  174. pageNumber: number;
  175. pageSize: number;
  176. totalPage: number;
  177. totalRow: number;
  178. }
  179. /** 获取积分分段人数 */
  180. export const getScoreChartData = (deptIdList: number[]) => {
  181. return http.request<ScoreChartItem[]>({
  182. url: `/admin/scoreManagement/getNumOfSectionScore`,
  183. method: 'post',
  184. data: { deptIdList },
  185. });
  186. };
  187. /** 积分分段数据 */
  188. export interface ScoreChartItem {
  189. num: number;
  190. scoreSection: number[];
  191. }