diff --git a/src/api/pigBatch.js b/src/api/pigBatch.js index 2919c89e..06ec3d95 100644 --- a/src/api/pigBatch.js +++ b/src/api/pigBatch.js @@ -197,10 +197,7 @@ import http from '../utils/http'; * @returns {Promise>} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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} */ 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>} */ export const getAllPens = () => { - return http.get('/api/v1/pens'); + return http.get('/api/v1/pens'); }; /** @@ -399,29 +396,29 @@ export const getAllPens = () => { * @returns {Promise>} */ 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, }; diff --git a/src/components/PlanDetail.vue b/src/components/PlanDetail.vue index 1aded98f..6904740f 100644 --- a/src/components/PlanDetail.vue +++ b/src/components/PlanDetail.vue @@ -1,15 +1,15 @@