产羔导出更新
This commit is contained in:
@@ -196,6 +196,21 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="母羊耳号" align="center" prop="femaleEarNumber" width="120" fixed="left" />
|
||||
<el-table-column label="母羊品种" align="center" prop="femaleBreed" width="100" />
|
||||
<el-table-column label="事件类型" align="center" width="90">
|
||||
<template #default>
|
||||
<el-tag type="success" size="small">产羔</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产羔日期" align="center" prop="createTime" width="110">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配种类型" align="center" prop="breedType" width="140">
|
||||
<template #default="scope">
|
||||
<span>{{ getBreedTypeLabel(scope.row.breedType) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配种日期" align="center" prop="breedingDate" width="110">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.breedingDate, '{y}-{m}-{d}') }}</span>
|
||||
@@ -204,6 +219,12 @@
|
||||
<el-table-column label="胎次" align="center" prop="parity" width="80" />
|
||||
<el-table-column label="公羊耳号" align="center" prop="maleEarNumber" width="120" />
|
||||
<el-table-column label="公羊品种" align="center" prop="maleBreed" width="120" />
|
||||
<!-- 供体信息(胚胎移植时有值) -->
|
||||
<el-table-column label="供体母羊" align="center" prop="donorEwe" width="120" />
|
||||
<el-table-column label="供体母羊品种" align="center" prop="donorEweBreed" width="120" />
|
||||
<el-table-column label="供体公羊" align="center" prop="donorRam" width="120" />
|
||||
<el-table-column label="供体公羊品种" align="center" prop="donorRamBreed" width="120" />
|
||||
<el-table-column label="移胚数" align="center" prop="embryoCount" width="90" />
|
||||
<el-table-column label="产羔数量" align="center" prop="lambsBorn" width="90" />
|
||||
<el-table-column label="活羔数量" align="center" prop="survival" width="90" />
|
||||
<el-table-column label="折损数" align="center" prop="loss" width="80">
|
||||
@@ -211,6 +232,23 @@
|
||||
<span>{{ (scope.row.lambsBorn || 0) - (scope.row.survival || 0) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="羔羊品种" align="center" prop="lambBreedId" width="110">
|
||||
<template #default="scope">
|
||||
<span>{{ getVarietyName(scope.row.lambBreedId) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="n in 8" :key="'lambcols'+n">
|
||||
<el-table-column :label="'羔羊耳号'+n" align="center" width="130">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.lambDetails && scope.row.lambDetails[n-1] ? scope.row.lambDetails[n-1].lambEarNumber : '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="'羔羊'+n+'出生重'" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.lambDetails && scope.row.lambDetails[n-1] ? scope.row.lambDetails[n-1].birthWeight : '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="技术员" align="center" prop="technician" width="100" />
|
||||
<el-table-column label="月龄" align="center" prop="monthAge" width="80" />
|
||||
<el-table-column label="产羔评分" align="center" prop="score" width="90" />
|
||||
@@ -267,6 +305,30 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="事件类型">
|
||||
<el-input value="产羔" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="产羔日期" prop="createTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.createTime"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择产羔日期"
|
||||
style="width:100%">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="配种类型">
|
||||
<el-input :value="getBreedTypeLabel(form.breedType)" placeholder="配种类型" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公羊耳号" prop="maleEarNumber">
|
||||
@@ -279,6 +341,40 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 供体信息(胚胎移植时显示) -->
|
||||
<template v-if="isEmbryoTransfer">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供体母羊">
|
||||
<el-input v-model="form.donorEwe" placeholder="供体母羊耳号" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供体母羊品种">
|
||||
<el-input v-model="form.donorEweBreed" placeholder="供体母羊品种" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供体公羊">
|
||||
<el-input v-model="form.donorRam" placeholder="供体公羊耳号" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供体公羊品种">
|
||||
<el-input v-model="form.donorRamBreed" placeholder="供体公羊品种" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="移胚数">
|
||||
<el-input v-model="form.embryoCount" placeholder="移胚数" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="怀孕天数" prop="pregnancyDays">
|
||||
@@ -328,17 +424,6 @@
|
||||
<el-input v-model.number="form.score" placeholder="请输入产羔评分" type="number" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产羔日期" prop="createTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.createTime"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择产羔日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
@@ -370,7 +455,7 @@
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="`羔羊耳号`" :prop="`lambForms.${index}.lambEarNumber`">
|
||||
<el-input v-model="lamb.lambEarNumber" placeholder="请输入羔羊耳号"
|
||||
@input="handleLambEarNumberInput(index)"/>
|
||||
@input="handleLambEarNumberInput(index)"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -452,6 +537,13 @@
|
||||
<el-descriptions-item label="公羊耳号">{{ detailData.maleEarNumber }}</el-descriptions-item>
|
||||
<el-descriptions-item label="公羊品种">{{ detailData.maleBreed }}</el-descriptions-item>
|
||||
<el-descriptions-item label="配种日期">{{ parseTime(detailData.breedingDate, '{y}-{m}-{d}') }}</el-descriptions-item>
|
||||
<template v-if="detailData.donorEwe || detailData.donorRam">
|
||||
<el-descriptions-item label="供体母羊">{{ detailData.donorEwe || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="供体母羊品种">{{ detailData.donorEweBreed || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="供体公羊">{{ detailData.donorRam || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="供体公羊品种">{{ detailData.donorRamBreed || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="移胚数">{{ detailData.embryoCount || '-' }}</el-descriptions-item>
|
||||
</template>
|
||||
<el-descriptions-item label="产羔数量">{{ detailData.lambsBorn }}</el-descriptions-item>
|
||||
<el-descriptions-item label="活羔数量">{{ detailData.survival }}</el-descriptions-item>
|
||||
<el-descriptions-item label="技术员">{{ detailData.technician }}</el-descriptions-item>
|
||||
@@ -539,6 +631,11 @@ const detailData = ref({})
|
||||
const lambDetailList = ref([])
|
||||
const varietyList = ref([]) // 品种列表
|
||||
|
||||
// 是否胚胎移植(有供体母羊或供体公羊信息时为true)
|
||||
const isEmbryoTransfer = computed(() => {
|
||||
return !!(form.value.donorEwe || form.value.donorRam)
|
||||
})
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
@@ -813,6 +910,19 @@ function getGenderDisplay(gender) {
|
||||
return { label: '未知', type: 'info' }
|
||||
}
|
||||
|
||||
/** 配种类型标签映射 */
|
||||
function getBreedTypeLabel(breedType) {
|
||||
const map = {
|
||||
'1': '供体母羊配种',
|
||||
'2': '同期发情人工授精',
|
||||
'3': '本交',
|
||||
'4': '自然发情人工授精',
|
||||
'5': '胚胎移植'
|
||||
}
|
||||
if (breedType == null || breedType === '') return '-'
|
||||
return map[String(breedType)] || String(breedType)
|
||||
}
|
||||
|
||||
/** 母羊耳号输入处理 */
|
||||
function handleEarNumberInput() {
|
||||
// 清空相关联动字段
|
||||
@@ -822,6 +932,12 @@ function handleEarNumberInput() {
|
||||
form.value.breedingDate = null
|
||||
form.value.pregnancyDays = null
|
||||
form.value.technician = null
|
||||
form.value.donorEwe = null
|
||||
form.value.donorEweBreed = null
|
||||
form.value.donorRam = null
|
||||
form.value.donorRamBreed = null
|
||||
form.value.embryoCount = null
|
||||
form.value.breedType = null
|
||||
}
|
||||
|
||||
/** 母羊耳号失焦处理 - 自动查询配种信息 */
|
||||
@@ -840,6 +956,13 @@ function handleEarNumberBlur() {
|
||||
form.value.breedingDate = breedingData.breeding_date
|
||||
form.value.pregnancyDays = breedingData.pregnancy_days
|
||||
form.value.technician = breedingData.technician || ''
|
||||
// 供体信息(胚胎移植时有值)
|
||||
form.value.donorEwe = breedingData.donor_ewe || null
|
||||
form.value.donorEweBreed = breedingData.donor_ewe_breed || null
|
||||
form.value.donorRam = breedingData.donor_ram || null
|
||||
form.value.donorRamBreed = breedingData.donor_ram_breed || null
|
||||
form.value.embryoCount = breedingData.embryo_count || null
|
||||
form.value.breedType = breedingData.breed_type || null
|
||||
const mVariety = varietyList.value.find(v => v.variety === breedingData.male_breed);
|
||||
const fVariety = varietyList.value.find(v => v.variety === breedingData.female_breed);
|
||||
|
||||
@@ -874,10 +997,19 @@ function handleEarNumberBlur() {
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listLambing_records(queryParams.value).then(response => {
|
||||
lambing_recordsList.value = response.rows
|
||||
const rows = response.rows || []
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
// 批量加载每行的羔羊详情
|
||||
const promises = rows.map(row =>
|
||||
getLambDetail(row.id).then(res => {
|
||||
row.lambDetails = res.data || []
|
||||
}).catch(() => { row.lambDetails = [] })
|
||||
)
|
||||
Promise.all(promises).then(() => {
|
||||
lambing_recordsList.value = rows
|
||||
loading.value = false
|
||||
})
|
||||
}).catch(() => { loading.value = false })
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
@@ -903,7 +1035,13 @@ function reset() {
|
||||
score: null,
|
||||
comment: null,
|
||||
createBy: null,
|
||||
createTime: null
|
||||
createTime: null,
|
||||
donorEwe: null,
|
||||
donorEweBreed: null,
|
||||
donorRam: null,
|
||||
donorRamBreed: null,
|
||||
embryoCount: null,
|
||||
breedType: null
|
||||
}
|
||||
showLambForms.value = false
|
||||
lambForms.value = []
|
||||
@@ -936,6 +1074,8 @@ function handleSelectionChange(selection) {
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
// 默认产羔日期为今天
|
||||
form.value.createTime = new Date().toISOString().split('T')[0]
|
||||
open.value = true
|
||||
title.value = "添加产羔记录"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user