Merge branch 'xiaoman'
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="waterStationWaterFunctionAreaBillId" :datasource="url"
|
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="waterSiteBillId" :datasource="url"
|
||||||
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
|
|
||||||
@@ -39,8 +39,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #billName="{ text, record }">
|
<template #billName="{ text, record }">
|
||||||
<div class="editable-cell">
|
<div class="editable-cell">
|
||||||
<div v-if="editableData[record.waterStationWaterFunctionAreaBillId]" class="editable-cell-input-wrapper">
|
<div v-if="editableData[record.waterSiteBillId]" class="editable-cell-input-wrapper">
|
||||||
<a-input v-model:value="editableData[record.waterStationWaterFunctionAreaBillId].billName" @pressEnter="save(record)" />
|
<a-input v-model:value="editableData[record.waterSiteBillId].billName" @pressEnter="save(record)" />
|
||||||
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="editable-cell-text-wrapper">
|
<div v-else class="editable-cell-text-wrapper">
|
||||||
@@ -51,9 +51,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #reportTime="{ text, record }">
|
<template #reportTime="{ text, record }">
|
||||||
<div class="editable-cell">
|
<div class="editable-cell">
|
||||||
<div v-if="editableData[record.waterStationWaterFunctionAreaBillId]" class="editable-cell-input-wrapper">
|
<div v-if="editableData[record.waterSiteBillId]" class="editable-cell-input-wrapper">
|
||||||
<a-date-picker v-model:value="editableData[record.waterStationWaterFunctionAreaBillId].reportTime"></a-date-picker>
|
<a-date-picker v-model:value="editableData[record.waterSiteBillId].reportTime"></a-date-picker>
|
||||||
<!-- <a-input v-model:value="editableData[record.waterStationWaterFunctionAreaBillId].reportTime" @pressEnter="save(record)" /> -->
|
<!-- <a-input v-model:value="editableData[record.waterSiteBillId].reportTime" @pressEnter="save(record)" /> -->
|
||||||
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="editable-cell-text-wrapper">
|
<div v-else class="editable-cell-text-wrapper">
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import moment from "moment";
|
||||||
import {
|
import {
|
||||||
// autonomyWaterFunctionTotalUrl,
|
// autonomyWaterFunctionTotalUrl,
|
||||||
listWaterSiteMonthTotal
|
listWaterSiteMonthTotal
|
||||||
@@ -324,17 +325,54 @@
|
|||||||
},
|
},
|
||||||
/* 导出 */
|
/* 导出 */
|
||||||
exportFile() {
|
exportFile() {
|
||||||
const columns = this.columns.filter(item => item.dataIndex);
|
|
||||||
const arr = [];
|
const arr = [];
|
||||||
const th = columns.map((item) => item.title);
|
const th1 = [];
|
||||||
arr.push(th);
|
const th2 = [];
|
||||||
this.data.forEach((d) => {
|
const merges = []; // 合并
|
||||||
const td = columns.map((item) => d[item.dataIndex]);
|
const columnsTemp = []; // 树形结构整理成list
|
||||||
|
this.columns.forEach((item, index) => {
|
||||||
|
if (item.children) {
|
||||||
|
item.children.forEach((citem) => {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push(citem.title)
|
||||||
|
columnsTemp.push(citem)
|
||||||
|
})
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - item.children.length
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push("")
|
||||||
|
columnsTemp.push(item)
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: index
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 1,
|
||||||
|
c: index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
arr.push(th1, th2);
|
||||||
|
this.datasource.forEach((d) => {
|
||||||
|
const td = columnsTemp.map((item) => d[item.dataIndex]);
|
||||||
arr.push(td);
|
arr.push(td);
|
||||||
});
|
});
|
||||||
|
|
||||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
sheet['!merges'] = merges;
|
||||||
|
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where
|
||||||
|
.timeEnd).format("YYYY年MM月DD日") + "统计数据");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import moment from "moment";
|
||||||
import {
|
import {
|
||||||
listWaterSiteYoy
|
listWaterSiteYoy
|
||||||
} from "@/api/ecology/river-statis";
|
} from "@/api/ecology/river-statis";
|
||||||
@@ -210,17 +211,102 @@
|
|||||||
},
|
},
|
||||||
/* 导出 */
|
/* 导出 */
|
||||||
exportFile() {
|
exportFile() {
|
||||||
const columns = this.columns.filter(item => item.dataIndex);
|
//环比数据
|
||||||
const arr = [];
|
const arr = [];
|
||||||
const th = columns.map((item) => item.title);
|
const th1 = [];
|
||||||
arr.push(th);
|
const th2 = [];
|
||||||
this.data.forEach((d) => {
|
const merges = []; // 合并
|
||||||
const td = columns.map((item) => d[item.dataIndex]);
|
const columnsTemp = []; // 树形结构整理成list
|
||||||
|
this.columnsMom.forEach((item, index) => {
|
||||||
|
if (item.children) {
|
||||||
|
item.children.forEach((citem) => {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push(citem.title)
|
||||||
|
columnsTemp.push(citem)
|
||||||
|
})
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - item.children.length
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push("")
|
||||||
|
columnsTemp.push(item)
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: index
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 1,
|
||||||
|
c: index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
arr.push(th1, th2);
|
||||||
|
this.momData.forEach((d) => {
|
||||||
|
const td = columnsTemp.map((item) => d[item.dataIndex]);
|
||||||
arr.push(td);
|
arr.push(td);
|
||||||
});
|
});
|
||||||
|
|
||||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
//同比数据
|
||||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
const arr2 = [];
|
||||||
|
const th3 = [];
|
||||||
|
const th4 = [];
|
||||||
|
const merges2 = []; // 合并
|
||||||
|
const columnsTemp2 = []; // 树形结构整理成list
|
||||||
|
this.columnsYoy.forEach((item, index) => {
|
||||||
|
if (item.children) {
|
||||||
|
item.children.forEach((citem) => {
|
||||||
|
th3.push(item.title)
|
||||||
|
th4.push(citem.title)
|
||||||
|
columnsTemp2.push(citem)
|
||||||
|
})
|
||||||
|
merges2.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: th3.length - item.children.length
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 0,
|
||||||
|
c: th3.length - 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
th3.push(item.title)
|
||||||
|
th4.push("")
|
||||||
|
columnsTemp2.push(item)
|
||||||
|
merges2.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: index
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 1,
|
||||||
|
c: index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
arr2.push(th3, th4);
|
||||||
|
this.yoyData.forEach((d) => {
|
||||||
|
const td = columnsTemp2.map((item) => d[item.dataIndex]);
|
||||||
|
arr2.push(td);
|
||||||
|
});
|
||||||
|
var dataSheet=arr.concat(arr2);
|
||||||
|
console.log("dataSheet"+dataSheet);
|
||||||
|
let sheet = XLSX.utils.aoa_to_sheet(dataSheet);
|
||||||
|
sheet['!merges'] = merges;
|
||||||
|
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where
|
||||||
|
.timeEnd).format("YYYY年MM月DD日") + "统计数据");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -552,13 +552,13 @@
|
|||||||
header: 1,
|
header: 1,
|
||||||
});
|
});
|
||||||
const riverList = aoa.filter(
|
const riverList = aoa.filter(
|
||||||
(item) => {
|
(item,index) => {
|
||||||
if (this.param.system == "1") {
|
if (this.param.system == "1") {
|
||||||
return item[1] && item[1] != "时间"
|
return item[1] && item[1] != "时间"
|
||||||
} else {
|
} else {
|
||||||
|
if(index>1 && item[2] != "平均值" && item[2] != "最大值" && item[2] != "最小值" && item[2] != "有效数据个数" && item[2] != "总数据个数"){
|
||||||
return item[2] && item[2] != "时间" && item[2] != "三类标准" && item[2] != "平均值" && item[2] != "最大值" &&
|
return item;
|
||||||
item[2] != "最小值" && item[2] != "有效数据个数" && item[2] != "总数据个数"
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import moment from "moment";
|
||||||
import {
|
import {
|
||||||
listAvgCompositeIndex,
|
listAvgCompositeIndex,
|
||||||
listTargetInfo,
|
listTargetInfo,
|
||||||
@@ -183,17 +184,53 @@
|
|||||||
},
|
},
|
||||||
/* 导出 */
|
/* 导出 */
|
||||||
exportFile() {
|
exportFile() {
|
||||||
const columns = this.columns.filter(item => item.dataIndex);
|
|
||||||
const arr = [];
|
const arr = [];
|
||||||
const th = columns.map((item) => item.title);
|
const th1 = [];
|
||||||
arr.push(th);
|
const th2 = [];
|
||||||
this.data.forEach((d) => {
|
const merges = []; // 合并
|
||||||
const td = columns.map((item) => d[item.dataIndex]);
|
const columnsTemp = []; // 树形结构整理成list
|
||||||
|
this.columns.forEach((item, index) => {
|
||||||
|
if (item.children) {
|
||||||
|
item.children.forEach((citem) => {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push(citem.title)
|
||||||
|
columnsTemp.push(citem)
|
||||||
|
})
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - item.children.length
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push("")
|
||||||
|
columnsTemp.push(item)
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: index
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 1,
|
||||||
|
c: index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
arr.push(th1, th2);
|
||||||
|
this.momData.forEach((d) => {
|
||||||
|
const td = columnsTemp.map((item) => d[item.dataIndex]);
|
||||||
arr.push(td);
|
arr.push(td);
|
||||||
});
|
});
|
||||||
|
|
||||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
sheet['!merges'] = merges;
|
||||||
|
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where
|
||||||
|
.timeEnd).format("YYYY年MM月DD日") + "统计数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import moment from "moment";
|
||||||
import {
|
import {
|
||||||
listMonthCompositeIndex,
|
listMonthCompositeIndex,
|
||||||
listTargetInfo,
|
listTargetInfo,
|
||||||
@@ -188,17 +189,54 @@
|
|||||||
},
|
},
|
||||||
/* 导出 */
|
/* 导出 */
|
||||||
exportFile() {
|
exportFile() {
|
||||||
const columns = this.columns.filter(item => item.dataIndex);
|
|
||||||
const arr = [];
|
const arr = [];
|
||||||
const th = columns.map((item) => item.title);
|
const th1 = [];
|
||||||
arr.push(th);
|
const th2 = [];
|
||||||
this.data.forEach((d) => {
|
const merges = []; // 合并
|
||||||
const td = columns.map((item) => d[item.dataIndex]);
|
const columnsTemp = []; // 树形结构整理成list
|
||||||
|
this.columns.forEach((item, index) => {
|
||||||
|
if (item.children) {
|
||||||
|
item.children.forEach((citem) => {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push(citem.title)
|
||||||
|
columnsTemp.push(citem)
|
||||||
|
})
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - item.children.length
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push("")
|
||||||
|
columnsTemp.push(item)
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: index
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 1,
|
||||||
|
c: index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
arr.push(th1, th2);
|
||||||
|
this.momData.forEach((d) => {
|
||||||
|
const td = columnsTemp.map((item) => d[item.dataIndex]);
|
||||||
arr.push(td);
|
arr.push(td);
|
||||||
});
|
});
|
||||||
|
|
||||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
sheet['!merges'] = merges;
|
||||||
|
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where
|
||||||
|
.timeEnd).format("YYYY年MM月DD日") + "统计数据");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -193,6 +193,7 @@
|
|||||||
console.log(arr);
|
console.log(arr);
|
||||||
var target = {
|
var target = {
|
||||||
sectionName:'',
|
sectionName:'',
|
||||||
|
waterQualityGoal:'',
|
||||||
january:'',
|
january:'',
|
||||||
february:'',
|
february:'',
|
||||||
march:'',
|
march:'',
|
||||||
@@ -210,6 +211,7 @@
|
|||||||
};
|
};
|
||||||
arr.forEach(e => {
|
arr.forEach(e => {
|
||||||
target.sectionName = e.sectionName;
|
target.sectionName = e.sectionName;
|
||||||
|
target.waterQualityGoal=e.waterQualityGoal;
|
||||||
var month = e.samplingTime.split("-")[1];
|
var month = e.samplingTime.split("-")[1];
|
||||||
if (month == '01') {
|
if (month == '01') {
|
||||||
target.january = e.waterQualityCategory;
|
target.january = e.waterQualityCategory;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import moment from "moment";
|
||||||
import {
|
import {
|
||||||
listAutonomyWaterFunctionTotal,
|
listAutonomyWaterFunctionTotal,
|
||||||
} from "@/api/ecology/river-statis";
|
} from "@/api/ecology/river-statis";
|
||||||
@@ -141,17 +142,54 @@
|
|||||||
},
|
},
|
||||||
/* 导出 */
|
/* 导出 */
|
||||||
exportFile() {
|
exportFile() {
|
||||||
const columns = this.columns.filter(item => item.dataIndex);
|
|
||||||
const arr = [];
|
const arr = [];
|
||||||
const th = columns.map((item) => item.title);
|
const th1 = [];
|
||||||
arr.push(th);
|
const th2 = [];
|
||||||
this.data.forEach((d) => {
|
const merges = []; // 合并
|
||||||
const td = columns.map((item) => d[item.dataIndex]);
|
const columnsTemp = []; // 树形结构整理成list
|
||||||
|
this.columns.forEach((item, index) => {
|
||||||
|
if (item.children) {
|
||||||
|
item.children.forEach((citem) => {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push(citem.title)
|
||||||
|
columnsTemp.push(citem)
|
||||||
|
})
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - item.children.length
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push("")
|
||||||
|
columnsTemp.push(item)
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: index
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 1,
|
||||||
|
c: index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
arr.push(th1, th2);
|
||||||
|
this.datasource.forEach((d) => {
|
||||||
|
const td = columnsTemp.map((item) => d[item.dataIndex]);
|
||||||
arr.push(td);
|
arr.push(td);
|
||||||
});
|
});
|
||||||
|
|
||||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
sheet['!merges'] = merges;
|
||||||
|
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where
|
||||||
|
.timeEnd).format("YYYY年MM月DD日") + "统计数据");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -193,6 +193,7 @@
|
|||||||
console.log(arr);
|
console.log(arr);
|
||||||
var target = {
|
var target = {
|
||||||
sectionName:'',
|
sectionName:'',
|
||||||
|
waterQualityGoal:'',
|
||||||
january:'',
|
january:'',
|
||||||
february:'',
|
february:'',
|
||||||
march:'',
|
march:'',
|
||||||
@@ -210,6 +211,7 @@
|
|||||||
};
|
};
|
||||||
arr.forEach(e => {
|
arr.forEach(e => {
|
||||||
target.sectionName = e.sectionName;
|
target.sectionName = e.sectionName;
|
||||||
|
target.waterQualityGoal=e.waterQualityGoal;
|
||||||
var month = e.samplingTime.split("-")[1];
|
var month = e.samplingTime.split("-")[1];
|
||||||
if (month == '01') {
|
if (month == '01') {
|
||||||
target.january = e.waterQualityCategory;
|
target.january = e.waterQualityCategory;
|
||||||
@@ -247,8 +249,10 @@
|
|||||||
if (month == '12') {
|
if (month == '12') {
|
||||||
target.december = e.waterQualityCategory;
|
target.december = e.waterQualityCategory;
|
||||||
}
|
}
|
||||||
|
if(arr.length == '12'){
|
||||||
target.standardRate = e.standardRate;
|
target.standardRate = e.standardRate;
|
||||||
target.standard = e.standard;
|
target.standard = e.standard;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.datasource.push(target);
|
this.datasource.push(target);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import moment from "moment";
|
||||||
import {
|
import {
|
||||||
listNationalWaterFunctionTotal
|
listNationalWaterFunctionTotal
|
||||||
} from "@/api/ecology/river-statis";
|
} from "@/api/ecology/river-statis";
|
||||||
@@ -137,17 +138,54 @@
|
|||||||
},
|
},
|
||||||
/* 导出 */
|
/* 导出 */
|
||||||
exportFile() {
|
exportFile() {
|
||||||
const columns = this.columns.filter(item => item.dataIndex);
|
|
||||||
const arr = [];
|
const arr = [];
|
||||||
const th = columns.map((item) => item.title);
|
const th1 = [];
|
||||||
arr.push(th);
|
const th2 = [];
|
||||||
this.data.forEach((d) => {
|
const merges = []; // 合并
|
||||||
const td = columns.map((item) => d[item.dataIndex]);
|
const columnsTemp = []; // 树形结构整理成list
|
||||||
|
this.columns.forEach((item, index) => {
|
||||||
|
if (item.children) {
|
||||||
|
item.children.forEach((citem) => {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push(citem.title)
|
||||||
|
columnsTemp.push(citem)
|
||||||
|
})
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - item.children.length
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 0,
|
||||||
|
c: th1.length - 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
th1.push(item.title)
|
||||||
|
th2.push("")
|
||||||
|
columnsTemp.push(item)
|
||||||
|
merges.push({
|
||||||
|
s: {
|
||||||
|
r: 0,
|
||||||
|
c: index
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
r: 1,
|
||||||
|
c: index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
arr.push(th1, th2);
|
||||||
|
this.datasource.forEach((d) => {
|
||||||
|
const td = columnsTemp.map((item) => d[item.dataIndex]);
|
||||||
arr.push(td);
|
arr.push(td);
|
||||||
});
|
});
|
||||||
|
|
||||||
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
let sheet = XLSX.utils.aoa_to_sheet(arr);
|
||||||
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
|
sheet['!merges'] = merges;
|
||||||
|
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where
|
||||||
|
.timeEnd).format("YYYY年MM月DD日") + "统计数据");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user