From de14683266a04f5c38174081b2ed5a4fc9b19f44 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Tue, 15 Feb 2022 09:54:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=B0=8F=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/base/community/buildTable.vue | 82 +++++++++++++++---- .../modules/base/community/communityTable.vue | 75 +++++++++++------ .../modules/base/community/roomTable.vue | 9 +- .../visual/basicinfo/basicInfoMain.vue | 3 + 4 files changed, 126 insertions(+), 43 deletions(-) diff --git a/src/views/modules/base/community/buildTable.vue b/src/views/modules/base/community/buildTable.vue index b7aae794..3a04cd3d 100644 --- a/src/views/modules/base/community/buildTable.vue +++ b/src/views/modules/base/community/buildTable.vue @@ -39,23 +39,41 @@ type="green" size="small" @click="handleAdd">新增楼宇 - 下载楼宇模板 - 下载楼宇模板 + + + :http-request="(()=>{uploadFile( 'building')})"> 导入楼宇数据 + 下载房屋模板 + + + 导入房屋数据 +
@@ -246,6 +264,7 @@ export default { this.$refs.ref_form.initForm('edit', row, this.agencyObj) }) }, + handleToNextLevel (row) { this.$emit('toNextLevel', row, 'building') }, @@ -355,11 +374,20 @@ export default { }, - handleExportModule () { + handleExportModule (type) { + let title = '' - title = '楼栋模板' + let url = "/gov/org/neighborhood/exporttemplate" + if (type === 'building') { + title = '楼宇导入模板' + url = '' + + } else if (type === 'room') { + title = '房间导入模板' + url = '' + } + - const url = "/gov/org/building/exporttemplate" let params = {} app.ajax.exportFilePost( @@ -375,8 +403,9 @@ export default { ); }, + // 上传文件之前的钩子 - beforeUpload (file) { + beforeUpload (file, type) { this.files = file; const isText = file.type === 'application/vnd.ms-excel' @@ -384,6 +413,8 @@ export default { if (!isText && !isTextComputer) { this.$message.error('请选择正确格式的文件') + this.files = null + this.fileName = '' return false } else { this.fileName = file.name; @@ -396,21 +427,35 @@ export default { this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) }, - async uploadFile () { - this.loading = true - + async uploadFile (type) { if (this.fileName == "") { - this.$message.warning('请选择要上传的文件!') + return false } + this.loading = true - //清空上传列表 - this.$refs['upload'].clearFiles() - var url = '/gov/org/building/import' + //清空上传列表 + let url = '' + let params = {} let fileFormData = new FormData(); fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 + params.file = fileFormData + params.orgId = this.agencyObj.id + params.orgType = this.agencyObj.level + + if (type === 'building') { + this.$refs['upload_building'].clearFiles() + url = '/gov/org/building/buildingimport' + + + } else if (type === 'room') { + this.$refs['upload_room'].clearFiles() + url = '/gov/org/ichouse/houseimport' + + } + const { data, code, msg } = await requestPost(url, fileFormData) if (code === 0) { @@ -510,6 +555,7 @@ export default { } .div_btn { + display: flex; margin-top: 20px; } diff --git a/src/views/modules/base/community/communityTable.vue b/src/views/modules/base/community/communityTable.vue index 211b44ea..118bf401 100644 --- a/src/views/modules/base/community/communityTable.vue +++ b/src/views/modules/base/community/communityTable.vue @@ -42,16 +42,16 @@ 下载小区模板 + @click="handleExportModule('community')">下载小区模板 - + :http-request="(()=>{uploadFile( 'community')})"> 导入小区数据 @@ -60,18 +60,16 @@ 下载楼宇模板 + @click="handleExportModule('building')">下载楼宇模板 + :http-request="(()=>{uploadFile( 'building')})"> 导入楼宇数据 @@ -79,18 +77,16 @@ 下载房屋模板 + @click="handleExportModule('room')">下载房屋模板 + :http-request="(()=>{uploadFile( 'room')})"> 导入房屋数据 @@ -241,9 +237,9 @@ export default { if (fromTree) { this.agencyObj = treeObj } - + // console.log(this.agencyObj) const url = "/gov/org/neighborhood/neighborhoodlist" - // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodlist" + let params = { pageSize: this.pageSize, pageNo: this.pageNo, @@ -401,11 +397,22 @@ export default { }, - handleExportModule () { + handleExportModule (type) { let title = '' - title = '小区模板' + let url = "/gov/org/neighborhood/exporttemplate" + if (type === 'community') { + title = '小区导入模板' + url = '' + + } else if (type === 'building') { + title = '楼宇导入模板' + url = '' + + } else if (type === 'room') { + title = '房间导入模板' + url = '' + } - const url = "/gov/org/neighborhood/exporttemplate" let params = {} app.ajax.exportFilePost( @@ -441,11 +448,10 @@ export default { }, // 上传文件个数超过定义的数量 handleExceed (files, fileList) { - this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) }, - async uploadFile () { + async uploadFile (type) { if (this.fileName == "") { @@ -454,13 +460,34 @@ export default { this.loading = true //清空上传列表 - this.$refs['upload'].clearFiles() - - var url = '/gov/org/neighborhood/import' + let url = '' + let params = {} let fileFormData = new FormData(); fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 - const { data, code, msg } = await requestPost(url, fileFormData) + params.file = fileFormData + params.orgId = this.agencyObj.id + params.orgType = this.agencyObj.level === 'grid' ? 'grid' : 'agency' + + + if (type === 'community') { + this.$refs['upload_community'].clearFiles() + url = '/gov/org/icneighborhood/neighborhoodimport' + + + } else if (type === 'building') { + this.$refs['upload_building'].clearFiles() + url = '/gov/org/building/buildingimport' + + + } else if (type === 'room') { + this.$refs['upload_room'].clearFiles() + url = '/gov/org/ichouse/houseimport' + + } + + + const { data, code, msg } = await requestPost(url, params) if (code === 0) { this.$message({ diff --git a/src/views/modules/base/community/roomTable.vue b/src/views/modules/base/community/roomTable.vue index 7aacb835..44e0be77 100644 --- a/src/views/modules/base/community/roomTable.vue +++ b/src/views/modules/base/community/roomTable.vue @@ -210,6 +210,7 @@ export default { if (fromTree) { this.agencyObj = treeObj } + const url = "/gov/org/house/houselist" let params = { @@ -416,10 +417,16 @@ export default { //清空上传列表 this.$refs['upload'].clearFiles() - var url = '/gov/org/house/import' + var url = '/gov/org/ichouse/houseimport' + + let params = {} let fileFormData = new FormData(); fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 + params.file = fileFormData + params.orgId = this.agencyObj.id + params.orgType = this.agencyObj.level + const { data, code, msg } = await requestPost(url, fileFormData) if (code === 0) { this.$message({ diff --git a/src/views/modules/visual/basicinfo/basicInfoMain.vue b/src/views/modules/visual/basicinfo/basicInfoMain.vue index 825a17d1..b3fcc0dc 100644 --- a/src/views/modules/visual/basicinfo/basicInfoMain.vue +++ b/src/views/modules/visual/basicinfo/basicInfoMain.vue @@ -113,6 +113,7 @@ import { defaults as defaultInteractions, Select, DoubleClickZoom } from 'ol/int import { getCenter, boundingExtent } from 'ol/extent.js'; import { Circle as CircleStyle, Icon, Fill, Stroke, Style, Text } from 'ol/style.js'; +import nextTick from 'dai-js/tools/nextTick' import { mapGetters } from "vuex"; import { Loading } from 'element-ui'; //引入Loading服务 import { requestPost } from "@/js/dai/request"; @@ -257,6 +258,8 @@ const vueGis = { //初始化地图 this.initMap() + + await nextTick(300) this.addParentLayer() this.loadParentPolygon() //添加标注图层