|  |  |  | 
|---|
|  |  |  | label: 'name', | 
|---|
|  |  |  | value: 'id', | 
|---|
|  |  |  | children: 'childCategoryList', | 
|---|
|  |  |  | checkStrictly: true | 
|---|
|  |  |  | }"></el-cascader> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="经纬度"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <el-input v-model="form.lnglat" disabled v-trim /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item> | 
|---|
|  |  |  | <mapDrag class="mapbox" @center="getCenter" /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="巡检内容" prop="content"> | 
|---|
|  |  |  | <el-input type="textarea" :rows="4" v-model="form.content" placeholder="请输入" /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="上传图片" prop="imgurl"> | 
|---|
|  |  |  | <UploadAvatarImage :file="{ 'imgurlfull': form.imgurlfull, 'imgurl': form.imgurl }" | 
|---|
|  |  |  | :uploadData="{ folder: 'projects' }" @uploadSuccess="uploadAvatarSuccess" @uploadEnd="isUploading = false" | 
|---|
|  |  |  | :uploadData="{ folder: 'ywPatrol/' }" @uploadSuccess="uploadAvatarSuccess" @uploadEnd="isUploading = false" | 
|---|
|  |  |  | @uploadBegin="isUploading = true" /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | </el-form> | 
|---|
|  |  |  | 
|---|
|  |  |  | import BaseOpera from '@/components/base/BaseOpera' | 
|---|
|  |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
|---|
|  |  |  | import UploadAvatarImage from '@/components/common/UploadAvatarImage' | 
|---|
|  |  |  | import mapDrag from '@/components/common/map/mapDrag.vue' | 
|---|
|  |  |  | import { fetchList } from '@/api/business/category' | 
|---|
|  |  |  | import { detail } from '@/api/Inspection/ywPatrolPoint' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'OperaYwPatrolPointWindow', | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | components: { GlobalWindow, UploadAvatarImage }, | 
|---|
|  |  |  | components: { GlobalWindow, UploadAvatarImage, mapDrag }, | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | // 表单数据 | 
|---|
|  |  |  | 
|---|
|  |  |  | code: '', | 
|---|
|  |  |  | content: '', | 
|---|
|  |  |  | imgurl: '', | 
|---|
|  |  |  | areaId: '', | 
|---|
|  |  |  | areaId: 0, | 
|---|
|  |  |  | areaIds: [], | 
|---|
|  |  |  | addr: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | deviceList: [], | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | initData() { | 
|---|
|  |  |  | open(title, row) { | 
|---|
|  |  |  | this.title = title | 
|---|
|  |  |  | this.visible = true | 
|---|
|  |  |  | if (row && row.id) { | 
|---|
|  |  |  | this.getDetail(row) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getDetail(row) { | 
|---|
|  |  |  | detail(row.id).then(res => { | 
|---|
|  |  |  | this.form = { ...res } | 
|---|
|  |  |  | // this.$set(this.form, 'areaId', res.areaId) | 
|---|
|  |  |  | // console.log('res', res) | 
|---|
|  |  |  | // console.log('res', this.form) | 
|---|
|  |  |  | this.initData(res.areaId) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | initData(areaId) { | 
|---|
|  |  |  | fetchList({ | 
|---|
|  |  |  | model: { type: 4 }, | 
|---|
|  |  |  | capacity: 1000, | 
|---|
|  |  |  | page: 1, | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | this.cateList = res.records || [] | 
|---|
|  |  |  | console.log('this.form.areaId', this.form) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (areaId) { | 
|---|
|  |  |  | this.cateList.forEach(item => { | 
|---|
|  |  |  | if (item.childCategoryList) { | 
|---|
|  |  |  | item.childCategoryList.forEach(item2 => { | 
|---|
|  |  |  | if (item2.id == areaId) { | 
|---|
|  |  |  | this.$set(this.form, 'areaIds', [item.id, item2.id]) | 
|---|
|  |  |  | console.log('areaIds', this.form) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeSel(e) { | 
|---|
|  |  |  | if (e && e.length == 1) { | 
|---|
|  |  |  | this.$set(this.form, 'catePId', e[0]) | 
|---|
|  |  |  | this.$set(this.form, 'cateId', '') | 
|---|
|  |  |  | } else if (e && e.length == 2) { | 
|---|
|  |  |  | this.$set(this.form, 'catePId', e[0]) | 
|---|
|  |  |  | this.$set(this.form, 'cateId', e[1]) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$set(this.form, 'catePId', '') | 
|---|
|  |  |  | this.$set(this.form, 'cateId', '') | 
|---|
|  |  |  | getCenter(data) { | 
|---|
|  |  |  | // console.log(data) | 
|---|
|  |  |  | // this.$set(this.form, 'postion', data.address) | 
|---|
|  |  |  | if(data.lng){ | 
|---|
|  |  |  | this.$set(this.form, 'lnglat', data.lng + ',' + data.lat) | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | this.$set(this.form, 'lnglat', '') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | this.$set(this.form, 'longitude', data.lng) | 
|---|
|  |  |  | this.$set(this.form, 'latitude', data.lat) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeSel(e) { | 
|---|
|  |  |  | if (e && e.length == 2) { | 
|---|
|  |  |  | this.$set(this.form, 'areaId', e[1]) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$set(this.form, 'areaId', '') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | uploadAvatarSuccess(file) { | 
|---|
|  |  |  | this.form.imgurl = file.imgurl | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <style lang="scss" scoped> | 
|---|
|  |  |  | .mapbox { | 
|---|
|  |  |  | width: 100%; | 
|---|
|  |  |  | height: 400px; | 
|---|
|  |  |  | margin-bottom: 20px; | 
|---|
|  |  |  | float: left; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|