diff --git a/package.json b/package.json index 929db2d..a50909e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "nprogress": "0.2.0", "pinia": "2.1.7", "splitpanes": "3.1.5", - "vue": "3.4.31", + "vue": "^3.4.31", "vue-cropper": "1.1.1", "vue-router": "4.4.0", "vuedraggable": "4.1.0", diff --git a/src/api/dairyProducts/milkInOutStore/milkInOutStore.js b/src/api/dairyProducts/milkInOutStore/milkInOutStore.js new file mode 100644 index 0000000..fd5f947 --- /dev/null +++ b/src/api/dairyProducts/milkInOutStore/milkInOutStore.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' + +export function getList(params) { + return request({ + url: '/milkInOutStore/list', + method: 'get', + params + }) +} + +export function importExcel(file) { + const data = new FormData() + data.append('file', file) + return request({ + url: '/milkInOutStore/import', + method: 'post', + data, + headers: { 'Content-Type': 'multipart/form-data' } + }) +} + +export function exportExcel(params) { + return request({ + url: '/milkInOutStore/export', + method: 'post', + params, + responseType: 'blob' + }) +} + +export function getColumns() { + return request({ url: '/milkInOutStore/columns', method: 'get' }) +} diff --git a/src/api/dairyProducts/milkProdclasses/milkProdclasses.js b/src/api/dairyProducts/milkProdclasses/milkProdclasses.js new file mode 100644 index 0000000..96d7b6d --- /dev/null +++ b/src/api/dairyProducts/milkProdclasses/milkProdclasses.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' + +export function listMilkProdclasses(query) { + return request({ + url: '/milkProdclasses/milkProdclasses/list', + method: 'get', + params: query + }) +} + +export function importMilkProdclasses(data) { + return request({ + url: '/milkProdclasses/milkProdclasses/import', + method: 'post', + data: data, + headers: { 'Content-Type': 'multipart/form-data' } + }) +} + +export function exportMilkProdclasses(query) { + return request({ + url: '/milkProdclasses/milkProdclasses/export', + method: 'post', + responseType: 'blob', + params: query + }) +} +export function getRanchList() { + return request({ + url: '/system/ranch/list', + method: 'get' + }) +} \ No newline at end of file diff --git a/src/api/dairyProducts/parityCorrection/parityCorrection.js b/src/api/dairyProducts/parityCorrection/parityCorrection.js index 788539b..0d2488b 100644 --- a/src/api/dairyProducts/parityCorrection/parityCorrection.js +++ b/src/api/dairyProducts/parityCorrection/parityCorrection.js @@ -43,4 +43,14 @@ // }) // } // 可以保留空文件或删除此文件 -// 因为前端不再需要调用后端API \ No newline at end of file +// 因为前端不再需要调用后端API +import request from '@/utils/request' + +// 查询胎次校正列表 +export function listParityCorrection(query) { + return request({ + url: '/parityCorrection/parityCorrection/listAll', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/src/api/dairyProducts/ranch/ranch.js b/src/api/dairyProducts/ranch/ranch.js new file mode 100644 index 0000000..b5f64bd --- /dev/null +++ b/src/api/dairyProducts/ranch/ranch.js @@ -0,0 +1,8 @@ +import request from '@/utils/request' + +export function getRanchList() { + return request({ + url: '/dairyProducts/ranch/list', + method: 'get' + }) +} \ No newline at end of file diff --git a/src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js b/src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js new file mode 100644 index 0000000..8e90017 --- /dev/null +++ b/src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询羊奶出入库列表 +export function listMilkInOutStore(query) { + return request({ + url: '/milkInOutStore/milkInOutStore/list', + method: 'get', + params: query + }) +} + +// 查询羊奶出入库详细 +export function getMilkInOutStore(id) { + return request({ + url: '/milkInOutStore/milkInOutStore/' + id, + method: 'get' + }) +} + +// 新增羊奶出入库 +export function addMilkInOutStore(data) { + return request({ + url: '/milkInOutStore/milkInOutStore', + method: 'post', + data: data + }) +} + +// 修改羊奶出入库 +export function updateMilkInOutStore(data) { + return request({ + url: '/milkInOutStore/milkInOutStore', + method: 'put', + data: data + }) +} + +// 删除羊奶出入库 +export function delMilkInOutStore(id) { + return request({ + url: '/milkInOutStore/milkInOutStore/' + id, + method: 'delete' + }) +} diff --git a/src/api/produce/bodyManage/body_measure.js b/src/api/produce/bodyManage/body_measure.js new file mode 100644 index 0000000..66862eb --- /dev/null +++ b/src/api/produce/bodyManage/body_measure.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询体尺测量列表 +export function listBody_measure(query) { + return request({ + url: '/body_measure/body_measure/list', + method: 'get', + params: query + }) +} + +// 查询体尺测量详细 +export function getBody_measure(id) { + return request({ + url: '/body_measure/body_measure/' + id, + method: 'get' + }) +} + +// 新增体尺测量 +export function addBody_measure(data) { + return request({ + url: '/body_measure/body_measure', + method: 'post', + data: data + }) +} + +// 修改体尺测量 +export function updateBody_measure(data) { + return request({ + url: '/body_measure/body_measure', + method: 'put', + data: data + }) +} + +// 删除体尺测量 +export function delBody_measure(id) { + return request({ + url: '/body_measure/body_measure/' + id, + method: 'delete' + }) +} diff --git a/src/api/produce/bodyManage/body_score.js b/src/api/produce/bodyManage/body_score.js new file mode 100644 index 0000000..5953c19 --- /dev/null +++ b/src/api/produce/bodyManage/body_score.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询体况评分列表 +export function listBody_score(query) { + return request({ + url: '/body_score/body_score/list', + method: 'get', + params: query + }) +} + +// 查询体况评分详细 +export function getBody_score(id) { + return request({ + url: '/body_score/body_score/' + id, + method: 'get' + }) +} + +// 新增体况评分 +export function addBody_score(data) { + return request({ + url: '/body_score/body_score', + method: 'post', + data: data + }) +} + +// 修改体况评分 +export function updateBody_score(data) { + return request({ + url: '/body_score/body_score', + method: 'put', + data: data + }) +} + +// 删除体况评分 +export function delBody_score(id) { + return request({ + url: '/body_score/body_score/' + id, + method: 'delete' + }) +} diff --git a/src/api/produce/bodyManage/breast_rating.js b/src/api/produce/bodyManage/breast_rating.js new file mode 100644 index 0000000..39b6d03 --- /dev/null +++ b/src/api/produce/bodyManage/breast_rating.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询乳房评分列表 +export function listBreast_rating(query) { + return request({ + url: '/breast_rating/breast_rating/list', + method: 'get', + params: query + }) +} + +// 查询乳房评分详细 +export function getBreast_rating(id) { + return request({ + url: '/breast_rating/breast_rating/' + id, + method: 'get' + }) +} + +// 新增乳房评分 +export function addBreast_rating(data) { + return request({ + url: '/breast_rating/breast_rating', + method: 'post', + data: data + }) +} + +// 修改乳房评分 +export function updateBreast_rating(data) { + return request({ + url: '/breast_rating/breast_rating', + method: 'put', + data: data + }) +} + +// 删除乳房评分 +export function delBreast_rating(id) { + return request({ + url: '/breast_rating/breast_rating/' + id, + method: 'delete' + }) +} diff --git a/src/api/produce/manage_sheep/changeComment.js b/src/api/produce/manage_sheep/changeComment.js new file mode 100644 index 0000000..615a290 --- /dev/null +++ b/src/api/produce/manage_sheep/changeComment.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询改备注列表 +export function listChangeComment(query) { + return request({ + url: '/changeComment/changeComment/list', + method: 'get', + params: query + }) +} + +// 查询改备注详细 +export function getChangeComment(id) { + return request({ + url: '/changeComment/changeComment/' + id, + method: 'get' + }) +} + +// 新增改备注 +export function addChangeComment(data) { + return request({ + url: '/changeComment/changeComment', + method: 'post', + data: data + }) +} + +// 修改改备注 +export function updateChangeComment(data) { + return request({ + url: '/changeComment/changeComment', + method: 'put', + data: data + }) +} + +// 删除改备注 +export function delChangeComment(id) { + return request({ + url: '/changeComment/changeComment/' + id, + method: 'delete' + }) +} diff --git a/src/api/produce/manage_sheep/changeEar.js b/src/api/produce/manage_sheep/changeEar.js new file mode 100644 index 0000000..c2d4105 --- /dev/null +++ b/src/api/produce/manage_sheep/changeEar.js @@ -0,0 +1,71 @@ +import request from '@/utils/request' + +// 查询修改电子耳号记录列表 +export function listChangeEar(query) { + return request({ + url: '/changeEar/changeEar/list', + method: 'get', + params: query + }) +} + +// 查询修改电子耳号记录详细 +export function getChangeEar(id) { + return request({ + url: '/changeEar/changeEar/' + id, + method: 'get' + }) +} + +// 新增修改电子耳号记录 +export function addChangeEar(data) { + return request({ + url: '/changeEar/changeEar', + method: 'post', + data: data + }) +} + +// 修改修改电子耳号记录 +export function updateChangeEar(data) { + return request({ + url: '/changeEar/changeEar', + method: 'put', + data: data + }) +} + +// 删除修改电子耳号记录 +export function delChangeEar(id) { + return request({ + url: '/changeEar/changeEar/' + id, + method: 'delete' + }) +} + + +// 根据羊只ID查询基本信息 +export function getSheepById(id) { + return request({ + url: '/sheep/sheep/' + id, + method: 'get' + }); +} + +//根据耳号(管理耳号或电子耳号)查询羊只信息 +export function getSheepByEarNumber(earNumber, earType) { + return request({ + url: '/sheep/sheep/byEarNumber', + method: 'get', + params: { earNumber, earType } + }); +} + +//校验新管理/电子耳号 +export function checkTagExists(tag, earType) { + return request({ + url: '/sheep/sheep/existsByTag', + method: 'get', + params: { tag, earType } + }); +} \ No newline at end of file diff --git a/src/api/produce/manage_sheep/changeVariety.js b/src/api/produce/manage_sheep/changeVariety.js new file mode 100644 index 0000000..a0f9e1d --- /dev/null +++ b/src/api/produce/manage_sheep/changeVariety.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询改品种记录列表 +export function listChangeVariety(query) { + return request({ + url: '/changeVariety/changeVariety/list', + method: 'get', + params: query + }) +} + +// 查询改品种记录详细 +export function getChangeVariety(id) { + return request({ + url: '/changeVariety/changeVariety/' + id, + method: 'get' + }) +} + +// 新增改品种记录 +export function addChangeVariety(data) { + return request({ + url: '/changeVariety/changeVariety', + method: 'post', + data: data + }) +} + +// 修改改品种记录 +export function updateChangeVariety(data) { + return request({ + url: '/changeVariety/changeVariety', + method: 'put', + data: data + }) +} + +// 删除改品种记录 +export function delChangeVariety(id) { + return request({ + url: '/changeVariety/changeVariety/' + id, + method: 'delete' + }) +} + +//通过管理耳号获取羊只信息 +export function getSheepByManageTags(manageTags) { + return request({ + url: `/sheep/sheep/byManageTags/${manageTags}`, + method: 'get' + }); +} \ No newline at end of file diff --git a/src/api/produce/manage_sheep/trans_group.js b/src/api/produce/manage_sheep/trans_group.js index 95ad242..0f0bba6 100644 --- a/src/api/produce/manage_sheep/trans_group.js +++ b/src/api/produce/manage_sheep/trans_group.js @@ -51,3 +51,12 @@ export function listSheepfold() { }); } + +//审批转群记录 +export function approveScTransGroup(data) { + return request({ + url: '/produce/manage_sheep/trans_group/approve', + method: 'put', + data + }) +} diff --git a/src/api/produce/manage_sheep/transition_info.js b/src/api/produce/manage_sheep/transition_info.js index a86dbf4..0ee92d6 100644 --- a/src/api/produce/manage_sheep/transition_info.js +++ b/src/api/produce/manage_sheep/transition_info.js @@ -9,6 +9,23 @@ export function listTransition_info(query) { }) } +// 查询牧场列表(用于下拉框) +export function listRanch() { + return request({ + url: '/ranch/ranch/list', + method: 'get', + params: { pageNum: 1, pageSize: 9999 } + }); +} + +// 查询指定牧场下的所有羊只耳号 +export function getSheepByRanchId(ranchId) { + return request({ + url: `/ranch/ranch/getSheepByRanchId/${ranchId}`, + method: 'get' + }); +} + // 查询转场详细 export function getTransition_info(id) { return request({ @@ -17,15 +34,15 @@ export function getTransition_info(id) { }) } + // 新增转场 export function addTransition_info(data) { return request({ - url: 'produce/manage_sheep/transition_info', + url: '/produce/manage_sheep/transition_info/batch', method: 'post', - data: data + data: data }) } - // 修改转场 export function updateTransition_info(data) { return request({ @@ -42,3 +59,14 @@ export function delTransition_info(id) { method: 'delete' }) } + +/** + * 审批转场记录 + */ +export function approveTransitionInfo(data) { + return request({ + url: '/produce/manage_sheep/transition_info/approve', + method: 'put', + data + }) +} diff --git a/src/api/produce/other/fixHoof.js b/src/api/produce/other/fixHoof.js index 56f9438..f1f3289 100644 --- a/src/api/produce/other/fixHoof.js +++ b/src/api/produce/other/fixHoof.js @@ -45,7 +45,7 @@ export function exportFixHoof(query) { url: '/produce/other/fixHoof/export', method: 'post', params: query, - responseType: 'blob' // 导出功能需要设置响应类型为blob + responseType: 'blob' }) } @@ -70,7 +70,7 @@ export function getVarietyOptions(query){ //通过羊舍获取羊只 export function getSheepBySheepfoldId(id) { return request({ - url: `/sheepfold_management/sheepfold_management/getSheepById`, // 使用你已有的接口路径 + url: `/sheepfold_management/sheepfold_management/getSheepById`, method: 'get', params:{ id: String(id) } }) diff --git a/src/api/system/dict/data.js b/src/api/system/dict/data.js index 6c9eb79..28b2e23 100644 --- a/src/api/system/dict/data.js +++ b/src/api/system/dict/data.js @@ -50,3 +50,6 @@ export function delData(dictCode) { method: 'delete' }) } + +// 兼容旧写法 +export { getDicts as listDictDataByType } \ No newline at end of file diff --git a/src/api/variety/variety.js b/src/api/variety/variety.js index 8c7ee14..5b3f49d 100644 --- a/src/api/variety/variety.js +++ b/src/api/variety/variety.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询羊只品种列表 export function listVariety(query) { return request({ - url: '/variety/variety/list', + url: '/base/variety/list', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listVariety(query) { // 查询羊只品种详细 export function getVariety(id) { return request({ - url: '/variety/variety/' + id, + url: '/base/variety/' + id, method: 'get' }) } @@ -20,7 +20,7 @@ export function getVariety(id) { // 新增羊只品种 export function addVariety(data) { return request({ - url: '/variety/variety', + url: '/base/variety', method: 'post', data: data }) @@ -29,7 +29,7 @@ export function addVariety(data) { // 修改羊只品种 export function updateVariety(data) { return request({ - url: '/variety/variety', + url: '/base/variety', method: 'put', data: data }) @@ -38,7 +38,7 @@ export function updateVariety(data) { // 删除羊只品种 export function delVariety(id) { return request({ - url: '/variety/variety/' + id, + url: '/base/variety/' + id, method: 'delete' }) } diff --git a/src/views/biosafety/disinfect/index.vue b/src/views/biosafety/disinfect/index.vue index ace824e..66547ac 100644 --- a/src/views/biosafety/disinfect/index.vue +++ b/src/views/biosafety/disinfect/index.vue @@ -1,324 +1,516 @@ - - - + + + + + + - - - + + + + - - - - - - - - - - - - - + + 搜索 重置 + - - 新增 - - - 修改 - - - 删除 - - - 导出 - - + 新增 + 修改 + 删除 + 导出 + - - + - - {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }} - + {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }} - - + - 修改 - 删除 + 修改 + 删除 - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 添加药品 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + - + 取 消 + 确 定 + + + + + + + + + + {{ editForm.sheepfoldName }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 添加药品 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 取 消 + 确 定 +/* ------------------ 下拉数据 ------------------ */ +const barns = ref([]) +const presOptions = ref([]) +const units = ref([]) +const usages = ref([]) +const medicines = ref([]) + +/* 校验规则 */ +const rules = { + sheepfoldIds: [{ required: true, message: '请选择羊舍', trigger: 'change' }], + datetime: [{ required: true, message: '请选择日期', trigger: 'change' }] +} + +/* 处方选择事件 - 新增 */ +function handleSelectPrescription(id) { + if (!id) return + getPrescription(id).then(res => { + usageDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +/* 处方选择事件 - 修改 */ +function handleSelectPrescriptionEdit(id) { + if (!id) return + getPrescription(id).then(res => { + editDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +/* 明细添加行 - 新增 */ +function handleAddDetail() { + usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* 明细添加行 - 修改 */ +function handleAddDetailEdit() { + editDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* ------------------ 初始加载 ------------------ */ +onMounted(() => { + getList() + /* 加载本地羊舍 */ + request({ url: '/sheepfold_management/sheepfold_management/list', method: 'get' }).then(res => { + barns.value = res.rows + }) + listPrescription({ status: 1, persType: 1 }).then(res => { + presOptions.value = res.rows.map(item => ({ id: item.id, label: item.name })) + }) + listUnit().then(res => { + units.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listUsage().then(res => { + usages.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listMedicine().then(res => { + medicines.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) +}) + \ No newline at end of file diff --git a/src/views/biosafety/health/index.vue b/src/views/biosafety/health/index.vue index e9fc95a..8cdf7b3 100644 --- a/src/views/biosafety/health/index.vue +++ b/src/views/biosafety/health/index.vue @@ -1,21 +1,16 @@ - - - - + + + + + + + - + 搜索 @@ -23,274 +18,518 @@ + - - 新增 - - - 修改 - - - 删除 - - - 导出 - - + 新增 + 修改 + 删除 + 导出 - + + - - - - {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }} - - - - + - + + + + + - + + + {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }} + - + - 修改 - 删除 + 修改 + 删除 - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ tag.sheepNo }} + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + 添加药品 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - +/* ------------------ 药品/处方/下拉 ------------------ */ +const usageDetails = ref([]) +const presOptions = ref([]) +const units = ref([]) +const usages = ref([]) +const medicines = ref([]) + +function handleSelectPrescription(id) { + if (!id) return + getPrescription(id).then(res => { + usageDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +function handleAddDetail() { + usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* ------------------ 初始化 ------------------ */ +onMounted(() => { + getList() + getBarns() + listPrescription({ status: 1, persType: 2 }).then(res => { + presOptions.value = res.rows.map(item => ({ id: item.id, label: item.name })) + }) + listUnit().then(res => { + units.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listUsage().then(res => { + usages.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listMedicine().then(res => { + medicines.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) +}) + \ No newline at end of file diff --git a/src/views/biosafety/immunity/index.vue b/src/views/biosafety/immunity/index.vue index 63112dc..dffa551 100644 --- a/src/views/biosafety/immunity/index.vue +++ b/src/views/biosafety/immunity/index.vue @@ -1,31 +1,16 @@ - - - + + + + - - + + - + 搜索 @@ -33,280 +18,518 @@ + - - 新增 - - - 修改 - - - 删除 - - - 导出 - - + 新增 + 修改 + 删除 + 导出 - + + - - - + - - + + + + + + - + - - {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }} - + {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }} - + - 修改 - 删除 + 修改 + 删除 - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ tag.sheepNo }} + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + 添加药品 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - +/* ------------------ 药品/处方/下拉 ------------------ */ +const usageDetails = ref([]) +const presOptions = ref([]) +const units = ref([]) +const usages = ref([]) +const medicines = ref([]) + +function handleSelectPrescription(id) { + if (!id) return + getPrescription(id).then(res => { + usageDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +function handleAddDetail() { + usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* ------------------ 初始化 ------------------ */ +onMounted(() => { + getList() + getBarns() + listPrescription({ status: 1, persType: 0 }).then(res => { + presOptions.value = res.rows.map(item => ({ id: item.id, label: item.name })) + }) + listUnit().then(res => { + units.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listUsage().then(res => { + usages.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listMedicine().then(res => { + medicines.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) +}) + \ No newline at end of file diff --git a/src/views/dairyProducts/milkInOutStore/milkInOutStore/index.vue b/src/views/dairyProducts/milkInOutStore/milkInOutStore/index.vue new file mode 100644 index 0000000..07c6d59 --- /dev/null +++ b/src/views/dairyProducts/milkInOutStore/milkInOutStore/index.vue @@ -0,0 +1,157 @@ + + + + + + + + + + 查询 + 重置 + + + + + + 导入 + + 导出 + 列设置 + + + + + + 饲喂来源: + + {{ f }} + + + + 销售去向: + + {{ s }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/dairyProducts/milkProdclasses/milkProdclasses/index.vue b/src/views/dairyProducts/milkProdclasses/milkProdclasses/index.vue new file mode 100644 index 0000000..ec8acd0 --- /dev/null +++ b/src/views/dairyProducts/milkProdclasses/milkProdclasses/index.vue @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 查询 + 重置 + + + + + + 导入 + + + 导出 + + + + + + + + + + + + + + + + + + + + + 将文件拖到此处或点击上传 + + + + + + diff --git a/src/views/dairyProducts/parityCorrection/index.vue b/src/views/dairyProducts/parityCorrection/index.vue index 846c373..201d3ea 100644 --- a/src/views/dairyProducts/parityCorrection/index.vue +++ b/src/views/dairyProducts/parityCorrection/index.vue @@ -1,54 +1,36 @@ - - - + + diff --git a/src/views/dairyProducts/sheepMilkAnalysis/index.vue b/src/views/dairyProducts/sheepMilkAnalysis/index.vue new file mode 100644 index 0000000..64bc19b --- /dev/null +++ b/src/views/dairyProducts/sheepMilkAnalysis/index.vue @@ -0,0 +1,194 @@ + + + + + + + + + + + + 查询 + 重置 + + + + + + 导出 + + + + {{ col.label }} + + + + 展示列 + + + + + + + + + + + + + + + + + + diff --git a/src/views/produce/bodyManage/body_measure/index.vue b/src/views/produce/bodyManage/body_measure/index.vue new file mode 100644 index 0000000..ebf88b3 --- /dev/null +++ b/src/views/produce/bodyManage/body_measure/index.vue @@ -0,0 +1,340 @@ + + + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 删除 + + + 导出 + + + + + + + + + + + + + + + + + + + + + + + + + {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }} + + + + + 修改 + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/produce/bodyManage/body_score/index.vue b/src/views/produce/bodyManage/body_score/index.vue new file mode 100644 index 0000000..ea09165 --- /dev/null +++ b/src/views/produce/bodyManage/body_score/index.vue @@ -0,0 +1,355 @@ + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 删除 + + + 导出 + + + + + + + + + + + + {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }} + + + + + + + + + + + {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }} + + + + + 修改 + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/produce/bodyManage/breast_rating/index.vue b/src/views/produce/bodyManage/breast_rating/index.vue new file mode 100644 index 0000000..28c141f --- /dev/null +++ b/src/views/produce/bodyManage/breast_rating/index.vue @@ -0,0 +1,319 @@ + + + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 删除 + + + 导出 + + + + + + + + + + + + + + + + + + + + + {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }} + + + + + 修改 + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/produce/manage_sheep/add_sheep/index.vue b/src/views/produce/manage_sheep/add_sheep/index.vue index 56dbaa0..1380d22 100644 --- a/src/views/produce/manage_sheep/add_sheep/index.vue +++ b/src/views/produce/manage_sheep/add_sheep/index.vue @@ -6,11 +6,12 @@ v-hasPermi="['produce:add_sheep:import']">导入 - + - + @@ -55,7 +56,6 @@ - @@ -127,7 +127,6 @@ import { getToken } from '@/utils/auth' const { proxy } = getCurrentInstance() -/* -------------------- 表单 -------------------- */ const form = ref({ earNumber: '', sheepfold: '', @@ -145,24 +144,63 @@ const form = ref({ const formRef = ref(null) const rules = { - earNumber: [{ required: true, message: '请输入耳号', trigger: 'blur' }], + earNumber: [ + { required: true, message: '请输入耳号', trigger: 'blur' }, + { validator: checkEarNumberExists, trigger: 'blur' } + ], sheepfold: [{ required: true, message: '请选择羊舍', trigger: 'change' }], bornWeight: [{ required: true, message: '请输入出生体重', trigger: 'blur' }], birthday: [{ required: true, message: '请选择出生日期', trigger: 'change' }], gender: [{ required: true, message: '请选择性别', trigger: 'change' }], - varietyId: [{ required: true, message: '请选择品种', trigger: 'change' }] + varietyId: [{ required: true, message: '请选择品种', trigger: 'change' }], + joinDate:[{ required: true, message: '请选择入群日期', trigger: 'change' }], + technician:[{ required: true, message: '请输入技术员', trigger: 'change' }], } -/* -------------------- 下拉数据 -------------------- */ +// 校验耳号是否存在 +function checkEarNumberExists(rule, value, callback) { + if (!value.trim()) { + return callback(new Error('请输入耳号')) + } + + request({ + url: `/sheep/sheep/existsByManageTags/${value.trim()}`, + method: 'get' + }) + .then(response => { + if (response.data === true) { + callback(new Error('耳号已存在,无法新增')) + } else { + callback() + } + }) + .catch(error => { + const status = error.response?.status; + const errorMsg = error.response?.data?.msg || ''; + if (status === 404) { + callback(); + } else { + callback(new Error('请求异常,请稍后重试')); + } + }); +} + +function handleEarNumberBlur() { + formRef.value.validateField('earNumber') +} + + const sheepfoldOptions = ref([]) const varietyOptions = ref([]) +//羊舍列表 function getSheepfoldOptions() { listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => { sheepfoldOptions.value = res.rows || [] }) } +//品种列表 function getVarietyOptions() { request({ url: '/base/variety/list', @@ -173,21 +211,38 @@ function getVarietyOptions() { }) } -/* -------------------- 功能方法 -------------------- */ +//确保日期格式一致 +function formatDate(date) { + if (!date) return null; + const d = new Date(date); + const yyyy = d.getFullYear(); + const mm = String(d.getMonth() + 1).padStart(2, '0'); + const dd = String(d.getDate()).padStart(2, '0'); + return `${yyyy}-${mm}-${dd}`; +} +//提交表单 function submitForm() { formRef.value.validate(valid => { - if (!valid) return - addSheep(form.value).then(res => { + if (!valid) return; + + const formData = JSON.parse(JSON.stringify(form.value)); + + formData.birthday = formatDate(formData.birthday); + formData.joinDate = formatDate(formData.joinDate); + + if (formData.bornWeight) { + formData.bornWeight = Number(formData.bornWeight); + } + + addSheep(formData).then(res => { if (res.code === 200) { - proxy.$modal.msgSuccess('新增成功') - resetForm() + proxy.$modal.msgSuccess('新增成功'); + resetForm(); } else { - proxy.$modal.msgError(res.msg || '新增失败') // 这里显示“耳号已存在”等后端报错 + proxy.$modal.msgError(res.msg || '新增失败'); } - }).catch(() => { - proxy.$modal.msgError('请求异常,请稍后重试') - }) - }) + }); + }); } function resetForm() { @@ -206,7 +261,7 @@ function resetForm() { technician: '' } } - +//导出 function handleExportForm() { exportSheepForm(form.value).then(res => { const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) @@ -239,29 +294,27 @@ function submitUpload() { uploadRef.value?.submit() } -// 上传成功回调 +// 导入成功 function handleImportSuccess(res) { if (res.code === 200) { proxy.$modal.msgSuccess(res.msg || '导入成功') importOpen.value = false uploadRef.value?.clearFiles() } else { - // 业务失败 + // 失败 proxy.$modal.msgError('导入失败:' + (res.msg || '未知原因')) } } -// 上传失败(网络/服务器异常) +// 导入失败(网络/服务器异常) function handleImportError(err) { const msg = JSON.parse(err.message || '{}')?.msg || '网络异常' proxy.$modal.msgError('导入失败:' + msg) } -/* -------------------- 初始化 -------------------- */ - - getSheepfoldOptions() - getVarietyOptions() +getSheepfoldOptions() +getVarietyOptions() diff --git a/src/views/produce/manage_sheep/changeComment/index.vue b/src/views/produce/manage_sheep/changeComment/index.vue new file mode 100644 index 0000000..775410f --- /dev/null +++ b/src/views/produce/manage_sheep/changeComment/index.vue @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 删除 + + + 导出 + + + + + + + + + + + + + + + {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }} + + + + + 修改 + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/produce/manage_sheep/changeEar/index.vue b/src/views/produce/manage_sheep/changeEar/index.vue new file mode 100644 index 0000000..0486f44 --- /dev/null +++ b/src/views/produce/manage_sheep/changeEar/index.vue @@ -0,0 +1,369 @@ + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 删除 + + + 导出 + + + + + + + + + + + {{ scope.row.earType === 0 ? '电子耳号' : '管理耳号' }} + + + + + + + + + {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }} + + + + + 修改 + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/produce/manage_sheep/changeVariety/index.vue b/src/views/produce/manage_sheep/changeVariety/index.vue new file mode 100644 index 0000000..4c0eab6 --- /dev/null +++ b/src/views/produce/manage_sheep/changeVariety/index.vue @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 删除 + + + 导出 + + + + + + + + + + + + + + + {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }} + + + + + 修改 + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/produce/manage_sheep/trans_group/index.vue b/src/views/produce/manage_sheep/trans_group/index.vue index 8872fa0..c6679ee 100644 --- a/src/views/produce/manage_sheep/trans_group/index.vue +++ b/src/views/produce/manage_sheep/trans_group/index.vue @@ -1,11 +1,9 @@ - - - + + @@ -59,15 +57,17 @@ - - - + - + + + + + @@ -95,27 +95,25 @@ - - - + + - + - + - + @@ -142,9 +140,6 @@ - @@ -180,33 +175,34 @@ \ No newline at end of file diff --git a/src/views/produce/manage_sheep/transition_info/index.vue b/src/views/produce/manage_sheep/transition_info/index.vue index cc85810..7538b49 100644 --- a/src/views/produce/manage_sheep/transition_info/index.vue +++ b/src/views/produce/manage_sheep/transition_info/index.vue @@ -1,36 +1,34 @@ - - - + + + - - - + + + - - + + + - - - + - 搜索 重置 @@ -41,19 +39,19 @@ 新增 + v-hasPermi="['transition_info:transition_info:add']">新增 修改 + v-hasPermi="['transition_info:transition_info:edit']">修改 删除 + v-hasPermi="['transition_info:transition_info:remove']">删除 导出 + v-hasPermi="['transition_info:transition_info:export']">导出 @@ -61,21 +59,17 @@ - - + + - - - - - - + + @@ -86,52 +80,50 @@ 审批 + v-hasPermi="['transition_info:transition_info:approve']">审批 删除 + v-hasPermi="['transition_info:transition_info:remove']">删除 + v-model:limit="queryParams.pageSize" @pagination="getList" /> - - - - - - - + + + - + + + - + + + - + - - - - @@ -145,15 +137,30 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - @@ -167,36 +174,47 @@ +onMounted(() => { + loadRanchOptions(); + getVarietyOptions(); + loadSheepOptions(); + getList(); +}); + \ No newline at end of file diff --git a/src/views/produce/other/castrate/index.vue b/src/views/produce/other/castrate/index.vue index cac02fe..4a74ec7 100644 --- a/src/views/produce/other/castrate/index.vue +++ b/src/views/produce/other/castrate/index.vue @@ -2,8 +2,8 @@ - - + + @@ -60,6 +60,7 @@ + {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }} @@ -82,9 +83,9 @@ - - + + @@ -134,7 +135,7 @@ const data = reactive({ manageTags: [], sheepfold: null, technician: null, - tagDetails: {} + tagDetails: {} }, queryParams: { pageNum: 1, @@ -151,18 +152,19 @@ const data = reactive({ // { required: true, message: '羊只id不能为空', trigger: 'blur' } // ], manageTags: [ - { required: true, message: '耳号不能为空', trigger: 'blur' } + { required: true, message: '请输入管理耳号', trigger: 'blur' } ], sheepfold: [ - { required: true, message: '羊舍不能为空', trigger: 'change' } + { required: true, message: '请选择羊舍', trigger: 'change' } ], technician: [ - { required: true, message: '技术员不能为空', trigger: 'blur' } + { required: true, message: '请输入技术员', trigger: 'blur' } ] } }) const { queryParams, form, rules } = toRefs(data) +//通过羊舍获取羊只 function loadSheepBySheepfold() { const sheepfoldId = form.value.sheepfold; if (!sheepfoldId) { @@ -170,23 +172,26 @@ function loadSheepBySheepfold() { return; } - // 加载选择的羊舍的耳号 getSheepBySheepfoldId(sheepfoldId) .then(res => { - const sheepList = res.data || []; + let sheepList = res.data || []; + sheepList = sheepList.filter(sheep => sheep.gender === 2); + if (sheepList.length === 0) { - proxy.$modal.msgInfo('该羊舍暂无可用耳号'); + proxy.$modal.msgInfo('该羊舍下暂无性别为公的羊只'); + sheepOptions.value = []; + return; } sheepOptions.value = sheepList.map(sheep => ({ id: sheep.id, manageTags: sheep.manageTags, - sheepfoldId: sheepfoldId + gender: sheep.gender })); }) .catch(error => { console.error('加载羊舍耳号失败', error); - proxy.$modal.msgError(`加载耳号失败: ${error.message}`); + proxy.$modal.msgError('加载耳号失败,请重试'); sheepOptions.value = []; }); } @@ -196,44 +201,45 @@ async function loadSheepInfo() { const tags = form.value.manageTags; if (!tags || tags.length === 0) return; - const tagDetails = {}; // 存储每个耳号的信息 + const tagDetails = {}; const validResults = []; for (const tag of tags) { try { const { data: sheepData } = await checkSheepByManageTags(tag.trim()); + if (!sheepData) { validResults.push(false); proxy.$modal.msgError(`耳号 ${tag} 不存在`); + } else if (sheepData.gender !== 2) { + validResults.push(false); + proxy.$modal.msgError(`耳号 ${tag} 对应的羊只性别不是公,无法添加`); } else { validResults.push(true); - // 存储当前耳号的备注、品种、羊舍等信息 tagDetails[tag] = { - comment: sheepData.comment || '', // 备注信息 - varietyId: sheepData.varietyId, + sheepId: sheepData.id, + gender: sheepData.gender, sheepfoldId: sheepData.sheepfoldId, - sheepId: sheepData.id + varietyId: sheepData.varietyId, + comment: sheepData.comment || '' }; - // 自动填充第一个耳号的羊舍(不影响备注,仅优化用户体验) if (validResults.length === 1) { form.value.sheepfold = sheepData.sheepfoldId; } } } catch (error) { - console.error('获取耳号信息失败:', error); - proxy.$modal.msgError(`耳号 ${tag} 验证失败`); + console.error(`耳号 ${tag} 校验失败`, error); validResults.push(false); + proxy.$modal.msgError(`耳号 ${tag} 校验异常,请重试`); } } - // 过滤不合法耳号 - if (validResults.includes(false)) { - form.value.manageTags = tags.filter((_, index) => validResults[index]); - proxy.$message.warning('部分耳号不合法,已过滤'); - } - - // 保存所有耳号的信息(关键:用于后续提交时匹配备注) + form.value.manageTags = tags.filter((_, index) => validResults[index]); form.value.tagDetails = tagDetails; + + if (validResults.includes(false)) { + proxy.$message.warning('部分耳号不符合条件(不存在或非公羊),已自动过滤'); + } } /** 查询列表 */ @@ -254,13 +260,19 @@ function getList() { total.value = res.total; loading.value = false; }); + + getVarietyOptions({ pageNum: 1, pageSize: 9999 }).then(res => { + varietyOptions.value = res.rows || [] + }) } +//取消 function cancel() { open.value = false reset() } +//重置 function reset() { form.value = { id: null, @@ -272,11 +284,13 @@ function reset() { proxy.resetForm('castrateRef'); } +//搜索 function handleQuery() { queryParams.value.pageNum = 1; getList(); } +//重置 function resetQuery() { daterangeCreateTime.value = [] proxy.resetForm('queryRef') @@ -289,12 +303,14 @@ function handleSelectionChange(selection) { multiple.value = !selection.length } +//新增 function handleAdd() { reset() open.value = true title.value = '添加去势' } +//修改 function handleUpdate(row) { reset(); const _id = row.id || ids.value; @@ -320,7 +336,7 @@ function handleUpdate(row) { }); } -// 新增:校验所有回显的耳号是否存在 +// 校验所有回显的耳号是否存在 async function validateAllTags() { const tags = form.value.manageTags || []; if (tags.length === 0) return; @@ -339,47 +355,53 @@ async function validateAllTags() { } } +//提交 function submitForm() { proxy.$refs.castrateRef.validate(valid => { if (!valid) return; const allTags = form.value.manageTags; const tagDetails = form.value.tagDetails || {}; + if (!allTags || allTags.length === 0) { - proxy.$modal.msgError('请选择耳号'); + proxy.$modal.msgError('请选择有效的公羊耳号'); return; } - // 循环处理每个耳号,逐个提交 - const requests = allTags.map(async (tag) => { - const details = tagDetails[tag] || {}; - const formData = { - ...form.value, - manageTags: tag, - comment: details.comment || '', // 关键:每个耳号的备注 - sheepId: details.sheepId, - varietyId: details.varietyId, - sheepfold: details.sheepfoldId || form.value.sheepfold - }; + const invalidTags = allTags.filter(tag => { + const details = tagDetails[tag]; + return !details || details.gender !== 2; + }); + if (invalidTags.length > 0) { + proxy.$modal.msgError(`耳号 ${invalidTags.join(',')} 性别不符合要求,无法提交`); + return; + } - // 提交单个去势记录(与后端接口匹配) - return addCastrate(formData); + const requests = allTags.map(tag => { + const details = tagDetails[tag]; + return addCastrate({ + manageTags: tag, + sheepId: details.sheepId, + sheepfold: details.sheepfoldId || form.value.sheepfold, + technician: form.value.technician, + varietyId: details.varietyId, + comment: details.comment + }); }); - // 并行处理所有请求 Promise.all(requests) .then(() => { - proxy.$modal.msgSuccess('操作成功'); + proxy.$modal.msgSuccess('新增成功'); open.value = false; getList(); }) .catch(error => { - proxy.$modal.msgError(`处理失败:${error.message}`); + proxy.$modal.msgError(`新增失败:${error.message}`); }); }); } - +//删除 function handleDelete(row) { const _ids = row.id || ids.value proxy.$modal.confirm(`是否确认删除去势编号为"${_ids}"的数据项?`).then(() => { @@ -390,10 +412,12 @@ function handleDelete(row) { }) } +//导出 function handleExport() { proxy.download('/produce/other/castrate/export', { ...queryParams.value }, `castrate_${new Date().getTime()}.xlsx`) } +//加载羊舍数据 const sheepfoldOptions = ref([]) function getSheepfoldOptions() { listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => { diff --git a/src/views/produce/other/fixHoof/index.vue b/src/views/produce/other/fixHoof/index.vue index 65ca5b5..15b0e4b 100644 --- a/src/views/produce/other/fixHoof/index.vue +++ b/src/views/produce/other/fixHoof/index.vue @@ -2,7 +2,8 @@ - + @@ -81,7 +82,7 @@ - @@ -107,7 +108,7 @@ \ No newline at end of file