fix : 修改导出问题
This commit is contained in:
parent
3c1634b797
commit
38ce78b8ee
|
@ -289,15 +289,29 @@ export default {
|
||||||
},
|
},
|
||||||
handleExport() {
|
handleExport() {
|
||||||
let filename = '实验室联系方式表.xlsx';
|
let filename = '实验室联系方式表.xlsx';
|
||||||
console.log(this.tableData)
|
getCtAll({page:0}).then((res) =>{
|
||||||
const ws = XLSX.utils.json_to_sheet(this.tableData.results);
|
if (res.data){
|
||||||
const wb = XLSX.utils.book_new();
|
let tableData = res.data;
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
const ws = XLSX.utils.json_to_sheet(tableData);
|
||||||
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
const wb = XLSX.utils.book_new();
|
||||||
try {
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
try {
|
||||||
return;
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
||||||
|
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
this.$message.error(data.message || '导出失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.showExportDialog = false;
|
||||||
|
.catch(error => {
|
||||||
|
this.$message.error('请求失败,请稍后再试');
|
||||||
|
console.error(error);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.handleDialogClose();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1;
|
||||||
|
|
|
@ -261,12 +261,11 @@ export default {
|
||||||
// if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
// if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
||||||
// this.$message.error('请选择完整的起止日期!');
|
// this.$message.error('请选择完整的起止日期!');
|
||||||
// return;}
|
// return;}
|
||||||
getMyQi().then((response) => {
|
getMyQi({page:0}).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
let filename = '资质变更情况统计表.xlsx';
|
let filename = '资质变更情况统计表.xlsx';
|
||||||
let tableData = response.data;
|
let tableData = response.data;
|
||||||
|
const ws = XLSX.utils.json_to_sheet(tableData);
|
||||||
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
|
||||||
const wb = XLSX.utils.book_new();
|
const wb = XLSX.utils.book_new();
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
|
|
@ -257,14 +257,11 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
handleExport() {
|
handleExport() {
|
||||||
// if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
getAllQi({page:0}).then((response) => {
|
||||||
// this.$message.error('请选择完整的起止日期!');
|
|
||||||
// return;}
|
|
||||||
getAllQi().then((response) => {
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
let filename = '资质情况统计表.xlsx';
|
let filename = '资质情况统计表.xlsx';
|
||||||
let tableData = response.data;
|
let tableData = response.data;
|
||||||
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
const ws = XLSX.utils.json_to_sheet(tableData);
|
||||||
const wb = XLSX.utils.book_new();
|
const wb = XLSX.utils.book_new();
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
|
|
@ -158,14 +158,6 @@ class CertificateViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
|
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
thread.join()
|
thread.join()
|
||||||
# # Update the objects
|
|
||||||
# for obj in objects:
|
|
||||||
# # for field, value in updates.items():
|
|
||||||
# # setattr(obj, field, value)
|
|
||||||
# # obj.save()
|
|
||||||
# serializer = CertificateSerializer(obj, data=updates, partial=True)
|
|
||||||
# serializer.is_valid(raise_exception=True)
|
|
||||||
# serializer.save()
|
|
||||||
|
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue