|
@@ -7,6 +7,9 @@
|
|
</el-select>
|
|
</el-select>
|
|
<el-color-picker v-model="mouseToolState.color" popper-class="custom-color-picker" show-alpha size="large" />
|
|
<el-color-picker v-model="mouseToolState.color" popper-class="custom-color-picker" show-alpha size="large" />
|
|
<el-button size="large" @click="changeDrawing">{{ drawing ? '关闭' : '开启' }}</el-button>
|
|
<el-button size="large" @click="changeDrawing">{{ drawing ? '关闭' : '开启' }}</el-button>
|
|
|
|
+ <div class="flex">
|
|
|
|
+ <div class="draw-item" @click="undo">撤销</div>
|
|
|
|
+ </div>
|
|
<div class="tabs1">
|
|
<div class="tabs1">
|
|
<div v-for="(item, index) in menu" :key="index" :class="menuActive1 === index ? 'tab tab_active' : 'tab'" @click="clickTab(index)">
|
|
<div v-for="(item, index) in menu" :key="index" :class="menuActive1 === index ? 'tab tab_active' : 'tab'" @click="clickTab(index)">
|
|
{{ item.name }}
|
|
{{ item.name }}
|
|
@@ -27,7 +30,7 @@
|
|
v-for="(item, index) in menu[menuActive1].children[menuActive2].children"
|
|
v-for="(item, index) in menu[menuActive1].children[menuActive2].children"
|
|
:key="index"
|
|
:key="index"
|
|
:class="menuActive2 === index ? 'tab tab_active' : 'tab'"
|
|
:class="menuActive2 === index ? 'tab tab_active' : 'tab'"
|
|
- @click="clickTab3(item.value)"
|
|
|
|
|
|
+ @click="clickTab3(item)"
|
|
>
|
|
>
|
|
{{ item.name }}
|
|
{{ item.name }}
|
|
</div>
|
|
</div>
|
|
@@ -40,7 +43,7 @@
|
|
<div class="edit-box">
|
|
<div class="edit-box">
|
|
<div class="flex">
|
|
<div class="flex">
|
|
<div class="text">字号</div>
|
|
<div class="text">字号</div>
|
|
- <el-input v-model="textEditState.fonSize" />
|
|
|
|
|
|
+ <el-input v-model="textEditState.fontSize" />
|
|
</div>
|
|
</div>
|
|
<div class="flex">
|
|
<div class="flex">
|
|
<div class="text">颜色</div>
|
|
<div class="text">颜色</div>
|
|
@@ -48,7 +51,7 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="edit-btn-box">
|
|
<div class="edit-btn-box">
|
|
- <el-button size="large" @click="textEditState.show = false">取消</el-button>
|
|
|
|
|
|
+ <el-button size="large" @click="cancelEdit">取消</el-button>
|
|
<el-button type="primary" size="large" @click="addText">确定</el-button>
|
|
<el-button type="primary" size="large" @click="addText">确定</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -62,6 +65,10 @@ interface Props {
|
|
|
|
|
|
const props = withDefaults(defineProps<Props>(), {});
|
|
const props = withDefaults(defineProps<Props>(), {});
|
|
const emits = defineEmits(['updateDrawing', 'updateMouseToolState']);
|
|
const emits = defineEmits(['updateDrawing', 'updateMouseToolState']);
|
|
|
|
+const getMap = inject('getMap');
|
|
|
|
+const getMouseTool = inject('getMouseTool');
|
|
|
|
+const updateMouseToolState = inject('updateMouseToolState');
|
|
|
|
+const undo = inject('undo');
|
|
|
|
|
|
const menuActive1 = ref(0);
|
|
const menuActive1 = ref(0);
|
|
const menuActive2 = ref(0);
|
|
const menuActive2 = ref(0);
|
|
@@ -107,7 +114,15 @@ const menu = ref([
|
|
}
|
|
}
|
|
]
|
|
]
|
|
},
|
|
},
|
|
- { name: '火点', value: 'firePoint', children: [] },
|
|
|
|
|
|
+ {
|
|
|
|
+ name: '火点',
|
|
|
|
+ value: 'firePoint',
|
|
|
|
+ children: [
|
|
|
|
+ { name: '起火点', value: 'marker', icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png', size: [19, 31] },
|
|
|
|
+ { name: '烟点', value: 'marker', icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png', size: [19, 31] },
|
|
|
|
+ { name: '已灭火点', value: 'marker', icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png', size: [19, 31] }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
{ name: '火线', value: 'firewire', children: [] },
|
|
{ name: '火线', value: 'firewire', children: [] },
|
|
{ name: '火场', value: 'fireGround', children: [] },
|
|
{ name: '火场', value: 'fireGround', children: [] },
|
|
{ name: '箭头', value: 'arrow', children: [] },
|
|
{ name: '箭头', value: 'arrow', children: [] },
|
|
@@ -119,7 +134,7 @@ const menu = ref([
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- name: '历史记录',
|
|
|
|
|
|
+ name: '历史预案',
|
|
children: []
|
|
children: []
|
|
}
|
|
}
|
|
]);
|
|
]);
|
|
@@ -132,7 +147,8 @@ const textEditState = reactive({
|
|
showTextEdit: false,
|
|
showTextEdit: false,
|
|
fontColor: '#f80102',
|
|
fontColor: '#f80102',
|
|
fontSize: '36',
|
|
fontSize: '36',
|
|
- text: ''
|
|
|
|
|
|
+ text: '',
|
|
|
|
+ lnglat: []
|
|
});
|
|
});
|
|
|
|
|
|
// 点击一级菜单
|
|
// 点击一级菜单
|
|
@@ -144,31 +160,75 @@ const clickTab2 = (value: number) => {
|
|
menuActive2.value = value;
|
|
menuActive2.value = value;
|
|
};
|
|
};
|
|
// 点击三级菜单
|
|
// 点击三级菜单
|
|
-const clickTab3 = (type) => {
|
|
|
|
- if (props.mouseToolState.graphicsType === type) {
|
|
|
|
|
|
+const clickTab3 = (item) => {
|
|
|
|
+ const type = item.value;
|
|
|
|
+ if (
|
|
|
|
+ props.mouseToolState.graphicsType !== type ||
|
|
|
|
+ (props.mouseToolState.graphicsType === 'marker' && props.mouseToolState.markerName !== item.name)
|
|
|
|
+ ) {
|
|
|
|
+ if (type === 'text') {
|
|
|
|
+ handleTextEdit();
|
|
|
|
+ } else if (type === 'marker') {
|
|
|
|
+ const data = {
|
|
|
|
+ graphicsType: type,
|
|
|
|
+ lineWidth: props.mouseToolState.lineWidth,
|
|
|
|
+ color: props.mouseToolState.color,
|
|
|
|
+ icon: item.icon,
|
|
|
|
+ size: item.size,
|
|
|
|
+ markerName: item.name
|
|
|
|
+ };
|
|
|
|
+ emits('updateDrawing', true);
|
|
|
|
+ updateMouseToolState(data);
|
|
|
|
+ } else {
|
|
|
|
+ textEditState.showTextEdit = false;
|
|
|
|
+ emits('updateDrawing', true);
|
|
|
|
+ props.mouseToolState.graphicsType = type;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ textEditState.showTextEdit = false;
|
|
emits('updateDrawing', false);
|
|
emits('updateDrawing', false);
|
|
props.mouseToolState.graphicsType = '';
|
|
props.mouseToolState.graphicsType = '';
|
|
- } else {
|
|
|
|
- emits('updateDrawing', true);
|
|
|
|
- props.mouseToolState.graphicsType = type;
|
|
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-const handleClick = () => {
|
|
|
|
- textEditState.fontColor = props.mouseToolState.color;
|
|
|
|
- textEditState.fontSize = props.mouseToolState.fontSize;
|
|
|
|
|
|
+const handleTextEdit = () => {
|
|
|
|
+ const map = getMap();
|
|
|
|
+ const mouseTool = getMouseTool();
|
|
|
|
+ mouseTool.close();
|
|
|
|
+ // 监听地图点击事件
|
|
|
|
+ map.on('click', handleClickMap);
|
|
|
|
+};
|
|
|
|
+const handleClickMap = (e) => {
|
|
|
|
+ // 获取点击位置的经纬度
|
|
|
|
+ textEditState.lnglat = e.lnglat;
|
|
textEditState.showTextEdit = true;
|
|
textEditState.showTextEdit = true;
|
|
};
|
|
};
|
|
const addText = () => {
|
|
const addText = () => {
|
|
- emits('updateMouseToolState', {
|
|
|
|
- color: props.mouseToolState.color,
|
|
|
|
- lineWidth: props.mouseToolState.lineWidth,
|
|
|
|
- drawType: props.mouseToolState.drawType,
|
|
|
|
|
|
+ const data = {
|
|
graphicsType: 'text',
|
|
graphicsType: 'text',
|
|
|
|
+ lineWidth: props.mouseToolState.lineWidth,
|
|
|
|
+ color: props.mouseToolState.lineWidth,
|
|
|
|
+ text: textEditState.text,
|
|
fontColor: textEditState.fontColor,
|
|
fontColor: textEditState.fontColor,
|
|
- fontSize: textEditState.fontSize
|
|
|
|
- });
|
|
|
|
|
|
+ fontSize: textEditState.fontSize,
|
|
|
|
+ lnglat: textEditState.lnglat
|
|
|
|
+ };
|
|
|
|
+ cancelEdit();
|
|
|
|
+ emits('updateDrawing', true);
|
|
|
|
+ updateMouseToolState(data);
|
|
|
|
+};
|
|
|
|
+const cancelEdit = () => {
|
|
textEditState.showTextEdit = false;
|
|
textEditState.showTextEdit = false;
|
|
|
|
+ textEditState.text = '';
|
|
};
|
|
};
|
|
|
|
+watch(
|
|
|
|
+ () => props.mouseToolState.graphicsType,
|
|
|
|
+ (value) => {
|
|
|
|
+ if (value) {
|
|
|
|
+ const map = getMap();
|
|
|
|
+ map.off('click', handleClickMap);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+);
|
|
const changeDrawing = () => {
|
|
const changeDrawing = () => {
|
|
emits('updateDrawing', !props.drawing);
|
|
emits('updateDrawing', !props.drawing);
|
|
};
|
|
};
|