From 9d08fc75f4524e3d824788dc9300dc349553a7a9 Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Thu, 17 Mar 2022 08:53:40 +0800 Subject: [PATCH] dd --- src/views/modules/base/resi.vue | 9 ++- .../modules/communityParty/elegant/index.vue | 68 +++++++++++++++---- .../communityService/measure/index.vue | 8 +-- .../modules/communityService/sqzzz/index.vue | 8 ++- src/views/modules/workSys/demandCate.vue | 9 +++ src/views/modules/workSys/resiCate.vue | 12 +++- 6 files changed, 90 insertions(+), 24 deletions(-) diff --git a/src/views/modules/base/resi.vue b/src/views/modules/base/resi.vue index 63dce11e..b65d924a 100644 --- a/src/views/modules/base/resi.vue +++ b/src/views/modules/base/resi.vue @@ -48,6 +48,7 @@ @selection-change="selectionChange"> { console.log('res----dddd', res) // this.download(res.data, title + '.xls') diff --git a/src/views/modules/communityParty/elegant/index.vue b/src/views/modules/communityParty/elegant/index.vue index 4422db93..425ff0ad 100644 --- a/src/views/modules/communityParty/elegant/index.vue +++ b/src/views/modules/communityParty/elegant/index.vue @@ -381,28 +381,68 @@ export default { this.uploading = true this.unloadPencent = Number(file.percentage.toFixed(0)) }, + download (data, fileName) { + console.log('data', data) + if (!data) { + return + } + + var csvData = new Blob([data]) + + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + window.navigator.msSaveOrOpenBlob(csvData, fileName) + } + // for Non-IE (chrome, firefox etc.) + else { + var a = document.createElement('a') + document.body.appendChild(a) + a.style = 'display: none' + var url = window.URL.createObjectURL(csvData) + a.href = url + a.download = fileName + a.click() + a.remove() + window.URL.revokeObjectURL(url) + } + }, async handleExportModule () { let url = "/resi/partymember/icpartymemberstyle/import/template-download" let params = {} - await this.$http - .post(url, params) + // app.ajax.exportFilePost( + // url, + // params, + // (data, rspMsg) => { + + // this.download(data, 'a.xls') + // }, + // (rspMsg, data) => { + // this.$message.error(rspMsg); + // } + // ); + await this.$http({ + method: 'POST', + url, + responseType: 'blob', + data: params + }) .then(res => { - // this.download(res.data, title + '.xls') + console.log('res-------dd', res) 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对象 + this.download(res.data, fileName) + // 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 => { diff --git a/src/views/modules/communityService/measure/index.vue b/src/views/modules/communityService/measure/index.vue index 859982f6..90604829 100644 --- a/src/views/modules/communityService/measure/index.vue +++ b/src/views/modules/communityService/measure/index.vue @@ -131,12 +131,10 @@ - 查询 + 查询 - 重置 + 重置 @@ -145,7 +143,7 @@
- 新增需求 + 新增
{ // this.download(res.data, title + '.xls') if (res.headers["content-disposition"]) { diff --git a/src/views/modules/workSys/demandCate.vue b/src/views/modules/workSys/demandCate.vue index 27b50ae2..b7ea8618 100644 --- a/src/views/modules/workSys/demandCate.vue +++ b/src/views/modules/workSys/demandCate.vue @@ -5,6 +5,7 @@ class="search-card">
@@ -25,6 +26,9 @@ size="small" @click="handleSearch">查询 + + 重置 +
@@ -220,6 +224,11 @@ export default { } return _val || row[item.columnName] }, + resetForm(formName) { + + this.form.firstCategoryCode = '' + this.handleSearch(); + }, handleSearch (val) { console.log('searchhh--', val) this.currentPage = 1 diff --git a/src/views/modules/workSys/resiCate.vue b/src/views/modules/workSys/resiCate.vue index 0d150e89..a7b25239 100644 --- a/src/views/modules/workSys/resiCate.vue +++ b/src/views/modules/workSys/resiCate.vue @@ -2,7 +2,7 @@
- + 查询 + + 重置 + +
@@ -335,6 +339,12 @@ export default { } return _val || row[item.columnName] }, + resetForm(formName) { + + this.isWarn = '' + this.level = '' + this.handleSearch(); + }, handleSearch(val) { console.log('searchhh--', val) this.currentPage = 1