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

perf:优化报表下载

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