Compare commits

..

No commits in common. "adb8da9df675cb8c97c15815848d692ff5a64eb4" and "8be5607e82b159fa59460fbd7b99cb801380d0bb" have entirely different histories.

2 changed files with 5 additions and 76 deletions

View File

@ -41,12 +41,4 @@ 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'
})
} }

View File

@ -7,7 +7,6 @@
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">
@ -157,18 +156,13 @@
@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 <el-input v-model="form.manageTags" placeholder="请输入管理耳号" />
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">
@ -183,8 +177,6 @@
</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">
@ -246,7 +238,7 @@
</template> </template>
<script setup name="Death"> <script setup name="Death">
import {listDeath, getDeath, delDeath, addDeath, updateDeath, getSheepInfo} from "@/api/sheep_death/death" import {listDeath, getDeath, delDeath, addDeath, updateDeath} from "@/api/sheep_death/death"
const {proxy} = getCurrentInstance() const {proxy} = getCurrentInstance()
@ -259,7 +251,6 @@ 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: {},
@ -300,64 +291,13 @@ 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,
@ -459,7 +399,4 @@ function handleExport() {
} }
getList() getList()
</script> </script>
<style scoped>
</style>