diff --git a/src/views/breed/lambing_records/index.vue b/src/views/breed/lambing_records/index.vue index 2aa7c68..c0cba8c 100644 --- a/src/views/breed/lambing_records/index.vue +++ b/src/views/breed/lambing_records/index.vue @@ -107,7 +107,7 @@ @keyup.enter="handleQuery" /> - + + + + + + + + + + + + + + @@ -267,6 +305,30 @@ + + + + + + + + + + + + + + + + + + @@ -279,13 +341,47 @@ + + - + - - - - - - @@ -370,7 +455,7 @@ + @input="handleLambEarNumberInput(index)"/> @@ -452,6 +537,13 @@ {{ detailData.maleEarNumber }} {{ detailData.maleBreed }} {{ parseTime(detailData.breedingDate, '{y}-{m}-{d}') }} + {{ detailData.lambsBorn }} {{ detailData.survival }} {{ detailData.technician }} @@ -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 = "添加产羔记录" }