Commit e50c2930 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

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