修改分组页面,新增名称重复校验以及查询的bug
This commit is contained in:
parent
fc40d2e408
commit
981da72495
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<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-input
|
||||
v-model="queryParams.groupName"
|
||||
@ -20,7 +20,7 @@
|
||||
</el-radio-group>
|
||||
</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-form-item>
|
||||
</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() {
|
||||
proxy.$refs["group_managementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
// 新增:计算祖先路径
|
||||
if (!valid) return;
|
||||
|
||||
// 计算祖先路径
|
||||
if (form.value.parentId === 0) {
|
||||
form.value.ancestors = "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"
|
||||
}
|
||||
const parentNode = findNode(group_managementOptions.value, form.value.parentId);
|
||||
form.value.ancestors = parentNode
|
||||
? `${parentNode.ancestors},${parentNode.groupId}`
|
||||
: "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()
|
||||
})
|
||||
}
|
||||
}
|
||||
const request = form.value.groupId != null
|
||||
? updateGroup_management(form.value)
|
||||
: addGroup_management(form.value);
|
||||
|
||||
request
|
||||
.then(() => {
|
||||
proxy.$modal.msgSuccess(form.value.groupId ? "修改成功" : "新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
})
|
||||
.catch(error => {
|
||||
// ✅ 后端返回的错误信息
|
||||
const msg = error?.response?.data?.msg || "操作失败";
|
||||
proxy.$modal.msgError(msg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<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
|
||||
v-model="queryParams.id"
|
||||
placeholder="请输入羊只id"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="bsManageTags">
|
||||
</el-form-item> -->
|
||||
<el-form-item label="耳号" prop="bsManageTags">
|
||||
<el-input
|
||||
v-model="queryParams.bsManageTags"
|
||||
placeholder="请输入管理耳号"
|
||||
placeholder="请输入耳号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
@ -66,7 +66,7 @@
|
||||
border
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['id'].visible"
|
||||
label="羊只id"
|
||||
align="center"
|
||||
@ -78,10 +78,10 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊只id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['bsManageTags'].visible"
|
||||
label="管理耳号"
|
||||
label="耳号"
|
||||
align="center"
|
||||
prop="bsManageTags"
|
||||
width="120"
|
||||
@ -89,10 +89,10 @@
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['ranchId'].visible"
|
||||
label="牧场id"
|
||||
align="center"
|
||||
@ -103,7 +103,7 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">牧场id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['drRanch'].visible"
|
||||
label="牧场名称"
|
||||
@ -116,7 +116,7 @@
|
||||
<span style="font-weight: bold; color: #333;">牧场名称</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['sheepfoldId'].visible"
|
||||
label="羊舍id"
|
||||
align="center"
|
||||
@ -127,7 +127,7 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊舍id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['sheepfoldName'].visible"
|
||||
label="羊舍名称"
|
||||
@ -166,7 +166,7 @@
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['varietyId'].visible"
|
||||
label="品种id"
|
||||
align="center"
|
||||
@ -177,7 +177,7 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">品种id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['variety'].visible"
|
||||
label="品种"
|
||||
@ -346,7 +346,7 @@
|
||||
<span style="font-weight: bold; color: #333;">当前体重</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['breedStatusId'].visible"
|
||||
label="繁育状态id"
|
||||
align="center"
|
||||
@ -357,7 +357,7 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">繁育状态id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['breed'].visible"
|
||||
label="繁殖状态"
|
||||
@ -370,7 +370,7 @@
|
||||
<span style="font-weight: bold; color: #333;">繁殖状态</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['bsFatherId'].visible"
|
||||
label="父号id"
|
||||
align="center"
|
||||
@ -381,20 +381,20 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">父号id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['fatherManageTags'].visible"
|
||||
label="父亲管理耳号"
|
||||
label="父亲耳号"
|
||||
align="center"
|
||||
prop="fatherManageTags"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">父亲管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">父亲耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['bsMotherId'].visible"
|
||||
label="母号id"
|
||||
align="center"
|
||||
@ -405,20 +405,20 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">母号id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['motherManageTags'].visible"
|
||||
label="母亲管理耳号"
|
||||
label="母亲耳号"
|
||||
align="center"
|
||||
prop="motherManageTags"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">母亲管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">母亲耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['receptorId'].visible"
|
||||
label="受体id"
|
||||
align="center"
|
||||
@ -429,20 +429,20 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">受体id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['receptorManageTags'].visible"
|
||||
label="受体管理耳号"
|
||||
label="受体耳号"
|
||||
align="center"
|
||||
prop="receptorManageTags"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">受体管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">受体耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['fatherFatherId'].visible"
|
||||
label="祖父号id"
|
||||
align="center"
|
||||
@ -453,20 +453,20 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">祖父号id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['grandfatherManageTags'].visible"
|
||||
label="祖父管理耳号"
|
||||
label="祖父耳号"
|
||||
align="center"
|
||||
prop="grandfatherManageTags"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">祖父管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">祖父耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['fatherMotherId'].visible"
|
||||
label="祖母号id"
|
||||
align="center"
|
||||
@ -477,20 +477,20 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">祖母号id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['grandmotherManageTags'].visible"
|
||||
label="祖母管理耳号"
|
||||
label="祖母耳号"
|
||||
align="center"
|
||||
prop="grandmotherManageTags"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">祖母管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">祖母耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['fatherId'].visible"
|
||||
label="外祖父号id"
|
||||
align="center"
|
||||
@ -501,20 +501,20 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">外祖父号id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['maternalGrandfatherManageTags'].visible"
|
||||
label="外祖父管理耳号"
|
||||
label="外祖父耳号"
|
||||
align="center"
|
||||
prop="maternalGrandfatherManageTags"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">外祖父管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">外祖父耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['motherId'].visible"
|
||||
label="外祖母号id"
|
||||
align="center"
|
||||
@ -525,17 +525,17 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">外祖母号id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['maternalGrandmotherManageTags'].visible"
|
||||
label="外祖母管理耳号"
|
||||
label="外祖母耳号"
|
||||
align="center"
|
||||
prop="maternalGrandmotherManageTags"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">外祖母管理耳号</span>
|
||||
<span style="font-weight: bold; color: #333;">外祖母耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -809,7 +809,7 @@
|
||||
<span>{{ parseTime(scope.row.sourceDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
v-if="columns['sourceRanchId'].visible"
|
||||
label="来源牧场id"
|
||||
align="center"
|
||||
@ -820,7 +820,7 @@
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">来源牧场id</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['sourceRanch'].visible"
|
||||
label="来源牧场"
|
||||
@ -915,14 +915,14 @@
|
||||
<el-dialog v-model="columnDialogVisible" title="显示列设置" width="800px">
|
||||
<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 label="id">羊只id</el-checkbox>
|
||||
<el-checkbox label="bsManageTags">管理耳号</el-checkbox>
|
||||
<el-checkbox label="ranchId">牧场id</el-checkbox>
|
||||
<!-- <el-checkbox label="id">羊只id</el-checkbox> -->
|
||||
<el-checkbox label="bsManageTags">耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="ranchId">牧场id</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="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="family">家系</el-checkbox>
|
||||
<el-checkbox label="name">羊只类型</el-checkbox>
|
||||
@ -936,22 +936,22 @@
|
||||
<el-checkbox label="statusId">羊只状态</el-checkbox>
|
||||
<el-checkbox label="weaningWeight">断奶体重</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="bsFatherId">父号id</el-checkbox>
|
||||
<el-checkbox label="fatherManageTags">父亲管理耳号</el-checkbox>
|
||||
<el-checkbox label="bsMotherId">母号id</el-checkbox>
|
||||
<el-checkbox label="motherManageTags">母亲管理耳号</el-checkbox>
|
||||
<el-checkbox label="receptorId">受体id</el-checkbox>
|
||||
<el-checkbox label="receptorManageTags">受体管理耳号</el-checkbox>
|
||||
<el-checkbox label="fatherFatherId">祖父号id</el-checkbox>
|
||||
<el-checkbox label="grandfatherManageTags">祖父管理耳号</el-checkbox>
|
||||
<el-checkbox label="fatherMotherId">祖母号id</el-checkbox>
|
||||
<el-checkbox label="grandmotherManageTags">祖母管理耳号</el-checkbox>
|
||||
<el-checkbox label="fatherId">外祖父号id</el-checkbox>
|
||||
<el-checkbox label="maternalGrandfatherManageTags">外祖父管理耳号</el-checkbox>
|
||||
<el-checkbox label="motherId">外祖母号id</el-checkbox>
|
||||
<el-checkbox label="maternalGrandmotherManageTags">外祖母管理耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="bsFatherId">父号id</el-checkbox> -->
|
||||
<el-checkbox label="fatherManageTags">父亲耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="bsMotherId">母号id</el-checkbox> -->
|
||||
<el-checkbox label="motherManageTags">母亲耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="receptorId">受体id</el-checkbox> -->
|
||||
<el-checkbox label="receptorManageTags">受体耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="fatherFatherId">祖父号id</el-checkbox> -->
|
||||
<el-checkbox label="grandfatherManageTags">祖父耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="fatherMotherId">祖母号id</el-checkbox> -->
|
||||
<el-checkbox label="grandmotherManageTags">祖母耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="fatherId">外祖父号id</el-checkbox> -->
|
||||
<el-checkbox label="maternalGrandfatherManageTags">外祖父耳号</el-checkbox>
|
||||
<!-- <el-checkbox label="motherId">外祖母号id</el-checkbox> -->
|
||||
<el-checkbox label="maternalGrandmotherManageTags">外祖母耳号</el-checkbox>
|
||||
<el-checkbox label="matingDate">配种日期</el-checkbox>
|
||||
<el-checkbox label="matingTypeId">配种类型</el-checkbox>
|
||||
<el-checkbox label="pregDate">孕检日期</el-checkbox>
|
||||
@ -972,7 +972,7 @@
|
||||
<el-checkbox label="breast">乳房评分</el-checkbox>
|
||||
<el-checkbox label="source">入群来源</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="updateBy">修改人</el-checkbox>
|
||||
<el-checkbox label="updateTime">修改日期</el-checkbox>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user