|
@@ -44,8 +44,9 @@
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="collectiveFarmlandList"><!--@selection-change="handleSelectionChange"-->
|
|
|
-<!-- <el-table-column type="selection" width="55" align="center"/>-->
|
|
|
+ <!-- :summary-method="getSummaries" el-table属性:自定义最后一行合计属性 -->
|
|
|
+ <!--:span-method="arraySpanMethod" el-table属性:需要合并单元格时使用-->
|
|
|
+ <el-table v-loading="loading" :data="collectiveFarmlandList" show-summary>
|
|
|
<el-table-column label="所属部门" align="center" prop="deptName"/>
|
|
|
<el-table-column label="承包地(亩)" align="center" prop="contractedLand"/>
|
|
|
<el-table-column label="机动地(亩)" align="center" prop="maneuverableLand"/>
|
|
@@ -73,12 +74,10 @@ import {
|
|
|
countFarmland,
|
|
|
} from "@/api/data/digitalagriculture/collective_farmland/farmland";
|
|
|
import deptselector from '@/views/components/deptselector'
|
|
|
-import {getToken} from '@/utils/auth'
|
|
|
import {treeselect} from '@/api/system/dept'
|
|
|
import Treeselect from '@riophae/vue-treeselect'
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
import {format_date} from "@/views/data/common/dateExport";
|
|
|
-import {Message} from "element-ui";
|
|
|
|
|
|
export default {
|
|
|
name: "StandingBook",
|
|
@@ -221,6 +220,49 @@ export default {
|
|
|
...this.queryParams
|
|
|
}, `农村集体耕地_${format_date(new Date())}.xlsx`)
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义table最后一行合计函数
|
|
|
+ */
|
|
|
+ /*getSummaries(param) {
|
|
|
+ const { columns, data } = param;
|
|
|
+ const sums = [];
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = '合计';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const values = data.map(item => Number(item[column.property]));
|
|
|
+ if (!values.every(value => isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[index] += '';
|
|
|
+ } else {
|
|
|
+ sums[index] = '-';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return sums;
|
|
|
+ }*/
|
|
|
+ /**
|
|
|
+ * 合并单元格
|
|
|
+ */
|
|
|
+ /*arraySpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ //确认哪行需要合并
|
|
|
+ if (row.deptName === '合计') {
|
|
|
+ //确认哪列合并
|
|
|
+ if (columnIndex === 0) {
|
|
|
+ return [1, 2];
|
|
|
+ } else if (columnIndex === 1) {
|
|
|
+ return [0, 0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
}
|
|
|
};
|
|
|
</script>
|