diff --git a/src/views/produce/bodyManage/body_score/index.vue b/src/views/produce/bodyManage/body_score/index.vue
index 4c99430..28a2cd5 100644
--- a/src/views/produce/bodyManage/body_score/index.vue
+++ b/src/views/produce/bodyManage/body_score/index.vue
@@ -183,6 +183,9 @@ const data = reactive({
score: [
{ required: true, message: '请输入体况评分', trigger: 'blur' }
],
+ datetime:[
+ { required: true, message: '请选择事件日期', trigger: 'blur' }
+ ],
technician: [
{ required: true, message: '请输入技术员', trigger: 'blur' }
]
diff --git a/src/views/produce/bodyManage/breast_rating/index.vue b/src/views/produce/bodyManage/breast_rating/index.vue
index 6a51052..af6d6f0 100644
--- a/src/views/produce/bodyManage/breast_rating/index.vue
+++ b/src/views/produce/bodyManage/breast_rating/index.vue
@@ -182,6 +182,9 @@ const data = reactive({
manageTags: [
{ required: true, message: '请输入管理耳号', trigger: 'blur' }
],
+ eventDate:[
+ { required: true, message: '请选择事件日期', trigger: 'blur' }
+ ],
score: [
{ required: true, message: '请输入乳房评分', trigger: 'blur' }
],
diff --git a/src/views/produce/manage_sheep/add_sheep/index.vue b/src/views/produce/manage_sheep/add_sheep/index.vue
index 807811c..24a1cc5 100644
--- a/src/views/produce/manage_sheep/add_sheep/index.vue
+++ b/src/views/produce/manage_sheep/add_sheep/index.vue
@@ -14,9 +14,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -84,11 +99,7 @@
-
-
-
-
-
+
@@ -130,6 +141,7 @@ import { ref, getCurrentInstance } from 'vue'
import request from '@/utils/request'
import { addSheep, exportSheepForm } from '@/api/produce/manage_sheep/add_sheep'
import { getSheepTypeList } from "@/api/produce/bodyManage/body_measure"
+import { listRanch } from '@/api/produce/manage_sheep/trans_group'
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
import { getToken } from '@/utils/auth'
@@ -137,6 +149,7 @@ import { getToken } from '@/utils/auth'
const { proxy } = getCurrentInstance()
const form = ref({
earNumber: '',
+ ranchId: null,
sheepfold: '',
father: '',
mother: '',
@@ -151,14 +164,17 @@ const form = ref({
technician: ''
})
const formRef = ref(null)
-
+const sheepfoldOptions = ref([])
+const varietyOptions = ref([])
+const ranchOptions = ref([])
const rules = {
earNumber: [
{ required: true, message: '请输入耳号', trigger: 'blur' },
{ validator: checkEarNumberExists, trigger: 'blur' }
],
+ ranchId: [{ required: true, message: '请选择牧场', trigger: 'change' }],
sheepfold: [{ required: true, message: '请选择羊舍', trigger: 'change' }],
- bornWeight: [{ required: true, message: '请输入出生体重', trigger: 'blur' }],
+ bornWeight: [{ required: true, message: '请输入出生体重', trigger: 'change' }],
birthday: [{ required: true, message: '请选择出生日期', trigger: 'change' }],
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
varietyId: [{ required: true, message: '请选择品种', trigger: 'change' }],
@@ -199,15 +215,33 @@ function handleEarNumberBlur() {
formRef.value.validateField('earNumber')
}
+function handleRanchChange(ranchId) {
+ form.value.sheepfold = '';
+ sheepfoldOptions.value = [];
-const sheepfoldOptions = ref([])
-const varietyOptions = ref([])
+ if (!ranchId) return;
+
+ listSheepfold({
+ pageNum: 1,
+ pageSize: 9999,
+ ranchId: ranchId
+ }).then(res => {
+ if (res.rows && res.rows.length > 0) {
+ sheepfoldOptions.value = res.rows || [];
+ } else {
+ proxy.$modal.msgWarning(`该牧场下暂无羊舍数据`);
+ }
+ }).catch(error => {
+ console.error('加载羊舍数据失败', error);
+ proxy.$modal.msgError('获取羊舍数据失败');
+ });
+}
//羊舍列表
function getSheepfoldOptions() {
- listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
- sheepfoldOptions.value = res.rows || []
- })
+ // listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
+ // sheepfoldOptions.value = res.rows || []
+ // })
}
//品种列表
@@ -221,6 +255,19 @@ function getVarietyOptions() {
})
}
+//加载所有牧场列表
+function loadRanchList() {
+ listRanch().then(res => {
+ ranchOptions.value = res.rows.map(ranch => ({
+ id: ranch.id,
+ ranchName: ranch.ranch
+ }));
+ }).catch(error => {
+ console.error('加载牧场列表失败', error);
+ proxy.$modal.msgError('获取牧场数据失败');
+ });
+}
+
// 加载羊只类别数据
const sheepTypeList = ref([]);
function loadSheepTypeList() {
@@ -257,6 +304,7 @@ function submitForm() {
addSheep(formData).then(res => {
if (res.code === 200) {
proxy.$modal.msgSuccess('新增成功');
+ formRef.value.clearValidate();
resetForm();
} else {
proxy.$modal.msgError(res.msg || '新增失败');
@@ -336,6 +384,7 @@ function handleImportError(err) {
onMounted(() => {
getSheepfoldOptions()
loadSheepTypeList()
+ loadRanchList()
getVarietyOptions()
})