diff --git a/src/api/produce/bodyManage/body_measure.js b/src/api/produce/bodyManage/body_measure.js
index 1f3da3a..32529e4 100644
--- a/src/api/produce/bodyManage/body_measure.js
+++ b/src/api/produce/bodyManage/body_measure.js
@@ -57,4 +57,12 @@ export function searchEarNumbers(query) {
method: 'get',
params: { query }
})
+}
+
+// 获取繁殖状态列表
+export function listBreedStatus() {
+ return request({
+ url: '/body_measure/body_measure/breedStatus',
+ method: 'get'
+ })
}
\ No newline at end of file
diff --git a/src/views/Breeding_records/Breeding_records/index.vue b/src/views/Breeding_records/Breeding_records/index.vue
index b9675c9..81b510d 100644
--- a/src/views/Breeding_records/Breeding_records/index.vue
+++ b/src/views/Breeding_records/Breeding_records/index.vue
@@ -1,84 +1,419 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
搜索
重置
@@ -87,23 +422,7 @@
- 新增
-
-
- 修改
+ 新增
删除
- 导出
+ 导出
-
+
-
-
-
- {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}
-
-
+
-
-
- 配种
-
+ 配种
+
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}
-
-
- {{ getBreedTypeText(scope.row.breedType) }}
-
+
+
+
+
+
+
+
+
+ {{ getBreedTypeText(scope.row.breedType) }}
+
+
-
-
- {{ scope.row.timeSincePlanning || 0 }}
-
-
+
+
-
-
-
- {{ scope.row.eweControlled === 1 ? '是' : '否' }}
-
-
-
-
+
+
+
+
-
-
-
-
- {{ scope.row.isPregnancyChecked === 1 ? '已孕检' : '未孕检' }}
-
-
-
-
-
- {{ scope.row.pregnancyCheckDate ? parseTime(scope.row.pregnancyCheckDate, '{y}-{m}-{d}') : '-' }}
-
-
-
-
-
- {{ scope.row.pregnancyResult }}
-
- -
-
-
-
-
- {{ scope.row.fetusCount || '-' }}
-
-
-
-
- {{ scope.row.pregnancyWay || '-' }}
-
-
-
-
- {{ scope.row.daysToPregnancyCheck || '-' }}
-
-
+
+
+
+
+
+
+ {{ scope.row.eweControlled === 1 ? '是' : '否' }}
+
+
+
+
+
- 修改
- 删除
+ 修改
+ 删除
-
+
-
@@ -251,135 +511,104 @@
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+ 胚胎移植手动录入
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
-
-
-
- 母羊信息
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 配种计划信息
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 孕检信息
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1627,10 +540,10 @@
- 供体母羊配种
- 同期发情人工授精
- 本交
- 自然发情人工授精
+ 供体母羊配种
+ 同期发情人工授精
+ 本交
+ 自然发情人工授精
未知类型
diff --git a/src/views/produce/bodyManage/body_measure/index.vue b/src/views/produce/bodyManage/body_measure/index.vue
index e00aecf..6458867 100644
--- a/src/views/produce/bodyManage/body_measure/index.vue
+++ b/src/views/produce/bodyManage/body_measure/index.vue
@@ -10,19 +10,45 @@
start-placeholder="开始日期" end-placeholder="结束日期">
-
-
-
-
- 清空
-
+
+
+
+
+
+
+ 添加
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+ 清空全部
+
+
+
+
+ {{ tag }}
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
-
-
-
+
+
+
+
+
@@ -30,23 +56,49 @@
-
-
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
导出
+
+ 导入
+
@@ -73,7 +129,12 @@
-
+
+
+ {{ parseTime(scope.row.measureDate, '{y}-{m}-{d}') }}
+
+
+
{{ genderMap[scope.row.gender] || '未知' }}
@@ -103,11 +164,7 @@
-
-
- {{ parseTime(scope.row.measureDate, '{y}-{m}-{d}') }}
-
-
+
@@ -161,7 +218,10 @@
-
+
+
+
@@ -205,16 +265,61 @@
+
+
+
+
+ 将文件拖到此处,或点击上传
+
+
+ 仅允许导入xls、xlsx格式文件。
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/produce/bodyManage/body_score/index.vue b/src/views/produce/bodyManage/body_score/index.vue
index 4248d05..1fbce12 100644
--- a/src/views/produce/bodyManage/body_score/index.vue
+++ b/src/views/produce/bodyManage/body_score/index.vue
@@ -6,15 +6,39 @@
start-placeholder="开始日期" end-placeholder="结束日期">
-
-
-
-
- 清空
-
+
+
+
+
+
+
+ 添加
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+ 清空全部
+
+
+
+
+ {{ tag }}
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
@@ -26,18 +50,18 @@
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
\ No newline at end of file
diff --git a/src/views/produce/bodyManage/breast_rating/index.vue b/src/views/produce/bodyManage/breast_rating/index.vue
index b34bc16..a02281d 100644
--- a/src/views/produce/bodyManage/breast_rating/index.vue
+++ b/src/views/produce/bodyManage/breast_rating/index.vue
@@ -10,15 +10,39 @@
start-placeholder="开始日期" end-placeholder="结束日期">
-
-
-
-
- 清空
-
+
+
+
+
+
+
+ 添加
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+ 清空全部
+
+
+
+
+ {{ tag }}
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
@@ -30,9 +54,16 @@
+
+
+
+
+
+
+
搜索
- 重置
+
@@ -54,13 +85,6 @@
-
- 已选耳号:
-
- {{ tag }}
-
-
@@ -151,7 +175,9 @@ import { listBreast_rating, getBreast_rating, delBreast_rating, addBreast_rating
import { checkSheepByManageTags, getVarietyOptions } from "@/api/produce/other/fixHoof"
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
import { getCurrentInstance, reactive, ref } from "vue"
-
+import { Plus, Delete, ArrowUp, ArrowDown } from '@element-plus/icons-vue'
+import { nextTick } from 'vue'
+import dayjs from 'dayjs'
const { proxy } = getCurrentInstance()
const breast_ratingList = ref([])
@@ -166,7 +192,14 @@ const title = ref("")
const daterangeCreateTime = ref([])
const daterangeEventDate = ref([]);
const isAdd = ref(false)
-
+const pasteText = ref('')
+const isExpanded = ref(false)
+const defaultShowCount = 2
+const displayedEarTags = computed(() => {
+ const list = queryParams.value.manageTagsList
+ if (isExpanded.value || list.length <= defaultShowCount) return list
+ return list.slice(0, defaultShowCount)
+})
const data = reactive({
form: {
id: null,
@@ -184,7 +217,9 @@ const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 20,
- manageTags: null
+ manageTags: null,
+ manageTagsList: [],
+ isDelete: null
},
rules: {
manageTags: [
@@ -285,8 +320,9 @@ function handleQuery() {
/** 重置按钮操作 */
function resetQuery() {
daterangeCreateTime.value = []
- daterangeEventDate.value = [];
+ daterangeEventDate.value = []
queryParams.value.manageTagsList = []
+ queryParams.value.isDelete = null
proxy.resetForm("queryRef")
handleQuery()
}
@@ -304,6 +340,7 @@ function handleAdd() {
isAdd.value = true
open.value = true
title.value = "添加乳房评分"
+ form.value.eventDate = dayjs().format('YYYY-MM-DD')
}
/** 修改按钮操作 */
@@ -386,10 +423,42 @@ function searchEarNumber(query) {
function clearEarNumbers() {
queryParams.value.manageTagsList = []
}
+
function removeEarNumber(tag) {
const idx = queryParams.value.manageTagsList.indexOf(tag)
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
}
+function handlePaste() {
+ nextTick(() => handlePasteSubmit())
+}
+
+function handlePasteSubmit() {
+ if (!pasteText.value.trim()) return
+ const separators = /[\s,,\n\r\t]+/
+ const raw = pasteText.value.trim().split(separators).filter(v => v)
+ const exist = new Set(queryParams.value.manageTagsList)
+ const adds = []
+ const dups = []
+ raw.forEach(v => {
+ if (!exist.has(v)) { adds.push(v); exist.add(v) }
+ else dups.push(v)
+ })
+ if (adds.length) {
+ queryParams.value.manageTagsList = [...queryParams.value.manageTagsList, ...adds]
+ proxy.$modal.msgSuccess(`成功添加 ${adds.length} 个耳号${dups.length ? `,已忽略 ${dups.length} 个重复` : ''}`)
+ } else if (dups.length) {
+ proxy.$modal.msgWarning('所有耳号均已存在')
+ }
+ pasteText.value = ''
+}
+
+function toggleExpand() {
+ isExpanded.value = !isExpanded.value
+}
+
+function handleEarChange(val) {
+ queryParams.value.manageTagsList = [...new Set(val)]
+}
onMounted(() => {
loadVarietyOptions()
getSheepfoldOptions()
@@ -398,9 +467,23 @@ onMounted(() => {
\ No newline at end of file
diff --git a/src/views/produce/manage_sheep/add_sheep/index.vue b/src/views/produce/manage_sheep/add_sheep/index.vue
index ede094f..0e84b67 100644
--- a/src/views/produce/manage_sheep/add_sheep/index.vue
+++ b/src/views/produce/manage_sheep/add_sheep/index.vue
@@ -1,7 +1,7 @@
-
导入
下载模板
@@ -130,8 +130,13 @@
-
+
将文件拖到此处,或点击上传
+
+
+ 仅允许导入xls、xlsx格式文件。
+
+
确 定
@@ -148,6 +153,7 @@ 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'
+import { UploadFilled } from '@element-plus/icons-vue'
const { proxy } = getCurrentInstance()
diff --git a/src/views/produce/manage_sheep/changeComment/index.vue b/src/views/produce/manage_sheep/changeComment/index.vue
index 1d8476d..bab1b93 100644
--- a/src/views/produce/manage_sheep/changeComment/index.vue
+++ b/src/views/produce/manage_sheep/changeComment/index.vue
@@ -6,45 +6,79 @@
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
-
-
-
-
- 清空
-
-
-
-
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+
+
+ 清空全部
+
+
+
+
+
+
+ {{ tag }}
+
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选择耳号:
-
- {{ tag }}
-
-
-
-
-
{{ parseTime(scope.row.eventDate, '{y}-{m}-{d}') }}
+
+
+
@@ -103,11 +137,22 @@
+
+
+
+ {{ tag }}
+
+
+
+ 一键清空 ({{ batchTags.length }})
+
+
-
+
\ No newline at end of file
diff --git a/src/views/produce/manage_sheep/changeEar/index.vue b/src/views/produce/manage_sheep/changeEar/index.vue
index 602ce20..01ed427 100644
--- a/src/views/produce/manage_sheep/changeEar/index.vue
+++ b/src/views/produce/manage_sheep/changeEar/index.vue
@@ -6,15 +6,49 @@
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
-
-
-
-
- 清空
-
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+
+
+ 清空全部
+
+
+
+
+
+ {{ tag }}
+
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -37,16 +77,9 @@
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
-
+
+
+
+ {{ parseTime(scope.row.eventDate, '{y}-{m}-{d}') }}
+
+
{{ scope.row.earType === 0 ? '电子耳号' : '管理耳号' }}
@@ -79,19 +117,15 @@
-
-
- {{ parseTime(scope.row.eventDate, '{y}-{m}-{d}') }}
-
-
+
-
{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+
+
+ 清空全部
+
+
+
+
+
+
+ {{ tag }}
+
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
@@ -26,23 +61,27 @@
-
+
+
+
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
-
+
-
-
{{ parseTime(scope.row.eventDate, '{y}-{m}-{d}') }}
+
+
+
-
{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}
+
+
+
+ {{ tag }}
+
+
+
+ 一键清空 ({{ batchTags.length }})
+
+
@@ -132,10 +185,12 @@
\ No newline at end of file
diff --git a/src/views/produce/manage_sheep/trans_group/index.vue b/src/views/produce/manage_sheep/trans_group/index.vue
index 2258375..0b2455c 100644
--- a/src/views/produce/manage_sheep/trans_group/index.vue
+++ b/src/views/produce/manage_sheep/trans_group/index.vue
@@ -6,25 +6,50 @@
start-placeholder="开始日期" end-placeholder="结束日期" />
-
-
-
-
- 清空
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+
+
+ 清空全部
+
+
+
+
+
+
+ {{ tag }}
+
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
@@ -36,18 +61,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
-
-
-
-
-
+
+
+
+
+
-
{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}
+
-
+
-
-
-
-
-
- 已选 {{ form.manageTags.length }} 个
-
-
+
+
+
+
+
+ {{ tag }}
+
+
+
+ 一键清空 ({{ batchTags.length }})
+
+
-
+
@@ -136,14 +184,15 @@
-
+
-
-
+
+
@@ -172,9 +221,12 @@ import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/
import { checkSheepByManageTags, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
import { getSheepTypeList } from "@/api/produce/bodyManage/body_measure"
import request from '@/utils/request'
+import dayjs from 'dayjs'
+import { nextTick } from 'vue'
+import { Plus, Delete, ArrowUp, ArrowDown } from '@element-plus/icons-vue'
const { proxy } = getCurrentInstance();
-const { trans_group_reason, status, trans_group_event_type } = proxy.useDict('trans_group_reason', 'status', 'trans_group_event_type');
+const { trans_group_reason, trans_group_event_type } = proxy.useDict('trans_group_reason', 'status', 'trans_group_event_type');
const trans_groupList = ref([]);
const open = ref(false);
@@ -196,12 +248,26 @@ const isAdd = ref(false);
const ranchOptions = ref([]);
const currentRanchSheepfolds = ref([]);
+const pasteText = ref('') // 批量粘贴输入框
+const isExpanded = ref(false) // 折叠状态
+const defaultShowCount = 2 // 默认展示条数
+
+/* 计算:控制实际展示的耳号列表 */
+const displayedEarTags = computed(() => {
+ const list = queryParams.value.manageTagsList || []
+ if (isExpanded.value || list.length <= defaultShowCount) return list
+ return list.slice(0, defaultShowCount)
+})
+
+const batchTags = ref([]) // 本次要新增的多条耳号
+const batchSheep = ref([]) // 对应的羊只对象
const data = reactive({
form: {
manageTags: [],
tagDetails: {},
eventType: null,
transDate: null,
+ currentFoldAllEars: ref([]),
},
queryParams: {
pageNum: 1,
@@ -214,7 +280,9 @@ const data = reactive({
varietyId: null,
sheepTypeId: null,
status: null,
+ isDelete: null,
},
+ manageTagsRaw: '',
rules: {
manageTags: [{ required: true, message: '请输入耳号', trigger: 'blur' }],
eventType: [{ required: true, message: '请选择事件类型', trigger: 'change' }],
@@ -226,7 +294,7 @@ const data = reactive({
technician: [{ required: true, message: '请输入技术员', trigger: 'blur' }],
},
});
-const { queryParams, form, rules } = toRefs(data);
+const { queryParams, form, rules, manageTagsRaw } = toRefs(data)
const earOptions = ref([])
const earLoading = ref(false)
/** 查询转群记录列表 */
@@ -262,10 +330,13 @@ function reset() {
comment: null,
createBy: null,
createTime: null,
- manageTags: [],
+ manageTags: '',
tagDetails: {},
sheepTypeId: null,
+ transDate: dayjs().format('YYYY-MM-DD')
};
+ batchTags.value = []
+ batchSheep.value = []
proxy.resetForm('trans_groupRef');
}
@@ -295,8 +366,18 @@ async function handleSheepFilter() {
}
if (isOnlySheepfold) {
- await loadSheepBySheepfoldOnly(foldFrom, ranchId);
- } else if (isOnlyTypeOrCombined) {
+ const list = await loadSheepBySheepfoldOnly(foldFrom, ranchId);
+ if (list.length === 0) {
+ proxy.$message.info('当前转出羊舍暂无羊只');
+ form.value.manageTags = [];
+ return;
+ }
+ form.value.manageTags = [...list];
+ await loadSheepInfo();
+ return;
+ }
+
+ if (isOnlyTypeOrCombined) {
form.value.manageTags = [];
let loadedSheep = [];
@@ -307,7 +388,8 @@ async function handleSheepFilter() {
}
if (loadedSheep.length > 0) {
- form.value.manageTags = loadedSheep.map((sheep) => sheep.manageTags);
+ const list = loadedSheep.map(s => s.manageTags);
+ form.value.manageTags = [...list];
await loadSheepInfo();
} else {
proxy.$message.info("未查询到符合条件的耳号");
@@ -381,7 +463,8 @@ async function loadSheepBySheepfoldOnly(sheepfoldId, ranchId) {
return [];
}
sheepOptions.value = newSheepList;
- return newSheepList;
+
+ return newSheepList.map(s => s.manageTags);
} catch (error) {
console.error('根据羊舍加载耳号失败:', error);
const errorMsg = error.response?.data?.msg || '加载羊舍耳号失败,请重试';
@@ -416,20 +499,26 @@ async function loadSheepBySheepfoldAndType(sheepfoldId, typeId) {
}
//只通过羊只类型
-async function loadSheepByTypeOnly(typeId) {
+async function loadSheepByTypeOnly(typeId, ranchId) {
try {
const res = await request({
url: '/sheep/sheep/listByTypeId',
method: 'get',
- params: { typeId },
+ params: { typeId, ranchId }
});
- const sheepList = res.rows || [];
- const formattedSheep = sheepList.map((sheep) => ({
- id: sheep.id,
- manageTags: sheep.manageTags,
- sheepfoldId: sheep.sheepfoldId,
+ const all = res.rows || [];
+ // 只保留当前牧场
+ const filtered = all.filter(s => s.ranchId === ranchId);
+ if (filtered.length === 0) {
+ proxy.$message.info('当前牧场下无此类型羊只');
+ sheepOptions.value = [];
+ return [];
+ }
+ const formattedSheep = filtered.map(s => ({
+ id: s.id,
+ manageTags: s.manageTags,
+ sheepfoldId: s.sheepfoldId
}));
-
sheepOptions.value = formattedSheep;
return formattedSheep;
} catch (error) {
@@ -480,15 +569,6 @@ async function loadSheepInfo() {
proxy.$message.warning('部分耳号不合法,已自动过滤');
}
form.value.tagDetails = tagDetails;
-
- if (firstRanchId && isAdd.value) {
- form.value.ranchId = firstRanchId;
- handleRanchChange(firstRanchId);
- }
-
- if (firstSheepfoldId && isAdd.value) {
- form.value.foldFrom = Number(firstSheepfoldId);
- }
}
//取消按钮
@@ -506,7 +586,11 @@ function handleQuery() {
//重置搜索框
function resetQuery() {
daterangeTransDate.value = [];
- queryParams.value.manageTagsList = []
+ queryParams.value.manageTagsList = [];
+ queryParams.value.eventType = null;
+ queryParams.value.technician = null;
+ queryParams.value.isDelete = null;
+ manageTagsRaw.value = '';
proxy.resetForm('queryRef');
handleQuery();
}
@@ -524,7 +608,7 @@ function handleAdd() {
title.value = '添加转群记录';
isAdd.value = true;
sheepOptions.value = [];
- form.value.manageTags = [];
+ form.value.manageTags = '';
}
//修改
@@ -577,46 +661,50 @@ async function handleUpdate(row) {
loading.value = false;
}
}
-
-//提交
function submitForm() {
proxy.$refs.trans_groupRef.validate((valid) => {
if (!valid) return;
- const allTags = form.value.manageTags;
- const tagDetails = form.value.tagDetails || {};
- if (!allTags || allTags.length === 0) {
- proxy.$modal.msgError('请选择或输入至少一个耳号');
- return;
+ if (batchTags.value.length === 0) {
+ proxy.$modal.msgError('请输入至少一个有效耳号')
+ return
}
- const requests = allTags.map(async (tag) => {
- const formData = { ...form.value };
- const details = tagDetails[tag] || {};
- formData.manageTags = tag;
- formData.sheepId = details.sheepId;
- formData.foldFrom = details.sheepfoldId;
- formData.comment = details.comment || '';
- formData.varietyId = details.varietyId || formData.varietyId;
+ // 批量新增
+ Promise.all(
+ batchTags.value.map((tag, idx) => {
+ const sheep = batchSheep.value[idx]
- if (formData.id) {
- return updateTrans_group(formData);
- } else {
- return addTrans_group(formData);
- }
- });
+ // 检查转入转出是否相同
+ if (sheep.sheepfoldId === form.value.foldTo) {
+ throw new Error(`耳号 ${tag} 转入转出羊舍不能相同`)
+ }
- Promise.all(requests)
- .then(() => {
- proxy.$modal.msgSuccess('操作成功');
- open.value = false;
- getList();
+ return addTrans_group({
+ sheepId: sheep.id,
+ manageTags: tag,
+ eventType: form.value.eventType,
+ ranchId: form.value.ranchId,
+ foldFrom: sheep.sheepfoldId,
+ foldTo: form.value.foldTo,
+ sheepTypeId: sheep.sheepTypeId || form.value.sheepTypeId,
+ varietyId: sheep.varietyId,
+ reason: form.value.reason,
+ transDate: form.value.transDate,
+ technician: form.value.technician,
+ comment: sheep.comment || ''
+ })
})
- .catch((error) => {
- proxy.$modal.msgError(`处理失败:${error.message}`);
- });
- });
+ ).then(() => {
+ proxy.$modal.msgSuccess(`成功新增 ${batchTags.value.length} 条转群记录`)
+ open.value = false
+ getList()
+ }).catch((error) => {
+ proxy.$modal.msgError(error.message || '新增失败')
+ })
+ })
}
+
//删除
function handleDelete(row) {
const _ids = row.id || ids.value;
@@ -673,19 +761,110 @@ function loadSheepTypeList() {
sheepTypeOptions.value = [];
});
}
-function searchEarNumber(query) {
- if (!query) { earOptions.value = []; return }
- earLoading.value = true
- searchEarNumbers(query.trim()).then(res => {
- earOptions.value = res.data || []
- }).finally(() => earLoading.value = false)
+/* 粘贴事件 */
+function handlePaste() {
+ nextTick(() => handlePasteSubmit())
}
+/* 批量提交:拆词 → 去重 → 回填 */
+function handlePasteSubmit() {
+ if (!pasteText.value || !pasteText.value.trim()) return
+ const separators = /[\p{White_Space},,\n\r\t]+/u
+ const raw = pasteText.value.trim().split(separators).filter(v => v)
+ const exist = new Set(queryParams.value.manageTagsList || [])
+ const adds = []
+ const dups = []
+ raw.forEach(v => {
+ if (!exist.has(v)) { adds.push(v); exist.add(v) }
+ else dups.push(v)
+ })
+ if (adds.length) {
+ queryParams.value.manageTagsList = [...(queryParams.value.manageTagsList || []), ...adds]
+ proxy.$modal.msgSuccess(`成功添加 ${adds.length} 个耳号,当前共 ${queryParams.value.manageTagsList.length} 个` +
+ (dups.length > 0 ? `,已忽略 ${dups.length} 个重复耳号` : ''))
+ } else if (dups.length > 0) {
+ proxy.$modal.msgWarning('所有耳号均已存在')
+ }
+ pasteText.value = ''
+}
+
+/* 切换展开/收起 */
+function toggleExpand() {
+ isExpanded.value = !isExpanded.value
+}
+
+/* 选择器变化时去重 */
+function handleEarChange(val) {
+ queryParams.value.manageTagsList = [...new Set(val)]
+}
+
+/* 一键清空 */
function clearEarNumbers() {
queryParams.value.manageTagsList = []
+ pasteText.value = ''
+ isExpanded.value = false
}
-function removeEarNumber(tag) {
- const idx = queryParams.value.manageTagsList.indexOf(tag)
- if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
+
+//校验和回显(和改备注完全一致)
+async function onManageTagsBlur() {
+ const raw = form.value.manageTags?.trim()
+ if (!raw) return
+
+ const separators = /[\p{White_Space},,]+/u
+ const tags = [...new Set(raw.split(separators).filter(v => v))]
+
+ if (tags.length === 1) {
+ try {
+ const { data: sheep } = await checkSheepByManageTags(tags[0].trim())
+ if (sheep) {
+ batchTags.value = [tags[0]]
+ batchSheep.value = [sheep]
+ } else {
+ proxy.$modal.msgWarning('未找到该耳号对应羊只')
+ batchTags.value = []
+ batchSheep.value = []
+ }
+ } catch {
+ proxy.$modal.msgWarning('未找到该耳号对应羊只')
+ batchTags.value = []
+ batchSheep.value = []
+ }
+ return
+ }
+
+ batchTags.value = []
+ batchSheep.value = []
+ for (const tag of tags) {
+ try {
+ const { data: sheep } = await checkSheepByManageTags(tag.trim())
+ if (sheep) {
+ batchTags.value.push(tag)
+ batchSheep.value.push(sheep)
+ } else {
+ proxy.$modal.msgWarning(`耳号 ${tag} 未找到对应羊只,已跳过`)
+ }
+ } catch {
+ proxy.$modal.msgWarning(`耳号 ${tag} 未找到对应羊只,已跳过`)
+ }
+ }
+
+ if (!batchTags.value.length) return
+ form.value.manageTags = batchTags.value.join(' ')
+}
+
+// 删除单个批量耳号(和改备注一致)
+function removeBatchTag(idx) {
+ batchTags.value.splice(idx, 1)
+ batchSheep.value.splice(idx, 1)
+ // 实时回写输入框,保持可视化
+ form.value.manageTags = batchTags.value.join(' ')
+}
+
+// 一键清空批量耳号(和改备注一致)
+function clearBatchTags() {
+ batchTags.value = []
+ batchSheep.value = []
+ form.value.manageTags = ''
+ form.value.oldComment = ''
}
onMounted(() => {
loadSheepfold();
@@ -704,10 +883,25 @@ onMounted(() => {
border-radius: 12px;
font-size: 12px;
}
-.selected-ear-numbers{
- margin-bottom: 16px;
- padding: 10px;
+
+.selected-ear-numbers {
+ max-height: 150px;
+ overflow-y: auto;
+ padding: 8px;
background: #f5f7fa;
border-radius: 4px;
+ border: 1px dashed #dcdfe6;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+}
+
+.selected-ear-numbers::-webkit-scrollbar {
+ width: 6px;
+}
+
+.selected-ear-numbers::-webkit-scrollbar-thumb {
+ background-color: #dcdfe6;
+ border-radius: 3px;
}
\ No newline at end of file
diff --git a/src/views/produce/manage_sheep/transition_info/index.vue b/src/views/produce/manage_sheep/transition_info/index.vue
index eb446d7..346f375 100644
--- a/src/views/produce/manage_sheep/transition_info/index.vue
+++ b/src/views/produce/manage_sheep/transition_info/index.vue
@@ -7,21 +7,61 @@
start-placeholder="开始日期" end-placeholder="结束日期">
-
-
-
-
- 清空
-
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+
+
+ 清空全部
+
+
+
+
+
+
+ {{ tag }}
+
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
+
+
+
+
+
@@ -34,28 +74,40 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
@@ -81,36 +133,37 @@
+
-
{{ parseTime(scope.row.transitionDate, '{y}-{m}-{d}') }}
-
+
-
-
-
-
-
-
+
+
-
-
- 待审批
- 审批完成
- 未知状态
-
-
-
{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}
+
+
+
+
+
+
+
-
+
-
-
-
-
-
- 已选 {{ form.manageTags.length }} 个
-
-
+
+
+
+
+ {{ tag }}
+
+
+
+ 一键清空 ({{ batchTags.length }})
+
+
+
-
-
+
@@ -201,7 +258,7 @@
-
+
@@ -216,10 +273,10 @@
-
-
-
+
+
+
@@ -235,10 +292,10 @@
@@ -768,9 +902,24 @@ onMounted(() => {
}
.selected-ear-numbers {
- margin-bottom: 16px;
- padding: 10px;
+ max-height: 150px;
+ overflow-y: auto;
+ padding: 8px;
background: #f5f7fa;
border-radius: 4px;
+ border: 1px dashed #dcdfe6;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ margin-top: 8px;
+}
+
+.selected-ear-numbers::-webkit-scrollbar {
+ width: 6px;
+}
+
+.selected-ear-numbers::-webkit-scrollbar-thumb {
+ background-color: #dcdfe6;
+ border-radius: 3px;
}
\ No newline at end of file
diff --git a/src/views/produce/other/castrate/index.vue b/src/views/produce/other/castrate/index.vue
index a1b89d2..aa42fb4 100644
--- a/src/views/produce/other/castrate/index.vue
+++ b/src/views/produce/other/castrate/index.vue
@@ -7,15 +7,39 @@
start-placeholder="开始日期" end-placeholder="结束日期" />
-
-
-
-
- 清空
-
+
+
+
+
+
+
+ 添加
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+ 清空全部
+
+
+
+
+ {{ tag }}
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
@@ -27,18 +51,18 @@
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
@@ -136,7 +160,9 @@
import { listCastrate, getCastrate, delCastrate, addCastrate, searchEarNumbers } from '@/api/produce/other/castrate'
import { checkSheepByManageTags, getVarietyOptions, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
-
+import { Plus, Delete, ArrowUp, ArrowDown } from '@element-plus/icons-vue'
+import { nextTick } from 'vue'
+import dayjs from 'dayjs'
const { proxy } = getCurrentInstance()
const castrateList = ref([])
@@ -152,7 +178,14 @@ const daterangeCreateTime = ref([])
const sheepOptions = ref([])
const varietyOptions = ref([])
const daterangeEventDate = ref([])
-
+const pasteText = ref('')
+const isExpanded = ref(false)
+const defaultShowCount = 2
+const displayedEarTags = computed(() => {
+ const list = queryParams.value.manageTagsList
+ if (isExpanded.value || list.length <= defaultShowCount) return list
+ return list.slice(0, defaultShowCount)
+})
const data = reactive({
form: {
manageTags: [],
@@ -173,6 +206,8 @@ const data = reactive({
createTime: null,
beginEventDate: null,
endEventDate: null,
+ manageTagsList: [],
+ isDelete: null
},
rules: {
manageTags: [
@@ -327,6 +362,7 @@ function resetQuery() {
daterangeCreateTime.value = []
daterangeEventDate.value = []
queryParams.value.manageTagsList = []
+ queryParams.value.isDelete = null
proxy.resetForm('queryRef')
handleQuery()
}
@@ -342,6 +378,7 @@ function handleAdd() {
reset()
open.value = true
title.value = '添加去势'
+ form.value.eventDate = dayjs().format('YYYY-MM-DD')
}
//修改
@@ -469,10 +506,43 @@ function searchEarNumber(query) {
function clearEarNumbers() {
queryParams.value.manageTagsList = []
}
+
function removeEarNumber(tag) {
const idx = queryParams.value.manageTagsList.indexOf(tag)
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
}
+
+function handlePaste() {
+ nextTick(() => handlePasteSubmit())
+}
+
+function handlePasteSubmit() {
+ if (!pasteText.value.trim()) return
+ const separators = /[\s,,\n\r\t]+/
+ const raw = pasteText.value.trim().split(separators).filter(v => v)
+ const exist = new Set(queryParams.value.manageTagsList)
+ const adds = []
+ const dups = []
+ raw.forEach(v => {
+ if (!exist.has(v)) { adds.push(v); exist.add(v) }
+ else dups.push(v)
+ })
+ if (adds.length) {
+ queryParams.value.manageTagsList = [...queryParams.value.manageTagsList, ...adds]
+ proxy.$modal.msgSuccess(`成功添加 ${adds.length} 个耳号${dups.length ? `,已忽略 ${dups.length} 个重复` : ''}`)
+ } else if (dups.length) {
+ proxy.$modal.msgWarning('所有耳号均已存在')
+ }
+ pasteText.value = ''
+}
+
+function toggleExpand() {
+ isExpanded.value = !isExpanded.value
+}
+
+function handleEarChange(val) {
+ queryParams.value.manageTagsList = [...new Set(val)]
+}
onMounted(() => {
getSheepfoldOptions()
getVarietyOptions()
@@ -488,10 +558,25 @@ onMounted(() => {
border-radius: 12px;
font-size: 12px;
}
-.selected-ear-numbers{
- margin-bottom: 16px;
- padding: 10px;
+
+.selected-ear-numbers {
+ max-height: 150px;
+ overflow-y: auto;
+ padding: 8px;
background: #f5f7fa;
border-radius: 4px;
+ border: 1px dashed #dcdfe6;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+}
+
+.selected-ear-numbers::-webkit-scrollbar {
+ width: 6px;
+}
+
+.selected-ear-numbers::-webkit-scrollbar-thumb {
+ background-color: #dcdfe6;
+ border-radius: 3px;
}
\ No newline at end of file
diff --git a/src/views/produce/other/fixHoof/index.vue b/src/views/produce/other/fixHoof/index.vue
index be52d1a..1824216 100644
--- a/src/views/produce/other/fixHoof/index.vue
+++ b/src/views/produce/other/fixHoof/index.vue
@@ -6,15 +6,39 @@
start-placeholder="开始日期" end-placeholder="结束日期" />
-
-
-
-
- 清空
-
+
+
+
+
+
+
+ 添加
+
+
+
+ 已选: {{ queryParams.manageTagsList.length }} 个
+
+
+ 清空全部
+
+
+
+
+ {{ tag }}
+
+
+ {{ isExpanded ? '收起' : `展开剩余 ${queryParams.manageTagsList.length - defaultShowCount} 个` }}
+
+
+
+
+
@@ -26,18 +50,18 @@
+
+
+
+
+
+
+
搜索
- 重置
+
-
- 已选耳号:
-
- {{ tag }}
-
-
@@ -133,9 +157,11 @@