添加地图分区摄像头数量

This commit is contained in:
wuhongjian 2022-07-14 17:02:42 +08:00
parent 1f7a02927e
commit 29b20ce55b
3 changed files with 300 additions and 253 deletions

View File

@ -2,14 +2,14 @@
* @Author: hisense.wuhongjian * @Author: hisense.wuhongjian
* @Date: 2021-10-13 09:30:54 * @Date: 2021-10-13 09:30:54
* @LastEditors: hisense.wuhongjian * @LastEditors: hisense.wuhongjian
* @LastEditTime: 2021-10-13 15:04:58 * @LastEditTime: 2022-07-14 16:28:27
* @Description: 点位-位置匹配 * @Description: 点位-位置匹配
*/ */
const DIVISION = { const DIVISION = {
qingdao: [ qingdao: [
{ {
districtName: '城阳区', districtName: '城阳区',
name: '城阳区', name: '城阳区(约1.5万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.31, lat: 36.31,
@ -18,7 +18,7 @@ const DIVISION = {
}, },
{ {
districtName: '李沧区', districtName: '李沧区',
name: '李沧区', name: '李沧区(约0.6万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.17, lat: 36.17,
@ -27,7 +27,7 @@ const DIVISION = {
}, },
{ {
districtName: '市北区', districtName: '市北区',
name: '市北区', name: '市北区(约0.7万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.1, lat: 36.1,
@ -36,7 +36,7 @@ const DIVISION = {
}, },
{ {
districtName: '市南区', districtName: '市南区',
name: '市南区', name: '市南区(约0.4万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.06, lat: 36.06,
@ -45,7 +45,7 @@ const DIVISION = {
}, },
{ {
districtName: '崂山区', districtName: '崂山区',
name: '崂山区', name: '崂山区(约2.0万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.11, lat: 36.11,
@ -54,7 +54,7 @@ const DIVISION = {
}, },
{ {
districtName: '即墨区', districtName: '即墨区',
name: '即墨区', name: '即墨区(约1.4万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.39, lat: 36.39,
@ -63,7 +63,7 @@ const DIVISION = {
}, },
{ {
districtName: '胶州市', districtName: '胶州市',
name: '胶州市', name: '胶州市(约1.5万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.27, lat: 36.27,
@ -72,7 +72,7 @@ const DIVISION = {
}, },
{ {
districtName: '平度市', districtName: '平度市',
name: '平度市', name: '平度市(约1.6万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.78, lat: 36.78,
@ -81,7 +81,7 @@ const DIVISION = {
}, },
{ {
districtName: '莱西市', districtName: '莱西市',
name: '莱西市', name: '莱西市(约1.0万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 36.89, lat: 36.89,
@ -90,7 +90,7 @@ const DIVISION = {
}, },
{ {
districtName: '西海岸新区', districtName: '西海岸新区',
name: '西海岸新区', name: '西海岸新区(约4.1万)',
districtCOde: '', districtCOde: '',
latLng: { latLng: {
lat: 35.99, lat: 35.99,

View File

@ -1,98 +1,120 @@
<template> <template>
<div class="list-box"> <div class="list-box">
<div class="list-item" v-for="(item, i) in newDataList" :key="i" @click.stop="showChildren(item)"> <div
<a-tooltip placement="top" :title="item.title" arrow-point-at-center> class="list-item"
<div :class="[newClickData.title === item.title ? 'select' : '', level === 1 ? 'parent' : '', judgeLeaf(item) ? 'leaf' : '']" v-for="(item, i) in newDataList"
class="list-text"> :key="i"
{{ item.title }} @click.stop="showChildren(item)"
<DownOutlined v-show="!item.show && !judgeLeaf(item)" /> >
<UpOutlined v-show="item.show && !judgeLeaf(item)" /> <a-tooltip placement="top" :title="item.title" arrow-point-at-center>
</div> <div
</a-tooltip> :class="[
<div style="margin-left:10px" v-if="!judgeLeaf(item) && item.show"> newClickData.title === item.title ? 'select' : '',
<abilityDocTree :dataList="item.children" @tree-click="handleTreeItem" :clickData="newClickData" level === 1 ? 'parent' : '',
:level="newLevel + 1"> judgeLeaf(item) ? 'leaf' : '',
</abilityDocTree> ]"
</div> class="list-text"
>
{{ item.title }}
<DownOutlined v-show="!item.show && !judgeLeaf(item)" />
<UpOutlined v-show="item.show && !judgeLeaf(item)" />
</div> </div>
</a-tooltip>
<div style="margin-left: 10px" v-if="!judgeLeaf(item) && item.show">
<abilityDocTree
:dataList="item.children"
@tree-click="handleTreeItem"
:clickData="newClickData"
:level="newLevel + 1"
></abilityDocTree>
</div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
import { defineComponent, onMounted, ref, watch, defineProps, nextTick } from 'vue'; import {
import { getDevelopDocTree } from '@/api/home' defineComponent,
import { message } from 'ant-design-vue' onMounted,
import { UpOutlined, DownOutlined } from '@ant-design/icons-vue' ref,
watch,
defineProps,
nextTick,
} from 'vue'
import { getDevelopDocTree } from '@/api/home'
import { message } from 'ant-design-vue'
import { UpOutlined, DownOutlined } from '@ant-design/icons-vue'
const props = defineProps({ const props = defineProps({
dataList: { dataList: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
level: { level: {
type: Number, type: Number,
default: 1 default: 1,
}, },
clickData: { clickData: {
type: Object, type: Object,
default: () => { title: '' } default: () => {
title: ''
},
}, },
}) })
// //
const newDataList = ref(props.dataList) const newDataList = ref(props.dataList)
// //
const newLevel = ref(props.level) const newLevel = ref(props.level)
const newClickData = ref(props.clickData) const newClickData = ref(props.clickData)
// //
const judgeLeaf = (item) => { const judgeLeaf = (item) => {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
return false return false
} else { } else {
return true return true
} }
} }
const showChildren = (item) => { const showChildren = (item) => {
if (!(item.children && item.children.length > 0)) { if (!(item.children && item.children.length > 0)) {
if (newClickData.value.title !== '') { if (newClickData.value.title !== '') {
handleTreeItem(item) handleTreeItem(item)
} else { } else {
handleTreeItem({ title: '' }) handleTreeItem({ title: '' })
} }
} }
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
item.show = !item.show; item.show = !item.show
} }
} }
watch( watch(
() => props.dataList, () => props.dataList,
(val) => { (val) => {
if (val) { if (val) {
newDataList.value = val newDataList.value = val
} }
} }
) )
watch( watch(
() => props.clickData, () => props.clickData,
(val) => { (val) => {
if (val) { if (val) {
newClickData.value = val newClickData.value = val
} }
} }
) )
const emit = defineEmits(['treeClick'])
const handleTreeItem = (item) => {
emit('tree-click', item);
}
const emit = defineEmits(['treeClick'])
const handleTreeItem = (item) => {
emit('tree-click', item)
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.list-text { .list-text {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
padding: 10px 0; padding: 10px 0;
@ -106,32 +128,32 @@ const handleTreeItem = (item) => {
text-overflow: ellipsis; text-overflow: ellipsis;
&:hover { &:hover {
color: #0058e1; color: #0058e1;
cursor: pointer; cursor: pointer;
} }
} }
.parent { .parent {
margin-bottom: 10px; margin-bottom: 10px;
background: rgba(0, 135, 225, 0.1); background: rgba(0, 135, 225, 0.1);
color: #333; color: #333;
&:hover { &:hover {
color: #fff; color: #fff;
background: #0058e1; background: #0058e1;
cursor: pointer; cursor: pointer;
} }
} }
.leaf { .leaf {
font-size: 14px; font-size: 14px;
color: #555; color: #555;
cursor: pointer; cursor: pointer;
} }
.select { .select {
color: #0058e1; color: #0058e1;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
} }
</style> </style>

View File

@ -4,214 +4,239 @@
<div id="container" class="content-menu"> <div id="container" class="content-menu">
<div class="rela"> <div class="rela">
<div class="left"> <div class="left">
<div class="first-title-text" v-for="(data, i) in titleList" :key="i" @click="changeName(data)" <div
:style="{ color: data.name === titleData.name ? '#0058e1' : '' }"> class="first-title-text"
v-for="(data, i) in titleList"
:key="i"
@click="changeName(data)"
:style="{ color: data.name === titleData.name ? '#0058e1' : '' }"
>
<div class="img" :class="data.className"></div> <div class="img" :class="data.className"></div>
{{ data.name }} {{ data.name }}
</div> </div>
<abilityDocTree :dataList="treeArray" @treeClick="treeClick" :clickData="clickData"></abilityDocTree> <abilityDocTree
:dataList="treeArray"
@treeClick="treeClick"
:clickData="clickData"
></abilityDocTree>
</div> </div>
<div class="right"> <div class="right">
<div class="new-menu-box" style="height:100%" v-if="titleData.name === '新手指引'"> <div
class="new-menu-box"
style="height: 100%"
v-if="titleData.name === '新手指引'"
>
<!-- 新手指引 --> <!-- 新手指引 -->
<a-empty description="新手指引" /> <a-empty description="新手指引" />
</div> </div>
<div v-else style="height:100%"> <div v-else style="height: 100%">
<iframe name="iframeName" width="1000" height="100%" id="iframeId" :frameborder="0" <iframe
:src="clickData.doc"></iframe> name="iframeName"
width="1000"
height="100%"
id="iframeId"
:frameborder="0"
:src="clickData.doc"
></iframe>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import HomeHeader from '@/views/home/components/header' import HomeHeader from '@/views/home/components/header'
import abilityDocTree from './components/abilityDocTree' import abilityDocTree from './components/abilityDocTree'
import { ref, reactive, onMounted, nextTick, watch } from 'vue' import { ref, reactive, onMounted, nextTick, watch } from 'vue'
import { Empty, message } from 'ant-design-vue' import { Empty, message } from 'ant-design-vue'
import { getDevelopDocTree } from '@/api/home' import { getDevelopDocTree } from '@/api/home'
import flatten from '@turf/flatten' import flatten from '@turf/flatten'
const titleList = ref([ const titleList = ref([
{ {
name: '新手指引', name: '新手指引',
className: 'newGuide' className: 'newGuide',
}, },
{ {
name: '技术文档', name: '技术文档',
className: 'doc' className: 'doc',
},
])
const titleData = ref(titleList.value[0])
const clickData = ref({})
const treeArray = ref([])
const treeArrayCopy = ref([])
let typeList = ['组件服务', '应用资源', '基础设施', '数据资源', '知识库']
const treeClick = (item) => {
clickData.value = item
console.log('clickData------------>', item)
titleData.value = titleList.value[1]
} }
])
const titleData = ref(titleList.value[0])
const clickData = ref({})
const treeArray = ref([])
const treeArrayCopy = ref([])
let typeList = ['组件服务', '应用资源', '基础设施', '数据资源', '知识库'];
const treeClick = (item) => { const getTreeData = () => {
clickData.value = item; getDevelopDocTree({})
console.log('clickData------------>', item); .then((res) => {
titleData.value = titleList.value[1] console.log('res------文档树------>', res)
} if (res.data.code !== 0) {
return message.error(res.data.msg)
const getTreeData = () => { }
getDevelopDocTree({}).then((res) => { treeArray.value = res.data.data || []
console.log('res------文档树------>', res); treeArrayCopy.value = JSON.parse(JSON.stringify(treeArray.value))
if (res.data.code !== 0) {
return message.error(res.data.msg)
}
treeArray.value = res.data.data || [];
treeArrayCopy.value = JSON.parse(JSON.stringify(treeArray.value))
}).catch((err) => {
message.error(err)
});
}
const changeName = (item) => {
titleData.value = item;
if (item.name == '新手指引') {
clickData.value = {}
}
if (item.name == '技术文档') {
if (!clickData.value.title) {
clickData.value = {}
treeArray.value = [];
treeArrayCopy.value.map((val, i) => {
let obj = Object.assign({}, val, {
title: val.title,
show: (i === 0 && val.children && val.children.length > 0) || typeList.includes(val.title) ? true : false,
children: []
})
formData(val.children, obj)
treeArray.value.push(obj)
}) })
getFirstData(treeArrayCopy.value[0] || {}) .catch((err) => {
message.error(err)
})
}
const changeName = (item) => {
titleData.value = item
if (item.name == '新手指引') {
clickData.value = {}
}
if (item.name == '技术文档') {
if (!clickData.value.title) {
clickData.value = {}
treeArray.value = []
treeArrayCopy.value.map((val, i) => {
let obj = Object.assign({}, val, {
title: val.title,
show:
(i === 0 && val.children && val.children.length > 0) ||
typeList.includes(val.title)
? true
: false,
children: [],
})
formData(val.children, obj)
treeArray.value.push(obj)
})
getFirstData(treeArrayCopy.value[0] || {})
}
} }
} }
}
const formData = (children = [], dataItem) => {
const formData = (children = [], dataItem) => { children.map((item, index) => {
children.map((item, index) => { let _obj = Object.assign({}, item, {
let _obj = Object.assign({}, item, { title: item.title,
title: item.title, show:
show: (index === 0 && item.children && item.children.length > 0) || typeList.includes(item.title) ? true : false, (index === 0 && item.children && item.children.length > 0) ||
children: [] typeList.includes(item.title)
? true
: false,
children: [],
})
if (item.children && item.children.length > 0) {
formData(item.children, _obj)
}
dataItem.children.push(_obj)
}) })
if (item.children && item.children.length > 0) {
formData(item.children, _obj)
}
dataItem.children.push(_obj)
})
}
const getFirstData = (firstObj = {}) => {
if (firstObj && firstObj.children && firstObj.children.length > 0) {
getFirstData(firstObj.children[0])
} else {
clickData.value = firstObj
} }
}
onMounted(() => {
getTreeData()
})
const getFirstData = (firstObj = {}) => {
if (firstObj && firstObj.children && firstObj.children.length > 0) {
getFirstData(firstObj.children[0])
} else {
clickData.value = firstObj
}
}
onMounted(() => {
getTreeData()
})
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.menu-box { .menu-box {
// overflow: hidden; // overflow: hidden;
height: 100%; height: 100%;
}
.first-title-text {
cursor: pointer;
font-size: 18px;
color: #333;
padding-bottom: 10px;
display: flex;
align-items: center;
&:hover {
color: #0058e1;
} }
}
.content-menu { .first-title-text {
width: 1240px; cursor: pointer;
display: flex; font-size: 18px;
justify-content: flex-start; color: #333;
margin: 0 auto; padding-bottom: 10px;
margin-top: 74px; display: flex;
box-sizing: border-box; align-items: center;
position: fixed;
left: 50%;
bottom: 0;
transform: translateX(-50%);
top: 0.6rem;
top: 0;
}
.left { &:hover {
width: 240px; color: #0058e1;
padding: 20px; }
height: 600px; }
margin-right: 20px;
background: rgba(244, 245, 248, 0.8);
overflow-y: scroll;
position: absolute;
top: 10px;
left: 0;
}
.right { .content-menu {
width: 870px; width: 1240px;
height: calc(100% - 20px); display: flex;
justify-content: flex-start;
margin: 0 auto;
margin-top: 74px;
box-sizing: border-box;
position: fixed;
left: 50%;
bottom: 0;
transform: translateX(-50%);
top: 0.6rem;
top: 0;
}
position: absolute; .left {
top: 10px; width: 240px;
left: 260px; padding: 20px;
} height: 600px;
margin-right: 20px;
background: rgba(244, 245, 248, 0.8);
overflow-y: scroll;
position: absolute;
top: 10px;
left: 0;
}
.sidebar { .right {
right: 0 !important; width: 870px;
} height: calc(100% - 20px);
.content { position: absolute;
right: 16rem !important; top: 10px;
left: 0 !important; left: 260px;
} }
.img { .sidebar {
height: 20px; right: 0 !important;
width: 20px; }
margin-right: 8px;
}
.doc { .content {
background: url('~@/assets/capabilityCloud/doc.png') no-repeat; right: 16rem !important;
background-size: 100%; left: 0 !important;
} }
.newGuide { .img {
background: url('~@/assets/capabilityCloud/newGuide.png') no-repeat; height: 20px;
background-size: 100%; width: 20px;
} margin-right: 8px;
}
.new-menu-box { .doc {
height: 100%; background: url('~@/assets/capabilityCloud/doc.png') no-repeat;
display: flex; background-size: 100%;
align-items: center; }
justify-content: center;
}
.rela { .newGuide {
width: 100%; background: url('~@/assets/capabilityCloud/newGuide.png') no-repeat;
height: 100%; background-size: 100%;
position: relative; }
}
.new-menu-box {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.rela {
width: 100%;
height: 100%;
position: relative;
}
</style> </style>