index.ts 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. import { http } from '@/utils/http/axios';
  2. import type { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';
  3. /**
  4. * 查询物品信息返回对象
  5. */
  6. export interface BusinessCertification {
  7. id: number;
  8. stuffName: string; // 物品名称
  9. injuryTime: string; // 入库日期
  10. stuffQty: number; // 物品数量
  11. surplusQty: number; // 物品结余数量
  12. remark: string; // 备注
  13. createdUserName: string; // 经办人
  14. status: boolean; // 状态(1-启用/0-禁用)
  15. createdAt: string; // 创建时间
  16. updatedAt: string; // 更新时间
  17. isDeleted: number; // 0-未删除,大于0(时间戳)-已删除
  18. statusName: string; // 状态名称
  19. accidentCertUrl: string; // 事故报告URL
  20. powerAttorneyUrl: string; // 授权委托书URL
  21. addressConfirmUrl: string; // 地址确认URL
  22. applicationFormUrl: string; // 申请表URL
  23. idCardUrl: string; // 身份证正反面URL
  24. laborContractUrl: string; // 劳动合同URL
  25. initialMedicalCertUrl: string; // 初次医疗证明URL
  26. trusteeIdCardUrl: string; // 被委托人员身份证正反面URL
  27. applicantName: string; // 申请人姓名
  28. applicantCode: string; // 申请人工号
  29. injuryReason: string; // 受伤原因
  30. departmentCode: string; // 部门编码
  31. templateId?: any; // 审批模板ID
  32. departmentName?: string; // 部门名称
  33. }
  34. /**
  35. * 查询物品信息请求参数
  36. */
  37. export interface BusinessQueryParam {
  38. stuffName?: string; // 物品名称
  39. status?: boolean; // 状态
  40. ids?: string[]; // 选择数据的ID
  41. }
  42. /** 审批流程参数 */
  43. export interface ApprovalProcessParam {
  44. id: string;
  45. approvalDescription: string;
  46. templateId?: number;
  47. approvalInfoList: {
  48. approvalOrder: number;
  49. approverIdList: number[];
  50. }[];
  51. }
  52. /** 审核参数(兼容旧调用:映射到 SaveApprovalReq) */
  53. export interface AuditPurchaseApplyParam {
  54. id: number;
  55. /** 1-审核通过,-1-审核不通过 → 映射 approvalStatus 2/3 */
  56. status: number;
  57. rejectReason?: string; // 同 returnReason
  58. approvalOrder?: number;
  59. templateId?: string;
  60. code?: string;
  61. }
  62. /** 提交审批 - 通过/退回 SaveApprovalReq */
  63. export interface SaveApprovalReq {
  64. id: number;
  65. approvalOrder?: number;
  66. /** 审批状态: 1-待审批,2-已审批,3-退回 */
  67. approvalStatus: number;
  68. /** 退回原因 */
  69. returnReason?: string;
  70. templateId?: string;
  71. }
  72. /**
  73. * 保存物品信息请求参数
  74. */
  75. export interface SaveInventoryRequest {
  76. applicantCode: string; // 申请人工号
  77. applicantName: string; // 申请人姓名
  78. injuryTime: string; // 入库日期 (ISO 格式)
  79. injuryReason: string; // 受伤原因
  80. accidentCertUrl: string; // 事故报告URL
  81. powerAttorneyUrl: string; // 授权委托书URL
  82. addressConfirmUrl: string; // 地址确认URL
  83. applicationFormUrl: string; // 申请表URL
  84. idCardUrl: string; // 身份证正反面URL
  85. laborContractUrl: string; // 劳动合同URL
  86. initialMedicalCertUrl: string; // 初次医疗证明URL
  87. trusteeIdCardUrl: string; // 被委托人员身份证正反面URL
  88. }
  89. /**
  90. * 更新工伤认定请求参数
  91. */
  92. export interface UpdateWorkInjuryApplyRequest {
  93. id: number; // 工伤认定ID
  94. applicantName: string; // 申请人姓名
  95. applicantCode: string; // 申请人工号
  96. injuryTime: string; // 受伤时间 (ISO 格式)
  97. status: boolean; // 状态(1-启用/0-禁用)
  98. injuryReason: string; // 受伤原因
  99. accidentCertUrl: string; // 事故报告URL
  100. powerAttorneyUrl: string; // 授权委托书URL
  101. addressConfirmUrl: string; // 地址确认URL
  102. applicationFormUrl: string; // 申请表URL
  103. idCardUrl: string; // 身份证正反面URL
  104. laborContractUrl: string; // 劳动合同URL
  105. initialMedicalCertUrl: string; // 初次医疗证明URL
  106. trusteeIdCardUrl: string; // 被委托人员身份证正反面URL
  107. departmentName: string; // 部门名称
  108. departmentCode: string | number[]; // 部门编码
  109. templateId: number; // 审批模板ID
  110. }
  111. /**
  112. * 查询物品库存管理列表
  113. */
  114. export function queryInventoryManage(query: QueryPageRequest<BusinessQueryParam>) {
  115. return http.request<QueryPageResponse<BusinessCertification>>({
  116. url: '/inventory/queryInventoryManage',
  117. method: 'post',
  118. data: query,
  119. });
  120. }
  121. /**
  122. * 保存业务信息
  123. */
  124. export function saveBusinessInformation(data: SaveInventoryRequest) {
  125. return http.request({
  126. url: '/WorkInjuryApply/saveWorkInjuryApply',
  127. method: 'post',
  128. data,
  129. });
  130. }
  131. /**
  132. * 更新物品信息请求参数
  133. */
  134. export interface UpdateInventoryRequest extends SaveInventoryRequest {
  135. id: number; // 物品ID
  136. }
  137. /**
  138. * 更新物品库存(编辑)
  139. */
  140. export function updateInventory(data: UpdateInventoryRequest) {
  141. return http.request({
  142. url: '/inventory/updateInventory',
  143. method: 'put',
  144. data,
  145. });
  146. }
  147. /**
  148. * 删除物品库存
  149. */
  150. export function deleteInventory(id: number) {
  151. return http.request({
  152. url: `/inventory/deleteInventory?id=${id}`,
  153. method: 'delete',
  154. // data: { id },
  155. });
  156. }
  157. /**
  158. * 查询物品库存详情
  159. */
  160. export function queryInventoryDetail(id: number) {
  161. return http.request<BusinessCertification>({
  162. url: `/inventory/queryInventoryDetail?id=${id}`,
  163. method: 'get',
  164. });
  165. }
  166. /**
  167. * 导入物品库存
  168. * 注意:导入功能使用 BatchImport 组件,直接通过 URL 上传文件
  169. */
  170. /**
  171. * 导出物品库存请求参数
  172. */
  173. export interface ExportInventoryRequest {
  174. stuffName?: string; // 物品名称
  175. status?: boolean; // 状态
  176. ids?: string[]; // 选择数据的ID
  177. }
  178. /**
  179. * 导出物品库存
  180. */
  181. export function exportInventory(query: ExportInventoryRequest) {
  182. return http.request({
  183. url: '/inventory/exportInventory',
  184. method: 'post',
  185. data: query,
  186. responseType: 'blob',
  187. }, {
  188. isTransformResponse: false,
  189. });
  190. }
  191. /** 提交审批流程 */
  192. export const submitApprovalProcess = (data: ApprovalProcessParam) => {
  193. return http.request({
  194. url: '/WorkInjuryApply/submit',
  195. method: 'post',
  196. data,
  197. });
  198. };
  199. /** 审核劳防用品采购申请(通过/退回)- 兼容旧接口,内部调 saveApproval */
  200. export function auditPurchaseApply(data: AuditPurchaseApplyParam) {
  201. return saveApproval({
  202. id: data.id,
  203. approvalStatus: data.status === 2 ? 2 : 3, // 3审核不通过 4已完成
  204. returnReason: data.rejectReason,
  205. approvalOrder: data.approvalOrder,
  206. templateId: data.templateId,
  207. code: data.code,
  208. });
  209. }
  210. /** 提交审批(通过/退回) */
  211. export function saveApproval(data: SaveApprovalReq) {
  212. return http.request({
  213. url: '/WorkInjuryApply/saveApproval',
  214. method: 'post',
  215. data,
  216. });
  217. }
  218. /**
  219. * 查询工伤认定详情
  220. */
  221. export function queryWorkInjuryApplyDetail(id: number) {
  222. return http.request<BusinessCertification>({
  223. url: `/WorkInjuryApply/queryWorkInjuryApplyDetail?id=${id}`,
  224. method: 'post',
  225. });
  226. }
  227. /** 编辑工伤认定(保存/提交,带审批信息) */
  228. export function updateWorkInjuryApply(data: UpdateWorkInjuryApplyRequest) {
  229. return http.request({
  230. url: '/WorkInjuryApply/updateWorkInjuryApply',
  231. method: 'put',
  232. data,
  233. });
  234. }
  235. /** 审核工伤认确定 */
  236. export function auditWorkInjuryConfirm(id: number, confirmedSealed: string) {
  237. return http.request<BusinessCertification>({
  238. url: `/WorkInjuryApply/confirmedSealed`,
  239. method: 'post',
  240. data:{
  241. id,
  242. confirmedSealed,
  243. }
  244. });
  245. }