From b8cf368cce059d3521d8b4b935c8053eda547777 Mon Sep 17 00:00:00 2001 From: linfso Date: Sat, 24 May 2025 10:46:11 +0800 Subject: [PATCH] md --- src/views/system/sysDataAuditRecord/index.vue | 83 ++++++++++++------- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/src/views/system/sysDataAuditRecord/index.vue b/src/views/system/sysDataAuditRecord/index.vue index a3ec9dc0..be7dc979 100644 --- a/src/views/system/sysDataAuditRecord/index.vue +++ b/src/views/system/sysDataAuditRecord/index.vue @@ -63,6 +63,8 @@ storageName="sysDataAuditRecordList_main" + ref="refTable" + v-loading="loading" border size="small" @@ -146,6 +148,7 @@ export default { total: 0, // 数据修改记录表表格数据 sysDataAuditRecordList: [], + selectionList:[], currentId:null, openForm: false, @@ -155,6 +158,7 @@ export default { id:null, titleView:"", openView: false, + // 更新网点时间范围 daterangeCreateTime: [], // 更新网点时间范围 @@ -207,6 +211,7 @@ export default { this.ids = selection.map(item => item.id) this.single = selection.length!==1 this.multiple = !selection.length + this.selectionList=selection; }, // 排序 查询字段是表格中字段名字 动态取值排序顺序 handleSortChange(column) { @@ -254,47 +259,63 @@ export default { }, /** 导出按钮操作 */ handleExport() { - // this.download('system/sysDataAuditRecord/export', { - // ...this.queryParams - // }, `sysDataAuditRecord_${new Date().getTime()}.xlsx`) - const loadingInstance = this.$loading({ + const loadingInstance = this.$loading({ text: '正在导出...' - }) - var qParam = {...this.queryParams}; - qParam.pageNum=1; - qParam.pageSize=50000; + }) - listSysDataAuditRecord(this.addDateRange(qParam, this.dateTimeRange)).then(response => { - this.downloadLoading = false - if (response.code === 200) { - const curList = response.rows - import('@/vendor/Export2Excel').then(excel => { - const tHeader = ['id','主键值','运单号','表名称','表描述','字段名称','字段描述','旧值','新值','操作类型','转义代码','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','创建网点','更新网点',]; - const filterVal = ['id','pkValue','billCode','tableName','tableComment','fieldName','fieldComment','oldValue','newValue','operationType','transferCode','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',]; - const data = this.formatJson(filterVal, curList, response.rows) - excel.export_json_to_excel({ - header: tHeader, - data, - filename: '数据修改记录表', - autoWidth: true - }) - loadingInstance.close() - }) - } - }); + + if(this.selectionList&&this.selectionList.length>0){ + this.exportData(this.selectionList,loadingInstance); + } + else{ + let qExportParam={...this.queryParams}; + qExportParam.pageNum=1; + qExportParam.pageSize=20000; + + qExportParam=this.addDateRange(qExportParam, this.dateTimeRange,"createTime") + + listSysDataAuditRecord(qExportParam).then(response => { + if (response.code === 200) { + this.exportData(response.rows,loadingInstance); + } + }); + } + }, + exportData(selData,loadingInstance){ + const curList =selData + import('@/vendor/Export2Excel').then(excel => { + const exportParam=this.$refs.refTable.getExportParam(); + const tHeader = exportParam.header; + const filterVal = exportParam.filter; + const data = this.formatJson(filterVal, curList, selData) + excel.export_json_to_excel({ + header: tHeader, + data, + filename: '数据修改记录', + autoWidth: true + }) + loadingInstance.close() + }) }, formatJson(filterVal, jsonData, resData) { let index = 0 return jsonData.map(v => filterVal.map(j => { + if (j === 'index') { return ++index } - if (j === 'status') { - var statusStr='xxx' - if(v[j] == 10){ - statusStr='xxx' + + + if (j === 'operationType') { + if(v[j] == 1){ + return '修改'; + }else{ + return '删除'; } - return statusStr; + } + + if (j === 'paymentType') { + return this.selectDictLabel(this.dict.type.emis_payment_type,v[j]); } return v[j] }))