Compare commits
No commits in common. "393e44442a35a01519cbd8c9aa059c5a3b5ceb5c" and "34c2873a4b861d8225b7843100a710699fd1c051" have entirely different histories.
393e44442a
...
34c2873a4b
@ -53,14 +53,3 @@ export function getSheepByManageTags(manageTags) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据耳号获取配种信息
|
|
||||||
export function getBreedInfoByManageTags(manageTags) {
|
|
||||||
return request({
|
|
||||||
url: '/Pregnancy_Test/Pregnancy_Test/getBreedInfoByManageTags',
|
|
||||||
method: 'get',
|
|
||||||
params: {
|
|
||||||
manageTags: manageTags
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询流产记录列表
|
|
||||||
export function listMiscarriage(query) {
|
|
||||||
return request({
|
|
||||||
url: '/miscarriage/miscarriage/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询流产记录详细
|
|
||||||
export function getMiscarriage(id) {
|
|
||||||
return request({
|
|
||||||
url: '/miscarriage/miscarriage/' + id,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据耳号查询羊只信息
|
|
||||||
export function getSheepInfo(manageTags) {
|
|
||||||
return request({
|
|
||||||
url: '/miscarriage/miscarriage/sheep/' + manageTags,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取流产原因选项
|
|
||||||
export function getReasonOptions() {
|
|
||||||
return request({
|
|
||||||
url: '/miscarriage/miscarriage/reasonOptions',
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增流产记录
|
|
||||||
export function addMiscarriage(data) {
|
|
||||||
return request({
|
|
||||||
url: '/miscarriage/miscarriage',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改流产记录
|
|
||||||
export function updateMiscarriage(data) {
|
|
||||||
return request({
|
|
||||||
url: '/miscarriage/miscarriage',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除流产记录
|
|
||||||
export function delMiscarriage(id) {
|
|
||||||
return request({
|
|
||||||
url: '/miscarriage/miscarriage/' + id,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -17,6 +17,14 @@ export function getDeath(id) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据管理耳号查询羊只信息
|
||||||
|
export function getSheepInfo(manageTags) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death/sheepInfo/' + manageTags,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 新增羊只死淘记录
|
// 新增羊只死淘记录
|
||||||
export function addDeath(data) {
|
export function addDeath(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -101,13 +101,7 @@
|
|||||||
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="孕检结果" align="center" prop="result" width="80">
|
<el-table-column label="孕检结果" align="center" prop="result" width="80" />
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="getResultTagType(scope.row.result)">
|
|
||||||
{{ scope.row.result }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="配种公羊" align="center" prop="fatherManageTags" width="100" />
|
<el-table-column label="配种公羊" align="center" prop="fatherManageTags" width="100" />
|
||||||
<el-table-column label="配种公羊品种" align="center" prop="fatherVariety" width="120" />
|
<el-table-column label="配种公羊品种" align="center" prop="fatherVariety" width="120" />
|
||||||
<el-table-column label="配种类型" align="center" prop="matingTypeName" width="80" />
|
<el-table-column label="配种类型" align="center" prop="matingTypeName" width="80" />
|
||||||
@ -116,13 +110,6 @@
|
|||||||
<span>{{ parseTime(scope.row.matingDate, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.matingDate, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- 新增配后天数字段 -->
|
|
||||||
<el-table-column label="配后天数" align="center" prop="daysAfterMating" width="80">
|
|
||||||
<template #default="scope">
|
|
||||||
<span v-if="scope.row.daysAfterMating !== null">{{ scope.row.daysAfterMating }}天</span>
|
|
||||||
<span v-else>-</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="胎儿数量" align="center" prop="fetusCount" width="80" />
|
<el-table-column label="胎儿数量" align="center" prop="fetusCount" width="80" />
|
||||||
<el-table-column label="月龄" align="center" prop="monthAge" width="60" />
|
<el-table-column label="月龄" align="center" prop="monthAge" width="60" />
|
||||||
<el-table-column label="孕检时羊只类别" align="center" prop="breedStatus" width="120" />
|
<el-table-column label="孕检时羊只类别" align="center" prop="breedStatus" width="120" />
|
||||||
@ -167,13 +154,12 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改孕检记录对话框 -->
|
<!-- 添加或修改孕检记录对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="900px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
|
||||||
<el-form ref="Pregnancy_TestRef" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="Pregnancy_TestRef" :model="form" :rules="rules" label-width="120px">
|
||||||
<!-- 基本信息 -->
|
<el-row :gutter="20">
|
||||||
<el-row :gutter="30">
|
|
||||||
<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="请输入耳号" @blur="getSheepAndBreedInfo" />
|
<el-input v-model="form.manageTags" placeholder="请输入耳号" @blur="getSheepInfo" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -182,17 +168,15 @@
|
|||||||
v-model="form.datetime"
|
v-model="form.datetime"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="请选择孕检日期"
|
placeholder="请选择孕检日期">
|
||||||
style="width: 100%">
|
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
<el-row :gutter="30">
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="孕检结果" prop="result">
|
<el-form-item label="孕检结果" prop="result">
|
||||||
<el-select v-model="form.result" placeholder="请选择孕检结果" @change="onResultChange" style="width: 100%">
|
<el-select v-model="form.result" placeholder="请选择孕检结果">
|
||||||
<el-option label="怀孕" value="怀孕" />
|
<el-option label="怀孕" value="怀孕" />
|
||||||
<el-option label="未孕" value="未孕" />
|
<el-option label="未孕" value="未孕" />
|
||||||
<el-option label="流产" value="流产" />
|
<el-option label="流产" value="流产" />
|
||||||
@ -201,18 +185,11 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="胎儿数量" prop="fetusCount">
|
<el-form-item label="胎儿数量" prop="fetusCount">
|
||||||
<el-input-number
|
<el-input-number v-model="form.fetusCount" :min="0" :max="10" placeholder="请输入胎儿数量" />
|
||||||
v-model="form.fetusCount"
|
|
||||||
:min="0"
|
|
||||||
:max="10"
|
|
||||||
placeholder="请输入胎儿数量"
|
|
||||||
:disabled="form.result !== '怀孕'"
|
|
||||||
style="width: 100%" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
<el-row :gutter="30">
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="技术员" prop="technician">
|
<el-form-item label="技术员" prop="technician">
|
||||||
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
@ -220,7 +197,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="孕检方式" prop="way">
|
<el-form-item label="孕检方式" prop="way">
|
||||||
<el-select v-model="form.way" placeholder="请选择孕检方式" style="width: 100%">
|
<el-select v-model="form.way" placeholder="请选择孕检方式">
|
||||||
<el-option label="B超" value="B超" />
|
<el-option label="B超" value="B超" />
|
||||||
<el-option label="试纸" value="试纸" />
|
<el-option label="试纸" value="试纸" />
|
||||||
<el-option label="血检" value="血检" />
|
<el-option label="血检" value="血检" />
|
||||||
@ -228,42 +205,48 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
<el-row :gutter="30">
|
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" :rows="3" />
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 配种信息显示 -->
|
<!-- 羊只信息显示 -->
|
||||||
<el-divider content-position="left">配种信息</el-divider>
|
<el-divider content-position="left">羊只信息</el-divider>
|
||||||
<el-row :gutter="30" v-if="breedInfo.manageTags">
|
<el-row :gutter="20" v-if="sheepInfo.id">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="配种类型">
|
<el-form-item label="品种">
|
||||||
<el-input v-model="breedInfo.matingTypeName" disabled />
|
<el-input v-model="sheepInfo.variety" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="配种公羊">
|
<el-form-item label="月龄">
|
||||||
<el-input v-model="breedInfo.fatherManageTags" disabled />
|
<el-input v-model="sheepInfo.monthAge" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="配种日期">
|
<el-form-item label="胎次">
|
||||||
<el-input :value="parseTime(breedInfo.matingDate, '{y}-{m}-{d}')" disabled />
|
<el-input v-model="sheepInfo.parity" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row v-if="!breedInfo.manageTags && form.manageTags">
|
<el-row :gutter="20" v-if="sheepInfo.id">
|
||||||
<el-col :span="24">
|
<el-col :span="8">
|
||||||
<el-alert
|
<el-form-item label="配次">
|
||||||
title="未找到该羊只的配种信息"
|
<el-input v-model="sheepInfo.matingCounts" disabled />
|
||||||
type="warning"
|
</el-form-item>
|
||||||
show-icon
|
</el-col>
|
||||||
:closable="false">
|
<el-col :span="8">
|
||||||
</el-alert>
|
<el-form-item label="当前羊舍">
|
||||||
|
<el-input v-model="sheepInfo.sheepfoldName" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="繁育状态">
|
||||||
|
<el-input v-model="sheepInfo.breedStatus" disabled />
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -278,7 +261,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Pregnancy_Test">
|
<script setup name="Pregnancy_Test">
|
||||||
import { listPregnancy_Test, getPregnancy_Test, delPregnancy_Test, addPregnancy_Test, updatePregnancy_Test, getSheepByManageTags, getBreedInfoByManageTags } from "@/api/Pregnancy_Test/Pregnancy_Test"
|
import { listPregnancy_Test, getPregnancy_Test, delPregnancy_Test, addPregnancy_Test, updatePregnancy_Test, getSheepByManageTags } from "@/api/Pregnancy_Test/Pregnancy_Test"
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
@ -291,7 +274,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 breedInfo = ref({})
|
const sheepInfo = ref({})
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
@ -319,55 +302,12 @@ const data = reactive({
|
|||||||
],
|
],
|
||||||
way: [
|
way: [
|
||||||
{ required: true, message: "孕检方式不能为空", trigger: "change" }
|
{ required: true, message: "孕检方式不能为空", trigger: "change" }
|
||||||
],
|
|
||||||
fetusCount: [
|
|
||||||
{
|
|
||||||
validator: (rule, value, callback) => {
|
|
||||||
if (form.value.result === '怀孕') {
|
|
||||||
if (!value || value <= 0) {
|
|
||||||
callback(new Error('孕检结果为怀孕时,胎儿数量必须填写且大于0'))
|
|
||||||
} else if (value > 10) {
|
|
||||||
callback(new Error('胎儿数量不能超过10个'))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
/** 孕检结果标签类型 */
|
|
||||||
function getResultTagType(result) {
|
|
||||||
switch (result) {
|
|
||||||
case '怀孕':
|
|
||||||
return 'success'
|
|
||||||
case '未孕':
|
|
||||||
return 'info'
|
|
||||||
case '流产':
|
|
||||||
return 'danger'
|
|
||||||
default:
|
|
||||||
return 'info'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 孕检结果变化处理 */
|
|
||||||
function onResultChange(value) {
|
|
||||||
if (value === '未孕' || value === '流产') {
|
|
||||||
form.value.fetusCount = 0
|
|
||||||
} else if (value === '怀孕') {
|
|
||||||
if (!form.value.fetusCount || form.value.fetusCount <= 0) {
|
|
||||||
form.value.fetusCount = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查询孕检记录列表 */
|
/** 查询孕检记录列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -378,31 +318,18 @@ function getList() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 根据耳号获取羊只信息和配种信息 */
|
/** 根据耳号获取羊只信息 */
|
||||||
function getSheepAndBreedInfo() {
|
function getSheepInfo() {
|
||||||
if (form.value.manageTags) {
|
if (form.value.manageTags) {
|
||||||
// 获取羊只基本信息
|
|
||||||
getSheepByManageTags(form.value.manageTags).then(response => {
|
getSheepByManageTags(form.value.manageTags).then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
sheepInfo.value = response.data
|
||||||
form.value.sheepId = response.data.id
|
form.value.sheepId = response.data.id
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError("未找到该耳号的羊只信息")
|
proxy.$modal.msgError("未找到该耳号的羊只信息")
|
||||||
|
sheepInfo.value = {}
|
||||||
form.value.sheepId = null
|
form.value.sheepId = null
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
|
||||||
proxy.$modal.msgError("查询羊只信息失败")
|
|
||||||
form.value.sheepId = null
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取配种信息
|
|
||||||
getBreedInfoByManageTags(form.value.manageTags).then(response => {
|
|
||||||
if (response.data) {
|
|
||||||
breedInfo.value = response.data
|
|
||||||
} else {
|
|
||||||
breedInfo.value = {}
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
breedInfo.value = {}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,12 +350,12 @@ function reset() {
|
|||||||
result: null,
|
result: null,
|
||||||
fetusCount: null,
|
fetusCount: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
way: 'B超', // 默认孕检方式为B超
|
way: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null
|
createTime: null
|
||||||
}
|
}
|
||||||
breedInfo.value = {}
|
sheepInfo.value = {}
|
||||||
proxy.resetForm("Pregnancy_TestRef")
|
proxy.resetForm("Pregnancy_TestRef")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,9 +392,9 @@ function handleUpdate(row) {
|
|||||||
getPregnancy_Test(_id).then(response => {
|
getPregnancy_Test(_id).then(response => {
|
||||||
form.value = response.data
|
form.value = response.data
|
||||||
form.value.manageTags = response.data.manageTags
|
form.value.manageTags = response.data.manageTags
|
||||||
// 获取配种信息用于显示
|
// 获取羊只信息用于显示
|
||||||
if (response.data.manageTags) {
|
if (response.data.manageTags) {
|
||||||
getSheepAndBreedInfo()
|
getSheepInfo()
|
||||||
}
|
}
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "修改孕检记录"
|
title.value = "修改孕检记录"
|
||||||
@ -480,34 +407,15 @@ function submitForm() {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.id != null) {
|
if (form.value.id != null) {
|
||||||
updatePregnancy_Test(form.value).then(response => {
|
updatePregnancy_Test(form.value).then(response => {
|
||||||
console.log("修改成功响应", response)
|
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
// 强制刷新页面数据
|
|
||||||
setTimeout(() => {
|
|
||||||
getList()
|
getList()
|
||||||
}, 500)
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error("修改失败", error)
|
|
||||||
proxy.$modal.msgError("修改失败")
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addPregnancy_Test(form.value).then(response => {
|
addPregnancy_Test(form.value).then(response => {
|
||||||
console.log("新增成功响应", response) // 查看这个日志
|
|
||||||
if (response && response.code === 200) {
|
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
// 强制刷新页面数据,延迟执行确保对话框关闭
|
|
||||||
setTimeout(() => {
|
|
||||||
getList()
|
getList()
|
||||||
}, 500)
|
|
||||||
} else {
|
|
||||||
console.error("新增返回异常", response)
|
|
||||||
proxy.$modal.msgError("新增失败")
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error("新增失败", error)
|
|
||||||
proxy.$modal.msgError("新增失败")
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -539,7 +447,6 @@ getList()
|
|||||||
.el-table {
|
.el-table {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-table .cell {
|
.el-table .cell {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -455,9 +455,9 @@ function genderToNumber(gender) {
|
|||||||
|
|
||||||
/** 性别显示函数 - 后端数值转前端显示 */
|
/** 性别显示函数 - 后端数值转前端显示 */
|
||||||
function getGenderDisplay(gender) {
|
function getGenderDisplay(gender) {
|
||||||
if (gender === 2 || gender === 'male') {
|
if (gender === 1 || gender === 'male') {
|
||||||
return { label: '公', type: 'primary' }
|
return { label: '公', type: 'primary' }
|
||||||
} else if (gender === 1 || gender === 'female') {
|
} else if (gender === 0 || gender === 'female') {
|
||||||
return { label: '母', type: 'success' }
|
return { label: '母', type: 'success' }
|
||||||
}
|
}
|
||||||
return { label: '未知', type: 'info' }
|
return { label: '未知', type: 'info' }
|
||||||
|
|||||||
@ -1,447 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="80px">
|
|
||||||
<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="variety">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.variety"
|
|
||||||
placeholder="请输入品种"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="事件日期" prop="datetime">
|
|
||||||
<el-date-picker clearable
|
|
||||||
v-model="queryParams.datetime"
|
|
||||||
type="date"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
placeholder="请选择事件日期">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="流产原因" prop="reason">
|
|
||||||
<el-select v-model="queryParams.reason" placeholder="请选择流产原因" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="item in reasonOptions"
|
|
||||||
:key="item"
|
|
||||||
:label="item"
|
|
||||||
:value="item">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="技术员" prop="technician">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.technician"
|
|
||||||
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>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="Plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['miscarriage:miscarriage:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['miscarriage:miscarriage:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="Delete"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['miscarriage:miscarriage:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="Download"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['miscarriage:miscarriage:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="miscarriageList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<el-table-column label="耳号" align="center" prop="bsManageTags" />
|
|
||||||
<el-table-column label="品种" align="center" prop="variety" />
|
|
||||||
<el-table-column label="事件类型" align="center">
|
|
||||||
<template #default="scope">
|
|
||||||
<span>流产</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="流产日期" align="center" prop="datetime" width="100">
|
|
||||||
<template #default="scope">
|
|
||||||
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="流产原因" align="center" prop="reason" />
|
|
||||||
<el-table-column label="配种类型" align="center" prop="matingTypeName" />
|
|
||||||
<el-table-column label="配种日期" align="center" prop="matingDate" width="100">
|
|
||||||
<template #default="scope">
|
|
||||||
<span>{{ scope.row.matingDate ? parseTime(scope.row.matingDate, '{y}-{m}-{d}') : '-' }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="胎次" align="center" prop="parity" />
|
|
||||||
<el-table-column label="配种公羊品种" align="center" prop="ramVariety" />
|
|
||||||
<el-table-column label="流产数量" align="center" prop="miscaLamb" />
|
|
||||||
<el-table-column label="技术员" align="center" prop="technician" />
|
|
||||||
<el-table-column label="月龄" align="center" prop="monthAge" />
|
|
||||||
<el-table-column label="流产时怀孕天数" align="center" prop="pregnantDays" />
|
|
||||||
<el-table-column label="当前羊舍" align="center" prop="sheepfoldName" />
|
|
||||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
|
||||||
<el-table-column label="创建日期" align="center" prop="createTime" width="100">
|
|
||||||
<template #default="scope">
|
|
||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="所在牧场" align="center" prop="drRanch" />
|
|
||||||
<el-table-column label="备注" align="center" prop="comment" />
|
|
||||||
<el-table-column label="是否列胎次" align="center" prop="status">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag v-if="scope.row.status === 1" type="success">是</el-tag>
|
|
||||||
<el-tag v-else-if="scope.row.status === 0" type="danger">否</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="是否见胎" align="center" prop="exposeType">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag v-if="scope.row.exposeType === 1" type="success">是</el-tag>
|
|
||||||
<el-tag v-else-if="scope.row.exposeType === 2" type="warning">复检无胎</el-tag>
|
|
||||||
<el-tag v-else-if="scope.row.exposeType === 3" type="danger">返情</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['miscarriage:miscarriage:edit']">修改</el-button>
|
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['miscarriage:miscarriage:remove']">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNum"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改流产记录对话框 -->
|
|
||||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
|
||||||
<el-form ref="miscarriageRef" :model="form" :rules="rules" label-width="100px">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="耳号" prop="manageTags">
|
|
||||||
<el-input
|
|
||||||
v-model="form.manageTags"
|
|
||||||
placeholder="请输入羊只耳号"
|
|
||||||
@blur="handleEarTagChange"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="事件日期" prop="datetime">
|
|
||||||
<el-date-picker clearable
|
|
||||||
v-model="form.datetime"
|
|
||||||
type="date"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
placeholder="请选择事件日期">
|
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="流产原因" prop="reason">
|
|
||||||
<el-select v-model="form.reason" placeholder="请选择流产原因" style="width: 100%;">
|
|
||||||
<el-option
|
|
||||||
v-for="item in reasonOptions"
|
|
||||||
:key="item"
|
|
||||||
:label="item"
|
|
||||||
:value="item">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="技术员" prop="technician">
|
|
||||||
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="是否列胎次" prop="status">
|
|
||||||
<el-select v-model="form.status" placeholder="请选择" style="width: 100%;" @change="handleStatusChange">
|
|
||||||
<el-option label="是" :value="1"></el-option>
|
|
||||||
<el-option label="否" :value="0"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="是否见胎" prop="exposeType">
|
|
||||||
<el-select v-model="form.exposeType" placeholder="请选择" style="width: 100%;" :disabled="form.status === 1">
|
|
||||||
<el-option label="是" :value="1"></el-option>
|
|
||||||
<el-option label="复检无胎" :value="2"></el-option>
|
|
||||||
<el-option label="返情" :value="3"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="流产羔羊数" prop="miscaLamb">
|
|
||||||
<el-input-number v-model="form.miscaLamb" :min="0" :max="10" style="width: 100%;" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-form-item label="备注" prop="comment">
|
|
||||||
<el-input v-model="form.comment" type="textarea" placeholder="请输入备注" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup name="Miscarriage">
|
|
||||||
import { listMiscarriage, getMiscarriage, delMiscarriage, addMiscarriage, updateMiscarriage, getSheepInfo, getReasonOptions } from "@/api/miscarriage/miscarriage"
|
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
|
||||||
|
|
||||||
const miscarriageList = ref([])
|
|
||||||
const open = ref(false)
|
|
||||||
const loading = ref(true)
|
|
||||||
const showSearch = ref(true)
|
|
||||||
const ids = ref([])
|
|
||||||
const single = ref(true)
|
|
||||||
const multiple = ref(true)
|
|
||||||
const total = ref(0)
|
|
||||||
const title = ref("")
|
|
||||||
const reasonOptions = ref([])
|
|
||||||
|
|
||||||
const data = reactive({
|
|
||||||
form: {},
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
bsManageTags: null,
|
|
||||||
variety: null,
|
|
||||||
datetime: null,
|
|
||||||
comment: null,
|
|
||||||
technician: null,
|
|
||||||
reason: null,
|
|
||||||
exposeType: null,
|
|
||||||
status: null,
|
|
||||||
miscaLamb: null,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
manageTags: [
|
|
||||||
{ required: true, message: "耳号不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
datetime: [
|
|
||||||
{ required: true, message: "事件日期不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
reason: [
|
|
||||||
{ required: true, message: "流产原因不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
status: [
|
|
||||||
{ required: true, message: "是否列胎次不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
exposeType: [
|
|
||||||
{ required: true, message: "是否见胎不能为空", trigger: "change" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
|
||||||
|
|
||||||
/** 查询流产记录列表 */
|
|
||||||
function getList() {
|
|
||||||
loading.value = true
|
|
||||||
listMiscarriage(queryParams.value).then(response => {
|
|
||||||
miscarriageList.value = response.rows
|
|
||||||
total.value = response.total
|
|
||||||
loading.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 获取流产原因选项 */
|
|
||||||
function getReasonOptionsList() {
|
|
||||||
getReasonOptions().then(response => {
|
|
||||||
reasonOptions.value = response.data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消按钮
|
|
||||||
function cancel() {
|
|
||||||
open.value = false
|
|
||||||
reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 表单重置
|
|
||||||
function reset() {
|
|
||||||
form.value = {
|
|
||||||
id: null,
|
|
||||||
sheepId: null,
|
|
||||||
manageTags: null,
|
|
||||||
datetime: null,
|
|
||||||
comment: null,
|
|
||||||
technician: null,
|
|
||||||
reason: null,
|
|
||||||
exposeType: null,
|
|
||||||
status: null,
|
|
||||||
miscaLamb: null
|
|
||||||
}
|
|
||||||
proxy.resetForm("miscarriageRef")
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
function handleQuery() {
|
|
||||||
queryParams.value.pageNum = 1
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
function resetQuery() {
|
|
||||||
proxy.resetForm("queryRef")
|
|
||||||
handleQuery()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 多选框选中数据
|
|
||||||
function handleSelectionChange(selection) {
|
|
||||||
ids.value = selection.map(item => item.id)
|
|
||||||
single.value = selection.length != 1
|
|
||||||
multiple.value = !selection.length
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
function handleAdd() {
|
|
||||||
reset()
|
|
||||||
open.value = true
|
|
||||||
title.value = "添加流产记录"
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
function handleUpdate(row) {
|
|
||||||
reset()
|
|
||||||
const _id = row.id || ids.value
|
|
||||||
getMiscarriage(_id).then(response => {
|
|
||||||
form.value = response.data
|
|
||||||
form.value.manageTags = response.data.bsManageTags
|
|
||||||
open.value = true
|
|
||||||
title.value = "修改流产记录"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 耳号输入框失焦事件 */
|
|
||||||
function handleEarTagChange() {
|
|
||||||
if (form.value.manageTags) {
|
|
||||||
getSheepInfo(form.value.manageTags).then(response => {
|
|
||||||
if (response.data) {
|
|
||||||
// 这里可以显示羊只相关信息或做验证
|
|
||||||
proxy.$modal.msgSuccess("羊只信息验证成功")
|
|
||||||
} else {
|
|
||||||
proxy.$modal.msgError("未找到该耳号对应的羊只信息")
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
proxy.$modal.msgError("羊只信息查询失败")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 是否列胎次变化事件 */
|
|
||||||
function handleStatusChange(value) {
|
|
||||||
if (value === 1) {
|
|
||||||
// 如果选择是,则是否见胎默认选择是
|
|
||||||
form.value.exposeType = 1
|
|
||||||
} else {
|
|
||||||
// 如果选择否,则清空是否见胎的值
|
|
||||||
form.value.exposeType = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 提交按钮 */
|
|
||||||
function submitForm() {
|
|
||||||
proxy.$refs["miscarriageRef"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
// 将耳号转换为sheepId保存
|
|
||||||
form.value.sheepId = form.value.manageTags
|
|
||||||
|
|
||||||
if (form.value.id != null) {
|
|
||||||
updateMiscarriage(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
|
||||||
open.value = false
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
addMiscarriage(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
|
||||||
open.value = false
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
function handleDelete(row) {
|
|
||||||
const _ids = row.id || ids.value
|
|
||||||
proxy.$modal.confirm('是否确认删除流产记录编号为"' + _ids + '"的数据项?').then(function() {
|
|
||||||
return delMiscarriage(_ids)
|
|
||||||
}).then(() => {
|
|
||||||
getList()
|
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
|
||||||
}).catch(() => {})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
function handleExport() {
|
|
||||||
proxy.download('miscarriage/miscarriage/export', {
|
|
||||||
...queryParams.value
|
|
||||||
}, `miscarriage_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
|
|
||||||
getList()
|
|
||||||
getReasonOptionsList()
|
|
||||||
</script>
|
|
||||||
@ -9,6 +9,14 @@
|
|||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="品种" prop="variety">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.variety"
|
||||||
|
placeholder="请输入品种"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="事件类型" prop="eventType">
|
<el-form-item label="事件类型" prop="eventType">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.eventType"
|
v-model="queryParams.eventType"
|
||||||
@ -25,6 +33,12 @@
|
|||||||
placeholder="请选择死亡日期">
|
placeholder="请选择死亡日期">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="性别" prop="gender">
|
||||||
|
<el-select v-model="queryParams.gender" placeholder="请选择性别" clearable>
|
||||||
|
<el-option label="公" value="1" />
|
||||||
|
<el-option label="母" value="0" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="死淘去向" prop="disposalDirection">
|
<el-form-item label="死淘去向" prop="disposalDirection">
|
||||||
<el-select v-model="queryParams.disposalDirection" placeholder="请选择死淘去向" clearable>
|
<el-select v-model="queryParams.disposalDirection" placeholder="请选择死淘去向" clearable>
|
||||||
<el-option label="深埋" value="深埋" />
|
<el-option label="深埋" value="深埋" />
|
||||||
@ -117,7 +131,7 @@
|
|||||||
<el-table-column label="死亡时羊只类别" align="center" prop="sheepType" width="130" />
|
<el-table-column label="死亡时羊只类别" align="center" prop="sheepType" width="130" />
|
||||||
<el-table-column label="性别" align="center" prop="gender" width="80">
|
<el-table-column label="性别" align="center" prop="gender" width="80">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.gender === 1 ? '母' : scope.row.gender === 2 ? '公' : '' }}</span>
|
<span>{{ scope.row.gender === 1 ? '公' : scope.row.gender === 0 ? '母' : '' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="日龄" align="center" prop="dayAge" width="80" />
|
<el-table-column label="日龄" align="center" prop="dayAge" width="80" />
|
||||||
@ -156,13 +170,64 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改羊只死淘记录对话框 - 简化版 -->
|
<!-- 添加或修改羊只死淘记录对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="800px" 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="handleEarTagBlur" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="事件类型" prop="eventType">
|
||||||
|
<el-input v-model="form.eventType" placeholder="事件类型" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="品种" prop="variety">
|
||||||
|
<el-input v-model="form.variety" placeholder="品种" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="死亡时羊只类别" prop="sheepType">
|
||||||
|
<el-input v-model="form.sheepType" placeholder="羊只类别" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="性别" prop="gender">
|
||||||
|
<el-select v-model="form.gender" placeholder="请选择性别" disabled>
|
||||||
|
<el-option label="公" :value="1" />
|
||||||
|
<el-option label="母" :value="0" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="日龄" prop="dayAge">
|
||||||
|
<el-input-number v-model="form.dayAge" placeholder="日龄" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="胎次" prop="parity">
|
||||||
|
<el-input-number v-model="form.parity" placeholder="胎次" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="羊舍" prop="sheepfoldName">
|
||||||
|
<el-input v-model="form.sheepfoldName" placeholder="羊舍" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="繁育状态" prop="breedStatus">
|
||||||
|
<el-input v-model="form.breedStatus" placeholder="繁育状态" readonly />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -176,7 +241,23 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="死亡时产后天数" prop="postLambingDay">
|
||||||
|
<el-input-number v-model="form.postLambingDay" placeholder="产后天数" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="死亡时泌乳天数" prop="lactationDay">
|
||||||
|
<el-input-number v-model="form.lactationDay" placeholder="泌乳天数" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="死亡时怀孕天数" prop="gestationDay">
|
||||||
|
<el-input-number v-model="form.gestationDay" placeholder="怀孕天数" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</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">
|
||||||
@ -189,7 +270,6 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="死淘去向" prop="disposalDirection">
|
<el-form-item label="死淘去向" prop="disposalDirection">
|
||||||
@ -205,7 +285,6 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="处理人" prop="handler">
|
<el-form-item label="处理人" prop="handler">
|
||||||
@ -218,7 +297,6 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="备注" prop="comment">
|
<el-form-item label="备注" prop="comment">
|
||||||
@ -238,9 +316,9 @@
|
|||||||
</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()
|
||||||
|
|
||||||
const deathList = ref([])
|
const deathList = ref([])
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
@ -258,28 +336,38 @@ const data = reactive({
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
manageTags: null,
|
manageTags: null,
|
||||||
|
variety: null,
|
||||||
eventType: null,
|
eventType: null,
|
||||||
deathDate: null,
|
deathDate: null,
|
||||||
|
sheepType: null,
|
||||||
|
gender: null,
|
||||||
|
dayAge: null,
|
||||||
|
parity: null,
|
||||||
diseaseTypeId: null,
|
diseaseTypeId: null,
|
||||||
diseaseSubtypeId: null,
|
diseaseSubtypeId: null,
|
||||||
disposalDirection: null,
|
disposalDirection: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
handler: null,
|
handler: null,
|
||||||
|
sheepfoldName: null,
|
||||||
workGroup: null,
|
workGroup: null,
|
||||||
|
breedStatus: null,
|
||||||
|
postLambingDay: null,
|
||||||
|
lactationDay: null,
|
||||||
|
gestationDay: null,
|
||||||
comment: null,
|
comment: null,
|
||||||
isDelete: null
|
isDelete: null
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
manageTags: [
|
manageTags: [
|
||||||
{required: true, message: "管理耳号不能为空", trigger: "blur"}
|
{ required: true, message: "管理耳号不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
deathDate: [
|
deathDate: [
|
||||||
{required: true, message: "死亡日期不能为空", trigger: "blur"}
|
{ required: true, message: "死亡日期不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const {queryParams, form, rules} = toRefs(data)
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
/** 查询羊只死淘记录列表 */
|
/** 查询羊只死淘记录列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
@ -297,23 +385,33 @@ function cancel() {
|
|||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置 - 简化版
|
// 表单重置
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
id: null,
|
id: null,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
manageTags: null,
|
manageTags: null,
|
||||||
eventType: "死亡", // 默认事件类型
|
variety: null,
|
||||||
deathDate: new Date().toISOString().split('T')[0], // 默认今日
|
eventType: "死亡",
|
||||||
|
deathDate: new Date().toISOString().split('T')[0],
|
||||||
|
sheepType: null,
|
||||||
|
gender: null,
|
||||||
|
dayAge: null,
|
||||||
|
parity: null,
|
||||||
diseaseTypeId: null,
|
diseaseTypeId: null,
|
||||||
diseaseSubtypeId: null,
|
diseaseSubtypeId: null,
|
||||||
disposalDirection: null,
|
disposalDirection: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
handler: null,
|
handler: null,
|
||||||
|
sheepfoldName: null,
|
||||||
workGroup: null,
|
workGroup: null,
|
||||||
comment: null,
|
breedStatus: null,
|
||||||
|
postLambingDay: null,
|
||||||
|
lactationDay: null,
|
||||||
|
gestationDay: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
|
comment: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
isDelete: null
|
isDelete: null
|
||||||
@ -321,6 +419,44 @@ function reset() {
|
|||||||
proxy.resetForm("deathRef")
|
proxy.resetForm("deathRef")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 管理耳号失去焦点事件 */
|
||||||
|
function handleEarTagBlur() {
|
||||||
|
if (form.value.manageTags && form.value.manageTags.trim()) {
|
||||||
|
getSheepInfo(form.value.manageTags.trim()).then(response => {
|
||||||
|
if (response.code === 200 && response.data) {
|
||||||
|
const sheepData = response.data
|
||||||
|
form.value.sheepId = sheepData.sheepId
|
||||||
|
form.value.variety = sheepData.variety
|
||||||
|
form.value.sheepType = sheepData.sheepType
|
||||||
|
form.value.gender = sheepData.gender
|
||||||
|
form.value.dayAge = sheepData.dayAge
|
||||||
|
form.value.parity = sheepData.parity
|
||||||
|
form.value.sheepfoldName = sheepData.sheepfoldName
|
||||||
|
form.value.breedStatus = sheepData.breedStatus
|
||||||
|
form.value.postLambingDay = sheepData.postLambingDay
|
||||||
|
form.value.lactationDay = sheepData.lactationDay
|
||||||
|
form.value.gestationDay = sheepData.gestationDay
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgWarning("未找到该耳号对应的羊只信息")
|
||||||
|
// 清空自动填充的字段
|
||||||
|
form.value.sheepId = null
|
||||||
|
form.value.variety = null
|
||||||
|
form.value.sheepType = null
|
||||||
|
form.value.gender = null
|
||||||
|
form.value.dayAge = null
|
||||||
|
form.value.parity = null
|
||||||
|
form.value.sheepfoldName = null
|
||||||
|
form.value.breedStatus = null
|
||||||
|
form.value.postLambingDay = null
|
||||||
|
form.value.lactationDay = null
|
||||||
|
form.value.gestationDay = null
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
proxy.$modal.msgError("查询羊只信息失败")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNum = 1
|
queryParams.value.pageNum = 1
|
||||||
@ -382,13 +518,12 @@ function submitForm() {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除羊只死淘记录编号为"' + _ids + '"的数据项?').then(function () {
|
proxy.$modal.confirm('是否确认删除羊只死淘记录编号为"' + _ids + '"的数据项?').then(function() {
|
||||||
return delDeath(_ids)
|
return delDeath(_ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList()
|
getList()
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
}).catch(() => {
|
}).catch(() => {})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user