index.ts 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. * @Author: liuJie
  3. * @Date: 2026-02-06 16:29:04
  4. * @LastEditors: liuJie
  5. * @LastEditTime: 2026-03-07 22:19:23
  6. * @Describe: 安全体系建设工作计划管理(管理员)
  7. */
  8. import { http } from '@/utils/http/axios';
  9. import type { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';
  10. /**
  11. * 安全体系建设工作计划列表项
  12. * 对应列表页表格字段
  13. */
  14. export interface WorkPlanItem {
  15. categoryName: string;
  16. cooperateDeptIds: string;
  17. cooperateDeptNames: string;
  18. createdAt: Date;
  19. createdBy: number;
  20. createdByName: string;
  21. executGroupIds: string;
  22. executGroupNames?: any;
  23. feedbackCount: number;
  24. feedbackRatio: number;
  25. fileUrl: string;
  26. id: number;
  27. issuedCount: number;
  28. plannedComplateTime: Date;
  29. plannedEndTime?: any;
  30. plannedStartTime?: any;
  31. responsibleDeptIds: number;
  32. responsibleDeptNames: string;
  33. status: number;
  34. statusName: string;
  35. trainingPlanName: string;
  36. updatedAt: Date;
  37. workContent: string;
  38. }
  39. /**
  40. * 工作计划列表查询条件
  41. */
  42. export interface WorkPlanQueryParam {
  43. keyword?: string;
  44. status?: number | string;
  45. categoryName?: string;
  46. startDate?: string;
  47. endDate?: string;
  48. /** 排序 */
  49. sortField?: string;
  50. sortOrder?: Boolean;
  51. }
  52. interface FileType {
  53. contentType: string;
  54. url: string;
  55. }
  56. /**
  57. * 新增/编辑工作计划请求体
  58. */
  59. export interface SaveWorkPlanRequest {
  60. id?: number;
  61. workContent: string;
  62. categoryName: string;
  63. trainingPlanName: string;
  64. responsibleDeptIds: string | number[] | string[];
  65. cooperateDeptIds: string | number[] | string[];
  66. executGroupIds: string | number[] | string[];
  67. plannedComplateTime: string;
  68. fileUrl: string;
  69. /** 其他业务字段按需扩展 */
  70. [key: string]: unknown;
  71. }
  72. export interface IssueWorkPlanParams {
  73. id: number;
  74. executGroupIds: string | number[] | string[];
  75. plannedStartTime: string;
  76. plannedEndTime: string;
  77. }
  78. export interface QueryParam {
  79. planId: number | string;
  80. keyword: string;
  81. status: number | string;
  82. startDate: string;
  83. endDate: string;
  84. responsibleDeptIds: string | number[] | string[];
  85. sortOrder: boolean;
  86. }
  87. export interface ViewSenderParamsType {
  88. pageNumber: number;
  89. pageSize: number;
  90. queryParam: QueryParam;
  91. }
  92. /** 编辑时必传 id */
  93. export interface UpdateWorkPlanRequest extends SaveWorkPlanRequest {
  94. id: number;
  95. }
  96. export interface ViewSenderQueryPageResponse {
  97. categoryName: string;
  98. cooperateDeptNames: string;
  99. createdAt: string;
  100. createdBy?: any;
  101. employeeId?: any;
  102. employeeName?: any;
  103. executGroupNames: string;
  104. fileUrl?: any;
  105. id: number;
  106. issuedByName?: any;
  107. planId: number;
  108. plannedComplateTime: string;
  109. responsibleDeptName: string;
  110. status: number;
  111. statusName?: any;
  112. trainingPlanName: string;
  113. updatedAt: string;
  114. workContent: string;
  115. }
  116. // 接口基础路径区分管理员 / 部门
  117. // 实际路径如有差异,统一调整
  118. const ADMIN_BASE = '/safetyWorkPlan/workPlan';
  119. // -----------管理员端-----------------
  120. /**
  121. * 查询安全体系建设工作计划列表(管理员端)
  122. */
  123. export function queryWorkPlanPage(data: QueryPageRequest<WorkPlanQueryParam>) {
  124. return http.request<QueryPageResponse<WorkPlanItem>>({
  125. url: `${ADMIN_BASE}/queryPageAdmin`,
  126. method: 'post',
  127. data,
  128. });
  129. }
  130. /**
  131. * 新增安全体系建设工作计划
  132. */
  133. export function saveWorkPlan(data: SaveWorkPlanRequest) {
  134. return http.request<number | void>({
  135. url: `${ADMIN_BASE}/save`,
  136. method: 'post',
  137. data,
  138. });
  139. }
  140. /**
  141. * 编辑安全体系建设工作计划
  142. */
  143. export function updateWorkPlan(data: UpdateWorkPlanRequest) {
  144. return http.request<void>({
  145. url: `${ADMIN_BASE}/update`,
  146. method: 'post',
  147. data,
  148. });
  149. }
  150. /**
  151. * 查询安全体系建设工作计划详情
  152. */
  153. export function queryWorkPlanDetail(id: number) {
  154. return http.request<SaveWorkPlanRequest>({
  155. url: `${ADMIN_BASE}/queryDetail`,
  156. // url: `/safetyWorkPlan/workPlanSendObj/queryDetail?id=${id}`,
  157. method: 'get',
  158. params: { id },
  159. });
  160. }
  161. /**
  162. * 查询部门安全体系建设工作计划详情
  163. */
  164. export function queryWorkPlanDepartmentDetail(id: number) {
  165. return http.request<SaveWorkPlanRequest>({
  166. url: `/safetyWorkPlan/workPlanSendObj/queryDetail?id=${id}`,
  167. method: 'get',
  168. });
  169. }
  170. /**
  171. * 删除安全体系建设工作计划
  172. */
  173. export function deleteWorkPlan(id: number) {
  174. return http.request<void>({
  175. url: `${ADMIN_BASE}/delete?id=${id}`,
  176. method: 'post',
  177. });
  178. }
  179. /**
  180. * 下发安全体系建设工作计划
  181. */
  182. export function issueWorkPlan(data: IssueWorkPlanParams) {
  183. return http.request<void>({
  184. url: `${ADMIN_BASE}/assign`,
  185. method: 'post',
  186. data,
  187. });
  188. }
  189. /**
  190. * 作废安全体系建设工作计划
  191. */
  192. export function cancelWorkPlan(id: number) {
  193. return http.request<number | void>({
  194. url: `${ADMIN_BASE}/invalid?id=${id}`,
  195. method: 'post',
  196. });
  197. }
  198. /**
  199. * @description: 查看发送对象列表
  200. */
  201. export function queryViewSender(data: ViewSenderParamsType) {
  202. return http.request<QueryPageResponse<ViewSenderQueryPageResponse>>({
  203. url: `/safetyWorkPlan/workPlanSendObj/queryPage`,
  204. method: 'post',
  205. data,
  206. });
  207. }
  208. /**
  209. * @description: 导出
  210. * @return {*}
  211. */
  212. export const exportTableData = (params)=> {
  213. return http.request({
  214. url: `/safety-culture/exportProductionEducationTrainingPlan`,
  215. method: 'get',
  216. params,
  217. responseType: 'blob',
  218. }, {
  219. isTransformResponse: false,
  220. });
  221. }
  222. // —————————————————部门端———————————————————
  223. /**
  224. * 查询安全体系建设工作计划列表(部门端分页)
  225. */
  226. export function queryWorkPlanDeptPage(query: QueryPageRequest<WorkPlanQueryParam>) {
  227. return http.request<QueryPageResponse<WorkPlanItem>>({
  228. url: `/safetyWorkPlan/workPlan/queryPageDept`,
  229. method: 'post',
  230. data: query,
  231. });
  232. }
  233. /**
  234. * 删除安全体系建设工作计划(部门)
  235. */
  236. export function deleteWorkPlanDept(id: number) {
  237. return http.request<void>({
  238. url: `/safetyWorkPlan/workPlanSendObj/delete?id=${id}`,
  239. method: 'post',
  240. });
  241. }
  242. /**
  243. * 反馈安全体系建设(部门)
  244. */
  245. export function issueWorkPlanDept(data) {
  246. return http.request<void>({
  247. url: `/safetyWorkPlan/workPlanSendObj/feedback`,
  248. method: 'post',
  249. data,
  250. });
  251. }