Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | 1x 1x 1x 2x 1x 2x 1x 2x 1x 2x 1x 2x 1x 1x 1x 2x 1x 2x 1x 2x 1x 2x 1x 2x 1x 2x 1x 2x 1x 1x 1x 2x 1x 2x | import { http } from "@/utils/http";
import type { BaseResponse } from "./base";
// 合同文件夹类型
export type ZSPContractFolderResult = {
id: number;
name: string;
count: number;
createTime: string;
description: string;
};
// 合同文件类型
export type ZSPContractFileResult = {
id: number;
fileName: string;
fileUrl?: string;
fileType: string;
fileSize: number;
uploadTime: string;
folderId: number;
contractNumber: string;
companyName: string;
commodity: string;
signDate: string;
contractType: string;
// 合同详情列表
details?: ZSPContractDetailResult[];
};
// 合同详情类型
export type ZSPContractDetailResult = {
id: number;
contractFileId: number;
commodityName: string;
commodityCode?: string;
totalQuantity: number;
unit: string;
unitPrice: number;
deliveredQty: number;
pendingQty: number;
billOfLading?: string;
remark?: string;
createTime: string;
updateTime: string;
};
// 创建合同详情请求
export interface ZSPContractDetailCreateRequest {
contractFileId: number;
commodityName: string;
commodityCode?: string;
totalQuantity: number;
unit?: string;
unitPrice: number;
deliveredQty?: number;
billOfLading?: string;
remark?: string;
}
// 更新合同详情请求
export interface ZSPContractDetailUpdateRequest {
id: number;
commodityName?: string;
commodityCode?: string;
totalQuantity?: number;
unit?: string;
unitPrice?: number;
deliveredQty?: number;
billOfLading?: string;
remark?: string;
}
// 批量创建合同详情请求
export interface ZSPContractDetailBatchCreateRequest {
contractFileId: number;
details: ZSPContractDetailCreateRequest[];
}
// ==================== 合同文件夹相关 ====================
/** 获取合同文件夹列表(GET) */
export const getZSPContractFolders = () => {
return http.request<BaseResponse<ZSPContractFolderResult[]>>(
"get",
"/api/zsp-contract/folders"
);
};
/** 创建合同文件夹(POST) */
export const createZSPContractFolder = (data: {
name: string;
description?: string;
}) => {
return http.request<BaseResponse>("post", "/api/zsp-contract/folders", { data });
};
/** 更新合同文件夹(PUT) */
export const updateZSPContractFolder = (
id: string | number,
data: { name: string; description?: string }
) => {
return http.request<BaseResponse>("put", `/api/zsp-contract/folders/${id}`, { data });
};
/** 删除合同文件夹(DELETE) */
export const deleteZSPContractFolder = (id: string | number) => {
return http.request<BaseResponse>("delete", `/api/zsp-contract/folders/${id}`);
};
// ==================== 合同文件相关 ====================
/** 获取合同列表(含详情)(GET) */
export const getZSPContracts = (folderId?: string) => {
return http.request<BaseResponse<ZSPContractFileResult[]>>(
"get",
"/api/zsp-contract/contracts",
{ params: folderId ? { folderId } : {} }
);
};
/** 获取单个合同详情(含详情列表)(GET) */
export const getZSPContract = (id: string | number) => {
return http.request<BaseResponse<ZSPContractFileResult>>(
"get",
`/api/zsp-contract/contracts/${id}`
);
};
/** 上传合同文件(POST) */
export const uploadZSPContract = (formData: FormData) => {
return http.request<BaseResponse>("post", "/api/zsp-contract/contracts", {
data: formData,
headers: { "Content-Type": "multipart/form-data" }
});
};
/** 删除合同文件(DELETE) */
export const deleteZSPContract = (id: string | number) => {
return http.request<BaseResponse>("delete", `/api/zsp-contract/contracts/${id}`);
};
/** 更新合同元信息(PUT) */
export const updateZSPContract = (
id: string | number,
data: {
contractNumber?: string;
companyName?: string;
commodity?: string;
signDate?: string;
contractType?: string;
folderId?: number;
}
) => {
return http.request<BaseResponse>("put", `/api/zsp-contract/contracts/${id}`, {
data
});
};
// ==================== 合同详情相关 ====================
/** 获取合同详情列表(GET) */
export const getZSPContractDetails = (contractFileId: string | number) => {
return http.request<BaseResponse<ZSPContractDetailResult[]>>(
"get",
`/api/zsp-contract/contracts/${contractFileId}/details`
);
};
/** 获取单个合同详情(GET) */
export const getZSPContractDetail = (id: string | number) => {
return http.request<BaseResponse<ZSPContractDetailResult>>(
"get",
`/api/zsp-contract/details/${id}`
);
};
/** 创建合同详情(POST) */
export const createZSPContractDetail = (
contractFileId: string | number,
data: ZSPContractDetailCreateRequest
) => {
return http.request<BaseResponse>("post", `/api/zsp-contract/contracts/${contractFileId}/details`, { data });
};
/** 更新合同详情(PUT) */
export const updateZSPContractDetail = (id: string | number, data: ZSPContractDetailUpdateRequest) => {
return http.request<BaseResponse>("put", `/api/zsp-contract/details/${id}`, { data });
};
/** 删除合同详情(DELETE) */
export const deleteZSPContractDetail = (id: string | number) => {
return http.request<BaseResponse>("delete", `/api/zsp-contract/details/${id}`);
};
/** 批量创建合同详情(POST) */
export const batchCreateZSPContractDetails = (
data: ZSPContractDetailBatchCreateRequest
) => {
return http.request<BaseResponse>("post", "/api/zsp-contract/details/batch", { data });
};
/** Excel导入合同详情(POST) */
export const importZSPContractDetailsFromExcel = (
contractFileId: string | number,
formData: FormData
) => {
return http.request<BaseResponse>(
"post",
`/api/zsp-contract/contracts/${contractFileId}/details/import`,
{
data: formData,
headers: { "Content-Type": "multipart/form-data" }
}
);
};
/** 导出合同详情到Excel(GET) */
export const exportZSPContractDetailsToExcel = (contractFileId: string | number) => {
return http.request<BaseResponse>(
"get",
`/api/zsp-contract/contracts/${contractFileId}/details/export`
);
};
|