修改羊只档案显示列及重置功能,调整表格显示列的顺序

This commit is contained in:
wyt
2026-01-30 16:12:02 +08:00
parent 4c55e8026e
commit 27ffbd84a5

View File

@@ -334,21 +334,6 @@
<span>{{ parseTime(scope.row.weaningDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.weaningDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
v-if="columns['statusId'].visible"
label="羊只状态"
align="center"
prop="statusId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">羊只状态</span>
</template>
<template #default="scope">
<dict-tag :options="sheep_status" :value="scope.row.statusId"/>
</template>
</el-table-column>
<el-table-column <el-table-column
v-if="columns['weaningWeight'].visible" v-if="columns['weaningWeight'].visible"
label="断奶体重" label="断奶体重"
@@ -491,18 +476,6 @@
<span style="font-weight: bold; color: #333;">受体id</span> <span style="font-weight: bold; color: #333;">受体id</span>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column
v-if="columns['receptorManageTags'].visible"
label="受体耳号"
align="center"
prop="receptorManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">受体耳号</span>
</template>
</el-table-column>
<!-- <el-table-column <!-- <el-table-column
v-if="columns['fatherFatherId'].visible" v-if="columns['fatherFatherId'].visible"
label="祖父号id" label="祖父号id"
@@ -599,6 +572,18 @@
<span style="font-weight: bold; color: #333;">外祖母耳号</span> <span style="font-weight: bold; color: #333;">外祖母耳号</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
v-if="columns['receptorManageTags'].visible"
label="受体耳号"
align="center"
prop="receptorManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">受体耳号</span>
</template>
</el-table-column>
<el-table-column <el-table-column
v-if="columns['matingDate'].visible" v-if="columns['matingDate'].visible"
label="配种日期" label="配种日期"
@@ -608,7 +593,7 @@
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">配种日期</span> <span style="font-weight: bold; color: #333;">最近配种日期</span>
</template> </template>
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.matingDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.matingDate, '{y}-{m}-{d}') }}</span>
@@ -623,7 +608,7 @@
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">配种类型</span> <span style="font-weight: bold; color: #333;">最近配种类型</span>
</template> </template>
<template #default="scope"> <template #default="scope">
<dict-tag :options="breed_type" :value="scope.row.matingTypeId"/> <dict-tag :options="breed_type" :value="scope.row.matingTypeId"/>
@@ -638,7 +623,7 @@
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">孕检日期</span> <span style="font-weight: bold; color: #333;">最近孕检日期</span>
</template> </template>
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.pregDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.pregDate, '{y}-{m}-{d}') }}</span>
@@ -653,7 +638,7 @@
sortable sortable
> >
<template #header> <template #header>
<span style="font-weight: bold; color: #333;">产羔日期</span> <span style="font-weight: bold; color: #333;">最近产羔日期</span>
</template> </template>
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.lambingDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.lambingDate, '{y}-{m}-{d}') }}</span>
@@ -894,7 +879,7 @@
<span style="font-weight: bold; color: #333;">来源牧场</span> <span style="font-weight: bold; color: #333;">来源牧场</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
v-if="columns['updateBy'].visible" v-if="columns['updateBy'].visible"
label="修改人" label="修改人"
align="center" align="center"
@@ -947,6 +932,21 @@
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> -->
<el-table-column
v-if="columns['statusId'].visible"
label="羊只状态"
align="center"
prop="statusId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">羊只状态</span>
</template>
<template #default="scope">
<dict-tag :options="sheep_status" :value="scope.row.statusId"/>
</template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
label="操作" label="操作"
@@ -995,7 +995,6 @@
<el-checkbox label="parity">胎次</el-checkbox> <el-checkbox label="parity">胎次</el-checkbox>
<el-checkbox label="birthWeight">出生体重</el-checkbox> <el-checkbox label="birthWeight">出生体重</el-checkbox>
<el-checkbox label="weaningDate">断奶日期</el-checkbox> <el-checkbox label="weaningDate">断奶日期</el-checkbox>
<el-checkbox label="statusId">羊只状态</el-checkbox>
<el-checkbox label="weaningWeight">断奶体重</el-checkbox> <el-checkbox label="weaningWeight">断奶体重</el-checkbox>
<el-checkbox label="currentWeight">当前体重</el-checkbox>\ <el-checkbox label="currentWeight">当前体重</el-checkbox>\
<el-checkbox label="weaningDayAge">断奶日龄</el-checkbox> <el-checkbox label="weaningDayAge">断奶日龄</el-checkbox>
@@ -1007,7 +1006,6 @@
<!-- <el-checkbox label="bsMotherId">母号id</el-checkbox> --> <!-- <el-checkbox label="bsMotherId">母号id</el-checkbox> -->
<el-checkbox label="motherManageTags">母亲耳号</el-checkbox> <el-checkbox label="motherManageTags">母亲耳号</el-checkbox>
<!-- <el-checkbox label="receptorId">受体id</el-checkbox> --> <!-- <el-checkbox label="receptorId">受体id</el-checkbox> -->
<el-checkbox label="receptorManageTags">受体耳号</el-checkbox>
<!-- <el-checkbox label="fatherFatherId">祖父号id</el-checkbox> --> <!-- <el-checkbox label="fatherFatherId">祖父号id</el-checkbox> -->
<el-checkbox label="grandfatherManageTags">祖父耳号</el-checkbox> <el-checkbox label="grandfatherManageTags">祖父耳号</el-checkbox>
<!-- <el-checkbox label="fatherMotherId">祖母号id</el-checkbox> --> <!-- <el-checkbox label="fatherMotherId">祖母号id</el-checkbox> -->
@@ -1016,6 +1014,7 @@
<el-checkbox label="maternalGrandfatherManageTags">外祖父耳号</el-checkbox> <el-checkbox label="maternalGrandfatherManageTags">外祖父耳号</el-checkbox>
<!-- <el-checkbox label="motherId">外祖母号id</el-checkbox> --> <!-- <el-checkbox label="motherId">外祖母号id</el-checkbox> -->
<el-checkbox label="maternalGrandmotherManageTags">外祖母耳号</el-checkbox> <el-checkbox label="maternalGrandmotherManageTags">外祖母耳号</el-checkbox>
<el-checkbox label="receptorManageTags">受体耳号</el-checkbox>
<el-checkbox label="matingDate">配种日期</el-checkbox> <el-checkbox label="matingDate">配种日期</el-checkbox>
<el-checkbox label="matingTypeId">配种类型</el-checkbox> <el-checkbox label="matingTypeId">配种类型</el-checkbox>
<el-checkbox label="pregDate">孕检日期</el-checkbox> <el-checkbox label="pregDate">孕检日期</el-checkbox>
@@ -1038,10 +1037,11 @@
<el-checkbox label="sourceDate">入群日期</el-checkbox> <el-checkbox label="sourceDate">入群日期</el-checkbox>
<!-- <el-checkbox label="sourceRanchId">来源牧场id</el-checkbox> --> <!-- <el-checkbox label="sourceRanchId">来源牧场id</el-checkbox> -->
<el-checkbox label="sourceRanch">来源牧场</el-checkbox> <el-checkbox label="sourceRanch">来源牧场</el-checkbox>
<el-checkbox label="updateBy">修改人</el-checkbox> <!-- <el-checkbox label="updateBy">修改人</el-checkbox>
<el-checkbox label="updateTime">修改日期</el-checkbox> <el-checkbox label="updateTime">修改日期</el-checkbox>
<el-checkbox label="createBy">创建人</el-checkbox> <el-checkbox label="createBy">创建人</el-checkbox>
<el-checkbox label="createTime">创建日期</el-checkbox> <el-checkbox label="createTime">创建日期</el-checkbox> -->
<el-checkbox label="statusId">羊只状态</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<div style="margin-top: 20px; display: flex; justify-content: space-between; align-items: center;"> <div style="margin-top: 20px; display: flex; justify-content: space-between; align-items: center;">
@@ -1085,8 +1085,36 @@ const multiple = ref(true)
const total = ref(0) const total = ref(0)
const title = ref("") const title = ref("")
const columnDialogVisible = ref(false) const columnDialogVisible = ref(false)
// const selectedColumns = ref([
// 'id', 'bsManageTags', 'ranchId', 'drRanch', 'sheepfoldId', 'sheepfoldName', 'electronicTags', 'varietyId', 'variety', 'family', 'name', 'gender', 'birthday', 'dayAge', 'monthAge', 'parity', 'birthWeight', 'weaningDate', 'statusId', 'weaningWeight', 'currentWeight','weaningDayAge', 'weaningDailyGain','breedStatusId', 'breed', 'bsFatherId', 'fatherManageTags', 'bsMotherId', 'motherManageTags', 'receptorId', 'receptorManageTags', 'fatherFatherId', 'grandfatherManageTags', 'fatherMotherId', 'grandmotherManageTags', 'fatherId', 'maternalGrandfatherManageTags', 'motherId', 'maternalGrandmotherManageTags', 'matingDate', 'matingTypeId', 'pregDate', 'lambingDate', 'lambingDay', 'matingDay', 'gestationDay', 'expectedDate', 'postLambingDay', 'lactationDay', 'anestrousDay', 'matingCounts', 'matingTotal', 'miscarriageCounts', 'comment', 'controlled', 'body', 'breast', 'source', 'sourceDate', 'sourceRanchId', 'sourceRanch', 'updateBy', 'updateTime', 'createBy', 'createTime'
// ])
// 在 setup 中修改 selectedColumns 的默认值
const selectedColumns = ref([ const selectedColumns = ref([
'id', 'bsManageTags', 'ranchId', 'drRanch', 'sheepfoldId', 'sheepfoldName', 'electronicTags', 'varietyId', 'variety', 'family', 'name', 'gender', 'birthday', 'dayAge', 'monthAge', 'parity', 'birthWeight', 'weaningDate', 'statusId', 'weaningWeight', 'currentWeight','weaningDayAge', 'weaningDailyGain','breedStatusId', 'breed', 'bsFatherId', 'fatherManageTags', 'bsMotherId', 'motherManageTags', 'receptorId', 'receptorManageTags', 'fatherFatherId', 'grandfatherManageTags', 'fatherMotherId', 'grandmotherManageTags', 'fatherId', 'maternalGrandfatherManageTags', 'motherId', 'maternalGrandmotherManageTags', 'matingDate', 'matingTypeId', 'pregDate', 'lambingDate', 'lambingDay', 'matingDay', 'gestationDay', 'expectedDate', 'postLambingDay', 'lactationDay', 'anestrousDay', 'matingCounts', 'matingTotal', 'miscarriageCounts', 'comment', 'controlled', 'body', 'breast', 'source', 'sourceDate', 'sourceRanchId', 'sourceRanch', 'updateBy', 'updateTime', 'createBy', 'createTime' 'bsManageTags', // 耳号
'drRanch', // 牧场名称
'sheepfoldName', // 羊舍名称
'electronicTags', // 电子耳号
'variety', // 品种
'family', //家系
'name', // 羊只类型
'gender', // 性别
'birthday', // 出生日期
'dayAge', // 日龄
'monthAge', //月龄
'parity', //胎次
'birthWeight', //出生体重
'weaningDate', //断奶日期
'weaningWeight',//断奶体重
'currentWeight', // 当前体重
'breed', // 繁殖状态
'fatherManageTags', // 父亲耳号
'motherManageTags', // 母亲耳号
'grandfatherManageTags',//祖父
'grandmotherManageTags',//祖母
'maternalGrandfatherManageTags',//外祖父
'maternalGrandmotherManageTags',//外祖母
'comment'//备注
]) ])
const isAllSelected = ref(false) const isAllSelected = ref(false)
const columns = reactive({ const columns = reactive({
@@ -1380,10 +1408,38 @@ function confirmColumnSettings() {
columnDialogVisible.value = false columnDialogVisible.value = false
} }
// 重置列设置 // 修改重置函数
function resetColumnSettings() { function resetColumnSettings() {
// 只重置为默认的核心字段
selectedColumns.value = [ selectedColumns.value = [
'id', 'bsManageTags', 'ranchId', 'drRanch', 'sheepfoldId', 'sheepfoldName', 'electronicTags', 'varietyId', 'variety', 'family', 'name', 'gender', 'birthday', 'dayAge', 'monthAge', 'parity', 'birthWeight', 'weaningDate', 'statusId', 'weaningWeight', 'currentWeight','weaningDayAge', 'weaningDailyGain','breedStatusId', 'breed', 'bsFatherId', 'fatherManageTags', 'bsMotherId', 'motherManageTags', 'receptorId', 'receptorManageTags', 'fatherFatherId', 'grandfatherManageTags', 'fatherMotherId', 'grandmotherManageTags', 'fatherId', 'maternalGrandfatherManageTags', 'motherId', 'maternalGrandmotherManageTags', 'matingDate', 'matingTypeId', 'pregDate', 'lambingDate', 'lambingDay', 'matingDay', 'gestationDay', 'expectedDate', 'postLambingDay', 'lactationDay', 'anestrousDay', 'matingCounts', 'matingTotal', 'miscarriageCounts', 'comment', 'controlled', 'body', 'breast', 'source', 'sourceDate', 'sourceRanchId', 'sourceRanch', 'updateBy', 'updateTime', 'createBy', 'createTime' 'bsManageTags', // 耳号
'drRanch', // 牧场名称
'sheepfoldName', // 羊舍名称
'electronicTags', // 电子耳号
'variety', // 品种
'family', //家系
'name', // 羊只类型
'gender', // 性别
'birthday', // 出生日期
'dayAge', // 日龄
'monthAge', //月龄
'parity', //胎次
'birthWeight', //出生体重
'weaningDate', //断奶日期
'weaningWeight',//断奶体重
'currentWeight', // 当前体重
'breed', // 繁殖状态
'fatherManageTags', // 父亲耳号
'motherManageTags', // 母亲耳号
'grandfatherManageTags',//祖父
'grandmotherManageTags',//祖母
'maternalGrandfatherManageTags',//外祖父
'maternalGrandmotherManageTags',//外祖母
'comment'//备注
] ]
updateColumnVisibility() updateColumnVisibility()
localStorage.setItem('selectedColumns', JSON.stringify(selectedColumns.value)) localStorage.setItem('selectedColumns', JSON.stringify(selectedColumns.value))