新需求修改
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 查询条件 -->
|
||||
<el-form :inline="true" :model="queryParams" class="filter-form">
|
||||
<el-form-item label="耳号">
|
||||
<el-input v-model="queryParams.manageEarTag" placeholder="请输入耳号" />
|
||||
<el-input v-model="queryParams.manageEarTag" placeholder="请输入耳号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="筛选天数">
|
||||
<el-input-number v-model="queryParams.screenDays" :min="1" placeholder="请输入天数" />
|
||||
@@ -14,21 +13,18 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作按钮行 -->
|
||||
<div class="button-group">
|
||||
<el-popover placement="bottom" width="400" trigger="click">
|
||||
<el-checkbox-group v-model="selectedFields" class="checkbox-columns">
|
||||
<!-- 使用 :value 替代 :label -->
|
||||
<el-checkbox v-for="col in allColumns" :key="col.prop" :value="col.prop">{{ col.label }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<template #reference>
|
||||
<el-button type="info">展示列</el-button>
|
||||
<el-button type="info" icon="Menu">展示列</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-button type="success" @click="handleExport">导出</el-button>
|
||||
<el-button type="success" icon="Download" @click="handleExport">导出</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-table :data="list" border style="width: 100%" v-loading="loading" :row-key="row => row.sheepId">
|
||||
<el-table-column
|
||||
v-for="col in visibleColumns"
|
||||
@@ -36,11 +32,11 @@
|
||||
:label="col.label"
|
||||
:prop="col.prop"
|
||||
:min-width="col.minWidth || 120"
|
||||
:sortable="col.sortable || false"
|
||||
:formatter="col.formatter || undefined"
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
@@ -49,7 +45,7 @@
|
||||
@current-change="handlePageChange"
|
||||
@size-change="handleSizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-sizes="[20, 50, 100, 200, 500, 1000, 2000]"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -68,49 +64,50 @@ export default {
|
||||
list: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20, // 修改默认每页条数
|
||||
manageEarTag: null,
|
||||
screenDays: 100 // 默认筛选天数
|
||||
},
|
||||
selectedFields: [],
|
||||
// 修改:为数字字段添加 sortable: true
|
||||
allColumns: [
|
||||
{ label: "耳号", prop: "manageEarTag" },
|
||||
{ label: "品种", prop: "variety" },
|
||||
{ label: "挤奶开始时间", prop: "milkingStartTime", formatter: row => row.milkingStartTime ? format(new Date(row.milkingStartTime),'yyyy-MM-dd') : '' },
|
||||
{ label: "干奶时间", prop: "dryEndTime", formatter: row => row.dryEndTime ? format(new Date(row.dryEndTime),'yyyy-MM-dd') : '' },
|
||||
{ label: "筛选天数", prop: "screenDays" },
|
||||
{ label: "挤奶天数", prop: "milkingDays" },
|
||||
{ label: "校正后最大胎次", prop: "maxParity" },
|
||||
{ label: "系统奶量之合计", prop: "sumSystemMilk" },
|
||||
{ label: "校正奶量之合计", prop: "sumCorrectedMilk" },
|
||||
{ label: "校正日平均奶量", prop: "avgCorrectedDaily" },
|
||||
{ label: "胎次1的总奶量", prop: "sumParity1Milk" },
|
||||
{ label: "胎次2的总奶量", prop: "sumParity2Milk" },
|
||||
{ label: "胎次3的总奶量", prop: "sumParity3Milk" },
|
||||
{ label: "胎次4的总奶量", prop: "sumParity4Milk" },
|
||||
{ label: "胎次1日平均", prop: "avgParity1Daily" },
|
||||
{ label: "胎次2日平均", prop: "avgParity2Daily" },
|
||||
{ label: "胎次3日平均", prop: "avgParity3Daily" },
|
||||
{ label: "胎次4日平均", prop: "avgParity4Daily" },
|
||||
{ label: "泌乳天数", prop: "lactationDays" },
|
||||
{ label: "过去7日均奶量", prop: "avgLast7Milk" },
|
||||
{ label: "校正过去7日均", prop: "avgLast7Corrected" },
|
||||
{ label: "过去14日均奶量", prop: "avgLast14Milk" },
|
||||
{ label: "过去30日均奶量", prop: "avgLast30Milk" },
|
||||
{ label: "筛选天数", prop: "screenDays", sortable: true },
|
||||
{ label: "挤奶天数", prop: "milkingDays", sortable: true },
|
||||
{ label: "校正后最大胎次", prop: "maxParity", sortable: true },
|
||||
{ label: "系统奶量之合计", prop: "sumSystemMilk", sortable: true },
|
||||
{ label: "校正奶量之合计", prop: "sumCorrectedMilk", sortable: true },
|
||||
{ label: "校正日平均奶量", prop: "avgCorrectedDaily", sortable: true },
|
||||
{ label: "胎次1的总奶量", prop: "sumParity1Milk", sortable: true },
|
||||
{ label: "胎次2的总奶量", prop: "sumParity2Milk", sortable: true },
|
||||
{ label: "胎次3的总奶量", prop: "sumParity3Milk", sortable: true },
|
||||
{ label: "胎次4的总奶量", prop: "sumParity4Milk", sortable: true },
|
||||
{ label: "胎次1日平均", prop: "avgParity1Daily", sortable: true },
|
||||
{ label: "胎次2日平均", prop: "avgParity2Daily", sortable: true },
|
||||
{ label: "胎次3日平均", prop: "avgParity3Daily", sortable: true },
|
||||
{ label: "胎次4日平均", prop: "avgParity4Daily", sortable: true },
|
||||
{ label: "泌乳天数", prop: "lactationDays", sortable: true },
|
||||
{ label: "过去7日均奶量", prop: "avgLast7Milk", sortable: true },
|
||||
{ label: "校正过去7日均", prop: "avgLast7Corrected", sortable: true },
|
||||
{ label: "过去14日均奶量", prop: "avgLast14Milk", sortable: true },
|
||||
{ label: "过去30日均奶量", prop: "avgLast30Milk", sortable: true },
|
||||
{ label: "羊只类别", prop: "sheepCategory" },
|
||||
{ label: "生日", prop: "birthday", formatter: row => row.birthday ? format(new Date(row.birthday),'yyyy-MM-dd') : '' },
|
||||
{ label: "当前胎次", prop: "parity" },
|
||||
{ label: "月龄", prop: "monthAge" },
|
||||
{ label: "当前体重", prop: "currentWeight" },
|
||||
{ label: "当前胎次", prop: "parity", sortable: true },
|
||||
{ label: "月龄", prop: "monthAge", sortable: true },
|
||||
{ label: "当前体重", prop: "currentWeight", sortable: true },
|
||||
{ label: "繁育状态", prop: "breedStatus" },
|
||||
{ label: "父号", prop: "fatherManageTags" },
|
||||
{ label: "母号", prop: "motherManageTags" },
|
||||
{ label: "牧场", prop: "ranchName" },
|
||||
{ label: "家系", prop: "family" },
|
||||
{ label: "母亲挤奶天数", prop: "motherMilkingDays" },
|
||||
{ label: "母亲校正奶量之合计", prop: "motherSumCorrected" },
|
||||
{ label: "母亲校正后最大胎次", prop: "motherMaxParity" },
|
||||
{ label: "母亲校正日平均奶量", prop: "motherAvgCorrectedDaily" }
|
||||
{ label: "母亲挤奶天数", prop: "motherMilkingDays", sortable: true },
|
||||
{ label: "母亲校正奶量之合计", prop: "motherSumCorrected", sortable: true },
|
||||
{ label: "母亲校正后最大胎次", prop: "motherMaxParity", sortable: true },
|
||||
{ label: "母亲校正日平均奶量", prop: "motherAvgCorrectedDaily", sortable: true }
|
||||
]
|
||||
};
|
||||
},
|
||||
@@ -120,6 +117,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
visibleColumns() {
|
||||
// 保持原有顺序
|
||||
return this.allColumns.filter(col => this.selectedFields.includes(col.prop));
|
||||
}
|
||||
},
|
||||
@@ -140,7 +138,7 @@ export default {
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
manageEarTag: null,
|
||||
screenDays: 100
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user