修改分组页面,新增名称重复校验以及查询的bug

This commit is contained in:
wyt 2025-09-03 10:35:39 +08:00
parent fc40d2e408
commit 981da72495
2 changed files with 129 additions and 96 deletions

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);
});
});
} }
/** 删除按钮操作 */ /** 删除按钮操作 */

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>