|
@@ -22,6 +22,8 @@ import { useStore } from "vuex";
|
|
|
import { unByKey } from "ol/Observable";
|
|
|
let store = useStore();
|
|
|
|
|
|
+const ROLE = store.state.home.userRole;
|
|
|
+
|
|
|
// 选中样式(高亮)
|
|
|
// const selectedStyle = new Style({
|
|
|
// image: new Icon({
|
|
@@ -34,6 +36,8 @@ let kmap = null;
|
|
|
const areaRef = ref(null);
|
|
|
let dragBox;
|
|
|
|
|
|
+const currentTree = ref(null)
|
|
|
+
|
|
|
const isDrawing = ref(false);
|
|
|
const enableBoxSelect = () => {
|
|
|
const data = mapPoint.value.filter((item) => item.fosterStatus === 0);
|
|
@@ -99,7 +103,6 @@ function addCluster(treeListData, distanceVal) {
|
|
|
mapPoint.value = treeListData;
|
|
|
}
|
|
|
clearCluster();
|
|
|
- let that = this;
|
|
|
let features = [];
|
|
|
// 根据状态加上对应的图标
|
|
|
for (let item of treeListData) {
|
|
@@ -130,6 +133,7 @@ function addCluster(treeListData, distanceVal) {
|
|
|
let style = false;
|
|
|
if (!style) {
|
|
|
const highlight = featureOne.get("highlight");
|
|
|
+ const currentTree = featureOne.get("currentTree");
|
|
|
if (highlight) {
|
|
|
style = new Style({
|
|
|
image: new Icon({
|
|
@@ -137,6 +141,13 @@ function addCluster(treeListData, distanceVal) {
|
|
|
scale: 0.6,
|
|
|
}),
|
|
|
});
|
|
|
+ } else if (currentTree) {
|
|
|
+ style = new Style({
|
|
|
+ image: new Icon({
|
|
|
+ src: require("@/assets/images/map/status/current-icon.png"),
|
|
|
+ scale: 0.8,
|
|
|
+ }),
|
|
|
+ });
|
|
|
} else {
|
|
|
style = new Style({
|
|
|
image: new Circle({
|
|
@@ -144,12 +155,12 @@ function addCluster(treeListData, distanceVal) {
|
|
|
fill: new Fill({
|
|
|
color:
|
|
|
featureOne.get("fosterStatus") === 0
|
|
|
- ? "#ffffff00"
|
|
|
+ ? (ROLE == 1 ? "#ffffff00" : "#BBBBBB99")
|
|
|
: featureOne.get("fosterStatus") === 1
|
|
|
? "#EEEEEE"
|
|
|
: featureOne.get("fosterStatus") === 2
|
|
|
? "#F0AC37"
|
|
|
- : "#ffffff00",
|
|
|
+ : (ROLE == 1 ? "#ffffff00" : "#BBBBBB99"),
|
|
|
}),
|
|
|
stroke: new Stroke({
|
|
|
color: "#fff",
|
|
@@ -191,6 +202,7 @@ function addCluster(treeListData, distanceVal) {
|
|
|
});
|
|
|
|
|
|
const highlight = featureObj.get("highlight");
|
|
|
+ const currentTree = featureObj.get("currentTree");
|
|
|
if (highlight) {
|
|
|
style = new Style({
|
|
|
image: new Icon({
|
|
@@ -198,6 +210,13 @@ function addCluster(treeListData, distanceVal) {
|
|
|
scale: 0.6,
|
|
|
}),
|
|
|
});
|
|
|
+ } else if (currentTree) {
|
|
|
+ style = new Style({
|
|
|
+ image: new Icon({
|
|
|
+ src: require("@/assets/images/map/status/current-icon.png"),
|
|
|
+ scale: 0.8,
|
|
|
+ }),
|
|
|
+ });
|
|
|
} else {
|
|
|
// 已认养--显示图标
|
|
|
if (imgIcon) {
|
|
@@ -215,12 +234,12 @@ function addCluster(treeListData, distanceVal) {
|
|
|
fill: new Fill({
|
|
|
color:
|
|
|
featureObj.get("fosterStatus") === 0
|
|
|
- ? "#ffffff00"
|
|
|
+ ? (ROLE == 1 ? "#ffffff00" : "#BBBBBB99")
|
|
|
: featureObj.get("fosterStatus") === 1
|
|
|
? "#EEEEEE"
|
|
|
: featureObj.get("fosterStatus") === 2
|
|
|
? "#F0AC37"
|
|
|
- : "#ffffff00",
|
|
|
+ : (ROLE == 1 ? "#ffffff00" : "#BBBBBB99"),
|
|
|
}),
|
|
|
stroke: new Stroke({
|
|
|
color: "#fff",
|
|
@@ -268,6 +287,9 @@ function addCluster(treeListData, distanceVal) {
|
|
|
features[0].set("highlight", true);
|
|
|
// features[0].setStyle(selectedStyle)
|
|
|
} else if (!hasFeatures) {
|
|
|
+ resetCurrentTree()
|
|
|
+ features[0].set("currentTree", true)
|
|
|
+ currentTree.value = features[0]
|
|
|
eventBus.emit("clickMapPoint", features[0])
|
|
|
}
|
|
|
}
|
|
@@ -291,7 +313,11 @@ function zoomToFeatures(features) {
|
|
|
kmap.getView().fit(extent, { duration: 500, padding: [200, 250, 120, 250] });
|
|
|
}
|
|
|
|
|
|
-defineExpose({ addCluster, enableBoxSelect, stopBoxSelect, initAreaMap });
|
|
|
+function resetCurrentTree() {
|
|
|
+ currentTree.value && currentTree.value.set("currentTree", false)
|
|
|
+}
|
|
|
+
|
|
|
+defineExpose({ addCluster, enableBoxSelect, stopBoxSelect, initAreaMap, resetCurrentTree });
|
|
|
|
|
|
// 分区
|
|
|
let regionLayer = null;
|