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('+++++++++ 成功 +++++++')