| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- import { http } from '@/utils/http/axios';
- import type { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';
- /**
- * 劳防用品采购申请 - 实体与接口
- * 基础路径: /api/ppePurchaseApply
- * 状态:0-待审核,1-审核通过,-1-审核不通过
- * 申请状态:1-待提交,2-待审批,3-已完成
- * 审批状态:1-待审批,2-已审批,3-退回
- */
- /** 采购申请主表(列表项 / 提交用) */
- export interface PpePurchaseApply {
- id?: number; // 采购申请主表唯一ID
- applyCode?: number; // 申请单号(业务唯一)
- applicantCode?: number; // 申请人编码
- applicantName?: string; // 申请人名称
- deptCode?: number; // 申请部门编码
- deptName?: string; // 申请部门名称
- status?: number; // 0-待审核/1-审核通过/-1审核不通过
- statusName?: string; // 申请状态:1-待提交,2-待审批,3-已完成
- nodeDescription?: string; // 当前节点名称
- isDeleted?: number;
- createdAt?: string;
- updatedAt?: string;
- templateId?: number; // 审核模板ID
- approvalStatus?: number; // 1-待审批,2-已审批,3-退回
- approvalOrder?: number; // 审批顺序
- rejectReason?: string; // 退回原因
- [key: string]: any;
- }
- /** 采购申请明细(劳防用品项)- 后端 PpePurchaseApplyDetail */
- export interface PpePurchaseApplyDetail {
- id?: number; // 采购申请物品唯一ID
- ppeApplyId?: number; // 关联的劳防采购申请单ID
- equipmentId?: number; // 劳防用品ID(关联ppe表的id)
- equipmentName?: string; // 劳防用品名称
- specSize?: string; // 规格/尺寸/鞋码
- applyNum?: number; // 需求数量
- model?: string; // 产品型号/品类类型
- unitPrice?: number; // 单价(元)
- pictureUrl?: string; // 样式照片URL
- remark?: string; // 申请备注
- isDeleted?: number;
- createdAt?: string;
- updatedAt?: string;
- [key: string]: any;
- }
- /** 兼容旧组件:明细行(表单用,可同时兼容后端字段名) */
- export interface PurchaseApplyItem extends PpePurchaseApplyDetail {
- ppeName?: string; // 同 equipmentName
- ppeId?: number; // 同 equipmentId
- stylePhoto?: string; // 同 pictureUrl 或附件 JSON
- sizeOrShoeSize?: string; // 同 specSize
- requiredQty?: number; // 同 applyNum
- specModelType?: string; // 同 model
- productNo?: string;
- [key: string]: any;
- }
- /** 兼容旧组件:列表与表单主表 */
- export type PersonalProtectiveEquipmentPurchaseApply = PpePurchaseApply & {
- applyNo?: string; // 展示用,可与 applyCode 互转
- itemList?: PurchaseApplyItem[];
- applicantDeptCode?: string;
- applicantDeptName?: string;
- currentNodeName?: string;
- };
- /** 分页查询请求 - 查询条件 QueryPersonalProtectiveEquipmentCommonPageReq */
- export interface QueryPurchaseApplyPageReq {
- /** 标题/搜索用品名称/申请人 */
- name?: string;
- /** 状态:0-待审核,1-审核通过,-1-审核不通过 */
- status?: number | string;
- /** 申请人部门CODE/申请部门编码 */
- applyDeptCode?: string;
- /** 申请人部门名称 */
- applyDeptName?: string;
- /** 审批状态:1-待审批,2-已审批,3-退回 */
- approvalStatus?: number | string;
- }
- /** 审批流程参数 */
- export interface ApprovalProcessParam {
- id: string;
- approvalDescription: string;
- templateId?: number;
- approvalInfoList: {
- approvalOrder: number;
- approverIdList: number[];
- }[];
- }
- /** 分页查询劳防用品采购申请列表 */
- export function queryPurchaseApplyList(
- query: QueryPageRequest<QueryPurchaseApplyPageReq>,
- ) {
- return http.request<QueryPageResponse<PpePurchaseApply>>({
- url: '/ppePurchaseApply/queryPpePurchaseApplyList',
- method: 'post',
- data: query,
- });
- }
- /** 分页查询劳防用品采购申请列表 */
- export function queryPurchaseApplyListAdmin(
- query: QueryPageRequest<QueryPurchaseApplyPageReq>,
- ) {
- return http.request<QueryPageResponse<PpePurchaseApply>>({
- url: '/ppePurchaseApply/queryPpePurchaseApplyListAdmin',
- method: 'post',
- data: query,
- });
- }
- /** 查询劳防用品详细内容(返回明细列表) */
- export function queryPurchaseApplyDetail(id: number) {
- return http.request<PpePurchaseApplyDetail[]>({
- url: `/ppePurchaseApply/queryPpePurchaseApplyDetail?id=${id}`,
- method: 'post',
- });
- }
- /** 删除劳防用品采购申请 */
- export function deletePurchaseApply(id: number) {
- return http.request({
- url: `/ppePurchaseApply/deletePpePurchaseApply?id=${id}`,
- method: 'delete',
- });
- }
- /** 审批信息项 */
- export interface ApprovalInfoItem {
- approvalOrder?: number;
- approverIdList?: number[];
- }
- /** 编辑/提交请求体 SavePpePurchaseApplyReq */
- export interface SavePpePurchaseApplyReq extends PpePurchaseApply {
- /** 保存或提交:0-保存 1-提交 */
- saveOrSubmit?: number;
- /** 审批描述 */
- approvalDescription?: string;
- /** 审批信息列表 */
- approvalInfoList?: ApprovalInfoItem[];
- /** 劳防采购申请列表详情 */
- ppePurchaseApplyDetails?: PpePurchaseApplyDetail[];
- /** 审核模板ID */
- templateId?: number;
- }
- /** 编辑劳防用品采购申请(保存/提交,带审批信息) */
- export function updatePurchaseApply(data: SavePpePurchaseApplyReq) {
- return http.request({
- url: '/ppePurchaseApply/updatePpePurchaseApplyDetail',
- method: 'put',
- data,
- });
- }
- /** 新增时也可走同一提交接口(无 id 或 saveOrSubmit=1) */
- export function savePurchaseApply(data: SavePpePurchaseApplyReq) {
- return http.request({
- url: '/ppePurchaseApply/updatePpePurchaseApplyDetail',
- method: 'put',
- data,
- });
- }
- /** 提交审批 - 通过/退回 SaveApprovalReq */
- export interface SaveApprovalReq {
- id: number;
- approvalOrder?: number;
- /** 审批状态: 1-待审批,2-已审批,3-退回 */
- approvalStatus: number;
- /** 退回原因 */
- returnReason?: string;
- templateId?: string;
- }
- /** 提交审批(通过/退回) */
- export function saveApproval(data: SaveApprovalReq) {
- return http.request({
- url: '/ppePurchaseApply/saveApproval',
- method: 'post',
- data,
- });
- }
- /** 审核参数(兼容旧调用:映射到 SaveApprovalReq) */
- export interface AuditPurchaseApplyParam {
- id: number;
- /** 1-审核通过,-1-审核不通过 → 映射 approvalStatus 2/3 */
- status: number;
- rejectReason?: string; // 同 returnReason
- approvalOrder?: number;
- templateId?: string;
- }
- /** 审核劳防用品采购申请(通过/退回)- 兼容旧接口,内部调 saveApproval */
- export function auditPurchaseApply(data: AuditPurchaseApplyParam) {
- return saveApproval({
- id: data.id,
- approvalStatus: data.status === 2 ? 2 : 3, // 1 通过→2 已审批,-1 不通过→3 退回
- returnReason: data.rejectReason,
- approvalOrder: data.approvalOrder,
- templateId: data.templateId,
- });
- }
- /** 提交审批流程 */
- export const submitApprovalProcess = (data: ApprovalProcessParam) => {
- return http.request({
- url: '/ppePurchaseApply/submit',
- method: 'post',
- data,
- });
- };
- /** 新增劳防用品采购申请(保存/提交,带审批信息) */
- export function saveThePurchaseRequest(data: SavePpePurchaseApplyReq) {
- return http.request({
- url: '/ppePurchaseApply/savePpePurchaseApplyList',
- method: 'post',
- data,
- });
- }
- /** 导出劳防用品采购申请管理 */
- export function exportSafetyEquipmentProcurementRequest (queryParams) {
- return http.request({
- url: '/ppePurchaseApply/exportPpePurchaseApplyList',
- method: 'post',
- responseType: 'blob',
- data: queryParams,
- }, {
- isTransformResponse: false,
- });
- }
|