From 40fa0b936059f70ce43f6fb9e52fa8638f601f4f Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Fri, 10 Jun 2022 15:37:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E6=88=B7=E4=B8=80=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personroom/epidemicbuildingunit.vue | 87 +++++++++++++++++-- 1 file changed, 82 insertions(+), 5 deletions(-) diff --git a/src/views/modules/personroom/epidemicbuildingunit.vue b/src/views/modules/personroom/epidemicbuildingunit.vue index fa0520b..282876a 100644 --- a/src/views/modules/personroom/epidemicbuildingunit.vue +++ b/src/views/modules/personroom/epidemicbuildingunit.vue @@ -61,10 +61,10 @@ type="primary">导入 - - - - + + + 一户一码 + @@ -120,6 +120,27 @@ @click="exportError">导出错误数据 + +
+ + + 数据初始化 + + + 一户一码生成 + + + 一户一码下载 + + +
+ + 取 消 + +
@@ -140,7 +161,9 @@ export default { deleteIsBatch: true, exportErrorInfoURL: '/custom/epidemicusererror/export' }, + uploadUrl: '', options: [], + zLoading: false, faultDataVisible: false, errordataList: [], deptIdListUpload: [], @@ -149,7 +172,8 @@ export default { dataForm: { id: '' }, - uploadUrl: '' + exportTemplate: false, + dialogVisibleExcel: false, } }, components: { @@ -170,6 +194,11 @@ export default { this.getOptions() }, methods: { + // 打开导出弹框 + exports () { + this.exportDisable = false + this.dialogVisibleExcel = true + }, getOptions () { this.$http .get(`/sys/user/deptOptions/getByLoginUser`) @@ -256,6 +285,54 @@ export default { } }).catch(() => {}) }, + updateMaUrl () { + this.$http.post(`/custom/epidemicbuildingunit/createBatchHouseCodeAndUrl`).then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + }).catch(() => {}) + }, + downloadUrl () { + this.zLoading = true + this.$http( + { method: 'post', + url: '/custom/epidemicbuildingunit/downloadZip', + responseType: 'blob'}).then(({ data: res }) => { + if (!res) { + this.zLoading = false + return this.$message.error("下载失败,请联系关系管理员") + } + let title = '一户一码' + this.download(res, title + '.Zip') + }).catch(() => {}) + }, + // 下载文件 + download (data, downFileName) { + if (!data) { + this.zLoading = false + return + } + console.log('一户一码下载中...') + var csvData = new Blob([data]) + + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + window.navigator.msSaveOrOpenBlob(csvData, downFileName); + } + // 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 = downFileName; + a.click(); + a.remove(); + window.URL.revokeObjectURL(url); + } + this.zLoading = false + }, + downloadMa (id) { this.$http.post(`/custom/epidemicbuildingunit/createHouseQrcode`, {id: id}, { responseType: 'blob' }).then(res => { let fileName = '房屋二维码.png'