Browse Source

导入小区

shibei_master
jiangyy 4 years ago
parent
commit
de14683266
  1. 82
      src/views/modules/base/community/buildTable.vue
  2. 75
      src/views/modules/base/community/communityTable.vue
  3. 9
      src/views/modules/base/community/roomTable.vue
  4. 3
      src/views/modules/visual/basicinfo/basicInfoMain.vue

82
src/views/modules/base/community/buildTable.vue

@ -39,23 +39,41 @@
type="green" type="green"
size="small" size="small"
@click="handleAdd">新增楼宇</el-button> @click="handleAdd">新增楼宇</el-button>
<el-button style="float:left"
<el-button style=";margin-left:10px"
type="blue" type="blue"
size="small" size="small"
@click="handleExportModule">下载楼宇模板</el-button> @click="handleExportModule('building')">下载楼宇模板</el-button>
<el-upload ref="upload"
<el-upload style=""
ref="upload_building"
:multiple='false' :multiple='false'
:show-file-list='false' :show-file-list='false'
:before-upload="beforeUpload" :before-upload="((file)=>{beforeUpload(file, 'building')})"
action="" action=""
accept=".xls,.xlsx" accept=".xls,.xlsx"
:limit="1" :http-request="(()=>{uploadFile( 'building')})">
:on-exceed="handleExceed"
:http-request="uploadFile">
<el-button style="margin-left:10px" <el-button style="margin-left:10px"
size="small" size="small"
type="red">导入楼宇数据</el-button> type="red">导入楼宇数据</el-button>
</el-upload> </el-upload>
<el-button style=";margin-left:10px"
type="blue"
size="small"
@click="handleExportModule('room')">下载房屋模板</el-button>
<el-upload style=""
ref="upload_room"
:multiple='false'
:show-file-list='false'
:before-upload="((file)=>{beforeUpload(file, 'room')})"
action=""
accept=".xls,.xlsx"
:http-request="(()=>{uploadFile( 'room')})">
<el-button style="margin-left:10px"
size="small"
type="red">导入房屋数据</el-button>
</el-upload>
</div> </div>
<div class="div_table"> <div class="div_table">
@ -246,6 +264,7 @@ export default {
this.$refs.ref_form.initForm('edit', row, this.agencyObj) this.$refs.ref_form.initForm('edit', row, this.agencyObj)
}) })
}, },
handleToNextLevel (row) { handleToNextLevel (row) {
this.$emit('toNextLevel', row, 'building') this.$emit('toNextLevel', row, 'building')
}, },
@ -355,11 +374,20 @@ export default {
}, },
handleExportModule () { handleExportModule (type) {
let title = '' 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 = {} let params = {}
app.ajax.exportFilePost( app.ajax.exportFilePost(
@ -375,8 +403,9 @@ export default {
); );
}, },
// //
beforeUpload (file) { beforeUpload (file, type) {
this.files = file; this.files = file;
const isText = file.type === 'application/vnd.ms-excel' const isText = file.type === 'application/vnd.ms-excel'
@ -384,6 +413,8 @@ export default {
if (!isText && !isTextComputer) { if (!isText && !isTextComputer) {
this.$message.error('请选择正确格式的文件') this.$message.error('请选择正确格式的文件')
this.files = null
this.fileName = ''
return false return false
} else { } else {
this.fileName = file.name; this.fileName = file.name;
@ -396,21 +427,35 @@ export default {
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`)
}, },
async uploadFile () { async uploadFile (type) {
this.loading = true
if (this.fileName == "") { if (this.fileName == "") {
this.$message.warning('请选择要上传的文件!')
return false return false
} }
this.loading = true
//
this.$refs['upload'].clearFiles()
var url = '/gov/org/building/import' //
let url = ''
let params = {}
let fileFormData = new FormData(); let fileFormData = new FormData();
fileFormData.append('file', this.files);//filenamefiletest.zip fileFormData.append('file', this.files);//filenamefiletest.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) const { data, code, msg } = await requestPost(url, fileFormData)
if (code === 0) { if (code === 0) {
@ -510,6 +555,7 @@ export default {
} }
.div_btn { .div_btn {
display: flex;
margin-top: 20px; margin-top: 20px;
} }

75
src/views/modules/base/community/communityTable.vue

@ -42,16 +42,16 @@
<el-button style="" <el-button style=""
type="blue" type="blue"
size="small" size="small"
@click="handleExportModule">下载小区模板</el-button> @click="handleExportModule('community')">下载小区模板</el-button>
<el-upload ref="upload" <el-upload ref="upload_community"
style="" style=""
:multiple='false' :multiple='false'
:show-file-list='false' :show-file-list='false'
:before-upload="((file)=>{beforeUpload(file, 'community')})" :before-upload="((file)=>{beforeUpload(file, 'community')})"
action="" action=""
accept=".xls,.xlsx" accept=".xls,.xlsx"
:http-request="uploadFile"> :http-request="(()=>{uploadFile( 'community')})">
<el-button style="margin-left:10px" <el-button style="margin-left:10px"
size="small" size="small"
type="red">导入小区数据</el-button> type="red">导入小区数据</el-button>
@ -60,18 +60,16 @@
<el-button style=";margin-left:10px" <el-button style=";margin-left:10px"
type="blue" type="blue"
size="small" size="small"
@click="handleExportModule">下载楼宇模板</el-button> @click="handleExportModule('building')">下载楼宇模板</el-button>
<el-upload style="" <el-upload style=""
ref="upload" ref="upload_building"
:multiple='false' :multiple='false'
:show-file-list='false' :show-file-list='false'
:before-upload="((file)=>{beforeUpload(file, 'building')})" :before-upload="((file)=>{beforeUpload(file, 'building')})"
action="" action=""
accept=".xls,.xlsx" accept=".xls,.xlsx"
:limit="1" :http-request="(()=>{uploadFile( 'building')})">
:on-exceed="handleExceed"
:http-request="uploadFile">
<el-button style="margin-left:10px" <el-button style="margin-left:10px"
size="small" size="small"
type="red">导入楼宇数据</el-button> type="red">导入楼宇数据</el-button>
@ -79,18 +77,16 @@
<el-button style=";margin-left:10px" <el-button style=";margin-left:10px"
type="blue" type="blue"
size="small" size="small"
@click="handleExportModule">下载房屋模板</el-button> @click="handleExportModule('room')">下载房屋模板</el-button>
<el-upload style="" <el-upload style=""
ref="upload" ref="upload_room"
:multiple='false' :multiple='false'
:show-file-list='false' :show-file-list='false'
:before-upload="((file)=>{beforeUpload(file, 'room')})" :before-upload="((file)=>{beforeUpload(file, 'room')})"
action="" action=""
accept=".xls,.xlsx" accept=".xls,.xlsx"
:limit="1" :http-request="(()=>{uploadFile( 'room')})">
:on-exceed="handleExceed"
:http-request="uploadFile">
<el-button style="margin-left:10px" <el-button style="margin-left:10px"
size="small" size="small"
type="red">导入房屋数据</el-button> type="red">导入房屋数据</el-button>
@ -241,9 +237,9 @@ export default {
if (fromTree) { if (fromTree) {
this.agencyObj = treeObj this.agencyObj = treeObj
} }
// console.log(this.agencyObj)
const url = "/gov/org/neighborhood/neighborhoodlist" const url = "/gov/org/neighborhood/neighborhoodlist"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodlist"
let params = { let params = {
pageSize: this.pageSize, pageSize: this.pageSize,
pageNo: this.pageNo, pageNo: this.pageNo,
@ -401,11 +397,22 @@ export default {
}, },
handleExportModule () { handleExportModule (type) {
let title = '' 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 = {} let params = {}
app.ajax.exportFilePost( app.ajax.exportFilePost(
@ -441,11 +448,10 @@ export default {
}, },
// //
handleExceed (files, fileList) { handleExceed (files, fileList) {
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`)
}, },
async uploadFile () { async uploadFile (type) {
if (this.fileName == "") { if (this.fileName == "") {
@ -454,13 +460,34 @@ export default {
this.loading = true this.loading = true
// //
this.$refs['upload'].clearFiles() let url = ''
let params = {}
var url = '/gov/org/neighborhood/import'
let fileFormData = new FormData(); let fileFormData = new FormData();
fileFormData.append('file', this.files);//filenamefiletest.zip fileFormData.append('file', this.files);//filenamefiletest.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) { if (code === 0) {
this.$message({ this.$message({

9
src/views/modules/base/community/roomTable.vue

@ -210,6 +210,7 @@ export default {
if (fromTree) { if (fromTree) {
this.agencyObj = treeObj this.agencyObj = treeObj
} }
const url = "/gov/org/house/houselist" const url = "/gov/org/house/houselist"
let params = { let params = {
@ -416,10 +417,16 @@ export default {
// //
this.$refs['upload'].clearFiles() this.$refs['upload'].clearFiles()
var url = '/gov/org/house/import' var url = '/gov/org/ichouse/houseimport'
let params = {}
let fileFormData = new FormData(); let fileFormData = new FormData();
fileFormData.append('file', this.files);//filenamefiletest.zip fileFormData.append('file', this.files);//filenamefiletest.zip
params.file = fileFormData
params.orgId = this.agencyObj.id
params.orgType = this.agencyObj.level
const { data, code, msg } = await requestPost(url, fileFormData) const { data, code, msg } = await requestPost(url, fileFormData)
if (code === 0) { if (code === 0) {
this.$message({ this.$message({

3
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 { getCenter, boundingExtent } from 'ol/extent.js';
import { Circle as CircleStyle, Icon, Fill, Stroke, Style, Text } from 'ol/style.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 { mapGetters } from "vuex";
import { Loading } from 'element-ui'; //Loading import { Loading } from 'element-ui'; //Loading
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
@ -257,6 +258,8 @@ const vueGis = {
// //
this.initMap() this.initMap()
await nextTick(300)
this.addParentLayer() this.addParentLayer()
this.loadParentPolygon() this.loadParentPolygon()
// //

Loading…
Cancel
Save