配种记录修改

This commit is contained in:
zyk 2025-12-21 23:45:59 +08:00
parent e06f4a1d89
commit cef7915037

View File

@ -386,8 +386,15 @@
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template> </template>
<script setup name="Breeding_records"> <script setup name="Breeding_records">
import { import {
listBreeding_records, listBreeding_records,
@ -447,11 +454,15 @@ const data = reactive({
breedType: [ breedType: [
{required: true, message: "配种方式不能为空", trigger: "change"} {required: true, message: "配种方式不能为空", trigger: "change"}
] ]
} },
submitting: false
}) })
const {queryParams, form, rules} = toRefs(data) const {queryParams, form, rules} = toRefs(data)
/** 获取配种方式文字显示 */ /** 获取配种方式文字显示 */
function getBreedTypeText(breedType) { function getBreedTypeText(breedType) {
if (breedType === 1) return '同期发情' if (breedType === 1) return '同期发情'
@ -489,6 +500,7 @@ function handleSortChange({column, prop, order}) {
// //
function cancel() { function cancel() {
open.value = false open.value = false
submitting.value = false
reset() reset()
} }
@ -618,6 +630,28 @@ function getRamInfoByTags() {
} }
} }
// /** */
// function submitForm() {
// proxy.$refs["Breeding_recordsRef"].validate(valid => {
// if (valid) {
// if (form.value.id != null) {
// updateBreeding_records(form.value).then(response => {
// proxy.$modal.msgSuccess("")
// open.value = false
// getList()
// })
// } else {
// addBreeding_records(form.value).then(response => {
// proxy.$modal.msgSuccess("")
// open.value = false
// getList()
// })
// }
// }
// })
// }
/** 提交按钮 */
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { function submitForm() {
proxy.$refs["Breeding_recordsRef"].validate(valid => { proxy.$refs["Breeding_recordsRef"].validate(valid => {
@ -627,12 +661,18 @@ function submitForm() {
proxy.$modal.msgSuccess("修改成功") proxy.$modal.msgSuccess("修改成功")
open.value = false open.value = false
getList() getList()
}).catch(error => {
console.error('修改失败:', error)
proxy.$modal.msgError("修改失败,请查看控制台")
}) })
} else { } else {
addBreeding_records(form.value).then(response => { addBreeding_records(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功") proxy.$modal.msgSuccess("新增成功")
open.value = false open.value = false
getList() getList()
}).catch(error => {
console.error('新增失败:', error)
proxy.$modal.msgError("新增失败,请查看控制台")
}) })
} }
} }