生物安全模块批量新增修改
This commit is contained in:
@@ -148,7 +148,14 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- 已选耳号 -->
|
<!-- 已选耳号 -->
|
||||||
<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)"
|
<el-tag v-for="(tag, idx) in selectedSheepList" :key="tag.sheepId" closable @close="removeSheep(idx)"
|
||||||
style="margin-right: 6px">
|
style="margin-right: 6px">
|
||||||
{{ tag.sheepNo }}
|
{{ tag.sheepNo }}
|
||||||
@@ -621,24 +628,57 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearAllSheep() {
|
||||||
|
proxy.$modal.confirm('确认清空所有已选羊只?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
selectedSheepList.value = []
|
||||||
|
proxy.$modal.msgSuccess('已清空全部羊只')
|
||||||
|
}).catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
function validateSheep() {
|
function validateSheep() {
|
||||||
const no = sheepInput.value.trim()
|
const no = sheepInput.value.trim()
|
||||||
if (!no) return
|
if (!no) return
|
||||||
|
|
||||||
|
// 检查是否已选择
|
||||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||||
proxy.$modal.msgWarning('该耳号已存在')
|
proxy.$modal.msgWarning('该耳号已存在')
|
||||||
sheepInput.value = ''
|
sheepInput.value = ''
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
request.get(`/sheep_file/sheep_file/byNo/${no}`).then(res => {
|
|
||||||
if (!res.data) {
|
request.get(`/sheep/sheep/byManageTags/${no}`).then(res => {
|
||||||
proxy.$modal.msgError('羊只耳号不存在')
|
// 有未查询到的耳号,弹窗显示
|
||||||
} else {
|
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({
|
selectedSheepList.value.push({
|
||||||
sheepNo: res.data.sheepNo || res.data.bsManageTags,
|
sheepId: sheep.id,
|
||||||
sheepId: res.data.id
|
sheepNo: sheep.manageTags
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只要 inHerd 有数据就清空输入框
|
||||||
|
if (res.data?.inHerd?.length > 0) {
|
||||||
sheepInput.value = ''
|
sheepInput.value = ''
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,13 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- 已选耳号 -->
|
<!-- 已选耳号 -->
|
||||||
<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)"
|
<el-tag v-for="(tag, idx) in selectedSheepList" :key="tag.sheepId" closable @close="removeSheep(idx)"
|
||||||
style="margin-right: 6px">
|
style="margin-right: 6px">
|
||||||
{{ tag.sheepNo }}
|
{{ 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() {
|
function validateSheep() {
|
||||||
const no = sheepInput.value.trim()
|
const no = sheepInput.value.trim()
|
||||||
if (!no) return
|
if (!no) return
|
||||||
|
|
||||||
|
// 检查是否已选择
|
||||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||||
proxy.$modal.msgWarning('该耳号已存在')
|
proxy.$modal.msgWarning('该耳号已存在')
|
||||||
sheepInput.value = ''
|
sheepInput.value = ''
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
request.get(`/sheep_file/sheep_file/byNo/${no}`).then(res => {
|
|
||||||
if (!res.data) {
|
request.get(`/sheep/sheep/byManageTags/${no}`).then(res => {
|
||||||
proxy.$modal.msgError('羊只耳号不存在')
|
// 有未查询到的耳号,弹窗显示
|
||||||
} else {
|
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({
|
selectedSheepList.value.push({
|
||||||
sheepNo: res.data.sheepNo || res.data.bsManageTags,
|
sheepId: sheep.id,
|
||||||
sheepId: res.data.id
|
sheepNo: sheep.manageTags
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只要 inHerd 有数据就清空输入框
|
||||||
|
if (res.data?.inHerd?.length > 0) {
|
||||||
sheepInput.value = ''
|
sheepInput.value = ''
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,13 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- 已选耳号 -->
|
<!-- 已选耳号 -->
|
||||||
<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)"
|
<el-tag v-for="(tag, idx) in selectedSheepList" :key="tag.sheepId" closable @close="removeSheep(idx)"
|
||||||
style="margin-right: 6px">
|
style="margin-right: 6px">
|
||||||
{{ tag.sheepNo }}
|
{{ 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() {
|
function validateSheep() {
|
||||||
const no = sheepInput.value.trim()
|
const no = sheepInput.value.trim()
|
||||||
if (!no) return
|
if (!no) return
|
||||||
|
|
||||||
|
// 检查是否已选择
|
||||||
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||||
proxy.$modal.msgWarning('该耳号已存在')
|
proxy.$modal.msgWarning('该耳号已存在')
|
||||||
sheepInput.value = ''
|
sheepInput.value = ''
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
request.get(`/sheep_file/sheep_file/byNo/${no}`).then(res => {
|
|
||||||
if (!res.data) {
|
request.get(`/sheep/sheep/byManageTags/${no}`).then(res => {
|
||||||
proxy.$modal.msgError('羊只耳号不存在')
|
// 有未查询到的耳号,弹窗显示
|
||||||
} else {
|
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({
|
selectedSheepList.value.push({
|
||||||
sheepNo: res.data.sheepNo || res.data.bsManageTags,
|
sheepId: sheep.id,
|
||||||
sheepId: res.data.id
|
sheepNo: sheep.manageTags
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
sheepInput.value = ''
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 只要 inHerd 有数据就清空输入框
|
||||||
|
if (res.data?.inHerd?.length > 0) {
|
||||||
|
sheepInput.value = ''
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||||
|
})
|
||||||
|
}
|
||||||
function removeSheep(index) {
|
function removeSheep(index) {
|
||||||
selectedSheepList.value.splice(index, 1)
|
selectedSheepList.value.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,21 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 查询表单 -->
|
<!-- 查询表单 -->
|
||||||
<el-form :model="queryParams" ref="queryRef" inline v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" inline v-show="showSearch" label-width="68px">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <el-form-item label="羊只耳号" prop="sheepNo">
|
||||||
|
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用空格分隔" clearable @keyup.enter="getList" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="检疫日期">
|
||||||
|
<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">
|
<el-form-item label="羊只耳号" prop="allEarNumbers">
|
||||||
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
|
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
|
||||||
<!-- 主选择器:不显示已选标签 -->
|
<!-- 主选择器:不显示已选标签 -->
|
||||||
<el-select v-model="queryParams.allEarNumbers" multiple filterable remote reserve-keyword
|
<el-select v-model="queryParams.allEarNumbers" multiple filterable remote reserve-keyword placeholder="输入耳号搜索"
|
||||||
placeholder="输入耳号搜索" :remote-method="searchEarNumber" :loading="earNumberLoading" allow-create
|
:remote-method="searchEarNumber" :loading="earNumberLoading" allow-create default-first-option collapse-tags
|
||||||
default-first-option collapse-tags :max-collapse-tags="0" style="width: 300px"
|
:max-collapse-tags="0" style="width: 300px" @change="handleEarNumberChange">
|
||||||
@change="handleEarNumberChange">
|
|
||||||
<el-option v-for="item in earNumberOptions" :key="item" :label="item" :value="item" />
|
<el-option v-for="item in earNumberOptions" :key="item" :label="item" :value="item" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
@@ -63,13 +71,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form-item>
|
</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="sheepNo">
|
<el-form-item label="样品类型" prop="sampleType">
|
||||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用空格分隔" clearable @keyup.enter="getList" />
|
<el-select v-model="queryParams.sampleType" placeholder="请选择" filterable clearable style="width: 150px">
|
||||||
</el-form-item> -->
|
<el-option v-for="i in sampleTypes" :key="i.value" :label="i.label" :value="i.value" />
|
||||||
<el-form-item label="检疫日期">
|
</el-select>
|
||||||
<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>
|
||||||
|
|
||||||
<el-form-item label="检疫项目" prop="quarItem">
|
<el-form-item label="检疫项目" prop="quarItem">
|
||||||
@@ -97,18 +108,6 @@
|
|||||||
</el-form-item>
|
</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-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="getList">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="getList">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</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 type="selection" width="55" align="center" />
|
||||||
|
|
||||||
<el-table-column label="羊只耳号" align="center" prop="sheepNo" />
|
<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">
|
<el-table-column label="羊只性别" align="center" prop="gender">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sheep_gender" :value="scope.row.gender" />
|
<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="sheepType" />
|
||||||
<el-table-column label="月龄" align="center" prop="monthAge" sortable="custom" />
|
<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="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="itemName" />
|
||||||
<el-table-column label="样品类型" align="center" prop="sample" />
|
<el-table-column label="样品类型" align="center" prop="sample" />
|
||||||
<el-table-column label="采样员" align="center" prop="sampler" />
|
<el-table-column label="采样员" align="center" prop="sampler" />
|
||||||
@@ -193,9 +194,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</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)"
|
<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 }}
|
{{ item.ear }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -291,6 +298,11 @@
|
|||||||
<span>{{ editForm.sheepNo }}</span>
|
<span>{{ editForm.sheepNo }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="羊只品种">
|
||||||
|
<span>{{ editForm.variety }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="羊只性别">
|
<el-form-item label="羊只性别">
|
||||||
<dict-tag :options="sheep_gender" :value="editForm.gender" />
|
<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() {
|
function validateSheepId() {
|
||||||
const ear = addForm.value.sheepIdInput.trim()
|
const ear = addForm.value.sheepIdInput.trim()
|
||||||
@@ -727,6 +750,7 @@ function validateSheepId() {
|
|||||||
validSheepId.value = false
|
validSheepId.value = false
|
||||||
alreadySelected.value = false
|
alreadySelected.value = false
|
||||||
|
|
||||||
|
// 检查是否已选择
|
||||||
if (addForm.value.sheepList.some(s => s.ear === ear)) {
|
if (addForm.value.sheepList.some(s => s.ear === ear)) {
|
||||||
alreadySelected.value = true
|
alreadySelected.value = true
|
||||||
addForm.value.sheepIdInput = ''
|
addForm.value.sheepIdInput = ''
|
||||||
@@ -734,17 +758,42 @@ function validateSheepId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request.get(`/sheep/sheep/byManageTags/${ear}`).then(res => {
|
request.get(`/sheep/sheep/byManageTags/${ear}`).then(res => {
|
||||||
if (res.data) {
|
// 有未查询到的耳号,弹窗显示
|
||||||
addForm.value.sheepList.push({ id: res.data.id, ear })
|
if (res.data?.notInHerd?.length > 0) {
|
||||||
validSheepId.value = true
|
const notFoundEars = res.data.notInHerd.join(' ')
|
||||||
} else {
|
proxy.$modal.msgWarning(`以下耳号未查询到:${notFoundEars} 请检查后重新输入` )
|
||||||
invalidSheepId.value = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理查询到的耳号
|
||||||
|
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 = ''
|
addForm.value.sheepIdInput = ''
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
proxy.$modal.msgError('查询失败,请稍后重试')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitAddForm() {
|
function submitAddForm() {
|
||||||
|
if (addForm.value.sheepList.length === 0) {
|
||||||
|
return proxy.$modal.msgError('请至少添加一个耳号')
|
||||||
|
}
|
||||||
addForm.value.ids = addForm.value.sheepList.map(s => s.id)
|
addForm.value.ids = addForm.value.sheepList.map(s => s.id)
|
||||||
addQuarantine(addForm.value).then(() => {
|
addQuarantine(addForm.value).then(() => {
|
||||||
proxy.$modal.msgSuccess('新增成功')
|
proxy.$modal.msgSuccess('新增成功')
|
||||||
@@ -832,7 +881,7 @@ getItems()
|
|||||||
getSample()
|
getSample()
|
||||||
getBarns()
|
getBarns()
|
||||||
getSheepType()
|
getSheepType()
|
||||||
getTechnicalList()
|
fetchTechnicalList()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -163,12 +163,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<div style="margin-bottom: 10px;margin-left: 60px;">
|
<!-- 已选耳号 -->
|
||||||
<el-tag v-for="(item, index) in selectedSheepList" :key="item.sheepNo" closable
|
<el-form-item v-if="selectedSheepList.length > 0" label="">
|
||||||
@close="removeSheep(index)" style="margin-right: 10px">
|
<p style="font-size: 12px; color: #999; width: 100%; display: block;">
|
||||||
{{ item.sheepNo }}({{ item.barnName }})
|
羊只总数:{{ 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-tag>
|
||||||
</div>
|
</el-form-item>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@@ -198,7 +206,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<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="请选择"
|
<el-select v-model="addForm.diseaseId" :disabled="!addForm.diseasePid" placeholder="请选择"
|
||||||
style="width: 100%">
|
style="width: 100%">
|
||||||
<el-option v-for="item in childDiseaseOptions" :key="item.id" :label="item.name" :value="item.id" />
|
<el-option v-for="item in childDiseaseOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||||
@@ -382,7 +390,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<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="请选择"
|
<el-select v-model="editForm.diseaseId" :disabled="!editForm.diseasePid" placeholder="请选择"
|
||||||
style="width: 100%">
|
style="width: 100%">
|
||||||
<el-option v-for="item in childDiseaseOptions" :key="item.id" :label="item.name" :value="item.id" />
|
<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)
|
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() {
|
function validateSheep() {
|
||||||
const no = sheepInput.value.trim()
|
const no = sheepInput.value.trim()
|
||||||
if (!no) return
|
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)) {
|
if (selectedSheepList.value.some(s => s.sheepNo === no)) {
|
||||||
proxy.$modal.msgWarning('该羊只已添加'); return
|
proxy.$modal.msgWarning('该耳号已存在')
|
||||||
}
|
|
||||||
selectedSheepList.value.push({
|
|
||||||
sheepNo: res.data.bsManageTags,
|
|
||||||
sheepId: res.data.id,
|
|
||||||
barnName: res.data.sheepfoldName
|
|
||||||
})
|
|
||||||
sheepInput.value = ''
|
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) {
|
function removeSheep(index) {
|
||||||
|
|||||||
Reference in New Issue
Block a user