Compare commits

..

5 Commits

8 changed files with 1636 additions and 107 deletions

View File

@ -61,3 +61,12 @@ export function addByEarTags(data) {
data data
}) })
} }
// 树形分组
export const listGroupTree = () =>
request({
url: '/sheep_grouping/sheep_grouping/group/tree',
method: 'get'
})

View File

@ -55,3 +55,11 @@ export function checkSheepfoldNoExist(ranchId, sheepfoldTypeId, sheepfoldNo) {
} }
}) })
} }
// 获取树形座位图(牧场 → 类型 → 羊舍 → 排栏)
export function getSeatMap() {
return request({
url: '/sheepfold_management/sheepfold_management/seatMap',
method: 'get'
})
}

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px" @submit.prevent>
<el-form-item label="分组名称" prop="groupName"> <el-form-item label="分组名称" prop="groupName">
<el-input <el-input
v-model="queryParams.groupName" v-model="queryParams.groupName"
@ -20,7 +20,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery" native-type="button"> 搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -256,38 +256,71 @@ async function handleUpdate(row) {
}) })
} }
/** 提交按钮 */
// function submitForm() {
// proxy.$refs["group_managementRef"].validate(valid => {
// if (valid) {
// //
// if (form.value.parentId === 0) {
// form.value.ancestors = "0"
// } else {
// const parentNode = findNode(group_managementOptions.value, form.value.parentId)
// if (parentNode) {
// form.value.ancestors = `${parentNode.ancestors},${parentNode.groupId}`
// } else {
// // 使
// form.value.ancestors = "0"
// }
// }
// if (form.value.groupId != null) {
// updateGroup_management(form.value).then(response => {
// proxy.$modal.msgSuccess("")
// open.value = false
// getList()
// })
// } else {
// addGroup_management(form.value).then(response => {
// proxy.$modal.msgSuccess("")
// open.value = false
// getList()
// })
// }
// }
// })
// }
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { function submitForm() {
proxy.$refs["group_managementRef"].validate(valid => { proxy.$refs["group_managementRef"].validate(valid => {
if (valid) { if (!valid) return;
//
//
if (form.value.parentId === 0) { if (form.value.parentId === 0) {
form.value.ancestors = "0" form.value.ancestors = "0";
} else { } else {
const parentNode = findNode(group_managementOptions.value, form.value.parentId) const parentNode = findNode(group_managementOptions.value, form.value.parentId);
if (parentNode) { form.value.ancestors = parentNode
form.value.ancestors = `${parentNode.ancestors},${parentNode.groupId}` ? `${parentNode.ancestors},${parentNode.groupId}`
} else { : "0";
// 使
form.value.ancestors = "0"
}
} }
if (form.value.groupId != null) { const request = form.value.groupId != null
updateGroup_management(form.value).then(response => { ? updateGroup_management(form.value)
proxy.$modal.msgSuccess("修改成功") : addGroup_management(form.value);
open.value = false
getList() request
}) .then(() => {
} else { proxy.$modal.msgSuccess(form.value.groupId ? "修改成功" : "新增成功");
addGroup_management(form.value).then(response => { open.value = false;
proxy.$modal.msgSuccess("新增成功") getList();
open.value = false
getList()
})
}
}
}) })
.catch(error => {
//
const msg = error?.response?.data?.msg || "操作失败";
proxy.$modal.msgError(msg);
});
});
} }
/** 删除按钮操作 */ /** 删除按钮操作 */

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,18 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="羊只id" prop="id"> <!-- <el-form-item label="羊只id" prop="id">
<el-input <el-input
v-model="queryParams.id" v-model="queryParams.id"
placeholder="请输入羊只id" placeholder="请输入羊只id"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item> -->
<el-form-item label="管理耳号" prop="bsManageTags"> <el-form-item label="耳号" prop="bsManageTags">
<el-input <el-input
v-model="queryParams.bsManageTags" v-model="queryParams.bsManageTags"
placeholder="请输入管理耳号" placeholder="请输入耳号"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
@ -66,7 +66,7 @@
border border
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column <!-- <el-table-column
v-if="columns['id'].visible" v-if="columns['id'].visible"
label="羊只id" label="羊只id"
align="center" align="center"
@ -78,10 +78,10 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">羊只id</span> <span style="font-weight: bold; color: #333;">羊只id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['bsManageTags'].visible" v-if="columns['bsManageTags'].visible"
label="管理耳号" label="耳号"
align="center" align="center"
prop="bsManageTags" prop="bsManageTags"
width="120" width="120"
@ -89,10 +89,10 @@
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">管理耳号</span> <span style="font-weight: bold; color: #333;">耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['ranchId'].visible" v-if="columns['ranchId'].visible"
label="牧场id" label="牧场id"
align="center" align="center"
@ -103,7 +103,7 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">牧场id</span> <span style="font-weight: bold; color: #333;">牧场id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['drRanch'].visible" v-if="columns['drRanch'].visible"
label="牧场名称" label="牧场名称"
@ -116,7 +116,7 @@
<span style="font-weight: bold; color: #333;">牧场名称</span> <span style="font-weight: bold; color: #333;">牧场名称</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['sheepfoldId'].visible" v-if="columns['sheepfoldId'].visible"
label="羊舍id" label="羊舍id"
align="center" align="center"
@ -127,7 +127,7 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">羊舍id</span> <span style="font-weight: bold; color: #333;">羊舍id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['sheepfoldName'].visible" v-if="columns['sheepfoldName'].visible"
label="羊舍名称" label="羊舍名称"
@ -166,7 +166,7 @@
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['varietyId'].visible" v-if="columns['varietyId'].visible"
label="品种id" label="品种id"
align="center" align="center"
@ -177,7 +177,7 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">品种id</span> <span style="font-weight: bold; color: #333;">品种id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['variety'].visible" v-if="columns['variety'].visible"
label="品种" label="品种"
@ -346,7 +346,7 @@
<span style="font-weight: bold; color: #333;">当前体重</span> <span style="font-weight: bold; color: #333;">当前体重</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['breedStatusId'].visible" v-if="columns['breedStatusId'].visible"
label="繁育状态id" label="繁育状态id"
align="center" align="center"
@ -357,7 +357,7 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">繁育状态id</span> <span style="font-weight: bold; color: #333;">繁育状态id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['breed'].visible" v-if="columns['breed'].visible"
label="繁殖状态" label="繁殖状态"
@ -370,7 +370,7 @@
<span style="font-weight: bold; color: #333;">繁殖状态</span> <span style="font-weight: bold; color: #333;">繁殖状态</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['bsFatherId'].visible" v-if="columns['bsFatherId'].visible"
label="父号id" label="父号id"
align="center" align="center"
@ -381,20 +381,20 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">父号id</span> <span style="font-weight: bold; color: #333;">父号id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['fatherManageTags'].visible" v-if="columns['fatherManageTags'].visible"
label="父亲管理耳号" label="父亲耳号"
align="center" align="center"
prop="fatherManageTags" prop="fatherManageTags"
width="120" width="120"
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">父亲管理耳号</span> <span style="font-weight: bold; color: #333;">父亲耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['bsMotherId'].visible" v-if="columns['bsMotherId'].visible"
label="母号id" label="母号id"
align="center" align="center"
@ -405,20 +405,20 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">母号id</span> <span style="font-weight: bold; color: #333;">母号id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['motherManageTags'].visible" v-if="columns['motherManageTags'].visible"
label="母亲管理耳号" label="母亲耳号"
align="center" align="center"
prop="motherManageTags" prop="motherManageTags"
width="120" width="120"
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">母亲管理耳号</span> <span style="font-weight: bold; color: #333;">母亲耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['receptorId'].visible" v-if="columns['receptorId'].visible"
label="受体id" label="受体id"
align="center" align="center"
@ -429,20 +429,20 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">受体id</span> <span style="font-weight: bold; color: #333;">受体id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['receptorManageTags'].visible" v-if="columns['receptorManageTags'].visible"
label="受体管理耳号" label="受体耳号"
align="center" align="center"
prop="receptorManageTags" prop="receptorManageTags"
width="120" width="120"
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">受体管理耳号</span> <span style="font-weight: bold; color: #333;">受体耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['fatherFatherId'].visible" v-if="columns['fatherFatherId'].visible"
label="祖父号id" label="祖父号id"
align="center" align="center"
@ -453,20 +453,20 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">祖父号id</span> <span style="font-weight: bold; color: #333;">祖父号id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['grandfatherManageTags'].visible" v-if="columns['grandfatherManageTags'].visible"
label="祖父管理耳号" label="祖父耳号"
align="center" align="center"
prop="grandfatherManageTags" prop="grandfatherManageTags"
width="120" width="120"
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">祖父管理耳号</span> <span style="font-weight: bold; color: #333;">祖父耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['fatherMotherId'].visible" v-if="columns['fatherMotherId'].visible"
label="祖母号id" label="祖母号id"
align="center" align="center"
@ -477,20 +477,20 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">祖母号id</span> <span style="font-weight: bold; color: #333;">祖母号id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['grandmotherManageTags'].visible" v-if="columns['grandmotherManageTags'].visible"
label="祖母管理耳号" label="祖母耳号"
align="center" align="center"
prop="grandmotherManageTags" prop="grandmotherManageTags"
width="120" width="120"
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">祖母管理耳号</span> <span style="font-weight: bold; color: #333;">祖母耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['fatherId'].visible" v-if="columns['fatherId'].visible"
label="外祖父号id" label="外祖父号id"
align="center" align="center"
@ -501,20 +501,20 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">外祖父号id</span> <span style="font-weight: bold; color: #333;">外祖父号id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['maternalGrandfatherManageTags'].visible" v-if="columns['maternalGrandfatherManageTags'].visible"
label="外祖父管理耳号" label="外祖父耳号"
align="center" align="center"
prop="maternalGrandfatherManageTags" prop="maternalGrandfatherManageTags"
width="120" width="120"
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">外祖父管理耳号</span> <span style="font-weight: bold; color: #333;">外祖父耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['motherId'].visible" v-if="columns['motherId'].visible"
label="外祖母号id" label="外祖母号id"
align="center" align="center"
@ -525,17 +525,17 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">外祖母号id</span> <span style="font-weight: bold; color: #333;">外祖母号id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['maternalGrandmotherManageTags'].visible" v-if="columns['maternalGrandmotherManageTags'].visible"
label="外祖母管理耳号" label="外祖母耳号"
align="center" align="center"
prop="maternalGrandmotherManageTags" prop="maternalGrandmotherManageTags"
width="120" width="120"
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">外祖母管理耳号</span> <span style="font-weight: bold; color: #333;">外祖母耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -809,7 +809,7 @@
<span>{{ parseTime(scope.row.sourceDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.sourceDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['sourceRanchId'].visible" v-if="columns['sourceRanchId'].visible"
label="来源牧场id" label="来源牧场id"
align="center" align="center"
@ -820,7 +820,7 @@
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">来源牧场id</span> <span style="font-weight: bold; color: #333;">来源牧场id</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="columns['sourceRanch'].visible" v-if="columns['sourceRanch'].visible"
label="来源牧场" label="来源牧场"
@ -915,14 +915,14 @@
<el-dialog v-model="columnDialogVisible" title="显示列设置" width="800px"> <el-dialog v-model="columnDialogVisible" title="显示列设置" width="800px">
<div style="max-height: 400px; overflow-y: auto; "> <div style="max-height: 400px; overflow-y: auto; ">
<el-checkbox-group v-model="selectedColumns" style="grid; grid-template-columns: repeat(3, 1fr); gap: 10px;" > <el-checkbox-group v-model="selectedColumns" style="grid; grid-template-columns: repeat(3, 1fr); gap: 10px;" >
<el-checkbox label="id">羊只id</el-checkbox> <!-- <el-checkbox label="id">羊只id</el-checkbox> -->
<el-checkbox label="bsManageTags">管理耳号</el-checkbox> <el-checkbox label="bsManageTags">耳号</el-checkbox>
<el-checkbox label="ranchId">牧场id</el-checkbox> <!-- <el-checkbox label="ranchId">牧场id</el-checkbox> -->
<el-checkbox label="drRanch">牧场名称</el-checkbox> <el-checkbox label="drRanch">牧场名称</el-checkbox>
<el-checkbox label="sheepfoldId">羊舍id</el-checkbox> <!-- <el-checkbox label="sheepfoldId">羊舍id</el-checkbox> -->
<el-checkbox label="sheepfoldName">羊舍名称</el-checkbox> <el-checkbox label="sheepfoldName">羊舍名称</el-checkbox>
<el-checkbox label="electronicTags">电子耳号</el-checkbox> <el-checkbox label="electronicTags">电子耳号</el-checkbox>
<el-checkbox label="varietyId">品种id</el-checkbox> <!-- <el-checkbox label="varietyId">品种id</el-checkbox> -->
<el-checkbox label="variety">品种</el-checkbox> <el-checkbox label="variety">品种</el-checkbox>
<el-checkbox label="family">家系</el-checkbox> <el-checkbox label="family">家系</el-checkbox>
<el-checkbox label="name">羊只类型</el-checkbox> <el-checkbox label="name">羊只类型</el-checkbox>
@ -936,22 +936,22 @@
<el-checkbox label="statusId">羊只状态</el-checkbox> <el-checkbox label="statusId">羊只状态</el-checkbox>
<el-checkbox label="weaningWeight">断奶体重</el-checkbox> <el-checkbox label="weaningWeight">断奶体重</el-checkbox>
<el-checkbox label="currentWeight">当前体重</el-checkbox> <el-checkbox label="currentWeight">当前体重</el-checkbox>
<el-checkbox label="breedStatusId">繁育状态id</el-checkbox> <!-- <el-checkbox label="breedStatusId">繁育状态id</el-checkbox> -->
<el-checkbox label="breed">繁殖状态</el-checkbox> <el-checkbox label="breed">繁殖状态</el-checkbox>
<el-checkbox label="bsFatherId">父号id</el-checkbox> <!-- <el-checkbox label="bsFatherId">父号id</el-checkbox> -->
<el-checkbox label="fatherManageTags">父亲管理耳号</el-checkbox> <el-checkbox label="fatherManageTags">父亲耳号</el-checkbox>
<el-checkbox label="bsMotherId">母号id</el-checkbox> <!-- <el-checkbox label="bsMotherId">母号id</el-checkbox> -->
<el-checkbox label="motherManageTags">母亲管理耳号</el-checkbox> <el-checkbox label="motherManageTags">母亲耳号</el-checkbox>
<el-checkbox label="receptorId">受体id</el-checkbox> <!-- <el-checkbox label="receptorId">受体id</el-checkbox> -->
<el-checkbox label="receptorManageTags">受体管理耳号</el-checkbox> <el-checkbox label="receptorManageTags">受体耳号</el-checkbox>
<el-checkbox label="fatherFatherId">祖父号id</el-checkbox> <!-- <el-checkbox label="fatherFatherId">祖父号id</el-checkbox> -->
<el-checkbox label="grandfatherManageTags">祖父管理耳号</el-checkbox> <el-checkbox label="grandfatherManageTags">祖父耳号</el-checkbox>
<el-checkbox label="fatherMotherId">祖母号id</el-checkbox> <!-- <el-checkbox label="fatherMotherId">祖母号id</el-checkbox> -->
<el-checkbox label="grandmotherManageTags">祖母管理耳号</el-checkbox> <el-checkbox label="grandmotherManageTags">祖母耳号</el-checkbox>
<el-checkbox label="fatherId">外祖父号id</el-checkbox> <!-- <el-checkbox label="fatherId">外祖父号id</el-checkbox> -->
<el-checkbox label="maternalGrandfatherManageTags">外祖父管理耳号</el-checkbox> <el-checkbox label="maternalGrandfatherManageTags">外祖父耳号</el-checkbox>
<el-checkbox label="motherId">外祖母号id</el-checkbox> <!-- <el-checkbox label="motherId">外祖母号id</el-checkbox> -->
<el-checkbox label="maternalGrandmotherManageTags">外祖母管理耳号</el-checkbox> <el-checkbox label="maternalGrandmotherManageTags">外祖母耳号</el-checkbox>
<el-checkbox label="matingDate">配种日期</el-checkbox> <el-checkbox label="matingDate">配种日期</el-checkbox>
<el-checkbox label="matingTypeId">配种类型</el-checkbox> <el-checkbox label="matingTypeId">配种类型</el-checkbox>
<el-checkbox label="pregDate">孕检日期</el-checkbox> <el-checkbox label="pregDate">孕检日期</el-checkbox>
@ -972,7 +972,7 @@
<el-checkbox label="breast">乳房评分</el-checkbox> <el-checkbox label="breast">乳房评分</el-checkbox>
<el-checkbox label="source">入群来源</el-checkbox> <el-checkbox label="source">入群来源</el-checkbox>
<el-checkbox label="sourceDate">入群日期</el-checkbox> <el-checkbox label="sourceDate">入群日期</el-checkbox>
<el-checkbox label="sourceRanchId">来源牧场id</el-checkbox> <!-- <el-checkbox label="sourceRanchId">来源牧场id</el-checkbox> -->
<el-checkbox label="sourceRanch">来源牧场</el-checkbox> <el-checkbox label="sourceRanch">来源牧场</el-checkbox>
<el-checkbox label="updateBy">修改人</el-checkbox> <el-checkbox label="updateBy">修改人</el-checkbox>
<el-checkbox label="updateTime">修改日期</el-checkbox> <el-checkbox label="updateTime">修改日期</el-checkbox>

View File

@ -18,7 +18,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="分组" prop="groupId"> <el-form-item label="分组" prop="groupId">
<el-select <!-- <el-select
v-model="queryParams.groupId" v-model="queryParams.groupId"
placeholder="请选择分组" placeholder="请选择分组"
clearable clearable
@ -30,8 +30,15 @@
:label="g.groupName" :label="g.groupName"
:value="g.groupId" :value="g.groupId"
/> />
</el-select> </el-select> -->
</el-form-item> <el-tree-select v-model="queryParams.groupId" :data="groupTree" style="width: 180px;"
:props="{ value: 'groupId', label: 'groupName', children: 'children' }"
value-key="groupId" placeholder="请选择"
check-strictly
clearable
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@ -134,14 +141,27 @@
<el-input type="textarea" :rows="4" v-model="form.earTags" :disabled="form.earTagsDisabled" placeholder="请输入耳号,多个耳号用逗号或换行分隔"/> <el-input type="textarea" :rows="4" v-model="form.earTags" :disabled="form.earTagsDisabled" placeholder="请输入耳号,多个耳号用逗号或换行分隔"/>
</el-form-item> </el-form-item>
<el-form-item label="分组" prop="groupId"> <el-form-item label="分组" prop="groupId">
<el-select v-model="form.groupId" placeholder="请选择分组" clearable> <!-- <el-select v-model="form.groupId" placeholder="请选择分组" clearable>
<el-option <el-option
v-for="g in leafGroupOptions" v-for="g in leafGroupOptions"
:key="g.groupId" :key="g.groupId"
:label="g.groupName" :label="g.groupName"
:value="g.groupId" :value="g.groupId"
/> />
</el-select> </el-select> -->
<el-tree-select
v-model="form.groupId"
:data="groupTree"
style="width: 180px"
:props="{ value: 'groupId', label: 'groupName', children: 'children' }"
value-key="groupId"
placeholder="请选择分组"
clearable
check-strictly
:select-leaf-only="true"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -159,6 +179,7 @@ import { listSheep_grouping, getSheep_grouping, delSheep_grouping, addSheep_grou
import {listLeafGroup} from "@/api/fileManagement/group_management" import {listLeafGroup} from "@/api/fileManagement/group_management"
import {listSheep_grouping_join} from "@/api/fileManagement/sheep_grouping" import {listSheep_grouping_join} from "@/api/fileManagement/sheep_grouping"
import { addByEarTags } from '@/api/fileManagement/sheep_grouping' import { addByEarTags } from '@/api/fileManagement/sheep_grouping'
import { listGroupTree } from '@/api/fileManagement/sheep_grouping'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@ -173,6 +194,8 @@ const total = ref(0)
const title = ref("") const title = ref("")
const leafGroupOptions = ref([]) const leafGroupOptions = ref([])
const { sheep_gender } = proxy.useDict('sheep_gender') const { sheep_gender } = proxy.useDict('sheep_gender')
// data
const groupTree = ref([])
const data = reactive({ const data = reactive({
form: { form: {
@ -390,17 +413,33 @@ loadLeafGroups()
getList() getList()
// //
// function loadLeafGroups() {
// listLeafGroup().then(res => {
// leafGroupOptions.value = res.data
// })
// }
// //
function loadLeafGroups() { function loadLeafGroups() {
listLeafGroup().then(res => { listGroupTree().then(res => {
leafGroupOptions.value = res.data groupTree.value = res.data
console.log(groupTree.value)
}) })
} }
// groupId // groupId
// function getGroupName(id) {
// const group = leafGroupOptions.value.find(g => g.groupId === id)
// return group ? group.groupName : ''
// }
function getGroupName(id) { function getGroupName(id) {
const group = leafGroupOptions.value.find(g => g.groupId === id) const flatten = (arr) =>
return group ? group.groupName : '' arr.reduce((acc, cur) => acc.concat(cur, flatten(cur.children || [])), [])
const node = flatten(groupTree.value).find(n => n.groupId === id)
return node ? node.groupName : ''
} }
</script> </script>

View File

@ -103,6 +103,86 @@
@pagination="getList" @pagination="getList"
/> />
<!-- ===== 图形化展示区域 ===== -->
<el-divider>牧场羊舍示意图</el-divider>
<el-collapse
v-model="activeNames"
accordion
style="margin-top: 16px; max-width: 100%; overflow-x: auto"
>
<!-- 一级牧场 -->
<el-collapse-item
v-for="ranch in seatMapTree"
:key="ranch.ranchId"
:title="ranch.ranchName"
:name="ranch.ranchId"
>
<!-- 二级羊舍类型 -->
<el-collapse accordion>
<el-collapse-item
v-for="type in ranch.types"
:key="type.typeId"
:title="`${type.typeName} (${type.folds.length}个)`"
>
<!-- 三级羊舍卡片 -->
<el-row :gutter="16">
<el-col
v-for="fold in type.folds"
:key="fold.foldNo"
:xs="24"
:sm="12"
:md="8"
:lg="6"
:xl="4"
style="margin-bottom: 16px"
>
<el-card shadow="hover">
<template #header>
<span>{{ fold.foldNo }}{{type.typeName}}</span>
</template>
<!-- 四级 -->
<div
v-for="row in fold.rows"
:key="row.rowNo"
class="seat-block"
>
<div class="row-label">{{ row.rowNo }}</div>
<div class="seat-row">
<!-- 五级栏位 -->
<div
v-for="col in row.columns"
:key="col"
class="seat"
:class="{ occupied: isOccupied(fold.foldNo, row.rowNo, col) }"
@click="toggleSeat(fold.foldNo, row.rowNo, col)"
>
{{ col }}
</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
</el-collapse-item>
</el-collapse>
</el-collapse-item>
</el-collapse>
<!-- 添加或修改羊舍管理对话框 --> <!-- 添加或修改羊舍管理对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body> <el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="sheepfold_managementRef" :model="form" :rules="rules" label-width="80px"> <el-form ref="sheepfold_managementRef" :model="form" :rules="rules" label-width="80px">
@ -190,7 +270,7 @@
</template> </template>
<script setup name="Sheepfold_management"> <script setup name="Sheepfold_management">
import { listSheepfold_management, getSheepfold_management, delSheepfold_management, addSheepfold_management, updateSheepfold_management,checkSheepfoldNoExist } from "@/api/fileManagement/sheepfold_management" import { getSeatMap,listSheepfold_management, getSheepfold_management, delSheepfold_management, addSheepfold_management, updateSheepfold_management,checkSheepfoldNoExist } from "@/api/fileManagement/sheepfold_management"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { bas_sheepfold_type, da_ranch } = proxy.useDict('bas_sheepfold_type', 'da_ranch') const { bas_sheepfold_type, da_ranch } = proxy.useDict('bas_sheepfold_type', 'da_ranch')
@ -206,6 +286,7 @@ const total = ref(0)
const title = ref("") const title = ref("")
const sheepfoldNoExists = ref(false) // const sheepfoldNoExists = ref(false) //
const data = reactive({ const data = reactive({
form: { form: {
id: null, id: null,
@ -295,6 +376,7 @@ function reset() {
function handleQuery() { function handleQuery() {
queryParams.value.pageNum = 1 queryParams.value.pageNum = 1
getList() getList()
loadSeatMap()
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -388,6 +470,7 @@ function submitForm() {
proxy.$modal.msgSuccess("修改成功") proxy.$modal.msgSuccess("修改成功")
open.value = false open.value = false
getList() getList()
loadSeatMap()
}) })
} else { } else {
// - // -
@ -423,6 +506,7 @@ function submitForm() {
proxy.$modal.msgSuccess(`新增成功,共添加${requests.length}条记录`) proxy.$modal.msgSuccess(`新增成功,共添加${requests.length}条记录`)
open.value = false open.value = false
getList() getList()
loadSeatMap()
}) })
.catch(error => { .catch(error => {
proxy.$modal.msgError("部分记录添加失败:" + error.message) proxy.$modal.msgError("部分记录添加失败:" + error.message)
@ -439,6 +523,7 @@ function handleDelete(row) {
return delSheepfold_management(_ids) return delSheepfold_management(_ids)
}).then(() => { }).then(() => {
getList() getList()
loadSeatMap();
proxy.$modal.msgSuccess("删除成功") proxy.$modal.msgSuccess("删除成功")
}).catch(() => {}) }).catch(() => {})
} }
@ -450,7 +535,46 @@ function handleExport() {
}, `sheepfold_management_${new Date().getTime()}.xlsx`) }, `sheepfold_management_${new Date().getTime()}.xlsx`)
} }
/* ===== 图形化展示所需变量和方法 ===== */
const activeNames = ref([]) //
const seatMapTree = ref([]) //
const loadSeatMap = () => {
getSeatMap()
.then(res => (seatMapTree.value = res.data))
.catch(err => proxy.$modal.msgError('加载座位图失败:' + err.message))
}
/* 演示:点击栏位切换颜色 */
const occupied = ref(new Set())
const isOccupied = (foldNo, rowNo, col) =>
occupied.value.has(`${foldNo}-${rowNo}-${col}`)
const toggleSeat = (foldNo, rowNo, col) => {
const key = `${foldNo}-${rowNo}-${col}`
occupied.value.has(key)
? occupied.value.delete(key)
: occupied.value.add(key)
}
/* 页面加载时拉取数据 */
onMounted(() => {
getList()
loadSeatMap()
})
getList() getList()
loadSeatMap()
</script> </script>
@ -462,4 +586,34 @@ getList()
border-radius: 4px; border-radius: 4px;
background-color: #f5f7fa; 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;
}
</style> </style>

View File

@ -42,7 +42,7 @@ export default defineConfig(({ mode, command }) => {
}, },
// vite 相关配置 // vite 相关配置
server: { server: {
port: 80, port: 82,
host: true, host: true,
open: true, open: true,
proxy: { proxy: {