diff --git a/package.json b/package.json index 4903716..bb90147 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "echarts": "5.5.1", "element-china-area-data": "^6.1.0", "element-plus": "^2.7.6", - "file-saver": "2.0.5", + "file-saver": "^2.0.5", "fuse.js": "6.6.2", "js-beautify": "1.14.11", "js-cookie": "3.0.5", @@ -37,7 +37,8 @@ "vue-cropper": "1.1.1", "vue-router": "4.4.0", "vuedraggable": "4.1.0", - "vuex": "^4.0.2" + "vuex": "^4.0.2", + "xlsx": "^0.18.5" }, "devDependencies": { "@vitejs/plugin-vue": "5.0.5", diff --git a/src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js b/src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js index d65fbd0..03ee763 100644 --- a/src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js +++ b/src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js @@ -1,4 +1,3 @@ -// src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js import request from '@/utils/request' // 查询羊奶产量分析列表(分页 + 条件) @@ -16,14 +15,4 @@ export function getSheepMilkAnalysis(sheepId) { url: '/dairyProducts/sheepMilkAnalysis/' + sheepId, method: 'get' }) -} - -// 导出羊奶产量分析 Excel -export function exportSheepMilkAnalysis(query) { - return request({ - url: '/dairyProducts/sheepMilkAnalysis/export', - method: 'get', - params: query, - responseType: 'blob' // 返回二进制流 - }) -} +} \ No newline at end of file diff --git a/src/api/fileManagement/sheep_grouping.js b/src/api/fileManagement/sheep_grouping.js index fb7d871..960b399 100644 --- a/src/api/fileManagement/sheep_grouping.js +++ b/src/api/fileManagement/sheep_grouping.js @@ -61,3 +61,12 @@ export function addByEarTags(data) { data }) } + + + +// 树形分组 +export const listGroupTree = () => + request({ + url: '/sheep_grouping/sheep_grouping/group/tree', + method: 'get' + }) \ No newline at end of file diff --git a/src/api/fileManagement/sheepfold_management.js b/src/api/fileManagement/sheepfold_management.js index 4847cd3..0e639b1 100644 --- a/src/api/fileManagement/sheepfold_management.js +++ b/src/api/fileManagement/sheepfold_management.js @@ -55,3 +55,11 @@ export function checkSheepfoldNoExist(ranchId, sheepfoldTypeId, sheepfoldNo) { } }) } + +// 获取树形座位图(牧场 → 类型 → 羊舍 → 排栏) +export function getSeatMap() { + return request({ + url: '/sheepfold_management/sheepfold_management/seatMap', + method: 'get' + }) +} diff --git a/src/views/biosafety/diagnosis/index.vue b/src/views/biosafety/diagnosis/index.vue index 21decfb..90db5f7 100644 --- a/src/views/biosafety/diagnosis/index.vue +++ b/src/views/biosafety/diagnosis/index.vue @@ -303,6 +303,7 @@ function reset() { id: null, treatId: null, sheepId: null, + sheepNo: null, datetime: null, sheepType: null, gender: null, diff --git a/src/views/biosafety/disinfect/index.vue b/src/views/biosafety/disinfect/index.vue index 18aeaca..8652be6 100644 --- a/src/views/biosafety/disinfect/index.vue +++ b/src/views/biosafety/disinfect/index.vue @@ -471,7 +471,7 @@ function handleDelete(row) { } function handleExport() { - proxy.download('biosafety/disinfect/export', { ...queryParams }, `disinfect_${Date.now()}.xlsx`) + proxy.download('biosafety/disinfect/export', { ...queryParams }, `消毒_${Date.now()}.xlsx`) } /* ---------- 下拉数据 ---------- */ diff --git a/src/views/biosafety/health/index.vue b/src/views/biosafety/health/index.vue index aae4661..00b5021 100644 --- a/src/views/biosafety/health/index.vue +++ b/src/views/biosafety/health/index.vue @@ -490,7 +490,7 @@ function handleDelete(row) { } function handleExport() { - proxy.download('biosafety/deworm/export', { ...queryParams }, `deworm_${Date.now()}.xlsx`) + proxy.download('biosafety/health/export', { ...queryParams }, `保健_${Date.now()}.xlsx`) } /* ------------------ 药品/处方/下拉 ------------------ */ diff --git a/src/views/biosafety/immunity/index.vue b/src/views/biosafety/immunity/index.vue index d260fe9..2a9b430 100644 --- a/src/views/biosafety/immunity/index.vue +++ b/src/views/biosafety/immunity/index.vue @@ -489,7 +489,7 @@ function handleDelete(row) { } function handleExport() { - proxy.download('biosafety/deworm/export', { ...queryParams }, `deworm_${Date.now()}.xlsx`) + proxy.download('biosafety/immunity/export', { ...queryParams }, `免疫_${Date.now()}.xlsx`) } /* ------------------ 药品/处方/下拉 ------------------ */ diff --git a/src/views/biosafety/medicine/index.vue b/src/views/biosafety/medicine/index.vue index 4d8eeb3..1c1657d 100644 --- a/src/views/biosafety/medicine/index.vue +++ b/src/views/biosafety/medicine/index.vue @@ -238,7 +238,7 @@ function handleDelete(row) { } function handleExport() { - proxy.download('system/medicine/export', { ...queryParams.value }, `medicine_${new Date().getTime()}.xlsx`) + proxy.download('system/medicine/export', { ...queryParams.value }, `药品_${new Date().getTime()}.xlsx`) } getList() diff --git a/src/views/biosafety/medicine/type.vue b/src/views/biosafety/medicine/type.vue index 2471e59..90ecb32 100644 --- a/src/views/biosafety/medicine/type.vue +++ b/src/views/biosafety/medicine/type.vue @@ -220,7 +220,7 @@ function handleDelete(row) { function handleExport() { proxy.download('biosafety/type/export', { ...queryParams.value - }, `type_${new Date().getTime()}.xlsx`) + }, `药品类型_${new Date().getTime()}.xlsx`) } getList() diff --git a/src/views/biosafety/medicine/unit.vue b/src/views/biosafety/medicine/unit.vue index 518da8c..9830cbc 100644 --- a/src/views/biosafety/medicine/unit.vue +++ b/src/views/biosafety/medicine/unit.vue @@ -180,7 +180,7 @@ function handleDelete(row) { function handleExport() { proxy.download('biosafety/unit/export', { ...queryParams.value - }, `unit_${new Date().getTime()}.xlsx`) + }, `药品计量单位_${new Date().getTime()}.xlsx`) } getList() diff --git a/src/views/biosafety/medicine/usage.vue b/src/views/biosafety/medicine/usage.vue index fd62de7..222016b 100644 --- a/src/views/biosafety/medicine/usage.vue +++ b/src/views/biosafety/medicine/usage.vue @@ -220,7 +220,7 @@ function handleDelete(row) { function handleExport() { proxy.download('biosafety/usage/export', { ...queryParams.value - }, `usage_${new Date().getTime()}.xlsx`) + }, `药品使用方法_${new Date().getTime()}.xlsx`) } getList() diff --git a/src/views/biosafety/prescription/index.vue b/src/views/biosafety/prescription/index.vue index c9c156f..24699d4 100644 --- a/src/views/biosafety/prescription/index.vue +++ b/src/views/biosafety/prescription/index.vue @@ -504,7 +504,7 @@ function cancel() { * 调用后端通用导出接口,文件名带时间戳 */ function handleExport() { - proxy.download('biosafety/prescription/export', { ...queryParams.value }, `prescription_${Date.now()}.xlsx`) + proxy.download('biosafety/prescription/export', { ...queryParams.value }, `处方_${Date.now()}.xlsx`) } // 初始化:加载列表 diff --git a/src/views/biosafety/quarantine/index.vue b/src/views/biosafety/quarantine/index.vue index 945e4ee..f789d5f 100644 --- a/src/views/biosafety/quarantine/index.vue +++ b/src/views/biosafety/quarantine/index.vue @@ -527,9 +527,9 @@ function handleDelete(row) { /* 导出 */ function handleExport() { proxy.download( - 'bisosafety/quarantine/export', + '/biosafety/quarantine/export', queryParams, - `quarantine_${Date.now()}.xlsx` + `检疫_${Date.now()}.xlsx` ) } diff --git a/src/views/biosafety/treatment/index.vue b/src/views/biosafety/treatment/index.vue index a795b81..e5bce04 100644 --- a/src/views/biosafety/treatment/index.vue +++ b/src/views/biosafety/treatment/index.vue @@ -729,7 +729,7 @@ function handleDelete(row) { .then(() => { getList(); proxy.$modal.msgSuccess('删除成功') }) } function handleExport() { - proxy.download('treatment/treatment/export', { ...queryParams }, `treatment_${Date.now()}.xlsx`) + proxy.download('treatment/treatment/export', { ...queryParams }, `治疗记录_${Date.now()}.xlsx`) } function resetForm(formObj) { Object.assign(formObj, { diff --git a/src/views/biosafety/usageInfo/index.vue b/src/views/biosafety/usageInfo/index.vue index d5167d6..ddb9c8d 100644 --- a/src/views/biosafety/usageInfo/index.vue +++ b/src/views/biosafety/usageInfo/index.vue @@ -342,7 +342,7 @@ function handleExport() { proxy.download( 'biosafety/usageInfo/export', { ...queryParams.value }, - `usage_${new Date().getTime()}.xlsx` + `药品使用记录_${new Date().getTime()}.xlsx` ) } diff --git a/src/views/dairyProducts/freshMilkTest/freshMilkTest/index.vue b/src/views/dairyProducts/freshMilkTest/freshMilkTest/index.vue index 4db694e..073ab7d 100644 --- a/src/views/dairyProducts/freshMilkTest/freshMilkTest/index.vue +++ b/src/views/dairyProducts/freshMilkTest/freshMilkTest/index.vue @@ -291,6 +291,9 @@ import { ref, reactive, onMounted } from 'vue'; import { listFreshMilkTest, getFreshMilkTest, delFreshMilkTest, addFreshMilkTest, updateFreshMilkTest } from "@/api/dairyProducts/freshMilkTest/freshMilkTest.js"; import { ElMessage, ElMessageBox } from 'element-plus'; +// 导入xlsx库和file-saver +import * as XLSX from 'xlsx'; +import { saveAs } from 'file-saver'; const freshMilkTestList = ref([]); const open = ref(false); @@ -304,6 +307,27 @@ const title = ref(""); const columnShowDialogVisible = ref(false); const freshMilkTestRef = ref(null); +// 列配置映射 +const columnConfig = [ + { prop: 'source', label: '来源' }, + { prop: 'datetime', label: '检测日期' }, + { prop: 'fat', label: '脂肪g/100g' }, + { prop: 'protein', label: '蛋白质g/100g' }, + { prop: 'nonFat', label: '非脂g/100g' }, + { prop: 'acidity', label: '酸度oT' }, + { prop: 'bacterialColony1', label: '菌落总数1' }, + { prop: 'bacterialColony2', label: '菌落总数2' }, + { prop: 'bacterialColony3', label: '菌落总数3' }, + { prop: 'bacterialColony4', label: '菌落总数4' }, + { prop: 'bacterialColony5', label: '菌落总数5' }, + { prop: 'coli', label: '大肠菌群(CFU/ml)' }, + { prop: 'lactoferrin', label: '乳铁蛋白(mg/L)' }, + { prop: 'ig', label: '免疫球蛋白(mg/L)' }, + { prop: 'commnet', label: '备注' }, + { prop: 'createBy', label: '创建人' }, + { prop: 'createTime', label: '创建时间' } +]; + // 默认显示的列 const selectedColumns = ref([ 'source', 'datetime', 'fat', 'protein', 'nonFat', 'acidity', @@ -545,17 +569,42 @@ function handleDelete(row) { }); } -/** 导出按钮操作 */ +/** 导出按钮操作 - 前端实现 */ function handleExport() { - const params = new URLSearchParams(); - for (const key in queryParams) { - if (queryParams[key] !== null && queryParams[key] !== undefined) { - params.append(key, queryParams[key]); - } - } + // 获取当前显示的列配置 + const visibleColumnsConfig = columnConfig.filter( + col => selectedColumns.value.includes(col.prop) + ); - const url = `/freshMilkTest/freshMilkTest/export?${params.toString()}`; - window.location.href = url; + // 准备导出数据 + const exportData = freshMilkTestList.value.map(item => { + const rowData = {}; + visibleColumnsConfig.forEach(col => { + // 特殊处理日期字段 + if (col.prop === 'datetime') { + rowData[col.label] = formatDate(item[col.prop]); + } else if (col.prop === 'createTime') { + rowData[col.label] = formatDateTime(item[col.prop]); + } else { + rowData[col.label] = item[col.prop]; + } + }); + return rowData; + }); + + // 创建工作簿和工作表 + const worksheet = XLSX.utils.json_to_sheet(exportData); + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, '鲜奶检验记录'); + + // 生成Excel文件并下载 + const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }); + const blob = new Blob([excelBuffer], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }); + + // 使用file-saver保存文件 + saveAs(blob, `鲜奶检验记录_${new Date().getTime()}.xlsx`); } // 初始化加载 diff --git a/src/views/dairyProducts/milkProdclasses/milkProdclasses/index.vue b/src/views/dairyProducts/milkProdclasses/milkProdclasses/index.vue index e6e0b37..bd6527f 100644 --- a/src/views/dairyProducts/milkProdclasses/milkProdclasses/index.vue +++ b/src/views/dairyProducts/milkProdclasses/milkProdclasses/index.vue @@ -1,16 +1,24 @@ - + + + \ No newline at end of file diff --git a/src/views/fileManagement/sheep_file/index.vue b/src/views/fileManagement/sheep_file/index.vue index a2af697..ad4f6e0 100644 --- a/src/views/fileManagement/sheep_file/index.vue +++ b/src/views/fileManagement/sheep_file/index.vue @@ -1,18 +1,18 @@ - + --> - 牧场id - + --> 牧场名称 - 羊舍id - + --> - 品种id - + --> 当前体重 - 繁育状态id - + --> 繁殖状态 - 父号id - + --> - 母号id - + --> - 受体id - + --> - 祖父号id - + --> - 祖母号id - + --> - 外祖父号id - + --> - 外祖母号id - + --> {{ parseTime(scope.row.sourceDate, '{y}-{m}-{d}') }} - 来源牧场id - + -->
- 羊只id - 管理耳号 - 牧场id + + 耳号 + 牧场名称 - 羊舍id + 羊舍名称 电子耳号 - 品种id + 品种 家系 羊只类型 @@ -936,22 +936,22 @@ 羊只状态 断奶体重 当前体重 - 繁育状态id + 繁殖状态 - 父号id - 父亲管理耳号 - 母号id - 母亲管理耳号 - 受体id - 受体管理耳号 - 祖父号id - 祖父管理耳号 - 祖母号id - 祖母管理耳号 - 外祖父号id - 外祖父管理耳号 - 外祖母号id - 外祖母管理耳号 + + 父亲耳号 + + 母亲耳号 + + 受体耳号 + + 祖父耳号 + + 祖母耳号 + + 外祖父耳号 + + 外祖母耳号 配种日期 配种类型 孕检日期 @@ -972,7 +972,7 @@ 乳房评分 入群来源 入群日期 - 来源牧场id + 来源牧场 修改人 修改日期 diff --git a/src/views/fileManagement/sheep_grouping/index.vue b/src/views/fileManagement/sheep_grouping/index.vue index afc48e6..dc7665d 100644 --- a/src/views/fileManagement/sheep_grouping/index.vue +++ b/src/views/fileManagement/sheep_grouping/index.vue @@ -18,7 +18,7 @@ /> - - - + --> + + + 搜索 重置 @@ -134,14 +141,27 @@ - + + + + @@ -462,4 +586,34 @@ getList() border-radius: 4px; background-color: #f5f7fa; } + +/* ===== 图形化展示样式 ===== */ +.seat-block { + margin-bottom: 8px; +} +.row-label { + font-weight: bold; + margin-bottom: 4px; +} +.seat-row { + display: flex; + flex-wrap: wrap; + gap: 4px; +} +.seat { + width: 32px; + height: 32px; + border: 1px solid #dcdfe6; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + font-size: 12px; + cursor: pointer; + background: #f2f6fc; +} +.seat.occupied { + background: #67c23a; + color: #fff; +} \ No newline at end of file diff --git a/src/views/stock/in/index.vue b/src/views/stock/in/index.vue index 142ff24..2e69780 100644 --- a/src/views/stock/in/index.vue +++ b/src/views/stock/in/index.vue @@ -2,7 +2,10 @@
- + + + @@ -20,8 +23,9 @@ - - 新增 + + 新增 import { listIn, getIn, delIn, addIn, updateIn } from "@/api/stock/in" import { getToken } from "@/utils/auth" -import { isVisible } from "element-plus/es/utils/index.mjs" + import { isVisible } from "element-plus/es/utils/index.mjs" const { proxy } = getCurrentInstance() const inList = ref([]) diff --git a/src/views/stock/management/index.vue b/src/views/stock/management/index.vue index 47009d2..418b222 100644 --- a/src/views/stock/management/index.vue +++ b/src/views/stock/management/index.vue @@ -2,20 +2,13 @@
- + - + + + 搜索 @@ -25,45 +18,24 @@ - 新增 + 新增 - 修改 + 修改 - 删除 + 删除 - 导出 + 导出 - 导入 + 导入 @@ -83,19 +55,16 @@ - - + + @@ -119,18 +88,12 @@ - - @@ -169,37 +132,37 @@ diff --git a/vite.config.js b/vite.config.js index 4f45d0f..4f566a6 100644 --- a/vite.config.js +++ b/vite.config.js @@ -42,7 +42,7 @@ export default defineConfig(({ mode, command }) => { }, // vite 相关配置 server: { - port: 80, + port: 82, host: true, open: true, proxy: {