Merge branch 'main' of http://118.182.97.76:3000/admin/zhyc-sheep-ui
This commit is contained in:
@@ -146,9 +146,16 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
|
||||
<!-- 已选耳号 -->
|
||||
<el-form-item label="已选耳号">
|
||||
<el-form-item v-if="selectedSheepList.length > 0" label="">
|
||||
<p style="font-size: 12px; color: #999; margin: 5px 0 0 0; width: 100%; display: block;">
|
||||
羊只总数:{{ selectedSheepList.length }}
|
||||
<el-button link type="danger" size="small" @click="clearAllSheep"
|
||||
style="margin-left: 10px;">
|
||||
清空全部
|
||||
</el-button>
|
||||
</p>
|
||||
<el-tag v-for="(tag, idx) in selectedSheepList" :key="tag.sheepId" closable @close="removeSheep(idx)"
|
||||
style="margin-right: 6px">
|
||||
{{ tag.sheepNo }}
|
||||
@@ -621,27 +628,60 @@
|
||||
})
|
||||
}
|
||||
|
||||
function clearAllSheep() {
|
||||
proxy.$modal.confirm('确认清空所有已选羊只?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
selectedSheepList.value = []
|
||||
proxy.$modal.msgSuccess('已清空全部羊只')
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
function validateSheep() {
|
||||
const no = sheepInput.value.trim()
|
||||
if (!no) return
|
||||
|
||||
// 检查是否已选择
|
||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||
proxy.$modal.msgWarning('该耳号已存在')
|
||||
sheepInput.value = ''
|
||||
return
|
||||
}
|
||||
request.get(`/sheep_file/sheep_file/byNo/${no}`).then(res => {
|
||||
if (!res.data) {
|
||||
proxy.$modal.msgError('羊只耳号不存在')
|
||||
} else {
|
||||
selectedSheepList.value.push({
|
||||
sheepNo: res.data.sheepNo || res.data.bsManageTags,
|
||||
sheepId: res.data.id
|
||||
|
||||
request.get(`/sheep/sheep/byManageTags/${no}`).then(res => {
|
||||
// 有未查询到的耳号,弹窗显示
|
||||
if (res.data?.notInHerd?.length > 0) {
|
||||
const notFoundEars = res.data.notInHerd.join(' ')
|
||||
proxy.$modal.msgWarning(`以下耳号未查询到:${notFoundEars} 请检查后重新输入`)
|
||||
}
|
||||
|
||||
// 处理查询到的耳号
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
res.data.inHerd.forEach(earNum => {
|
||||
// 检查是否已存在
|
||||
if (!selectedSheepList.value.some(s => s.sheepNo === earNum)) {
|
||||
const sheep = res.data.sheepDetails.find(s => s.manageTags === earNum)
|
||||
if (sheep) {
|
||||
selectedSheepList.value.push({
|
||||
sheepId: sheep.id,
|
||||
sheepNo: sheep.manageTags
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
sheepInput.value = ''
|
||||
|
||||
// 只要 inHerd 有数据就清空输入框
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
sheepInput.value = ''
|
||||
}
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function removeSheep(index) {
|
||||
selectedSheepList.value.splice(index, 1)
|
||||
}
|
||||
|
||||
@@ -152,8 +152,14 @@
|
||||
</el-row>
|
||||
|
||||
|
||||
<!-- 已选耳号 -->
|
||||
<el-form-item label="已选耳号">
|
||||
<!-- 已选耳号 -->
|
||||
<el-form-item v-if="selectedSheepList.length > 0" label="">
|
||||
<p style="font-size: 12px; color: #999; margin: 5px 0 0 0; width: 100%; display: block;">
|
||||
羊只总数:{{ selectedSheepList.length }}
|
||||
<el-button link type="danger" size="small" @click="clearAllSheep" style="margin-left: 10px;">
|
||||
清空全部
|
||||
</el-button>
|
||||
</p>
|
||||
<el-tag v-for="(tag, idx) in selectedSheepList" :key="tag.sheepId" closable @close="removeSheep(idx)"
|
||||
style="margin-right: 6px">
|
||||
{{ tag.sheepNo }}
|
||||
@@ -654,24 +660,57 @@ function handleBarnChange(barnIds) {
|
||||
})
|
||||
}
|
||||
|
||||
function clearAllSheep() {
|
||||
proxy.$modal.confirm('确认清空所有已选羊只?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
selectedSheepList.value = []
|
||||
proxy.$modal.msgSuccess('已清空全部羊只')
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
function validateSheep() {
|
||||
const no = sheepInput.value.trim()
|
||||
if (!no) return
|
||||
|
||||
// 检查是否已选择
|
||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||
proxy.$modal.msgWarning('该耳号已存在')
|
||||
sheepInput.value = ''
|
||||
return
|
||||
}
|
||||
request.get(`/sheep_file/sheep_file/byNo/${no}`).then(res => {
|
||||
if (!res.data) {
|
||||
proxy.$modal.msgError('羊只耳号不存在')
|
||||
} else {
|
||||
selectedSheepList.value.push({
|
||||
sheepNo: res.data.sheepNo || res.data.bsManageTags,
|
||||
sheepId: res.data.id
|
||||
|
||||
request.get(`/sheep/sheep/byManageTags/${no}`).then(res => {
|
||||
// 有未查询到的耳号,弹窗显示
|
||||
if (res.data?.notInHerd?.length > 0) {
|
||||
const notFoundEars = res.data.notInHerd.join(' ')
|
||||
proxy.$modal.msgWarning(`以下耳号未查询到:${notFoundEars} 请检查后重新输入`)
|
||||
}
|
||||
|
||||
// 处理查询到的耳号
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
res.data.inHerd.forEach(earNum => {
|
||||
// 检查是否已存在
|
||||
if (!selectedSheepList.value.some(s => s.sheepNo === earNum)) {
|
||||
const sheep = res.data.sheepDetails.find(s => s.manageTags === earNum)
|
||||
if (sheep) {
|
||||
selectedSheepList.value.push({
|
||||
sheepId: sheep.id,
|
||||
sheepNo: sheep.manageTags
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
sheepInput.value = ''
|
||||
|
||||
// 只要 inHerd 有数据就清空输入框
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
sheepInput.value = ''
|
||||
}
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -149,8 +149,14 @@
|
||||
</el-row>
|
||||
|
||||
|
||||
<!-- 已选耳号 -->
|
||||
<el-form-item label="已选耳号">
|
||||
<!-- 已选耳号 -->
|
||||
<el-form-item v-if="selectedSheepList.length > 0" label="">
|
||||
<p style="font-size: 12px; color: #999; margin: 5px 0 0 0; width: 100%; display: block;">
|
||||
羊只总数:{{ selectedSheepList.length }}
|
||||
<el-button link type="danger" size="small" @click="clearAllSheep" style="margin-left: 10px;">
|
||||
清空全部
|
||||
</el-button>
|
||||
</p>
|
||||
<el-tag v-for="(tag, idx) in selectedSheepList" :key="tag.sheepId" closable @close="removeSheep(idx)"
|
||||
style="margin-right: 6px">
|
||||
{{ tag.sheepNo }}
|
||||
@@ -651,27 +657,59 @@ function handleBarnChange(barnIds) {
|
||||
})
|
||||
}
|
||||
|
||||
function clearAllSheep() {
|
||||
proxy.$modal.confirm('确认清空所有已选羊只?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
selectedSheepList.value = []
|
||||
proxy.$modal.msgSuccess('已清空全部羊只')
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
function validateSheep() {
|
||||
const no = sheepInput.value.trim()
|
||||
if (!no) return
|
||||
|
||||
// 检查是否已选择
|
||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||
proxy.$modal.msgWarning('该耳号已存在')
|
||||
sheepInput.value = ''
|
||||
return
|
||||
}
|
||||
request.get(`/sheep_file/sheep_file/byNo/${no}`).then(res => {
|
||||
if (!res.data) {
|
||||
proxy.$modal.msgError('羊只耳号不存在')
|
||||
} else {
|
||||
selectedSheepList.value.push({
|
||||
sheepNo: res.data.sheepNo || res.data.bsManageTags,
|
||||
sheepId: res.data.id
|
||||
|
||||
request.get(`/sheep/sheep/byManageTags/${no}`).then(res => {
|
||||
// 有未查询到的耳号,弹窗显示
|
||||
if (res.data?.notInHerd?.length > 0) {
|
||||
const notFoundEars = res.data.notInHerd.join(' ')
|
||||
proxy.$modal.msgWarning(`以下耳号未查询到:${notFoundEars} 请检查后重新输入`)
|
||||
}
|
||||
|
||||
// 处理查询到的耳号
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
res.data.inHerd.forEach(earNum => {
|
||||
// 检查是否已存在
|
||||
if (!selectedSheepList.value.some(s => s.sheepNo === earNum)) {
|
||||
const sheep = res.data.sheepDetails.find(s => s.manageTags === earNum)
|
||||
if (sheep) {
|
||||
selectedSheepList.value.push({
|
||||
sheepId: sheep.id,
|
||||
sheepNo: sheep.manageTags
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
sheepInput.value = ''
|
||||
|
||||
// 只要 inHerd 有数据就清空输入框
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
sheepInput.value = ''
|
||||
}
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||
})
|
||||
}
|
||||
|
||||
function removeSheep(index) {
|
||||
selectedSheepList.value.splice(index, 1)
|
||||
}
|
||||
|
||||
@@ -2,68 +2,8 @@
|
||||
<div class="app-container">
|
||||
<!-- 查询表单 -->
|
||||
<el-form :model="queryParams" ref="queryRef" inline v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="羊只耳号" prop="allEarNumbers">
|
||||
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
|
||||
<!-- 主选择器:不显示已选标签 -->
|
||||
<el-select v-model="queryParams.allEarNumbers" multiple filterable remote reserve-keyword
|
||||
placeholder="输入耳号搜索" :remote-method="searchEarNumber" :loading="earNumberLoading" allow-create
|
||||
default-first-option collapse-tags :max-collapse-tags="0" style="width: 300px"
|
||||
@change="handleEarNumberChange">
|
||||
<el-option v-for="item in earNumberOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
|
||||
|
||||
<!-- 辅助粘贴输入框 -->
|
||||
<el-input v-model="pasteInput" placeholder="或粘贴多个耳号(空格/换行/逗号分隔)" style="width: 300px" @paste="handlePaste"
|
||||
@keyup.enter="handlePasteSubmit" clearable>
|
||||
<template #append>
|
||||
<el-button @click="handlePasteSubmit" :icon="Plus">添加</el-button>
|
||||
|
||||
</template>
|
||||
|
||||
</el-input>
|
||||
|
||||
|
||||
<!-- 耳号计数显示 -->
|
||||
<el-tag v-if="queryParams.allEarNumbers && queryParams.allEarNumbers.length > 0" type="info" effect="plain"
|
||||
size="large">
|
||||
已选: {{ queryParams.allEarNumbers.length }} 个
|
||||
</el-tag>
|
||||
|
||||
|
||||
<!-- 清空按钮 -->
|
||||
<el-button type="danger" plain @click="clearAllEarNumbers"
|
||||
v-if="queryParams.allEarNumbers && queryParams.allEarNumbers.length > 0" :icon="Delete">
|
||||
清空全部
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 已选耳号展示区域(默认显示2个,可展开) -->
|
||||
<div v-if="queryParams.allEarNumbers && queryParams.allEarNumbers.length > 0"
|
||||
class="selected-ear-numbers-display" style="margin-top: 10px;">
|
||||
<!-- 显示前2个或全部耳号 -->
|
||||
<el-tag v-for="(tag, index) in displayedEarNumbers" :key="tag" closable @close="handleRemoveEarNumber(tag)"
|
||||
style="margin: 4px;" type="success">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
|
||||
|
||||
<!-- 展开/收起按钮 -->
|
||||
<el-button v-if="queryParams.allEarNumbers.length > defaultShowCount" type="primary" link
|
||||
@click="toggleExpand" style="margin-left: 8px;">
|
||||
{{ isExpanded ? '收起' : `展开剩余 ${queryParams.allEarNumbers.length - defaultShowCount} 个` }}
|
||||
<el-icon class="el-icon--right">
|
||||
<component :is="isExpanded ? ArrowUp : ArrowDown" />
|
||||
</el-icon>
|
||||
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用空格分隔" clearable @keyup.enter="getList" />
|
||||
</el-form-item> -->
|
||||
@@ -71,6 +11,77 @@
|
||||
<el-date-picker v-model="daterangeDatetime" type="daterange" range-separator="-" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊只耳号" prop="allEarNumbers">
|
||||
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
|
||||
<!-- 主选择器:不显示已选标签 -->
|
||||
<el-select v-model="queryParams.allEarNumbers" multiple filterable remote reserve-keyword placeholder="输入耳号搜索"
|
||||
:remote-method="searchEarNumber" :loading="earNumberLoading" allow-create default-first-option collapse-tags
|
||||
:max-collapse-tags="0" style="width: 300px" @change="handleEarNumberChange">
|
||||
<el-option v-for="item in earNumberOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
|
||||
|
||||
<!-- 辅助粘贴输入框 -->
|
||||
<el-input v-model="pasteInput" placeholder="或粘贴多个耳号(空格/换行/逗号分隔)" style="width: 300px" @paste="handlePaste"
|
||||
@keyup.enter="handlePasteSubmit" clearable>
|
||||
<template #append>
|
||||
<el-button @click="handlePasteSubmit" :icon="Plus">添加</el-button>
|
||||
|
||||
</template>
|
||||
|
||||
</el-input>
|
||||
|
||||
|
||||
<!-- 耳号计数显示 -->
|
||||
<el-tag v-if="queryParams.allEarNumbers && queryParams.allEarNumbers.length > 0" type="info" effect="plain"
|
||||
size="large">
|
||||
已选: {{ queryParams.allEarNumbers.length }} 个
|
||||
</el-tag>
|
||||
|
||||
|
||||
<!-- 清空按钮 -->
|
||||
<el-button type="danger" plain @click="clearAllEarNumbers"
|
||||
v-if="queryParams.allEarNumbers && queryParams.allEarNumbers.length > 0" :icon="Delete">
|
||||
清空全部
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 已选耳号展示区域(默认显示2个,可展开) -->
|
||||
<div v-if="queryParams.allEarNumbers && queryParams.allEarNumbers.length > 0"
|
||||
class="selected-ear-numbers-display" style="margin-top: 10px;">
|
||||
<!-- 显示前2个或全部耳号 -->
|
||||
<el-tag v-for="(tag, index) in displayedEarNumbers" :key="tag" closable @close="handleRemoveEarNumber(tag)"
|
||||
style="margin: 4px;" type="success">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
|
||||
|
||||
<!-- 展开/收起按钮 -->
|
||||
<el-button v-if="queryParams.allEarNumbers.length > defaultShowCount" type="primary" link
|
||||
@click="toggleExpand" style="margin-left: 8px;">
|
||||
{{ isExpanded ? '收起' : `展开剩余 ${queryParams.allEarNumbers.length - defaultShowCount} 个` }}
|
||||
<el-icon class="el-icon--right">
|
||||
<component :is="isExpanded ? ArrowUp : ArrowDown" />
|
||||
</el-icon>
|
||||
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="羊只类型" prop="sheepType">
|
||||
<el-select v-model="queryParams.sheepType" placeholder="请选择" filterable clearable style="width: 150px">
|
||||
<el-option v-for="i in sheepTypes" :key="i.value" :label="i.makeLabelFormatter" :value="i.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="样品类型" prop="sampleType">
|
||||
<el-select v-model="queryParams.sampleType" placeholder="请选择" filterable clearable style="width: 150px">
|
||||
<el-option v-for="i in sampleTypes" :key="i.value" :label="i.label" :value="i.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="检疫项目" prop="quarItem">
|
||||
<el-select v-model="queryParams.quarItem" placeholder="请选择" filterable clearable style="width: 150px">
|
||||
@@ -97,18 +108,6 @@
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="羊只类型" prop="sheepType">
|
||||
<el-select v-model="queryParams.sheepType" placeholder="请选择" filterable clearable style="width: 150px">
|
||||
<el-option v-for="i in sheepTypes" :key="i.value" :label="i.makeLabelFormatter" :value="i.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="样品类型" prop="sampleType">
|
||||
<el-select v-model="queryParams.sampleType" placeholder="请选择" filterable clearable style="width: 150px">
|
||||
<el-option v-for="i in sampleTypes" :key="i.value" :label="i.label" :value="i.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="getList">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
@@ -134,6 +133,9 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
<el-table-column label="羊只耳号" align="center" prop="sheepNo" />
|
||||
<el-table-column label="品种" align="center" prop="variety" />
|
||||
<el-table-column label="检疫日期" align="center" prop="datetime" width="180"
|
||||
:formatter="(_, __, v) => parseTime(v, '{y}-{m}-{d}')" />
|
||||
<el-table-column label="羊只性别" align="center" prop="gender">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sheep_gender" :value="scope.row.gender" />
|
||||
@@ -142,8 +144,7 @@
|
||||
<el-table-column label="羊只类别" align="center" prop="sheepType" />
|
||||
<el-table-column label="月龄" align="center" prop="monthAge" sortable="custom" />
|
||||
<el-table-column label="繁育状态" align="center" prop="breed" />
|
||||
<el-table-column label="检疫日期" align="center" prop="datetime" width="180"
|
||||
:formatter="(_, __, v) => parseTime(v, '{y}-{m}-{d}')" />
|
||||
|
||||
<el-table-column label="检疫项目" align="center" prop="itemName" />
|
||||
<el-table-column label="样品类型" align="center" prop="sample" />
|
||||
<el-table-column label="采样员" align="center" prop="sampler" />
|
||||
@@ -193,9 +194,15 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
<p style="font-size: 12px; color: #999; margin: 5px 0 0 0; width: 100%; display: block;">
|
||||
羊只总数:{{ addForm.sheepList.length }}
|
||||
<el-button v-if="addForm.sheepList.length > 0" link type="danger" size="small" @click="clearAllSheep"
|
||||
style="margin-left: 10px;">
|
||||
清空全部
|
||||
</el-button>
|
||||
</p>
|
||||
<el-tag v-for="(item, i) in addForm.sheepList" :key="item.id" closable @close="addForm.sheepList.splice(i, 1)"
|
||||
style="margin: 5px 5px 0 0">
|
||||
style="margin: 0px 5px 0 0">
|
||||
{{ item.ear }}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
@@ -291,6 +298,11 @@
|
||||
<span>{{ editForm.sheepNo }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="羊只品种">
|
||||
<span>{{ editForm.variety }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="羊只性别">
|
||||
<dict-tag :options="sheep_gender" :value="editForm.gender" />
|
||||
@@ -718,6 +730,17 @@ function handleBarnChange(selectedBarnIds) {
|
||||
}
|
||||
})
|
||||
}
|
||||
function clearAllSheep() {
|
||||
proxy.$modal.confirm('确认清空所有已选羊只?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
addForm.value.sheepList = []
|
||||
validSheepId.value = false
|
||||
proxy.$modal.msgSuccess('已清空全部羊只')
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
function validateSheepId() {
|
||||
const ear = addForm.value.sheepIdInput.trim()
|
||||
@@ -727,6 +750,7 @@ function validateSheepId() {
|
||||
validSheepId.value = false
|
||||
alreadySelected.value = false
|
||||
|
||||
// 检查是否已选择
|
||||
if (addForm.value.sheepList.some(s => s.ear === ear)) {
|
||||
alreadySelected.value = true
|
||||
addForm.value.sheepIdInput = ''
|
||||
@@ -734,17 +758,42 @@ function validateSheepId() {
|
||||
}
|
||||
|
||||
request.get(`/sheep/sheep/byManageTags/${ear}`).then(res => {
|
||||
if (res.data) {
|
||||
addForm.value.sheepList.push({ id: res.data.id, ear })
|
||||
validSheepId.value = true
|
||||
} else {
|
||||
invalidSheepId.value = true
|
||||
// 有未查询到的耳号,弹窗显示
|
||||
if (res.data?.notInHerd?.length > 0) {
|
||||
const notFoundEars = res.data.notInHerd.join(' ')
|
||||
proxy.$modal.msgWarning(`以下耳号未查询到:${notFoundEars} 请检查后重新输入` )
|
||||
}
|
||||
addForm.value.sheepIdInput = ''
|
||||
|
||||
// 处理查询到的耳号
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
res.data.inHerd.forEach(earNum => {
|
||||
// 检查是否已存在
|
||||
if (!addForm.value.sheepList.some(s => s.ear === earNum)) {
|
||||
const sheep = res.data.sheepDetails.find(s => s.manageTags === earNum)
|
||||
if (sheep) {
|
||||
addForm.value.sheepList.push({
|
||||
id: sheep.id,
|
||||
ear: sheep.manageTags
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
validSheepId.value = true
|
||||
}
|
||||
|
||||
// 只要 inHerd 有数据就清空输入框
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
addForm.value.sheepIdInput = ''
|
||||
}
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||
})
|
||||
}
|
||||
|
||||
function submitAddForm() {
|
||||
if (addForm.value.sheepList.length === 0) {
|
||||
return proxy.$modal.msgError('请至少添加一个耳号')
|
||||
}
|
||||
addForm.value.ids = addForm.value.sheepList.map(s => s.id)
|
||||
addQuarantine(addForm.value).then(() => {
|
||||
proxy.$modal.msgSuccess('新增成功')
|
||||
@@ -832,7 +881,7 @@ getItems()
|
||||
getSample()
|
||||
getBarns()
|
||||
getSheepType()
|
||||
getTechnicalList()
|
||||
fetchTechnicalList()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -163,12 +163,20 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<div style="margin-bottom: 10px;margin-left: 60px;">
|
||||
<el-tag v-for="(item, index) in selectedSheepList" :key="item.sheepNo" closable
|
||||
@close="removeSheep(index)" style="margin-right: 10px">
|
||||
{{ item.sheepNo }}({{ item.barnName }})
|
||||
</el-tag>
|
||||
</div>
|
||||
<!-- 已选耳号 -->
|
||||
<el-form-item v-if="selectedSheepList.length > 0" label="">
|
||||
<p style="font-size: 12px; color: #999; width: 100%; display: block;">
|
||||
羊只总数:{{ selectedSheepList.length }}
|
||||
<el-button link type="danger" size="small" @click="clearAllSheep" style="margin-left: 10px;">
|
||||
清空全部
|
||||
</el-button>
|
||||
</p>
|
||||
<el-tag v-for="(tag, idx) in selectedSheepList" :key="tag.sheepId" closable @close="removeSheep(idx)"
|
||||
style="margin-right: 6px">
|
||||
{{ tag.sheepNo }}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@@ -198,7 +206,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="疾病子类型" prop="diseaseId">
|
||||
<el-form-item label="疾病子类" prop="diseaseId">
|
||||
<el-select v-model="addForm.diseaseId" :disabled="!addForm.diseasePid" placeholder="请选择"
|
||||
style="width: 100%">
|
||||
<el-option v-for="item in childDiseaseOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||
@@ -382,7 +390,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="疾病子类型" prop="diseaseId">
|
||||
<el-form-item label="疾病子类" prop="diseaseId">
|
||||
<el-select v-model="editForm.diseaseId" :disabled="!editForm.diseasePid" placeholder="请选择"
|
||||
style="width: 100%">
|
||||
<el-option v-for="item in childDiseaseOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||
@@ -869,23 +877,57 @@ function deletePresDetail(row) {
|
||||
swPresDetailList.value.splice(swPresDetailList.value.indexOf(row), 1)
|
||||
}
|
||||
|
||||
/* ---------- 羊只验证 ---------- */
|
||||
function clearAllSheep() {
|
||||
proxy.$modal.confirm('确认清空所有已选羊只?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
selectedSheepList.value = []
|
||||
proxy.$modal.msgSuccess('已清空全部羊只')
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
function validateSheep() {
|
||||
const no = sheepInput.value.trim()
|
||||
if (!no) return
|
||||
request.get(`/sheep_file/sheep_file/byNo/${no}`).then(res => {
|
||||
if (!res.data) {
|
||||
proxy.$modal.msgError('羊只耳号不存在'); return
|
||||
}
|
||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||
proxy.$modal.msgWarning('该羊只已添加'); return
|
||||
}
|
||||
selectedSheepList.value.push({
|
||||
sheepNo: res.data.bsManageTags,
|
||||
sheepId: res.data.id,
|
||||
barnName: res.data.sheepfoldName
|
||||
})
|
||||
|
||||
// 检查是否已选择
|
||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||
proxy.$modal.msgWarning('该耳号已存在')
|
||||
sheepInput.value = ''
|
||||
return
|
||||
}
|
||||
|
||||
request.get(`/sheep/sheep/byManageTags/${no}`).then(res => {
|
||||
// 有未查询到的耳号,弹窗显示
|
||||
if (res.data?.notInHerd?.length > 0) {
|
||||
const notFoundEars = res.data.notInHerd.join(' ')
|
||||
proxy.$modal.msgWarning(`以下耳号未查询到:${notFoundEars} 请检查后重新输入`)
|
||||
}
|
||||
|
||||
// 处理查询到的耳号
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
res.data.inHerd.forEach(earNum => {
|
||||
// 检查是否已存在
|
||||
if (!selectedSheepList.value.some(s => s.sheepNo === earNum)) {
|
||||
const sheep = res.data.sheepDetails.find(s => s.manageTags === earNum)
|
||||
if (sheep) {
|
||||
selectedSheepList.value.push({
|
||||
sheepId: sheep.id,
|
||||
sheepNo: sheep.manageTags
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 只要 inHerd 有数据就清空输入框
|
||||
if (res.data?.inHerd?.length > 0) {
|
||||
sheepInput.value = ''
|
||||
}
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||
})
|
||||
}
|
||||
function removeSheep(index) {
|
||||
|
||||
@@ -1,46 +1,156 @@
|
||||
<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-input
|
||||
v-model="queryParams.id"
|
||||
placeholder="请输入羊只id"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="耳号" prop="bsManageTags">
|
||||
<el-input
|
||||
v-model="queryParams.bsManageTags"
|
||||
placeholder="请输入耳号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="电子耳号" prop="electronicTags">
|
||||
<el-input
|
||||
v-model="queryParams.electronicTags"
|
||||
placeholder="请输入电子耳号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="牧场名称" prop="drRanch" style="width: 100%">
|
||||
<el-select
|
||||
v-model="queryParams.drRanch"
|
||||
placeholder="请选择牧场"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in da_ranch"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="耳号" prop="allEarNumbers" style="width: 100%">
|
||||
<el-select
|
||||
v-model="queryParams.allEarNumbers"
|
||||
multiple
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入耳号搜索"
|
||||
:remote-method="searchEarMethod"
|
||||
:loading="loadingEar"
|
||||
collapse-tags
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in earOptions"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="电子耳号" prop="allEleEarNumbers" style="width: 100%">
|
||||
<el-select
|
||||
v-model="queryParams.allEleEarNumbers"
|
||||
multiple
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
collapse-tags
|
||||
placeholder="输入号码"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="性别" prop="allGenders" style="width: 100%">
|
||||
<el-select
|
||||
v-model="queryParams.allGenders"
|
||||
multiple
|
||||
collapse-tags
|
||||
placeholder="请选择性别"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in sheep_gender"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="是否在群" prop="statusId" style="width: 100%">
|
||||
<el-radio-group v-model="queryParams.statusId">
|
||||
<el-radio :label="1">是</el-radio>
|
||||
<el-radio :label="0">否</el-radio>
|
||||
<el-radio :label="null">全部</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="繁殖状态" prop="allBreedingStatus" style="width: 100%">
|
||||
<el-select
|
||||
v-model="queryParams.allBreedingStatus"
|
||||
multiple
|
||||
collapse-tags
|
||||
placeholder="请选择繁殖状态"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in breedOptions"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="羊只类型" prop="allSheepTypes" style="width: 100%">
|
||||
<el-select
|
||||
v-model="queryParams.allSheepTypes"
|
||||
multiple
|
||||
collapse-tags
|
||||
placeholder="请选择类型"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item style="margin-left: 10px;">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<!-- 新增:自定义筛选按钮 -->
|
||||
<el-button type="info" plain icon="Setting" @click="openColumnDialog">显示列</el-button>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="1.5">
|
||||
<CustomFilter ref="customFilterRef" @filter="handleCustomFilter" />
|
||||
<span v-if="isCustomFilterActive" style="color: #67c23a; margin-left: 5px;">
|
||||
<i class="el-icon-success"></i> 筛选条件已激活
|
||||
</span>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
@@ -63,7 +173,6 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 新增:显示已应用的筛选条件 -->
|
||||
<div v-if="appliedFilters.length > 0" class="applied-filters mb8">
|
||||
<div class="filter-title">已应用筛选条件:</div>
|
||||
<el-tag
|
||||
@@ -81,10 +190,6 @@
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 10px;">
|
||||
<el-button type="info" plain icon="Setting" @click="openColumnDialog">显示列</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="sheep_fileList"
|
||||
@@ -93,44 +198,6 @@
|
||||
border
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column
|
||||
v-if="columns['id'].visible"
|
||||
label="羊只id"
|
||||
align="center"
|
||||
prop="id"
|
||||
width="120"
|
||||
fixed="left"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊只id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['bsManageTags'].visible"
|
||||
label="耳号"
|
||||
align="center"
|
||||
prop="bsManageTags"
|
||||
width="120"
|
||||
fixed="left"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['ranchId'].visible"
|
||||
label="牧场id"
|
||||
align="center"
|
||||
prop="ranchId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">牧场id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['drRanch'].visible"
|
||||
label="牧场名称"
|
||||
@@ -143,35 +210,17 @@
|
||||
<span style="font-weight: bold; color: #333;">牧场名称</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['sheepfoldId'].visible"
|
||||
label="羊舍id"
|
||||
align="center"
|
||||
prop="sheepfoldId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊舍id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['sheepfoldName'].visible"
|
||||
label="羊舍名称"
|
||||
v-if="columns['bsManageTags'].visible"
|
||||
label="耳号"
|
||||
align="center"
|
||||
prop="sheepfoldName"
|
||||
prop="bsManageTags"
|
||||
width="120"
|
||||
fixed="left"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊舍名称</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-tooltip :content="scope.row.sheepfoldName" placement="top">
|
||||
<span style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
||||
{{ scope.row.sheepfoldName }}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<span style="font-weight: bold; color: #333;">耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -193,18 +242,72 @@
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['varietyId'].visible"
|
||||
label="品种id"
|
||||
<el-table-column
|
||||
v-if="columns['gender'].visible"
|
||||
label="性别"
|
||||
align="center"
|
||||
prop="varietyId"
|
||||
prop="gender"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sheep_gender" :value="scope.row.gender"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="columns['statusId'].visible"
|
||||
label="羊只状态"
|
||||
align="center"
|
||||
prop="statusId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">品种id</span>
|
||||
<span style="font-weight: bold; color: #333;">羊只状态</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sheep_status" :value="scope.row.statusId"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="columns['breed'].visible"
|
||||
label="繁殖状态"
|
||||
align="center"
|
||||
prop="breed"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">繁殖状态</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['name'].visible"
|
||||
label="羊只类型"
|
||||
align="center"
|
||||
prop="name"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊只类型</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="columns['sheepfoldName'].visible"
|
||||
label="羊舍名称"
|
||||
align="center"
|
||||
prop="sheepfoldName"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊舍名称</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['variety'].visible"
|
||||
label="品种"
|
||||
@@ -229,33 +332,6 @@
|
||||
<span style="font-weight: bold; color: #333;">家系</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['name'].visible"
|
||||
label="羊只类型"
|
||||
align="center"
|
||||
prop="name"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊只类型</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['gender'].visible"
|
||||
label="性别"
|
||||
align="center"
|
||||
prop="gender"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<!-- <template #header>
|
||||
<span style="font-weight: bold; color: #333;">性别</span>
|
||||
</template> -->
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sheep_gender" :value="scope.row.gender"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['birthday'].visible"
|
||||
label="出生日期"
|
||||
@@ -358,8 +434,6 @@
|
||||
<span style="font-weight: bold; color: #333;">当前体重</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
v-if="columns['weaningDayAge'].visible"
|
||||
label="断奶日龄"
|
||||
@@ -372,7 +446,6 @@
|
||||
<span style="font-weight: bold; color: #333;">断奶日龄</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="columns['weaningDailyGain'].visible"
|
||||
label="断奶日增重"
|
||||
@@ -385,49 +458,6 @@
|
||||
<span style="font-weight: bold; color: #333;">断奶日增重</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <el-table-column
|
||||
v-if="columns['breedStatusId'].visible"
|
||||
label="繁育状态id"
|
||||
align="center"
|
||||
prop="breedStatusId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">繁育状态id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['breed'].visible"
|
||||
label="繁殖状态"
|
||||
align="center"
|
||||
prop="breed"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">繁殖状态</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['bsFatherId'].visible"
|
||||
label="父号id"
|
||||
align="center"
|
||||
prop="bsFatherId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">父号id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['fatherManageTags'].visible"
|
||||
label="父亲耳号"
|
||||
@@ -440,18 +470,6 @@
|
||||
<span style="font-weight: bold; color: #333;">父亲耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['bsMotherId'].visible"
|
||||
label="母号id"
|
||||
align="center"
|
||||
prop="bsMotherId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">母号id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['motherManageTags'].visible"
|
||||
label="母亲耳号"
|
||||
@@ -464,30 +482,6 @@
|
||||
<span style="font-weight: bold; color: #333;">母亲耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['receptorId'].visible"
|
||||
label="受体id"
|
||||
align="center"
|
||||
prop="receptorId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">受体id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column
|
||||
v-if="columns['fatherFatherId'].visible"
|
||||
label="祖父号id"
|
||||
align="center"
|
||||
prop="fatherFatherId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">祖父号id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['grandfatherManageTags'].visible"
|
||||
label="祖父耳号"
|
||||
@@ -500,18 +494,6 @@
|
||||
<span style="font-weight: bold; color: #333;">祖父耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['fatherMotherId'].visible"
|
||||
label="祖母号id"
|
||||
align="center"
|
||||
prop="fatherMotherId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">祖母号id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['grandmotherManageTags'].visible"
|
||||
label="祖母耳号"
|
||||
@@ -524,18 +506,6 @@
|
||||
<span style="font-weight: bold; color: #333;">祖母耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['fatherId'].visible"
|
||||
label="外祖父号id"
|
||||
align="center"
|
||||
prop="fatherId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">外祖父号id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['maternalGrandfatherManageTags'].visible"
|
||||
label="外祖父耳号"
|
||||
@@ -548,18 +518,6 @@
|
||||
<span style="font-weight: bold; color: #333;">外祖父耳号</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['motherId'].visible"
|
||||
label="外祖母号id"
|
||||
align="center"
|
||||
prop="motherId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">外祖母号id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['maternalGrandmotherManageTags'].visible"
|
||||
label="外祖母耳号"
|
||||
@@ -855,18 +813,6 @@
|
||||
<span>{{ parseTime(scope.row.sourceDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['sourceRanchId'].visible"
|
||||
label="来源牧场id"
|
||||
align="center"
|
||||
prop="sourceRanchId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">来源牧场id</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['sourceRanch'].visible"
|
||||
label="来源牧场"
|
||||
@@ -879,89 +825,6 @@
|
||||
<span style="font-weight: bold; color: #333;">来源牧场</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
v-if="columns['updateBy'].visible"
|
||||
label="修改人"
|
||||
align="center"
|
||||
prop="updateBy"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">修改人</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['updateTime'].visible"
|
||||
label="修改日期"
|
||||
align="center"
|
||||
prop="updateTime"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">修改日期</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['createBy'].visible"
|
||||
label="创建人"
|
||||
align="center"
|
||||
prop="createBy"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">创建人</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="columns['createTime'].visible"
|
||||
label="创建日期"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">创建日期</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
v-if="columns['statusId'].visible"
|
||||
label="羊只状态"
|
||||
align="center"
|
||||
prop="statusId"
|
||||
width="120"
|
||||
sortable
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">羊只状态</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sheep_status" :value="scope.row.statusId"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
fixed="right"
|
||||
width="120"
|
||||
>
|
||||
<template #header>
|
||||
<span style="font-weight: bold; color: #333;">操作</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['sheep_file:sheep_file:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
@@ -973,18 +836,13 @@
|
||||
:page-sizes="[20, 50, 100, 200, 500, 1000, 2000]"
|
||||
/>
|
||||
|
||||
<!-- 列显示设置对话框 -->
|
||||
<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-group v-model="selectedColumns" style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;" >
|
||||
<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="sheepfoldName">羊舍名称</el-checkbox>
|
||||
<el-checkbox label="electronicTags">电子耳号</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>
|
||||
@@ -996,23 +854,15 @@
|
||||
<el-checkbox label="birthWeight">出生体重</el-checkbox>
|
||||
<el-checkbox label="weaningDate">断奶日期</el-checkbox>
|
||||
<el-checkbox label="weaningWeight">断奶体重</el-checkbox>
|
||||
<el-checkbox label="currentWeight">当前体重</el-checkbox>\
|
||||
<el-checkbox label="currentWeight">当前体重</el-checkbox>
|
||||
<el-checkbox label="weaningDayAge">断奶日龄</el-checkbox>
|
||||
<el-checkbox label="weaningDailyGain">断奶日增重</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="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="receptorManageTags">受体耳号</el-checkbox>
|
||||
<el-checkbox label="matingDate">配种日期</el-checkbox>
|
||||
@@ -1035,12 +885,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="sourceRanch">来源牧场</el-checkbox>
|
||||
<!-- <el-checkbox label="updateBy">修改人</el-checkbox>
|
||||
<el-checkbox label="updateTime">修改日期</el-checkbox>
|
||||
<el-checkbox label="createBy">创建人</el-checkbox>
|
||||
<el-checkbox label="createTime">创建日期</el-checkbox> -->
|
||||
<el-checkbox label="statusId">羊只状态</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
@@ -1056,7 +901,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Sheep_file">
|
||||
import { listSheep_file, getSheep_file } from "@/api/fileManagement/sheep_file"
|
||||
import { listSheep_file, getSheep_file, delSheep_file, getFieldValues } from "@/api/fileManagement/sheep_file"
|
||||
import request from '@/utils/request'
|
||||
// 新增:引入自定义筛选组件
|
||||
import CustomFilter from '@/components/CustomFilter/index.vue'
|
||||
|
||||
@@ -1075,6 +921,7 @@ const { breed_type } = proxy.useDict('breed_type')
|
||||
const { controlled } = proxy.useDict('controlled')
|
||||
const { source } = proxy.useDict('source')
|
||||
const { sheep_status } = proxy.useDict('sheep_status')
|
||||
const { da_ranch } = proxy.useDict('da_ranch')
|
||||
const sheep_fileList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
@@ -1085,12 +932,16 @@ const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const columnDialogVisible = ref(false)
|
||||
// const selectedColumns = ref([
|
||||
// 'id', 'bsManageTags', 'ranchId', 'drRanch', 'sheepfoldId', 'sheepfoldName', 'electronicTags', 'varietyId', 'variety', 'family', 'name', 'gender', 'birthday', 'dayAge', 'monthAge', 'parity', 'birthWeight', 'weaningDate', 'statusId', 'weaningWeight', 'currentWeight','weaningDayAge', 'weaningDailyGain','breedStatusId', 'breed', 'bsFatherId', 'fatherManageTags', 'bsMotherId', 'motherManageTags', 'receptorId', 'receptorManageTags', 'fatherFatherId', 'grandfatherManageTags', 'fatherMotherId', 'grandmotherManageTags', 'fatherId', 'maternalGrandfatherManageTags', 'motherId', 'maternalGrandmotherManageTags', 'matingDate', 'matingTypeId', 'pregDate', 'lambingDate', 'lambingDay', 'matingDay', 'gestationDay', 'expectedDate', 'postLambingDay', 'lactationDay', 'anestrousDay', 'matingCounts', 'matingTotal', 'miscarriageCounts', 'comment', 'controlled', 'body', 'breast', 'source', 'sourceDate', 'sourceRanchId', 'sourceRanch', 'updateBy', 'updateTime', 'createBy', 'createTime'
|
||||
// ])
|
||||
|
||||
// 新增:下拉选项响应式数据
|
||||
const earOptions = ref([])
|
||||
const loadingEar = ref(false)
|
||||
const breedOptions = ref([])
|
||||
const typeOptions = ref([])
|
||||
|
||||
// 在 setup 中修改 selectedColumns 的默认值
|
||||
const selectedColumns = ref([
|
||||
'drRanch', // 牧场名称
|
||||
'bsManageTags', // 耳号
|
||||
'drRanch', // 牧场名称
|
||||
'sheepfoldName', // 羊舍名称
|
||||
@@ -1190,14 +1041,24 @@ const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// 多选参数
|
||||
allEarNumbers: [],
|
||||
allEleEarNumbers: [],
|
||||
allGenders: [],
|
||||
allBreedingStatus: [],
|
||||
allSheepTypes: [],
|
||||
|
||||
// 默认在群 (1)
|
||||
statusId: 1,
|
||||
|
||||
// 其他单值参数
|
||||
drRanch: null,
|
||||
id: null,
|
||||
bsManageTags: null,
|
||||
drRanch: null,
|
||||
electronicTags: null,
|
||||
variety: null,
|
||||
name: null,
|
||||
gender: null,
|
||||
statusId: null,
|
||||
breed: null,
|
||||
},
|
||||
rules: {
|
||||
@@ -1209,6 +1070,35 @@ const data = reactive({
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 初始化加载选项数据 */
|
||||
function initOptions() {
|
||||
getFieldValues('breed').then(res => { breedOptions.value = res.data || [] })
|
||||
getFieldValues('name').then(res => { typeOptions.value = res.data || [] })
|
||||
}
|
||||
|
||||
// 页面加载时初始化
|
||||
initOptions()
|
||||
|
||||
/** 耳号远程搜索方法 */
|
||||
function searchEarMethod(query) {
|
||||
if (query) {
|
||||
loadingEar.value = true
|
||||
request({
|
||||
url: '/sheep_file/sheep_file/searchEarNumbers',
|
||||
method: 'get',
|
||||
params: { query: query }
|
||||
}).then(res => {
|
||||
loadingEar.value = false
|
||||
earOptions.value = res.data || []
|
||||
}).catch(() => {
|
||||
loadingEar.value = false
|
||||
earOptions.value = []
|
||||
})
|
||||
} else {
|
||||
earOptions.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 修改 getList 函数,支持传入自定义参数
|
||||
function getList(queryParamOverride = null) {
|
||||
loading.value = true
|
||||
@@ -1330,6 +1220,16 @@ function handleQuery() {
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
|
||||
// 重置新增的多选字段
|
||||
queryParams.value.allEarNumbers = []
|
||||
queryParams.value.allEleEarNumbers = []
|
||||
queryParams.value.allGenders = []
|
||||
queryParams.value.allBreedingStatus = []
|
||||
queryParams.value.allSheepTypes = []
|
||||
|
||||
// 重置默认值
|
||||
queryParams.value.statusId = 1
|
||||
|
||||
// 清空自定义筛选条件
|
||||
customFilterParams.value = {}
|
||||
appliedFilters.value = []
|
||||
@@ -1436,10 +1336,6 @@ function resetColumnSettings() {
|
||||
'maternalGrandfatherManageTags',//外祖父
|
||||
'maternalGrandmotherManageTags',//外祖母
|
||||
'comment'//备注
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
updateColumnVisibility()
|
||||
localStorage.setItem('selectedColumns', JSON.stringify(selectedColumns.value))
|
||||
@@ -1448,10 +1344,6 @@ function resetColumnSettings() {
|
||||
/**
|
||||
* 处理自定义筛选
|
||||
*/
|
||||
/**
|
||||
* 处理自定义筛选
|
||||
*/
|
||||
//
|
||||
function handleCustomFilter(filterParams) {
|
||||
console.log('接收到筛选参数:', filterParams)
|
||||
|
||||
@@ -1533,7 +1425,6 @@ function getDictLabel(field, value) {
|
||||
/**
|
||||
* 移除单个筛选条件
|
||||
*/
|
||||
// 6. 修改 removeAppliedFilter 函数
|
||||
function removeAppliedFilter(index) {
|
||||
const filter = appliedFilters.value[index]
|
||||
|
||||
@@ -1553,7 +1444,6 @@ function removeAppliedFilter(index) {
|
||||
/**
|
||||
* 清除所有筛选条件
|
||||
*/
|
||||
// 7. 修改 clearAllFilters 函数
|
||||
function clearAllFilters() {
|
||||
customFilterParams.value = {}
|
||||
appliedFilters.value = []
|
||||
|
||||
Reference in New Issue
Block a user