Commit 1f0769b4 authored by “yiyousong”'s avatar “yiyousong”

perf:优化报表下载

parent b69af704
...@@ -69,4 +69,7 @@ export default { ...@@ -69,4 +69,7 @@ export default {
.ant-calendar-next-year-btn::after { .ant-calendar-next-year-btn::after {
border-color: rgba(0, 0, 0, 1) !important; border-color: rgba(0, 0, 0, 1) !important;
} }
.ant-progress-text {
color: #fff !important;
}
</style> </style>
\ No newline at end of file
...@@ -96,7 +96,7 @@ const filterVal = [ ...@@ -96,7 +96,7 @@ const filterVal = [
"organization", "organization",
"customerDesignPictures", "customerDesignPictures",
"customerDesignVideos", "customerDesignVideos",
"memberLevel", "levelName",
"lastLoginTime", "lastLoginTime",
"status", "status",
]; // 导出的表头字段名,需要导出表格字段名 ]; // 导出的表头字段名,需要导出表格字段名
......
...@@ -209,31 +209,15 @@ export default { ...@@ -209,31 +209,15 @@ export default {
// 获取报表 // 获取报表
async getPrintList() { async getPrintList() {
this.loading = true; this.loading = true;
let pramse = { let { total, data } = await this.getDataList();
page: this.current, this.total = total;
size: this.size, this.tableData = data;
siteId: this.siteId, this.$emit("update", { total, time: this.searchForm.time });
type: this.searchForm.status,
createTimeStart: this.searchForm.time[0],
createTimeEnd: this.searchForm.time[1],
};
if (this.searchForm.type == 1) {
pramse.matterName = `%${this.searchForm.searchName}%`;
} else {
pramse.materialName = `%${this.searchForm.searchName}%`;
}
let res = await getPrintList(pramse);
if (res.code == 1) {
let { data, total } = res.data;
this.total = total;
this.tableData = data;
this.$emit("update", { total, time: this.searchForm.time });
}
this.loading = false; this.loading = false;
}, },
// 获取导出数据 // 获取数据函数
async getExportPrintList() { async getDataList(searchForm) {
let list = []; let list = [];
let listTotal = 0; let listTotal = 0;
let pramse = { let pramse = {
...@@ -243,6 +227,7 @@ export default { ...@@ -243,6 +227,7 @@ export default {
type: this.searchForm.status, type: this.searchForm.status,
createTimeStart: this.searchForm.time[0], createTimeStart: this.searchForm.time[0],
createTimeEnd: this.searchForm.time[1], createTimeEnd: this.searchForm.time[1],
...searchForm,
}; };
if (this.searchForm.type == 1) { if (this.searchForm.type == 1) {
pramse.matterName = `%${this.searchForm.searchName}%`; pramse.matterName = `%${this.searchForm.searchName}%`;
...@@ -250,10 +235,10 @@ export default { ...@@ -250,10 +235,10 @@ export default {
pramse.materialName = `%${this.searchForm.searchName}%`; pramse.materialName = `%${this.searchForm.searchName}%`;
} }
let res = await getPrintList(pramse); let res = await getPrintList(pramse);
if (res.data.code == 1) { if (res.code == 1) {
let { data, total } = res.data.data; let { data, total } = res.data;
list = data;
listTotal = total; listTotal = total;
list = data;
} }
return { return {
data: list, data: list,
...@@ -304,7 +289,7 @@ export default { ...@@ -304,7 +289,7 @@ export default {
"填单记录报表" + this.$moment().format("YYYYMMDDHHmmss") "填单记录报表" + this.$moment().format("YYYYMMDDHHmmss")
); );
} else { } else {
this.dataSection(this.getExportPrintList, {}, (data) => { this.dataSection(this.getDataList, {}, (data) => {
if (!data.length) { if (!data.length) {
this.$message.warning("暂无数据"); this.$message.warning("暂无数据");
return; return;
......
...@@ -32,8 +32,8 @@ import { mapState } from "vuex"; ...@@ -32,8 +32,8 @@ import { mapState } from "vuex";
import storage from "@/utils/js/Storage"; import storage from "@/utils/js/Storage";
import { export2Excel } from "@/utils/js/exportExcel"; import { export2Excel } from "@/utils/js/exportExcel";
import { getSys12345 } from "@/api/dataAdmin"; import { getSys12345 } from "@/api/dataAdmin";
const tHeader = ["序号", "微信号", "电话号码", "拨打位置", "拨打时间"]; // 导出的表头名信息 const tHeader = ["微信号", "电话号码", "拨打位置", "拨打时间"]; // 导出的表头名信息
const filterVal = ["index", "nickname", "phone", "address", "create_time"]; // 导出的表头字段名,需要导出表格字段名 const filterVal = ["nickname", "phone", "address", "create_time"]; // 导出的表头字段名,需要导出表格字段名
export default { export default {
components: {}, components: {},
data() { data() {
......
...@@ -50,7 +50,6 @@ import FormDetails from "./components/FormDetails.vue"; ...@@ -50,7 +50,6 @@ import FormDetails from "./components/FormDetails.vue";
import { export2Excel } from "@/utils/js/exportExcel"; import { export2Excel } from "@/utils/js/exportExcel";
import { adminList, letterInfo } from "@/api/dataAdmin"; import { adminList, letterInfo } from "@/api/dataAdmin";
const tHeader = [ const tHeader = [
"序号",
"工单编号", "工单编号",
"信件标题", "信件标题",
"信件类别", "信件类别",
...@@ -64,7 +63,6 @@ const tHeader = [ ...@@ -64,7 +63,6 @@ const tHeader = [
"办理部门", "办理部门",
]; // 导出的表头名信息 ]; // 导出的表头名信息
const filterVal = [ const filterVal = [
"index",
"LetterCode", "LetterCode",
"strTitle", "strTitle",
"strType", "strType",
...@@ -294,6 +292,18 @@ export default { ...@@ -294,6 +292,18 @@ export default {
if (this.selectedRowKeys.length && this.excelData.length) { if (this.selectedRowKeys.length && this.excelData.length) {
// 深度克隆避免影响页面表格展示 // 深度克隆避免影响页面表格展示
let data = this.$_.cloneDeep(this.excelData); let data = this.$_.cloneDeep(this.excelData);
for (let item of data) {
item.strGender =
item.strGender == 0 ? "" : item.strGender == 1 ? "" : "";
item.source =
item.source == 1
? "微官网"
: item.source == 2
? "自助服务系统"
: item.source == 3
? "数字填单系统"
: "";
}
export2Excel( export2Excel(
this.tHeader, this.tHeader,
this.filterVal, this.filterVal,
...@@ -306,6 +316,18 @@ export default { ...@@ -306,6 +316,18 @@ export default {
this.$message.warning("暂无数据"); this.$message.warning("暂无数据");
return; return;
} }
for (let item of data) {
item.strGender =
item.strGender == 0 ? "" : item.strGender == 1 ? "" : "";
item.source =
item.source == 1
? "微官网"
: item.source == 2
? "自助服务系统"
: item.source == 3
? "数字填单系统"
: "";
}
export2Excel( export2Excel(
this.tHeader, this.tHeader,
this.filterVal, this.filterVal,
......
...@@ -173,31 +173,15 @@ export default { ...@@ -173,31 +173,15 @@ export default {
// 获取报表 // 获取报表
async getBillList() { async getBillList() {
this.loading = true; this.loading = true;
let pramse = { let { total, data } = await this.getDataList();
page: this.current, this.total = total;
size: this.size, this.tableData = data;
siteId: this.siteId, this.$emit("update", { total, time: this.searchForm.time });
type: this.searchForm.status,
operTimeStart: this.searchForm.time[0],
operTimeEnd: this.searchForm.time[1],
};
if (this.searchForm.type == 1) {
pramse.matterName = `%${this.searchForm.searchName}%`;
} else {
pramse.materialName = `%${this.searchForm.searchName}%`;
}
let res = await getBillList(pramse);
if (res.code == 1) {
let { data, total } = res.data;
this.total = total;
this.tableData = data;
this.$emit("update", { total, time: this.searchForm.time });
}
this.loading = false; this.loading = false;
}, },
// 获取导出数据 // 获取数据函数
async getExportPrintList() { async getDataList(searchForm) {
let list = []; let list = [];
let listTotal = 0; let listTotal = 0;
let pramse = { let pramse = {
...@@ -207,6 +191,7 @@ export default { ...@@ -207,6 +191,7 @@ export default {
type: this.searchForm.status, type: this.searchForm.status,
operTimeStart: this.searchForm.time[0], operTimeStart: this.searchForm.time[0],
operTimeEnd: this.searchForm.time[1], operTimeEnd: this.searchForm.time[1],
...searchForm,
}; };
if (this.searchForm.type == 1) { if (this.searchForm.type == 1) {
pramse.matterName = `%${this.searchForm.searchName}%`; pramse.matterName = `%${this.searchForm.searchName}%`;
...@@ -216,8 +201,8 @@ export default { ...@@ -216,8 +201,8 @@ export default {
let res = await getBillList(pramse); let res = await getBillList(pramse);
if (res.code == 1) { if (res.code == 1) {
let { data, total } = res.data; let { data, total } = res.data;
list = data;
listTotal = total; listTotal = total;
list = data;
} }
return { return {
data: list, data: list,
...@@ -257,7 +242,7 @@ export default { ...@@ -257,7 +242,7 @@ export default {
"样表记录报表" + this.$moment().format("YYYYMMDDHHmmss") "样表记录报表" + this.$moment().format("YYYYMMDDHHmmss")
); );
} else { } else {
this.dataSection(this.getExportPrintList, {}, (data) => { this.dataSection(this.getDataList, {}, (data) => {
if (!data.length) { if (!data.length) {
this.$message.warning("暂无数据"); this.$message.warning("暂无数据");
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment