From fd21ede21c0f52eaa5dcc277fdbeda1802235ee5 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Fri, 24 Jun 2022 14:01:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=A7=8D=E6=96=B9=E5=BC=8F=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personroom/epidemicplotbuilding.vue | 95 ++++++++++++++++++- 1 file changed, 90 insertions(+), 5 deletions(-) diff --git a/src/views/modules/personroom/epidemicplotbuilding.vue b/src/views/modules/personroom/epidemicplotbuilding.vue index cffbbd7..bc2330d 100644 --- a/src/views/modules/personroom/epidemicplotbuilding.vue +++ b/src/views/modules/personroom/epidemicplotbuilding.vue @@ -67,15 +67,39 @@ {{$t("export")}} + + + + - - 导入楼栋信息 - + 导入 - {{ $t('deleteBatch') }} + + + + + + + + + + + + @@ -141,13 +165,26 @@ export default { uploadBuildingUrl: '', streetArr: [], communitys: [], + deptIdListUpload: [], grids: [], + options: [], plotArr: [] } }, components: { AddOrUpdate }, + watch: { + 'deptIdListUpload': function (val) { + if (val.length > 0) { + this.gridIdImport = val[val.length - 1] + this.uploadBuildingUrl = `${window.SITE_CONFIG['apiURL']}/custom/epidemicplotbuilding/importBuilding?token= + ${Cookies.get('token')}&gridId=` + val[val.length - 1] + } else { + this.gridIdImport = '' + } + } + }, created: function () { this.getOptions() // 乡镇下拉框赋值 @@ -223,6 +260,15 @@ export default { } this.buildingTypeArr = res.data }).catch(() => {}) + this.$http + .get(`/sys/user/deptOptions/getByLoginUser`) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.options = res.data.options + }) + .catch(() => { }) }, buildingTypeFormat (row, column) { if (row.buildingType) { @@ -252,6 +298,45 @@ export default { this.uploadLoading = false this.$message.error('上传失败请重试') }, + beforeImportUser () { + //所属组织全都不选,直接上传 + if (this.gridIdImport === '') { + document.getElementById('importBut').click() + return false + } + //选中网格 + let selectGird = this.$refs['deptTree'].getCheckedNodes()[0].label + + this.$confirm(`确定将楼栋导入到${selectGird}?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + document.getElementById('importBut').click() + }).catch(() => { }) + }, + uploadSuccess (response, file, fileList) { + this.uploeadLoeading = false + this.$refs.upload.clearFiles() + if (response.code !== 0 || (response.data !== null && response.data.length > 0)) { + this.errordataList = response.data + if (this.errordataList != null && this.errordataList.length > 0) { + this.faultDataVisible = true + } else { + this.$message.error(response.msg) + } + this.getDataList() + return + } + this.$message({ + message: '导入成功', + type: 'success', + duration: 1000, + onClose: () => { + this.getDataList() + } + }) + }, //导入完成 uploadBuildingSuccess (response, file, fileList) { console.log('+++++++++ 成功 +++++++')