diff --git a/src/mixins/view-module.js b/src/mixins/view-module.js index d8f48fa0..dcfabd2e 100644 --- a/src/mixins/view-module.js +++ b/src/mixins/view-module.js @@ -42,17 +42,18 @@ export default { methods: { // 获取数据列表 query () { - const params = { - order: this.order, - orderField: this.orderField, - page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null, - limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null, - ...this.dataForm - } - this.post = true - this.$http.post( - this.mixinViewModuleOptions.getDataListURL, - params + 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 + } + } ).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 42e37b0c..d3a6ffe4 100644 --- a/src/views/modules/plugins/stats/factagencyuserhousedaily.vue +++ b/src/views/modules/plugins/stats/factagencyuserhousedaily.vue @@ -1,10 +1,11 @@ @@ -76,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: { @@ -90,7 +138,7 @@ export default { }, created () { this.getGridList() - this.getValiheList() + // this.getValiheList() }, watch: { timeRange (val) { @@ -104,6 +152,59 @@ 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.agencyId = nodeData.agencyId; + this.dataForm.level = nodeData.level + this.$refs.cascaderUnit.checkedValue = nodeData.agencyId; + this.$refs.cascaderUnit.computePresentText(); + this.$refs.cascaderUnit.toggleDropDownVisible(false); + + }, getGridList() { const { user } = this.$store.state this.$http @@ -115,6 +216,8 @@ export default { console.log('获取查询详情成功', res.data) // this.optionsA = res.data this.optionsA.push(res.data) + this.dataForm.agencyId = res.data.agencyId + this.dataForm.level = res.data.level } }) .catch(() => { @@ -124,3 +227,89 @@ export default { } } + + +