From 80f08345a5b0757ac7a0168ea3e6ca88ecff7155 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Fri, 29 Oct 2021 17:51:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/base/community/buildTable.vue | 30 +- .../modules/base/community/community.vue | 41 ++- .../modules/base/community/communityForm.vue | 312 ++++++++---------- .../modules/base/community/communityTable.vue | 14 +- 4 files changed, 197 insertions(+), 200 deletions(-) diff --git a/epmet-oper-web/src/views/modules/base/community/buildTable.vue b/epmet-oper-web/src/views/modules/base/community/buildTable.vue index 587f513..9697cf7 100644 --- a/epmet-oper-web/src/views/modules/base/community/buildTable.vue +++ b/epmet-oper-web/src/views/modules/base/community/buildTable.vue @@ -49,20 +49,26 @@ - - - - + + + + + @@ -145,7 +151,7 @@ export default { //form相关 formShow: false, - formTitle: '新增小区' + formTitle: '新增楼宇' } }, @@ -190,7 +196,7 @@ export default { }, handleDetail (row) { - this.formTitle = '小区详情' + this.formTitle = '楼宇详情' this.formShow = true this.$nextTick(() => { this.$refs.ref_form.initForm('detail', row) @@ -198,7 +204,7 @@ export default { }, handleAdd () { - this.formTitle = '新增小区' + this.formTitle = '新增楼宇' this.formShow = true this.$nextTick(() => { this.$refs.ref_form.initForm('add') @@ -206,7 +212,7 @@ export default { }, handleEdit (row) { - this.formTitle = '修改小区' + this.formTitle = '修改楼宇' this.formShow = true this.$refs.ref_form.initForm('edit', row) }, diff --git a/epmet-oper-web/src/views/modules/base/community/community.vue b/epmet-oper-web/src/views/modules/base/community/community.vue index 2efa749..42e11cb 100644 --- a/epmet-oper-web/src/views/modules/base/community/community.vue +++ b/epmet-oper-web/src/views/modules/base/community/community.vue @@ -33,9 +33,9 @@
+ ref="ref_neighTable"> + ref="ref_buildingTable"> @@ -69,7 +69,9 @@ export default { }, selTreeId: '', - selTreeLevel: '' + selTreeLevel: '', + + centerPoint: [] } }, @@ -77,8 +79,10 @@ export default { CDialog }, async mounted () { - await this.loadTree() + await this.loadOrgData() + await this.$refs['ref_communityTable'].initData(this.centerPoint) + await this.loadTree() await this.$refs['ref_communityTable'].loadTable(this.selTreeId, this.selTreeLevel) }, computed: { @@ -108,8 +112,35 @@ export default { } }, + //加载组织数据 + async loadOrgData () { + const url = "/gov/org/agency/maporg" + // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg" + let params = {} + + const { data, code, msg } = await requestPost(url, params) + + if (code === 0) { + this.centerPoint = [] + + this.centerPoint.push(data.latitude) + this.centerPoint.push(data.longitude) + + } else { + this.$message.error(msg) + } + + }, + handleNodeClick (obj) { - this.$refs['ref_communityTable'].loadTable(obj.id, obj.level) + if (obj.level === 'building') { + this.$refs['ref_buildingTable'].loadTable(obj.id, obj.level) + } else if (obj.level === 'neighbourHood') { + this.$refs['ref_neighTable'].loadTable(obj.id, obj.level) + } else { + this.$refs['ref_communityTable'].loadTable(obj.id, obj.level) + } + }, handleSizeChange (val) { diff --git a/epmet-oper-web/src/views/modules/base/community/communityForm.vue b/epmet-oper-web/src/views/modules/base/community/communityForm.vue index 0cd9cb2..7606ac8 100644 --- a/epmet-oper-web/src/views/modules/base/community/communityForm.vue +++ b/epmet-oper-web/src/views/modules/base/community/communityForm.vue @@ -2,153 +2,112 @@
- - - + + + - + {{ dataForm.agencyName }} - - - + + + - - - + + + - 添加物业 + 添加物业 - - + + - - + + - - + + - 查询 -
+ 查询 +
经度 - + 纬度 - +
@@ -156,25 +115,19 @@
- - - + + + @@ -182,12 +135,9 @@
取 消 - 确 定 + 确 定
@@ -202,7 +152,7 @@ var markers var infoWindowList let loading // 加载动画 export default { - data() { + data () { return { formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 @@ -228,19 +178,20 @@ export default { name: '' }, - keyWords: '' + keyWords: '', + centerPoint: [] } }, components: {}, - mounted() { + mounted () { this.initMap() }, methods: { // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 - initMap() { + initMap () { // 定义地图中心点坐标 - var center = new window.TMap.LatLng(39.98412, 116.307484) + var center = new window.TMap.LatLng(36.0722275, 120.38945519) // 定义map变量,调用 TMap.Map() 构造函数创建地图 map = new window.TMap.Map(document.getElementById('app'), { center: center, // 设置地图中心点坐标 @@ -248,8 +199,7 @@ export default { pitch: 43.5, // 设置俯仰角 rotation: 45 // 设置地图旋转角度 }) - console.log(map) - console.log(window) + search = new window.TMap.service.Search({ pageSize: 10 }) // 新建一个地点搜索类 markers = new TMap.MultiMarker({ @@ -265,7 +215,7 @@ export default { this.handleMoveCenter() }, - setMarker(lat, lng) { + setMarker (lat, lng) { markers.setGeometries([]) markers.add([ { @@ -279,7 +229,7 @@ export default { ]) }, - handleSearchMap() { + handleSearchMap () { infoWindowList.forEach((infoWindow) => { infoWindow.close() }) @@ -307,7 +257,7 @@ export default { }) }, - handleMoveCenter() { + handleMoveCenter () { //修改地图中心点 const center = map.getCenter() const lat = center.getLat() @@ -317,7 +267,12 @@ export default { this.setMarker(lat, lng) }, - async initForm(type, row) { + async initForm (centerPoint, type, row) { + + this.centerPoint = centerPoint + // debugger + map.setCenter(new TMap.LatLng(this.centerPoint[0], this.centerPoint[1])) + this.formType = type if (row) { this.neighborHoodId = row.neighborHoodId @@ -330,7 +285,7 @@ export default { }, //加载组织 - async loadAgency() { + async loadAgency () { const url = '/epmetuser/customerstaff/staffbasicinfo' let params = {} @@ -344,8 +299,8 @@ export default { } }, //加载网格 - async loadGrid() { - const url = '/gov/org/grid/allgrids' + async loadGrid () { + const url = '/gov/org/grid/allgridsnopermission ' // const url = "https://epmet-dev.elinkservice.cn:7082/api/apimock-v2/95518686fa128a53f64c678906848062/gov/org/grid/allgrids" let params = { agencyId: this.dataForm.agencyId @@ -360,7 +315,7 @@ export default { } }, //加载物业 - async loadProperty() { + async loadProperty () { const url = '/gov/org/propertymanagement/list' // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/list" let params = {} @@ -374,19 +329,20 @@ export default { } }, - handleAddProperty() { + handleAddProperty () { + this.propertyForm.name = '' this.propertyFormShow = true }, - async handleComfirm() { + async handleComfirm () { if (this.propertyFormShow) { this.addProperty() } else { this.addCommunity() } }, - async addCommunity() { + async addCommunity () { let url = '' if (this.formType === 'add') { url = '/gov/org/neighborhood/neighborhoodadd' @@ -410,7 +366,7 @@ export default { this.$message.error(msg) } }, - async addProperty() { + async addProperty () { const url = '/gov/org/propertymanagement/add' // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/add" let params = { @@ -431,7 +387,7 @@ export default { this.$message.error(msg) } }, - handleCancle() { + handleCancle () { if (this.propertyFormShow) { this.propertyForm.name = '' this.propertyFormShow = false @@ -439,9 +395,9 @@ export default { this.$emit('dialogCancle') } }, - resetData() {}, + resetData () { }, // 开启加载动画 - startLoading() { + startLoading () { loading = Loading.service({ lock: true, // 是否锁定 text: '正在加载……', // 加载中需要显示的文字 @@ -449,7 +405,7 @@ export default { }) }, // 结束加载动画 - endLoading() { + endLoading () { // clearTimeout(timer); if (loading) { loading.close() @@ -457,7 +413,7 @@ export default { } }, computed: { - dataRule() { + dataRule () { return { neighborHoodName: [ { required: true, message: '小区名称不能为空', trigger: 'blur' }, @@ -482,7 +438,7 @@ export default { ] } }, - propertyRule() { + propertyRule () { name: [ { required: true, message: '物业名称不能为空', trigger: 'blur' } // { min: 1, max: 50, message: '小区名称长度在 1 到 50个字符', trigger: 'blur' } diff --git a/epmet-oper-web/src/views/modules/base/community/communityTable.vue b/epmet-oper-web/src/views/modules/base/community/communityTable.vue index 9ae55cd..3c59460 100644 --- a/epmet-oper-web/src/views/modules/base/community/communityTable.vue +++ b/epmet-oper-web/src/views/modules/base/community/communityTable.vue @@ -109,7 +109,7 @@ :close-on-press-escape="false" :title="formTitle" width="800px" - top='5' + top='15' @closed="diaClose"> { - this.$refs.ref_form.initForm('detail', row) + this.$refs.ref_form.initForm(this.centerPoint, 'detail', row) }) }, @@ -210,14 +214,14 @@ export default { this.formTitle = '新增小区' this.formShow = true this.$nextTick(() => { - this.$refs.ref_form.initForm('add') + this.$refs.ref_form.initForm(this.centerPoint, 'add') }) }, handleEdit (row) { this.formTitle = '修改小区' this.formShow = true - this.$refs.ref_form.initForm('edit', row) + this.$refs.ref_form.initForm(this.centerPoint, 'edit', row) }, addFormCancle () {