diff --git a/project/xbot/AppWorkOrder/components/Detail.vue b/project/xbot/AppWorkOrder/components/Detail.vue index 50174956..ec020bf4 100644 --- a/project/xbot/AppWorkOrder/components/Detail.vue +++ b/project/xbot/AppWorkOrder/components/Detail.vue @@ -14,6 +14,9 @@
+ @@ -168,16 +212,14 @@ export default { return { forwardForm: { content: '', - girdId: '', - girdName: '', - girdMemberId: '', - girdMemberName: '', - name: '' + handleUserId: '', + handleUserName: '', + files: [], + user: [] }, isLoading: true, name: '', detail: {}, - isShowUser: false, eventList: [], isShowAdd: false, userList: [], @@ -196,7 +238,17 @@ export default { content: [], eventStatus: '1' }, - evaluation: {} + evaluation: {}, + isShowEdit: false, //编辑工单信息 + editInfo: {}, + placeDetail: { + lng: '', + lat: '', + address: '' + }, + showMap: false, + searchPlace: '', + map: null, } }, @@ -303,29 +355,6 @@ export default { } }) }, - - onConfirm() { - // if (this.gridInfo.userId) { - // this.forwardForm.girdId = this.gridInfo.girdId - // this.forwardForm.girdName = this.gridInfo.girdName - // this.forwardForm.girdMemberId = this.gridInfo.id - // this.forwardForm.girdMemberName = this.gridInfo.name - // } else { - // this.forwardForm.girdId = this.gridInfo.id - // } - // this.forwardForm.girdName = this.gridInfo.girdName - // this.forwardForm.name = `${this.gridInfo.girdName}${this.gridInfo.name ? '-' + this.gridInfo.name : ''}` - // this.isShowUser = false - if(!this.gridInfo.userId) { - return this.$message.error('请选择网格员!') - } - this.forwardForm.girdId = this.gridInfo.girdId - this.forwardForm.girdName = this.gridInfo.girdName - this.forwardForm.girdMemberId = this.gridInfo.id - this.forwardForm.girdMemberName = this.gridInfo.name - this.forwardForm.name = `${this.gridInfo.girdName}${this.gridInfo.name ? '-' + this.gridInfo.name : ''}` - this.isShowUser = false - }, getDict() { this.instance.post(`/app/appresidentreportgroup/list?current=1&size=100000`).then(res => { if (res.code == 0) { @@ -401,6 +430,111 @@ export default { }) } }) + }, + + onChooseUser(v) { + this.forwardForm.handleUserId = v[0].id + this.forwardForm.handleUserName = v[0].name + this.forwardForm.user = v + }, + + editClick() { + this.isShowEdit = true + this.editInfo = {...this.detail} + this.editInfo.girdIds = [] + if(this.editInfo.girdId) { + this.editInfo.girdIds.push(this.editInfo.girdId) + } + }, + + selectMap() { + this.editInfo.lng = this.placeDetail.lng + this.editInfo.lat = this.placeDetail.lat + this.editInfo.address = this.placeDetail.address + this.showMap = false + }, + initMapSelect() { + AMapLoader.load({ + key: 'b553334ba34f7ac3cd09df9bc8b539dc', + version: '2.0', + plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'], + }).then((AMap2) => { + this.map = new AMap2.Map('mapDialog', { + resizeEnable: true, + zooms: [6, 20], + zoom: 11, + center:[107.11059, 31.56618], + }) + this.placeSearch = new AMap2.PlaceSearch({ map: this.map }) + new AMap2.AutoComplete({ + input: 'searchPlaceInput', + output: 'searchPlaceOutput', + }).on('select', (e) => { + if (e?.poi) { + this.placeSearch.setCity(e.poi.adcode) + this.movePosition(e.poi.location) + } + }) + this.map.on('click', (e) => { + new AMap2.Geocoder().getAddress(e.lnglat, (sta, res) => { + if (res?.regeocode) { + this.placeDetail = { + lng: e.lnglat?.lng, + lat: e.lnglat?.lat, + address: res.regeocode.formattedAddress, + } + } + }) + this.movePosition(e.lnglat) + }) + }) + }, + + movePosition(center) { + if (this.map) { + this.map.clearMap() + this.map.panTo(center) + this.map.add([ + new AMap.Marker({ + position: center, + clickable: true, + }), + ]) + this.map.setFitView() + } + }, + + onUserChange (e) { + if (e.length) { + this.editInfo.girdName = e[0].girdName + } else { + this.editInfo.girdIds = [] + this.editInfo.girdName = '' + } + }, + + onCloseEdit() { + this.isShowEdit = false + this.editInfo = {} + }, + + onConfirmEdit() { + this.$refs.editInfo.validate(v => { + if (v) { + this.instance.post('/app/appsessionarchivereportinfo/update', { + ...this.editInfo, + id: this.$route.query.id, + flName: this.dictList.filter(v => v.dictValue === this.editInfo.flId)[0].dictName, + girdIds: this.editInfo.girdIds.length ? this.editInfo.girdIds[0] : '' + }).then(res => { + if (res?.code == 0) { + this.isShowEdit = false + this.getDetail() + this.$message.success('编辑成功!') + } + }) + } + }) } } }