diff --git a/src/mixins/view-module.js b/src/mixins/view-module.js index ebde6a3e..dcfabd2e 100644 --- a/src/mixins/view-module.js +++ b/src/mixins/view-module.js @@ -44,16 +44,16 @@ export default { query () { this.dataListLoading = true this.$http.get( - this.mixinViewModuleOptions.getDataListURL, - { - params: { - order: this.order, - orderField: this.orderField, - page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null, - limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null, - ...this.dataForm + this.mixinViewModuleOptions.getDataListURL, + { + params: { + order: this.order, + orderField: this.orderField, + page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null, + limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null, + ...this.dataForm + } } - } ).then(({ data: res }) => { this.dataListLoading = false if (res.code !== 0) { diff --git a/src/views/modules/plugins/stats/factagencyuserhousedaily.vue b/src/views/modules/plugins/stats/factagencyuserhousedaily.vue index ab707517..858c9eaf 100644 --- a/src/views/modules/plugins/stats/factagencyuserhousedaily.vue +++ b/src/views/modules/plugins/stats/factagencyuserhousedaily.vue @@ -1,6 +1,7 @@ - - {{ $t('query') }} + {{ $t('query') }} - + + +
+ 总计 + 导出 +
+ - - - - - - - - - - - - - + + + + + + + + + + + + + +
+ + + @@ -85,13 +121,16 @@ export default { getDataListURL: '/data/stats/factAgencyUserHouseDaily/page', getDataListIsPage: true, deleteURL: '/data/stats/factAgencyUserHouseDaily', - deleteIsBatch: true + deleteIsBatch: true, + exportURL: '/data/stats/factAgencyUserHouseDaily/export' }, optionsA: [], + totalVisible: false, timeRange: '', dataForm: { id: '' }, + tableData: [] } }, components: { @@ -113,13 +152,58 @@ export default { } }, methods: { + totalHandle () { + this.tableData = [] + this.$http + .get('/data/stats/factAgencyUserHouseDaily/total',{params: this.dataForm}) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取查询详情成功', res.data) + this.tableData.push(res.data) + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + this.totalVisible = true + }, + exportHandle () { + const url = this.mixinViewModuleOptions.exportURL + this.$http({ + method: 'GET', + url, + responseType: 'blob', + params: this.dataForm + }).then(res => { + // this.download(res.data, title + '.xls') + if (res.headers["content-disposition"]) { + let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) + console.log('filename', fileName) + let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) + var url = window.URL.createObjectURL(blob) + var aLink = document.createElement('a') + aLink.style.display = 'none' + aLink.href = url + aLink.setAttribute('download', fileName) + document.body.appendChild(aLink) + aLink.click() + document.body.removeChild(aLink) //下载完成移除元素 + window.URL.revokeObjectURL(url) //释放掉blob对象 + } else this.$message.error('下载失败') + }).catch(err => { + console.log('err', err) + return this.$message.error('网络错误') + }) + }, cascaderClick (nodeData) { this.dataForm.objectId = nodeData.objectId; this.dataForm.objectType = nodeData.objectType this.$refs.cascaderUnit.checkedValue = nodeData.objectId; this.$refs.cascaderUnit.computePresentText(); this.$refs.cascaderUnit.toggleDropDownVisible(false); - + }, getGridList() { const { user } = this.$store.state @@ -145,7 +229,7 @@ export default { } + +