|
@@ -204,8 +204,8 @@ class AuthenticMap {
|
|
|
|
|
|
// 清空单个数据
|
|
|
clearMapData(name, val, id) {
|
|
|
- mapData[name] = val;
|
|
|
- // resetMapData()
|
|
|
+ name && (mapData[name] = val);
|
|
|
+ resetMapData()
|
|
|
this.clickPointLayer.source.forEachFeature((feature) => {
|
|
|
if (feature.get("id") === id) {
|
|
|
feature.set("icon", "point");
|
|
@@ -223,21 +223,39 @@ class AuthenticMap {
|
|
|
mapData.selectPointArr = [];
|
|
|
}
|
|
|
//全选
|
|
|
- allSelect(){
|
|
|
+ allSelect(ids){
|
|
|
let arr = []
|
|
|
this.clickPointLayer.source.forEachFeature((feature) => {
|
|
|
+ if(!ids || ids.findIndex((id)=> id == feature.get('id')) > -1){
|
|
|
feature.set("icon", "point-act");
|
|
|
feature.set("iconBg", "name-act-bg");
|
|
|
+ }
|
|
|
});
|
|
|
const points = this.kmap.getLayerFeatures();
|
|
|
points.forEach((feature) => {
|
|
|
+ if(!ids || ids.findIndex((id)=> id == feature.get('id')) > -1) {
|
|
|
feature.set("icon", "point-act");
|
|
|
this.kmap.polygonStyle(feature);
|
|
|
mapData.isPointHide = feature;
|
|
|
arr.push(feature)
|
|
|
+ }
|
|
|
});
|
|
|
mapData.selectPointArr = arr;
|
|
|
}
|
|
|
+ //no全选
|
|
|
+ allUnSelect(){
|
|
|
+ this.clickPointLayer.source.forEachFeature((feature) => {
|
|
|
+ feature.set("icon", "point");
|
|
|
+ feature.set("iconBg", "name-bg");
|
|
|
+ });
|
|
|
+ const points = this.kmap.getLayerFeatures();
|
|
|
+ points.forEach((feature) => {
|
|
|
+ feature.set("icon", "point");
|
|
|
+ this.kmap.polygonStyle(feature);
|
|
|
+ mapData.isPointHide = feature;
|
|
|
+ });
|
|
|
+ mapData.selectPointArr = [];
|
|
|
+ }
|
|
|
// 地图点击事件
|
|
|
addMapSingerClick() {
|
|
|
let that = this;
|
|
@@ -361,6 +379,53 @@ class AuthenticMap {
|
|
|
});
|
|
|
return { geometryArr, area: area.toFixed(2) };
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ address
|
|
|
+ farmName
|
|
|
+ masterName
|
|
|
+ masterTel
|
|
|
+ speciesTypeName
|
|
|
+ ""
|
|
|
+ * @param form
|
|
|
+ */
|
|
|
+ search(form){
|
|
|
+ const points = this.kmap.getLayerFeatures();
|
|
|
+ let arr = []
|
|
|
+ points.forEach((feature) => {
|
|
|
+ let condition = []
|
|
|
+ if(form.address != ''){
|
|
|
+ condition.push(feature.get("address").includes(form.address))
|
|
|
+ }
|
|
|
+ if(form.farmName != ''){
|
|
|
+ condition.push(feature.get("farmName").includes(form.farmName))
|
|
|
+ }
|
|
|
+ if(form.masterName != ''){
|
|
|
+ condition.push(feature.get("masterName").includes(form.masterName))
|
|
|
+ }
|
|
|
+ if(form.masterTel != ''){
|
|
|
+ condition.push(feature.get("masterTel").includes(form.masterTel))
|
|
|
+ }
|
|
|
+ if(form.speciesTypeName != ''){
|
|
|
+ condition.push(feature.get("speciesTypeName").includes(form.speciesTypeName))
|
|
|
+ }
|
|
|
+ let b = false
|
|
|
+ for(let item of condition){
|
|
|
+ if(item){
|
|
|
+ b = true
|
|
|
+ }else{
|
|
|
+ b = false
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(b){
|
|
|
+ arr.push(feature.get("id"))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.allUnSelect()
|
|
|
+ // alert(arr)
|
|
|
+ this.allSelect(arr)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export default AuthenticMap;
|