优化了死亡模块,修改状态在群不在群
This commit is contained in:
parent
393e44442a
commit
dc36abbb24
@ -41,4 +41,12 @@ export function delDeath(id) {
|
|||||||
url: '/sheep_death/death/' + id,
|
url: '/sheep_death/death/' + id,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据管理耳号查询羊只信息
|
||||||
|
export function getSheepInfo(manageTags) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death/sheepInfo/' + manageTags,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@ -7,6 +7,7 @@
|
|||||||
placeholder="请输入管理耳号"
|
placeholder="请输入管理耳号"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
|
@blur="validateManageTagsInQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="事件类型" prop="eventType">
|
<el-form-item label="事件类型" prop="eventType">
|
||||||
@ -156,13 +157,18 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改羊只死淘记录对话框 - 简化版 -->
|
<!-- 添加或修改羊只死淘记录对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||||
<el-form ref="deathRef" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="deathRef" :model="form" :rules="rules" label-width="120px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="管理耳号" prop="manageTags">
|
<el-form-item label="管理耳号" prop="manageTags">
|
||||||
<el-input v-model="form.manageTags" placeholder="请输入管理耳号" />
|
<el-input
|
||||||
|
v-model="form.manageTags"
|
||||||
|
placeholder="请输入管理耳号"
|
||||||
|
@blur="validateManageTagsInForm"
|
||||||
|
:loading="validatingTags"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -177,6 +183,8 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="疾病类型ID" prop="diseaseTypeId">
|
<el-form-item label="疾病类型ID" prop="diseaseTypeId">
|
||||||
@ -238,7 +246,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Death">
|
<script setup name="Death">
|
||||||
import {listDeath, getDeath, delDeath, addDeath, updateDeath} from "@/api/sheep_death/death"
|
import {listDeath, getDeath, delDeath, addDeath, updateDeath, getSheepInfo} from "@/api/sheep_death/death"
|
||||||
|
|
||||||
const {proxy} = getCurrentInstance()
|
const {proxy} = getCurrentInstance()
|
||||||
|
|
||||||
@ -251,6 +259,7 @@ const single = ref(true)
|
|||||||
const multiple = ref(true)
|
const multiple = ref(true)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const title = ref("")
|
const title = ref("")
|
||||||
|
const validatingTags = ref(false) // 验证管理耳号的loading状态
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
@ -291,13 +300,64 @@ function getList() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 验证查询条件中的管理耳号 */
|
||||||
|
function validateManageTagsInQuery() {
|
||||||
|
const manageTags = queryParams.value.manageTags
|
||||||
|
if (manageTags && manageTags.trim()) {
|
||||||
|
validateManageTags(manageTags.trim(), 'query')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 验证表单中的管理耳号 */
|
||||||
|
function validateManageTagsInForm() {
|
||||||
|
const manageTags = form.value.manageTags
|
||||||
|
if (manageTags && manageTags.trim()) {
|
||||||
|
validateManageTags(manageTags.trim(), 'form')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 验证管理耳号是否存在 */
|
||||||
|
function validateManageTags(manageTags, source) {
|
||||||
|
if (validatingTags.value) return // 防止重复请求
|
||||||
|
|
||||||
|
validatingTags.value = true
|
||||||
|
|
||||||
|
getSheepInfo(manageTags).then(response => {
|
||||||
|
if (response.code === 200 && response.data) {
|
||||||
|
if (source === 'form') {
|
||||||
|
proxy.$modal.msgSuccess("羊只验证成功")
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgSuccess("耳号验证成功")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 耳号不存在时清除输入并提示
|
||||||
|
if (source === 'form') {
|
||||||
|
form.value.manageTags = null
|
||||||
|
} else {
|
||||||
|
queryParams.value.manageTags = null
|
||||||
|
}
|
||||||
|
proxy.$modal.msgError("该耳号不存在")
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
// 验证失败时清除输入并提示
|
||||||
|
if (source === 'form') {
|
||||||
|
form.value.manageTags = null
|
||||||
|
} else {
|
||||||
|
queryParams.value.manageTags = null
|
||||||
|
}
|
||||||
|
proxy.$modal.msgError("该耳号不存在")
|
||||||
|
}).finally(() => {
|
||||||
|
validatingTags.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置 - 简化版
|
// 表单重置
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
id: null,
|
id: null,
|
||||||
@ -399,4 +459,7 @@ function handleExport() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getList()
|
getList()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user