Commit a0484dce authored by “yiyousong”'s avatar “yiyousong”

pref:修改填单报表显示和导出

parent 425ab64b
......@@ -92,7 +92,7 @@
</div>
<div class="tabFont ellipsis">
样表全称:{{
record.materialFullName ? record.materialFullName : "--"
record.materiaFullName ? record.materiaFullName : "--"
}}
</div>
</template>
......@@ -216,7 +216,7 @@ export default {
"matterName",
"matterFullName",
"materialName",
"materialFullName",
"materiaFullName",
"idName",
"idCard",
"mobile",
......@@ -242,6 +242,8 @@ export default {
},
// 获取报表列表
async togetPrintList(searchForm = {}) {
let list = [];
let listTotal = 0;
let pramse = {
page: this.tablePagination.current,
size: this.tablePagination.pageSize,
......@@ -261,8 +263,13 @@ export default {
if (code == 1) {
this.tableSourceData = data.data;
this.tablePagination.total = data.total;
return data.data;
list = data.data;
listTotal = data.total;
}
return {
data: list,
total: listTotal,
};
},
// 重置搜索
handleReset() {
......@@ -304,10 +311,9 @@ export default {
1: "本地打印",
2: "在线提交",
};
let data = [];
if (this.tableSelectedKeys.length && this.tableSelectedRows.length) {
// 深度克隆避免影响页面表格展示
data = this.$_.cloneDeep(this.tableSelectedRows);
let data = this.$_.cloneDeep(this.tableSelectedRows);
data.forEach((item) => {
Object.keys(obj).forEach((keys) => {
if (item.type == keys) {
......@@ -315,27 +321,61 @@ export default {
}
});
});
} else {
data = this.$_.cloneDeep(
await this.togetPrintList({ page: 1, size: -1 })
export2Excel(
this.tHeader,
this.filterVal,
data,
"填单记录报表" + this.$moment().format("YYYYMMDDHHmmss")
);
if (!data.length) return;
for (let item of data) {
Object.keys(obj).forEach((key) => {
if (item.type == key) {
item.type = obj[key];
}
});
} else {
this.dataSection(this.togetPrintList, {}, (data) => {
if (!data.length) {
this.$message.warning("暂无数据");
return;
}
data.forEach((item) => {
Object.keys(obj).forEach((keys) => {
if (item.type == keys) {
item.type = obj[keys];
}
});
});
export2Excel(
this.tHeader,
this.filterVal,
data,
"填单记录报表" + this.$moment().format("YYYYMMDDHHmmss")
);
});
}
this.btnLoading = false;
},
// 数据切片
async dataSection(fn, searchForm, callback) {
let dataList = [];
let page = 1;
let size = 1000;
let execute = async () => {
let { data, total } = await fn(page, size, searchForm);
dataList = [...dataList, ...data];
this.$app.progressFile.show = true;
this.$app.progressFile.percent = parseInt(
(dataList.length / total) * 100
);
if (dataList.length >= total || data.length == 0) {
if (callback) callback(dataList);
this.$app.progressFile.show = false;
this.$app.progressFile.percent = 1;
return;
}
setTimeout(() => {
page += 1;
execute();
});
};
execute();
},
},
};
</script>
......
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