From d8c918768a63499ad92238e68abd66af48daf4c7 Mon Sep 17 00:00:00 2001
From: wyt <414651037@qq.com>
Date: Wed, 20 Aug 2025 18:42:55 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BE=8A=E5=8F=AA=E5=88=86=E7=BB=84=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E4=B8=8B=E6=8B=89=E6=A1=86=E8=B0=83=E6=95=B4=E4=B8=BA?=
=?UTF-8?q?=E5=B5=8C=E5=A5=97=E6=9F=A5=E8=AF=A2=EF=BC=8C=E7=BE=8A=E8=88=8D?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B7=BB=E5=8A=A0=E5=8F=AF=E8=A7=86=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/fileManagement/sheep_grouping.js | 9 +
.../fileManagement/sheepfold_management.js | 8 +
.../fileManagement/sheep_grouping/index.vue | 57 ++++++-
.../sheepfold_management/index.vue | 154 +++++++++++++++++-
4 files changed, 218 insertions(+), 10 deletions(-)
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/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 @@
-
+
+
+
+
@@ -159,6 +179,7 @@ import { listSheep_grouping, getSheep_grouping, delSheep_grouping, addSheep_grou
import {listLeafGroup} from "@/api/fileManagement/group_management"
import {listSheep_grouping_join} from "@/api/fileManagement/sheep_grouping"
import { addByEarTags } from '@/api/fileManagement/sheep_grouping'
+import { listGroupTree } from '@/api/fileManagement/sheep_grouping'
const { proxy } = getCurrentInstance()
@@ -173,6 +194,8 @@ const total = ref(0)
const title = ref("")
const leafGroupOptions = ref([])
const { sheep_gender } = proxy.useDict('sheep_gender')
+// data 里声明
+const groupTree = ref([])
const data = reactive({
form: {
@@ -390,17 +413,33 @@ loadLeafGroups()
getList()
+// // 调用示例
+// function loadLeafGroups() {
+// listLeafGroup().then(res => {
+// leafGroupOptions.value = res.data
+// })
+// }
+
// 调用示例
function loadLeafGroups() {
- listLeafGroup().then(res => {
- leafGroupOptions.value = res.data
+ listGroupTree().then(res => {
+ groupTree.value = res.data
+ console.log(groupTree.value)
})
}
+
// 根据 groupId 获取分组名称
+// function getGroupName(id) {
+// const group = leafGroupOptions.value.find(g => g.groupId === id)
+// return group ? group.groupName : ''
+// }
+
function getGroupName(id) {
- const group = leafGroupOptions.value.find(g => g.groupId === id)
- return group ? group.groupName : ''
+ const flatten = (arr) =>
+ arr.reduce((acc, cur) => acc.concat(cur, flatten(cur.children || [])), [])
+ const node = flatten(groupTree.value).find(n => n.groupId === id)
+ return node ? node.groupName : ''
}
diff --git a/src/views/fileManagement/sheepfold_management/index.vue b/src/views/fileManagement/sheepfold_management/index.vue
index de5b88c..c71db04 100644
--- a/src/views/fileManagement/sheepfold_management/index.vue
+++ b/src/views/fileManagement/sheepfold_management/index.vue
@@ -103,6 +103,86 @@
@pagination="getList"
/>
+
+
+ 牧场羊舍示意图
+
+
+
+
+
+
+
+
+
+
+
+ {{ fold.foldNo }}号{{type.typeName}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -190,7 +270,7 @@
@@ -462,4 +584,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