|
|
@@ -14,7 +14,7 @@ |
|
|
|
<van-button type="primary" round >搜索</van-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="location"> |
|
|
|
<div class="location" :id="locationMap"> |
|
|
|
<img src="../../assets/images/app/location.png" alt=""> |
|
|
|
</div> |
|
|
|
|
|
|
@@ -32,145 +32,56 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <van-popup v-model="open" position="bottom" round >--> |
|
|
|
<!-- <div class="landPopup">--> |
|
|
|
<!-- <p class="landPopup_title">属性数据 <img src="../../assets/images/app/edit.png" width="25" alt=""></p>--> |
|
|
|
<!-- <van-form ref="landForm">--> |
|
|
|
<!-- <van-field v-model="form.dkbm" label="地块代码:" placeholder="<自动生成>" :border="false" input-align="right" label-width="auto" maxlength="19" :disabled="true" >--> |
|
|
|
<!-- <!– <template #button v-if="!isDisabled">--> |
|
|
|
<!-- <van-button size="mini" type="primary" native-type="button" @click="generateCode">生成代码</van-button>--> |
|
|
|
<!-- </template> –>--> |
|
|
|
<!-- </van-field>--> |
|
|
|
<!-- <van-field v-model="form.dkmc" label="地块名称:" placeholder="请输入地块名称" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />--> |
|
|
|
<!-- <van-field v-model="syqxzText" label="所有权性质:"--> |
|
|
|
<!-- placeholder="请选择所有权性质"--> |
|
|
|
<!-- required--> |
|
|
|
<!-- :rules="[{ required: true }]"--> |
|
|
|
<!-- :border="false"--> |
|
|
|
<!-- input-align="right"--> |
|
|
|
<!-- right-icon="arrow-down"--> |
|
|
|
<!-- readonly--> |
|
|
|
<!-- clickable--> |
|
|
|
<!-- @click="showOwnership = true"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- <van-popup v-model="showOwnership" position="bottom" get-container=".app-container">--> |
|
|
|
<!-- <van-picker--> |
|
|
|
<!-- show-toolbar--> |
|
|
|
<!-- :columns="syqxzOptions"--> |
|
|
|
<!-- value-key="dictLabel"--> |
|
|
|
<!-- @confirm="onConfirmOwnershipOptions"--> |
|
|
|
<!-- @cancel="showOwnership = false"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- </van-popup>--> |
|
|
|
<!-- <van-field v-model="dklbText" label="地块类别:"--> |
|
|
|
<!-- placeholder="请选择地块类别"--> |
|
|
|
<!-- required--> |
|
|
|
<!-- :rules="[{ required: true }]"--> |
|
|
|
<!-- :border="false"--> |
|
|
|
<!-- input-align="right"--> |
|
|
|
<!-- right-icon="arrow-down"--> |
|
|
|
<!-- readonly--> |
|
|
|
<!-- clickable--> |
|
|
|
<!-- @click="openLandCategoryPopup"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- <van-popup v-model="showLandCategory" position="bottom" get-container=".app-container">--> |
|
|
|
<!-- <van-picker--> |
|
|
|
<!-- show-toolbar--> |
|
|
|
<!-- :columns="dklbOptions"--> |
|
|
|
<!-- value-key="dictLabel"--> |
|
|
|
<!-- @confirm="onConfirmLandCategoryOptions"--> |
|
|
|
<!-- @cancel="showLandCategory = false"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- </van-popup>--> |
|
|
|
<!-- <van-field v-model="tdlylxText" label="土地利用类型:"--> |
|
|
|
<!-- placeholder="请选择土地利用类型"--> |
|
|
|
<!-- required--> |
|
|
|
<!-- :rules="[{ required: true }]"--> |
|
|
|
<!-- :border="false"--> |
|
|
|
<!-- input-align="right"--> |
|
|
|
<!-- right-icon="arrow-down"--> |
|
|
|
<!-- readonly--> |
|
|
|
<!-- clickable--> |
|
|
|
<!-- @click="showLandType = true"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- <van-popup v-model="showLandType" position="bottom" get-container=".app-container">--> |
|
|
|
<!-- <van-picker--> |
|
|
|
<!-- show-toolbar--> |
|
|
|
<!-- :columns="tdlylxOptions"--> |
|
|
|
<!-- value-key="dictLabel"--> |
|
|
|
<!-- @confirm="onConfirmLandTypeOptions"--> |
|
|
|
<!-- @cancel="showLandType = false"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- </van-popup>--> |
|
|
|
<!-- <van-field v-model="dldjText" label="地力等级:"--> |
|
|
|
<!-- placeholder="请选择地力等级"--> |
|
|
|
<!-- required--> |
|
|
|
<!-- :rules="[{ required: true }]"--> |
|
|
|
<!-- :border="false"--> |
|
|
|
<!-- input-align="right"--> |
|
|
|
<!-- right-icon="arrow-down"--> |
|
|
|
<!-- readonly--> |
|
|
|
<!-- clickable--> |
|
|
|
<!-- @click="showLandGrade = true"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- <van-popup v-model="showLandGrade" position="bottom" get-container=".app-container">--> |
|
|
|
<!-- <van-picker--> |
|
|
|
<!-- show-toolbar--> |
|
|
|
<!-- :columns="dldjOptions"--> |
|
|
|
<!-- value-key="dictLabel"--> |
|
|
|
<!-- @confirm="onConfirmLandGradeOptions"--> |
|
|
|
<!-- @cancel="showLandGrade = false"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- </van-popup>--> |
|
|
|
<!-- <van-field v-model="tdytText" label="土地用途:"--> |
|
|
|
<!-- placeholder="请选择土地用途"--> |
|
|
|
<!-- required--> |
|
|
|
<!-- :rules="[{ required: true }]"--> |
|
|
|
<!-- :border="false"--> |
|
|
|
<!-- input-align="right"--> |
|
|
|
<!-- right-icon="arrow-down"--> |
|
|
|
<!-- readonly--> |
|
|
|
<!-- clickable--> |
|
|
|
<!-- @click="showLandPurpose = true"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- <van-popup v-model="showLandPurpose" position="bottom" get-container=".app-container">--> |
|
|
|
<!-- <van-picker--> |
|
|
|
<!-- show-toolbar--> |
|
|
|
<!-- :columns="tdytOptions"--> |
|
|
|
<!-- value-key="dictLabel"--> |
|
|
|
<!-- @confirm="onConfirmLandPurposeOptions"--> |
|
|
|
<!-- @cancel="showLandPurpose = false"--> |
|
|
|
<!-- />--> |
|
|
|
<!-- </van-popup>--> |
|
|
|
<!-- <van-field v-model="form.sfjbnt" label="基本农田:" required :rules="[{ required: true }]" :border="false" input-align="right" >--> |
|
|
|
<!-- <template #input>--> |
|
|
|
<!-- <van-radio-group v-model="form.sfjbnt" direction="horizontal">--> |
|
|
|
<!-- <!– <van-radio name="1">是</van-radio>--> |
|
|
|
<!-- <van-radio name="2">否</van-radio> –>--> |
|
|
|
<!-- <van-radio v-for="dict in sfjbntOptions" :ke="dict.dictValue" :name="dict.dictValue">{{ dict.dictLabel }}</van-radio>--> |
|
|
|
<!-- </van-radio-group>--> |
|
|
|
<!-- </template>--> |
|
|
|
<!-- </van-field>--> |
|
|
|
<!-- <van-field v-model="form.scmjm" type="number" label="实测面积(亩):" placeholder="请输入实测面积(亩)" required :rules="[{ required: true }]" :border="false" input-align="right" />--> |
|
|
|
<!-- <van-field v-model="form.zjrxm" label="指界人姓名:" placeholder="请输入指界人姓名" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="100" />--> |
|
|
|
<!-- <van-field v-model="form.dkdz" label="地块东至:" placeholder="请输入地块东至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />--> |
|
|
|
<!-- <van-field v-model="form.dkxz" label="地块西至:" placeholder="请输入地块西至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />--> |
|
|
|
<!-- <van-field v-model="form.dknz" label="地块南至:" placeholder="请输入地块南至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />--> |
|
|
|
<!-- <van-field v-model="form.dkbz" label="地块北至:" placeholder="请输入地块北至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />--> |
|
|
|
<!-- <van-field v-model="form.dkbzxx" label="地块备注信息:" placeholder="请输入地块备注信息" type="textarea" rows="3" :border="false" input-align="right" maxlength="250" />--> |
|
|
|
<!-- </van-form>--> |
|
|
|
<!-- <div class="footer_main">--> |
|
|
|
<!-- <van-button type="default" hairline size="large">关闭弹窗</van-button>--> |
|
|
|
<!-- <van-button type="danger" hairline size="large">删除地块</van-button>--> |
|
|
|
<!-- <van-button type="info" hairline size="large">保存信息</van-button>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- </van-popup>--> |
|
|
|
<van-popup v-model="open" position="bottom" round > |
|
|
|
<div class="landPopup"> |
|
|
|
<p class="landPopup_title">属性数据 <img @click="$router.push({name:'appAttributeEdit',query:{fid:form.fid}})" src="../../assets/images/app/edit.png" width="25" alt=""></p> |
|
|
|
<van-field readonly v-model="form.deptName" label="区域位置名称" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.bsm" label="标识码" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.ysdm" label="要素代码" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dkbm" label="地块代码" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dkmc" label="地块名称" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.syqxz" label="所有权性质" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dklb" label="地块类别" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.tdlylx" label="土地利用类型" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dldj" label="地力等级" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.tdyt" label="土地用途" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.sfjbnt" label="是否基本农田" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dkdz" label="地块东至" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dkxz" label="地块西至" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dknz" label="地块南至" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dkbz" label="地块北至" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.dkbzxx" label="备注信息" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.zjrxm" label="指界人姓名" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.txmj" label="图显面积" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.scmjm" label="实测面积" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.sfzwd" label="是否账外地" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
|
|
|
|
<p class="landPopup_title">经营数据 <img @click="$router.push({name:'appOperateEdit',query:{dkbm:form.dkbm}})" src="../../assets/images/app/edit.png" width="25" alt=""></p> |
|
|
|
<van-field readonly v-model="form.jymj" label="经营面积(亩)" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.jyfs" label="经营方式" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.jydxmc" label="经营对象名称" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.jykssj" label="经营开始时间" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.jyjssj" label="经营结束时间" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.cbje" label="承包金额(元)" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.surveyStatus" label="调查状态" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly v-model="form.bzxx" label="备注信息" placeholder="请输入" input-align="right" label-width="auto" /> |
|
|
|
<van-field readonly label="实物图" placeholder="" input-align="right" label-width="auto" /> |
|
|
|
<div v-if="!!form.dkImg"> |
|
|
|
<el-tooltip effect="light" :content="item" placement="bottom" v-for="(item, index) in form.dkImg.split(',')" :key="index"> |
|
|
|
<el-image style="height: 64px; width: 64px; margin: 2px; display: inline-block;" fit="scale-down" :src="baseRoutingUrll + item" :preview-src-list="form.dkImg.split(',').map((x) => baseRoutingUrll + x)"/> |
|
|
|
</el-tooltip> |
|
|
|
</div> |
|
|
|
<div class="footer_main"> |
|
|
|
<van-button type="danger" @click="open = false" hairline size="large">关闭弹窗</van-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</van-popup> |
|
|
|
|
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { listLand, listLandQuery,getLand, getLandDetail, getLandDetailByDkbm, delLand, addLand, updateLand, printLand } from "@/api/resource/land" |
|
|
|
import { getOperationDetailByDkbm } from "@/api/resource/operation" |
|
|
|
import { areaSavePri, cleanSavePri } from "@/api/gis/map" |
|
|
|
import { getToken } from "@/utils/auth" |
|
|
|
import Treeselect from "@riophae/vue-treeselect"; |
|
|
@@ -181,6 +92,7 @@ |
|
|
|
import {getConfigKey} from "@/api/system/config"; |
|
|
|
import {getDept,getInfoByImportCode} from "@/api/system/dept"; |
|
|
|
import MapField from "@/components/house/MapField"; |
|
|
|
import {Toast} from "vant"; |
|
|
|
import $ from "jquery"; |
|
|
|
|
|
|
|
|
|
|
@@ -189,7 +101,8 @@ |
|
|
|
components: { Treeselect, Splitpanes, Pane,MapField }, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
fform: {}, // 地块信息表单参数 |
|
|
|
baseRoutingUrll:'/api', |
|
|
|
form: {}, // 地块信息表单参数 |
|
|
|
map: "", // 地图 |
|
|
|
mapGeoServerUrl: "", // geoserver地址 |
|
|
|
mapCenterLocation: [], // 地图中心坐标 |
|
|
@@ -227,9 +140,24 @@ |
|
|
|
value:'', |
|
|
|
deptId:100, |
|
|
|
importCode:'', |
|
|
|
locationMap: this.guidProduct(), |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
isAndroid() { |
|
|
|
return !!window._Native_object; |
|
|
|
}, |
|
|
|
hasSelectLocationMode() { |
|
|
|
return this.isAndroid && typeof(window._Native_object.SelectLocationMode) === 'function'; |
|
|
|
}, |
|
|
|
hasGetLocationTimeout() { |
|
|
|
return this.isAndroid && typeof(window._Native_object.GetLocationTimeout) === 'function'; |
|
|
|
}, |
|
|
|
hasGetLocationMode() { |
|
|
|
return this.isAndroid && typeof(window._Native_object.GetLocationMode) === 'function'; |
|
|
|
}, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
console.log(this.$store.getters.user.user.dept.deptId) |
|
|
|
this.deptId = this.$store.getters.user.user.dept.deptId; |
|
|
@@ -243,9 +171,11 @@ |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
// 初始化地图 |
|
|
|
setTimeout(() => { |
|
|
|
this.initMap(); |
|
|
|
}, 500); |
|
|
|
listLandQuery().then(response => { |
|
|
|
setTimeout(() => { |
|
|
|
this.initMap(response.rows); |
|
|
|
}, 500); |
|
|
|
}); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onClickLeft(){ |
|
|
@@ -269,8 +199,15 @@ |
|
|
|
this.villageBorderLayerName = response.msg; |
|
|
|
}); |
|
|
|
}, |
|
|
|
guidProduct(){ |
|
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { |
|
|
|
var r = Math.random() * 16 | 0, |
|
|
|
v = c == 'x' ? r : (r & 0x3 | 0x8); |
|
|
|
return v.toString(16); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 初始化地图 |
|
|
|
initMap() { |
|
|
|
initMap(resourceList) { |
|
|
|
getDept(this.deptId).then(response => { |
|
|
|
let dept = response.data; |
|
|
|
if (dept.longitude && dept.latitude) { |
|
|
@@ -355,64 +292,100 @@ |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
var mark_layer = null; |
|
|
|
function addMark(lng, lat) { |
|
|
|
if(!mark_layer) |
|
|
|
{ |
|
|
|
mark_layer = new ol.layer.Vector({ |
|
|
|
source: new ol.source.Vector(), |
|
|
|
}); |
|
|
|
that.map.addLayer(mark_layer); |
|
|
|
} |
|
|
|
else |
|
|
|
mark_layer.getSource().clear(); |
|
|
|
|
|
|
|
let newFeature = new ol.Feature({ |
|
|
|
geometry: new ol.geom.Point(ol.proj.fromLonLat([lng, lat])), //几何信息 |
|
|
|
//name: "标注点", |
|
|
|
}); |
|
|
|
newFeature.setStyle(new ol.style.Style({ |
|
|
|
image: new ol.style.Icon({ |
|
|
|
//设置图标偏移 |
|
|
|
anchor: [0.5, 0.5], |
|
|
|
//标注样式的起点位置 |
|
|
|
anchorOrigin: "top-right", |
|
|
|
//X方向单位:分数 |
|
|
|
anchorXUnits: "fraction", |
|
|
|
//Y方向单位:像素 |
|
|
|
anchorYUnits: "fraction", |
|
|
|
//偏移起点位置的方向 |
|
|
|
offsetOrigin: "top-right", |
|
|
|
//透明度 |
|
|
|
opacity: 0.9, |
|
|
|
//图片路径 |
|
|
|
src: require('../../assets/images/app/mark.png'), |
|
|
|
}), |
|
|
|
zIndex: 9999, |
|
|
|
})); |
|
|
|
mark_layer.getSource().addFeature(newFeature); |
|
|
|
} |
|
|
|
var that = this; |
|
|
|
var Zb; |
|
|
|
$("#" + this.locationMap).click(function () { |
|
|
|
that.getCurrentLocation(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
let lat = res.data.lat; |
|
|
|
let lng = res.data.lng; |
|
|
|
if(lat && lng){ |
|
|
|
Zb = [lng,lat]; |
|
|
|
}else { |
|
|
|
Zb =[115.452752, 31.789033]; |
|
|
|
} |
|
|
|
addMark(lng,lat); |
|
|
|
that.map.getView().animate({ |
|
|
|
// 只设置需要的属性即可 |
|
|
|
center: ol.proj.fromLonLat(Zb), // 中心点 |
|
|
|
zoom: 18, // 缩放级别 |
|
|
|
rotation: undefined, // 缩放完成view视图旋转弧度 |
|
|
|
duration: 1000, // 缩放持续时间,默认不需要设置 |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 地图点击事件 |
|
|
|
this.map.on("click", (evt) => { |
|
|
|
// 点击宅基地查看详情 |
|
|
|
console.log(this.landLayer) |
|
|
|
if (this.landLayer) { |
|
|
|
const viewResolution = this.map.getView().getResolution(); |
|
|
|
const url = this.landLayer.getSource() |
|
|
|
.getFeatureInfoUrl(evt.coordinate, viewResolution, 'EPSG:3857', {'INFO_FORMAT': 'application/json'}); |
|
|
|
console.log(url) |
|
|
|
if (url) { |
|
|
|
fetch(url) |
|
|
|
.then(response => response.json()) |
|
|
|
.then(data => { |
|
|
|
if (data.features.length > 0) { |
|
|
|
let id = data.features[0].id.split(".")[1]; |
|
|
|
getDk(id).then(response => { |
|
|
|
const data = response.data; |
|
|
|
this.reset(); |
|
|
|
this.form = data; |
|
|
|
this.syqxzText = this.selectDictLabel(this.syqxzOptions, data.syqxz); |
|
|
|
if (data.dklb === '10') { |
|
|
|
this.dklbText = '承包地块'; |
|
|
|
} else { |
|
|
|
this.dklbText = this.selectDictLabel(this.dklbOptions, data.dklb); |
|
|
|
} |
|
|
|
this.dldjText = this.selectDictLabel(this.dldjOptions, data.dldj); |
|
|
|
this.tdytText = this.selectDictLabel(this.tdytOptions, data.tdyt); |
|
|
|
this.tdlylxText = this.selectDictLabel(this.tdlylxOptions, data.tdlylx); |
|
|
|
this.title = "查看地块信息"; |
|
|
|
this.showSaveBtn = false; |
|
|
|
this.showDeleteBtn = true; |
|
|
|
// this.isDisabled = true; |
|
|
|
let id = data.features[0].properties.DKBM; |
|
|
|
getLandDetailByDkbm(id).then(response => { |
|
|
|
this.form = response.data; |
|
|
|
setTimeout(() => { |
|
|
|
this.open = true; |
|
|
|
}, 10); |
|
|
|
}); |
|
|
|
|
|
|
|
/* if (this.selectedHomesteadLayer) { |
|
|
|
this.map.removeLayer(this.selectedHomesteadLayer); |
|
|
|
this.selectedHomesteadLayer = ""; |
|
|
|
} |
|
|
|
this.selectedHomesteadLayer = new ol.layer.Vector({ |
|
|
|
source: new ol.source.Vector({ |
|
|
|
features: new ol.format.GeoJSON().readFeatures(data) |
|
|
|
}), |
|
|
|
name: 'selectedHomesteadLayer', |
|
|
|
style: new ol.style.Style({ |
|
|
|
fill: new ol.style.Fill({ |
|
|
|
//矢量图层填充颜色,以及透明度 |
|
|
|
color: "rgba(255, 84, 87, 0.3)", |
|
|
|
}), |
|
|
|
stroke: new ol.style.Stroke({ |
|
|
|
//边界样式 |
|
|
|
color: "#ff5457", |
|
|
|
width: 3, |
|
|
|
}), |
|
|
|
}) |
|
|
|
}, 500); |
|
|
|
}); |
|
|
|
// this.map.addLayer(this.selectedHomesteadLayer); |
|
|
|
this.map.getLayers().insertAt(4, this.selectedHomesteadLayer);*/ |
|
|
|
// getLandDetail(id).then(response => { |
|
|
|
// // this.form = response.data; |
|
|
|
// getLandDetailByDkbm(response.data.dkbm).then(res => { |
|
|
|
// res.data.txmj = response.data.txmj; |
|
|
|
// this.form = res.data; |
|
|
|
// }); |
|
|
|
// // getOperationDetailByDkbm(response.data.dkbm).then(response => { |
|
|
|
// // this.form = response.data |
|
|
|
// // }) |
|
|
|
// setTimeout(() => { |
|
|
|
// this.open = true; |
|
|
|
// }, 500); |
|
|
|
// }); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@@ -427,6 +400,105 @@ |
|
|
|
} |
|
|
|
this.addLandLayer(); |
|
|
|
}, |
|
|
|
getLocationMode() { |
|
|
|
let mode = ''; |
|
|
|
if(this.hasGetLocationMode) |
|
|
|
{ |
|
|
|
mode = window._Native_object.GetLocationMode(); |
|
|
|
} |
|
|
|
console.log('当前选择定位模式: ' + mode); |
|
|
|
return mode; |
|
|
|
}, |
|
|
|
getLocationTimeout() { |
|
|
|
let timeout = 10000; |
|
|
|
if(this.hasGetLocationMode) |
|
|
|
{ |
|
|
|
let to = window._Native_object.GetLocationTimeout(); |
|
|
|
if(to <= 0) |
|
|
|
to = 30000; |
|
|
|
timeout = to; |
|
|
|
} |
|
|
|
console.log('当前选择定位超时: ' + timeout); |
|
|
|
return timeout; |
|
|
|
}, |
|
|
|
getDeptLocation(callback) { |
|
|
|
getQueryLand().then((response) => { |
|
|
|
if (response.code == 200) { |
|
|
|
let InsertCode = response.data; |
|
|
|
if (InsertCode != null) { |
|
|
|
var lat = InsertCode.lat; |
|
|
|
var lng = InsertCode.lng; |
|
|
|
if(lat !=null && lng !=null && lat !="" && lng !=""){ |
|
|
|
callback(response); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.getCurrentLocation(callback); |
|
|
|
}); |
|
|
|
}, |
|
|
|
getCurrentLocation(callback) { |
|
|
|
// 1. 首先尝试Android宿主端 |
|
|
|
if(this.isAndroid) // Android层注入全局对象 |
|
|
|
{ |
|
|
|
let mode = this.getLocationMode(); |
|
|
|
if(mode !== 'h5') |
|
|
|
{ |
|
|
|
console.log('使用Native获取定位'); |
|
|
|
let coord = window._Native_object.GetLocation(null); |
|
|
|
console.log('Native坐标: ' + coord); |
|
|
|
if(coord) |
|
|
|
{ |
|
|
|
let arr = coord.split(','); |
|
|
|
let res = { |
|
|
|
code: 200, |
|
|
|
data: { |
|
|
|
lng: arr[0], |
|
|
|
lat: arr[1], |
|
|
|
}, |
|
|
|
}; |
|
|
|
callback(res); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 2. 再尝试浏览器 |
|
|
|
if (navigator.geolocation) { |
|
|
|
console.log('使用浏览器获取定位'); |
|
|
|
const loading = Toast.loading({ |
|
|
|
message: '定位中...', |
|
|
|
duration: 0, |
|
|
|
}); |
|
|
|
let timeout = this.getLocationTimeout(); |
|
|
|
navigator.geolocation.getCurrentPosition( |
|
|
|
(position) => { |
|
|
|
const { latitude, longitude } = position.coords; |
|
|
|
console.log('浏览器定位结果: 经纬度=' + longitude + ', ' + latitude); |
|
|
|
let res = { |
|
|
|
code: 200, |
|
|
|
data: { |
|
|
|
lng: longitude, |
|
|
|
lat: latitude, |
|
|
|
}, |
|
|
|
}; |
|
|
|
loading.clear(); |
|
|
|
callback(res); |
|
|
|
}, |
|
|
|
(error) => { |
|
|
|
loading.clear(); |
|
|
|
console.log('定位失败: ' + error.message); |
|
|
|
getQueryLand().then(callback); |
|
|
|
}, |
|
|
|
{ enableHighAccuracy: true, timeout: timeout } |
|
|
|
); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 最后使用地区坐标 |
|
|
|
console.log('使用地区坐标定位'); |
|
|
|
getQueryLand().then(callback); |
|
|
|
}, |
|
|
|
// 添加地块图层 |
|
|
|
addLandLayer() { |
|
|
|
this.landLayer = new ol.layer.Image({ |
|
|
|