修bug
This commit is contained in:
@@ -197,10 +197,7 @@ import http from '../utils/http';
|
||||
* @returns {Promise<Array<PigBatchResponseDTO>>}
|
||||
*/
|
||||
export const getPigBatches = (params) => {
|
||||
const newParams = {
|
||||
is_active: params.is_active,
|
||||
};
|
||||
return http.get('/api/v1/pig-batches', { params: newParams });
|
||||
return http.get('/api/v1/pig-batches', params);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -209,7 +206,7 @@ export const getPigBatches = (params) => {
|
||||
* @returns {Promise<PigBatchResponseDTO>}
|
||||
*/
|
||||
export const createPigBatch = (batchData) => {
|
||||
return http.post('/api/v1/pig-batches', batchData);
|
||||
return http.post('/api/v1/pig-batches', batchData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -218,7 +215,7 @@ export const createPigBatch = (batchData) => {
|
||||
* @returns {Promise<PigBatchResponseDTO>}
|
||||
*/
|
||||
export const getPigBatchById = (id) => {
|
||||
return http.get(`/api/v1/pig-batches/${id}`);
|
||||
return http.get(`/api/v1/pig-batches/${id}`);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -228,7 +225,7 @@ export const getPigBatchById = (id) => {
|
||||
* @returns {Promise<PigBatchResponseDTO>}
|
||||
*/
|
||||
export const updatePigBatch = (id, batchData) => {
|
||||
return http.put(`/api/v1/pig-batches/${id}`, batchData);
|
||||
return http.put(`/api/v1/pig-batches/${id}`, batchData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -237,7 +234,7 @@ export const updatePigBatch = (id, batchData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const deletePigBatch = (id) => {
|
||||
return http.delete(`/api/v1/pig-batches/${id}`);
|
||||
return http.delete(`/api/v1/pig-batches/${id}`);
|
||||
};
|
||||
|
||||
// --- 猪批次业务操作 ---
|
||||
@@ -249,7 +246,7 @@ export const deletePigBatch = (id) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const assignPensToBatch = (id, pensData) => {
|
||||
return http.post(`/api/v1/pig-batches/assign-pens/${id}`, pensData);
|
||||
return http.post(`/api/v1/pig-batches/assign-pens/${id}`, pensData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -259,7 +256,7 @@ export const assignPensToBatch = (id, pensData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const removePenFromBatch = (penID, batchID) => {
|
||||
return http.delete(`/api/v1/pig-batches/remove-pen/${penID}/${batchID}`);
|
||||
return http.delete(`/api/v1/pig-batches/remove-pen/${penID}/${batchID}`);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -269,7 +266,7 @@ export const removePenFromBatch = (penID, batchID) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const buyPigsForBatch = (id, buyData) => {
|
||||
return http.post(`/api/v1/pig-batches/buy-pigs/${id}`, buyData);
|
||||
return http.post(`/api/v1/pig-batches/buy-pigs/${id}`, buyData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -279,7 +276,7 @@ export const buyPigsForBatch = (id, buyData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const sellPigsFromBatch = (id, sellData) => {
|
||||
return http.post(`/api/v1/pig-batches/sell-pigs/${id}`, sellData);
|
||||
return http.post(`/api/v1/pig-batches/sell-pigs/${id}`, sellData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -289,7 +286,7 @@ export const sellPigsFromBatch = (id, sellData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const movePigsIntoPen = (id, moveData) => {
|
||||
return http.post(`/api/v1/pig-batches/move-pigs-into-pen/${id}`, moveData);
|
||||
return http.post(`/api/v1/pig-batches/move-pigs-into-pen/${id}`, moveData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -299,7 +296,7 @@ export const movePigsIntoPen = (id, moveData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const transferPigsWithinBatch = (id, transferData) => {
|
||||
return http.post(`/api/v1/pig-batches/transfer-within-batch/${id}`, transferData);
|
||||
return http.post(`/api/v1/pig-batches/transfer-within-batch/${id}`, transferData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -309,7 +306,7 @@ export const transferPigsWithinBatch = (id, transferData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const transferPigsAcrossBatches = (sourceBatchID, transferData) => {
|
||||
return http.post(`/api/v1/pig-batches/transfer-across-batches/${sourceBatchID}`, transferData);
|
||||
return http.post(`/api/v1/pig-batches/transfer-across-batches/${sourceBatchID}`, transferData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -319,7 +316,7 @@ export const transferPigsAcrossBatches = (sourceBatchID, transferData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const reclassifyPenToNewBatch = (fromBatchID, reclassifyData) => {
|
||||
return http.post(`/api/v1/pig-batches/reclassify-pen/${fromBatchID}`, reclassifyData);
|
||||
return http.post(`/api/v1/pig-batches/reclassify-pen/${fromBatchID}`, reclassifyData);
|
||||
};
|
||||
|
||||
// --- 猪只数量变更记录 ---
|
||||
@@ -331,7 +328,7 @@ export const reclassifyPenToNewBatch = (fromBatchID, reclassifyData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const recordSickPigsInBatch = (id, sickData) => {
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pigs/${id}`, sickData);
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pigs/${id}`, sickData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -341,7 +338,7 @@ export const recordSickPigsInBatch = (id, sickData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const recordSickPigRecoveryInBatch = (id, recoveryData) => {
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pig-recovery/${id}`, recoveryData);
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pig-recovery/${id}`, recoveryData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -351,7 +348,7 @@ export const recordSickPigRecoveryInBatch = (id, recoveryData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const recordSickPigDeathInBatch = (id, deathData) => {
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pig-death/${id}`, deathData);
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pig-death/${id}`, deathData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -361,7 +358,7 @@ export const recordSickPigDeathInBatch = (id, deathData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const recordSickPigCullInBatch = (id, cullData) => {
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pig-cull/${id}`, cullData);
|
||||
return http.post(`/api/v1/pig-batches/record-sick-pig-cull/${id}`, cullData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -371,7 +368,7 @@ export const recordSickPigCullInBatch = (id, cullData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const recordDeathInBatch = (id, deathData) => {
|
||||
return http.post(`/api/v1/pig-batches/record-death/${id}`, deathData);
|
||||
return http.post(`/api/v1/pig-batches/record-death/${id}`, deathData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -381,7 +378,7 @@ export const recordDeathInBatch = (id, deathData) => {
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export const recordCullInBatch = (id, cullData) => {
|
||||
return http.post(`/api/v1/pig-batches/record-cull/${id}`, cullData);
|
||||
return http.post(`/api/v1/pig-batches/record-cull/${id}`, cullData);
|
||||
};
|
||||
|
||||
// --- 新增的猪栏和猪舍API ---
|
||||
@@ -391,7 +388,7 @@ export const recordCullInBatch = (id, cullData) => {
|
||||
* @returns {Promise<Array<PenResponse>>}
|
||||
*/
|
||||
export const getAllPens = () => {
|
||||
return http.get('/api/v1/pens');
|
||||
return http.get('/api/v1/pens');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -399,29 +396,29 @@ export const getAllPens = () => {
|
||||
* @returns {Promise<Array<PigHouseResponse>>}
|
||||
*/
|
||||
export const getAllPigHouses = () => {
|
||||
return http.get('/api/v1/pig-houses');
|
||||
return http.get('/api/v1/pig-houses');
|
||||
};
|
||||
|
||||
export const PigBatchApi = {
|
||||
getPigBatches,
|
||||
createPigBatch,
|
||||
getPigBatchById,
|
||||
updatePigBatch,
|
||||
deletePigBatch,
|
||||
assignPensToBatch,
|
||||
removePenFromBatch,
|
||||
buyPigsForBatch,
|
||||
sellPigsFromBatch,
|
||||
movePigsIntoPen,
|
||||
transferPigsWithinBatch,
|
||||
transferPigsAcrossBatches,
|
||||
reclassifyPenToNewBatch,
|
||||
recordSickPigsInBatch,
|
||||
recordSickPigRecoveryInBatch,
|
||||
recordSickPigDeathInBatch,
|
||||
recordSickPigCullInBatch,
|
||||
recordDeathInBatch,
|
||||
recordCullInBatch,
|
||||
getAllPens,
|
||||
getAllPigHouses,
|
||||
getPigBatches,
|
||||
createPigBatch,
|
||||
getPigBatchById,
|
||||
updatePigBatch,
|
||||
deletePigBatch,
|
||||
assignPensToBatch,
|
||||
removePenFromBatch,
|
||||
buyPigsForBatch,
|
||||
sellPigsFromBatch,
|
||||
movePigsIntoPen,
|
||||
transferPigsWithinBatch,
|
||||
transferPigsAcrossBatches,
|
||||
reclassifyPenToNewBatch,
|
||||
recordSickPigsInBatch,
|
||||
recordSickPigRecoveryInBatch,
|
||||
recordSickPigDeathInBatch,
|
||||
recordSickPigCullInBatch,
|
||||
recordDeathInBatch,
|
||||
recordCullInBatch,
|
||||
getAllPens,
|
||||
getAllPigHouses,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user