Commit b4f15f47 authored by co_dengxiongwen's avatar co_dengxiongwen

tj

parent 0d415dc6
...@@ -58,36 +58,36 @@ ...@@ -58,36 +58,36 @@
</template> </template>
<script> <script>
import AddOrUpdate from './add-or-update' import AddOrUpdate from './add-or-update'
import QueryDetail from './query-detail' import QueryDetail from './query-detail'
import { getUUID } from '@/util' import { getUUID } from '@/util'
import Vue from 'vue' import Vue from 'vue'
// openlayer // openlayer
import 'ol/ol.css' import 'ol/ol.css'
import { Map, View } from 'ol' import { Map, View } from 'ol'
import { Projection } from 'ol/proj' import { Projection } from 'ol/proj'
import { getCenter } from 'ol/extent' import { getCenter } from 'ol/extent'
import Modify from 'ol/interaction/Modify' import Modify from 'ol/interaction/Modify'
import ImageLayer from 'ol/layer/Image' import ImageLayer from 'ol/layer/Image'
import ImageStatic from 'ol/source/ImageStatic' import ImageStatic from 'ol/source/ImageStatic'
import Zoom from 'ol/control/Zoom' import Zoom from 'ol/control/Zoom'
import { DoubleClickZoom } from 'ol/interaction' import { DoubleClickZoom } from 'ol/interaction'
import Draw from 'ol/interaction/Draw' import Draw from 'ol/interaction/Draw'
import LineString from 'ol/geom/LineString' import LineString from 'ol/geom/LineString'
// 图上图标相关 // 图上图标相关
import OlFeature from 'ol/Feature' import OlFeature from 'ol/Feature'
import OlGeomPoint from 'ol/geom/Point' import OlGeomPoint from 'ol/geom/Point'
import OlLayerVector from 'ol/layer/Vector' import OlLayerVector from 'ol/layer/Vector'
import OlSourceVector from 'ol/source/Vector' import OlSourceVector from 'ol/source/Vector'
import OlStyleStyle from 'ol/style/Style' import OlStyleStyle from 'ol/style/Style'
import OlStyleIcon from 'ol/style/Icon' import OlStyleIcon from 'ol/style/Icon'
// 用来添加相关文字描述的 // 用来添加相关文字描述的
import Text from 'ol/style/Text' import Text from 'ol/style/Text'
import Fill from 'ol/style/Fill' import Fill from 'ol/style/Fill'
import Stroke from 'ol/style/Stroke' import Stroke from 'ol/style/Stroke'
let that let that
export default { export default {
data() { data() {
return { return {
featureItem: '', featureItem: '',
...@@ -208,7 +208,10 @@ ...@@ -208,7 +208,10 @@
this.map.removeInteraction(this.draw) this.map.removeInteraction(this.draw)
if (this.editable) { if (this.editable) {
this.iconStyle = e this.iconStyle = e
if (this.iconStyle.name === '红外探测器' || this.iconStyle.name === '振动光纤') { if (
this.iconStyle.name === '红外探测器' ||
this.iconStyle.name === '振动光纤'
) {
this.drawType = 'LineString' this.drawType = 'LineString'
} else { } else {
this.drawType = 'Point' this.drawType = 'Point'
...@@ -257,22 +260,24 @@ ...@@ -257,22 +260,24 @@
zoom: 2.5, zoom: 2.5,
maxZoom: 5, maxZoom: 5,
minZoom: 1.5, minZoom: 1.5,
extent: [-1100, -100, 2000, 1000]//[minX,minY,maxX,maxY] 控制拖动 extent: [-1100, -100, 2000, 1000] //[minX,minY,maxX,maxY] 控制拖动
}) })
}) })
// 删除默认的双击事件 // 删除默认的双击事件
const dblClickInteraction = this.map const dblClickInteraction = this.map
.getInteractions() .getInteractions()
.getArray() .getArray()
.find(interaction => { .find((interaction) => {
return interaction instanceof DoubleClickZoom return interaction instanceof DoubleClickZoom
}) })
this.map.removeInteraction(dblClickInteraction) this.map.removeInteraction(dblClickInteraction)
this.changeVectorLayer(this.list) this.changeVectorLayer(this.list)
this.map.on('click', function (evt) { this.map.on('click', function(evt) {
let feature = evt.map.forEachFeatureAtPixel(evt.pixel, function (feature) { let feature = evt.map.forEachFeatureAtPixel(evt.pixel, function(
feature
) {
return feature return feature
}) })
console.log('***当前点击***', feature) console.log('***当前点击***', feature)
...@@ -290,9 +295,11 @@ ...@@ -290,9 +295,11 @@
} else { } else {
//编辑状态下添加资源点事件(不包含红外探测器和振动光纤) //编辑状态下添加资源点事件(不包含红外探测器和振动光纤)
if (that.iconStyle === null || !that.editable) { if (that.iconStyle === null || !that.editable) {
} else { } else {
if (that.iconStyle.name === '红外探测器' || that.iconStyle.name === '振动光纤') { if (
that.iconStyle.name === '红外探测器' ||
that.iconStyle.name === '振动光纤'
) {
return return
} }
let bean = that.addPoint(coordinate) let bean = that.addPoint(coordinate)
...@@ -301,7 +308,9 @@ ...@@ -301,7 +308,9 @@
that.iconStyle = null that.iconStyle = null
that.lineList = [] that.lineList = []
let newFeature = that.vectorLayer.getSource().getFeatureById(bean.key) let newFeature = that.vectorLayer
.getSource()
.getFeatureById(bean.key)
for (let i in that.list) { for (let i in that.list) {
//true弹出详情页面 //true弹出详情页面
that.mapClick(newFeature, that.list[i], false) that.mapClick(newFeature, that.list[i], false)
...@@ -326,7 +335,9 @@ ...@@ -326,7 +335,9 @@
//获取feature对象 //获取feature对象
let feature_ = this.vectorLayer.getSource().getFeatureById(item.id) let feature_ = this.vectorLayer.getSource().getFeatureById(item.id)
//获取红外探测器或者振动光纤第二个点的feature对象 //获取红外探测器或者振动光纤第二个点的feature对象
let featureEnd = this.vectorLayer.getSource().getFeatureById(item.key + 'end') let featureEnd = this.vectorLayer
.getSource()
.getFeatureById(item.key + 'end')
if (feature_) { if (feature_) {
if (feature_ === feature || featureEnd === feature) { if (feature_ === feature || featureEnd === feature) {
//console.log(feature_) //console.log(feature_)
...@@ -352,7 +363,9 @@ ...@@ -352,7 +363,9 @@
//获取新增的feature对象 //获取新增的feature对象
let newFeature = this.vectorLayer.getSource().getFeatureById(item.key) let newFeature = this.vectorLayer.getSource().getFeatureById(item.key)
//获取红外探测器或者振动光纤第二个点的feature对象 //获取红外探测器或者振动光纤第二个点的feature对象
let newFeatureEnd = this.vectorLayer.getSource().getFeatureById(item.key + 'end') let newFeatureEnd = this.vectorLayer
.getSource()
.getFeatureById(item.key + 'end')
if (newFeature) { if (newFeature) {
if (newFeature === feature || newFeatureEnd === feature) { if (newFeature === feature || newFeatureEnd === feature) {
newFeature.setStyle(style2) newFeature.setStyle(style2)
...@@ -376,12 +389,19 @@ ...@@ -376,12 +389,19 @@
}, },
//添加点 //添加点
addPoint(coordinate) { addPoint(coordinate) {
let bean = this.getNewBox(this.iconStyle, parseFloat(coordinate[0]).toFixed(2), parseFloat(coordinate[1]).toFixed(2), this.iconStyle.value) let bean = this.getNewBox(
this.iconStyle,
parseFloat(coordinate[0]).toFixed(2),
parseFloat(coordinate[1]).toFixed(2),
this.iconStyle.value
)
//新建一个要素ol.Feature //新建一个要素ol.Feature
let newFeature = new OlFeature({ let newFeature = new OlFeature({
geometry: new OlGeomPoint(coordinate) //几何信息 geometry: new OlGeomPoint(coordinate) //几何信息
}) })
newFeature.setStyle(this.getPointStyle(this.iconStyle.value + '.png', this.iconStyle.name)) //设置要素样式 newFeature.setStyle(
this.getPointStyle(this.iconStyle.value + '.png', this.iconStyle.name)
) //设置要素样式
newFeature.setId(bean.key) newFeature.setId(bean.key)
this.vectorLayer.getSource().addFeature(newFeature) this.vectorLayer.getSource().addFeature(newFeature)
//添加需要拖动的点 //添加需要拖动的点
...@@ -435,7 +455,12 @@ ...@@ -435,7 +455,12 @@
let newFeature = new OlFeature({ let newFeature = new OlFeature({
geometry: new OlGeomPoint(coordinate) //几何信息 geometry: new OlGeomPoint(coordinate) //几何信息
}) })
newFeature.setStyle(that.getPointStyle(that.iconStyle.value + '.png', that.iconStyle.name)) //设置要素样式 newFeature.setStyle(
that.getPointStyle(
that.iconStyle.value + '.png',
that.iconStyle.name
)
) //设置要素样式
newFeature.setId(bean.key + 'end') newFeature.setId(bean.key + 'end')
//添加结束的点 //添加结束的点
that.vectorLayer.getSource().addFeature(newFeature) that.vectorLayer.getSource().addFeature(newFeature)
...@@ -453,7 +478,11 @@ ...@@ -453,7 +478,11 @@
for (let i in that.list) { for (let i in that.list) {
//true弹出详情页面 //true弹出详情页面
that.mapClick(that.vectorLayer.getSource().getFeatureById(bean.key), that.list[i], false) that.mapClick(
that.vectorLayer.getSource().getFeatureById(bean.key),
that.list[i],
false
)
} }
that.updateHandle() that.updateHandle()
}) })
...@@ -545,7 +574,10 @@ ...@@ -545,7 +574,10 @@
for (let i in list) { for (let i in list) {
if (list[i].imageSrc) { if (list[i].imageSrc) {
//振动光纤和红外线对射 //振动光纤和红外线对射
if (list[i].type === 'e670524ecb9e4a03b8ddbc7d91a63b1b' || list[i].type === '4f69755dbc0c45e49c142857286c5669') { if (
list[i].type === 'e670524ecb9e4a03b8ddbc7d91a63b1b' ||
list[i].type === '4f69755dbc0c45e49c142857286c5669'
) {
let lineFeatures = [] let lineFeatures = []
lineFeatures.push([list[i].xlongit, list[i].ylat]) lineFeatures.push([list[i].xlongit, list[i].ylat])
lineFeatures.push([list[i].xpoint, list[i].ypoint]) lineFeatures.push([list[i].xpoint, list[i].ypoint])
...@@ -555,7 +587,10 @@ ...@@ -555,7 +587,10 @@
lineLastArr.push(list[i]) lineLastArr.push(list[i])
} }
featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat)) featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat))
let style = this.getPointStyle(list[i].imageSrc + '.png', this.list[i].name) let style = this.getPointStyle(
list[i].imageSrc + '.png',
this.list[i].name
)
featuresArr[i].setStyle(style) featuresArr[i].setStyle(style)
featuresArr[i].setId(list[i].id) featuresArr[i].setId(list[i].id)
} else { } else {
...@@ -564,8 +599,13 @@ ...@@ -564,8 +599,13 @@
} }
let LinefeaturesArr = [] let LinefeaturesArr = []
for (let i in lineLastArr) { for (let i in lineLastArr) {
LinefeaturesArr.push(this.getFeature(lineLastArr[i].xpoint, lineLastArr[i].ypoint)) LinefeaturesArr.push(
let style = this.getPointStyle(lineLastArr[i].imageSrc + '.png', lineLastArr[i].name) this.getFeature(lineLastArr[i].xpoint, lineLastArr[i].ypoint)
)
let style = this.getPointStyle(
lineLastArr[i].imageSrc + '.png',
lineLastArr[i].name
)
LinefeaturesArr[i].setStyle(style) LinefeaturesArr[i].setStyle(style)
lineLastArr[i].key = lineLastArr[i].id lineLastArr[i].key = lineLastArr[i].id
LinefeaturesArr[i].setId(lineLastArr[i].key + 'end') LinefeaturesArr[i].setId(lineLastArr[i].key + 'end')
...@@ -579,7 +619,10 @@ ...@@ -579,7 +619,10 @@
}) })
this.map.addLayer(this.vectorLayer) this.map.addLayer(this.vectorLayer)
//将点和线的Feature对象 ,放在一个数组里面 //将点和线的Feature对象 ,放在一个数组里面
let modifyFeatures = this.lineVectorLayer.getSource().getFeatures().concat(this.vectorLayer.getSource().getFeatures()) let modifyFeatures = this.lineVectorLayer
.getSource()
.getFeatures()
.concat(this.vectorLayer.getSource().getFeatures())
// this.modify = new Modify({ // this.modify = new Modify({
// source: this.vectorLayer.getSource() // source: this.vectorLayer.getSource()
// }) // })
...@@ -588,13 +631,15 @@ ...@@ -588,13 +631,15 @@
features: modifyFeatures features: modifyFeatures
}) })
}) })
this.modify.on('modifyend', e => { this.modify.on('modifyend', (e) => {
let pixel = this.map.getEventPixel(e.mapBrowserEvent.originalEvent) let pixel = this.map.getEventPixel(e.mapBrowserEvent.originalEvent)
//获取当前拖拽的feature对象,该feature没有id, //获取当前拖拽的feature对象,该feature没有id,
let feature = e.mapBrowserEvent.map.forEachFeatureAtPixel(pixel, let feature = e.mapBrowserEvent.map.forEachFeatureAtPixel(
pixel,
function(feature) { function(feature) {
return feature return feature
}) }
)
if (feature) { if (feature) {
that.cancelDisabled = false that.cancelDisabled = false
...@@ -603,15 +648,25 @@ ...@@ -603,15 +648,25 @@
//根据id获取feature对象 //根据id获取feature对象
//let feature_ = that.vectorLayer.getSource().getFeatureById(that.list[i].id) //let feature_ = that.vectorLayer.getSource().getFeatureById(that.list[i].id)
//新增的feature对象没保存,是没有id通过,key获取feature对象 //新增的feature对象没保存,是没有id通过,key获取feature对象
let featureKey = that.vectorLayer.getSource().getFeatureById(that.list[i].key) let featureKey = that.vectorLayer
.getSource()
.getFeatureById(that.list[i].key)
//红外探测器和振动光纤的第二点同过key+'end'获取feature对象 //红外探测器和振动光纤的第二点同过key+'end'获取feature对象
let featureEnd = that.vectorLayer.getSource().getFeatureById(that.list[i].key + 'end') let featureEnd = that.vectorLayer
.getSource()
.getFeatureById(that.list[i].key + 'end')
if (featureKey || featureEnd) { if (featureKey || featureEnd) {
//获取坐标 //获取坐标
let coordinate let coordinate
//if (feature_) coordinate = feature_.getGeometry().flatCoordinates //if (feature_) coordinate = feature_.getGeometry().flatCoordinates
if (featureKey) coordinate = featureKey.getGeometry().flatCoordinates if (featureKey) {
if (featureKey && coordinate.toString() === feature.getGeometry().flatCoordinates.toString()) { coordinate = featureKey.getGeometry().flatCoordinates
}
if (
featureKey &&
coordinate.toString() ===
feature.getGeometry().flatCoordinates.toString()
) {
that.list[i].xlongit = parseFloat(coordinate[0]).toFixed(2) that.list[i].xlongit = parseFloat(coordinate[0]).toFixed(2)
that.list[i].ylat = parseFloat(coordinate[1]).toFixed(2) that.list[i].ylat = parseFloat(coordinate[1]).toFixed(2)
that.listItem = JSON.parse(JSON.stringify(that.list[i])) that.listItem = JSON.parse(JSON.stringify(that.list[i]))
...@@ -619,18 +674,31 @@ ...@@ -619,18 +674,31 @@
// that.listItem.xlongit = parseFloat(coordinate[0]).toFixed(2) // that.listItem.xlongit = parseFloat(coordinate[0]).toFixed(2)
// that.listItem.ylat = parseFloat(coordinate[1]).toFixed(2) // that.listItem.ylat = parseFloat(coordinate[1]).toFixed(2)
// } // }
let style = that.getPointStyle(that.list[i].imageSrc + '2.png', that.list[i].name, '0.3') let style = that.getPointStyle(
that.list[i].imageSrc + '2.png',
that.list[i].name,
'0.3'
)
featureKey.setStyle(style) featureKey.setStyle(style)
//break //break
} else { } else {
if (featureKey) { if (featureKey) {
let style = that.getPointStyle(that.list[i].imageSrc + '.png', that.list[i].name) let style = that.getPointStyle(
that.list[i].imageSrc + '.png',
that.list[i].name
)
featureKey.setStyle(style) featureKey.setStyle(style)
} }
} }
if (featureEnd) coordinate = featureEnd.getGeometry().flatCoordinates if (featureEnd) {
if (featureEnd && coordinate.toString() === feature.getGeometry().flatCoordinates.toString()) { coordinate = featureEnd.getGeometry().flatCoordinates
}
if (
featureEnd &&
coordinate.toString() ===
feature.getGeometry().flatCoordinates.toString()
) {
that.list[i].xpoint = parseFloat(coordinate[0]).toFixed(2) that.list[i].xpoint = parseFloat(coordinate[0]).toFixed(2)
that.list[i].ypoint = parseFloat(coordinate[1]).toFixed(2) that.list[i].ypoint = parseFloat(coordinate[1]).toFixed(2)
that.listItem = JSON.parse(JSON.stringify(that.list[i])) that.listItem = JSON.parse(JSON.stringify(that.list[i]))
...@@ -638,12 +706,19 @@ ...@@ -638,12 +706,19 @@
// that.listItem.xpoint = parseFloat(coordinate[0]).toFixed(2) // that.listItem.xpoint = parseFloat(coordinate[0]).toFixed(2)
// that.listItem.ypoint = parseFloat(coordinate[1]).toFixed(2) // that.listItem.ypoint = parseFloat(coordinate[1]).toFixed(2)
// } // }
let style = that.getPointStyle(that.list[i].imageSrc + '2.png', that.list[i].name, '0.3') let style = that.getPointStyle(
that.list[i].imageSrc + '2.png',
that.list[i].name,
'0.3'
)
featureEnd.setStyle(style) featureEnd.setStyle(style)
//break //break
} else { } else {
if (featureEnd) { if (featureEnd) {
let style = that.getPointStyle(that.list[i].imageSrc + '.png', that.list[i].name) let style = that.getPointStyle(
that.list[i].imageSrc + '.png',
that.list[i].name
)
featureEnd.setStyle(style) featureEnd.setStyle(style)
} }
} }
...@@ -687,7 +762,11 @@ ...@@ -687,7 +762,11 @@
}, },
//新建资源点对象 //新建资源点对象
getNewBox(item, j, w, src) { getNewBox(item, j, w, src) {
let uuid = getUUID().replace('-', '').replace('-', '').replace('-', '').replace('-', '') let uuid = getUUID()
.replace('-', '')
.replace('-', '')
.replace('-', '')
.replace('-', '')
return { return {
id: uuid, id: uuid,
key: uuid, key: uuid,
...@@ -696,8 +775,6 @@ ...@@ -696,8 +775,6 @@
password: '', password: '',
port: '', port: '',
remark: '', remark: '',
lineId: this.checkedData.lineId,
lineName: this.checkedData.lineName,
stationId: this.checkedData.stationId, stationId: this.checkedData.stationId,
stationName: this.checkedData.stationName, stationName: this.checkedData.stationName,
subCode: this.checkedData.subCode, subCode: this.checkedData.subCode,
...@@ -731,19 +808,25 @@ ...@@ -731,19 +808,25 @@
url: this.$http.adornUrl('/liResource/getTreeList'), url: this.$http.adornUrl('/liResource/getTreeList'),
method: 'post', method: 'post',
data: { data: {
stationId: this.checkedData.sId,
name: this.searchInput name: this.searchInput
} }
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.treeData = data.tree this.treeData = data.tree
this.defaultExpandedKeys = [] this.defaultExpandedKeys = []
this.$nextTick(() => { this.$nextTick(() => {
if (!this.treeData || this.treeData.length <= 0 || !this.treeData[0].children || this.treeData[0].children.length <= 0) { if (
!this.treeData ||
this.treeData.length <= 0 ||
!this.treeData[0].children ||
this.treeData[0].children.length <= 0
) {
return return
} }
if (!this.tierMap) { if (!this.tierMap) {
this.currentNode = this.$refs.tree.getNode(this.treeData[0].children[0].id).data this.currentNode = this.$refs.tree.getNode(
this.treeData[0].children[0].id
).data
//将选中的层级树节点设置为选中 //将选中的层级树节点设置为选中
this.$refs.tree.setCurrentNode(this.currentNode) this.$refs.tree.setCurrentNode(this.currentNode)
Vue.set(this.treeData[0].children[0], 'iconB', true) Vue.set(this.treeData[0].children[0], 'iconB', true)
...@@ -758,19 +841,28 @@ ...@@ -758,19 +841,28 @@
} }
if (this.tierMap.level === 5) { if (this.tierMap.level === 5) {
this.currentNode = this.$refs.tree.getNode(this.tierMap.id).data this.currentNode = this.$refs.tree.getNode(this.tierMap.id).data
this.initStation(this.tierMap.stationId, this.tierMap.children, this.tierMap.id) this.initStation(
this.tierMap.stationId,
this.tierMap.children,
this.tierMap.id
)
} }
if (this.tierMap.level === 6) { if (this.tierMap.level === 6) {
this.currentNode = this.$refs.tree.getNode(this.tierMap.id).data this.currentNode = this.$refs.tree.getNode(this.tierMap.id).data
let sysId = '' let sysId = ''
this.systemList.forEach(element => { this.systemList.forEach((element) => {
if (this.tierMap.subCode === element.value) { if (this.tierMap.subCode === element.value) {
sysId = element.id sysId = element.id
} }
}) })
let res = this.$refs.tree.getNode(this.tierMap.tierId + sysId).data let res = this.$refs.tree.getNode(this.tierMap.tierId + sysId)
this.initStation(this.tierMap.stationId, res.children, this.tierMap.tierId + sysId) .data
this.initStation(
this.tierMap.stationId,
res.children,
this.tierMap.tierId + sysId
)
} }
//将选中的层级树节点设置为选中 //将选中的层级树节点设置为选中
this.$refs.tree.setCurrentNode(this.currentNode) this.$refs.tree.setCurrentNode(this.currentNode)
...@@ -820,7 +912,7 @@ ...@@ -820,7 +912,7 @@
url: this.$http.adornUrl('/liResource/getResourceTreeList'), url: this.$http.adornUrl('/liResource/getResourceTreeList'),
method: 'post', method: 'post',
data: data data: data
}).then(data => { }).then((data) => {
// console.log('初始化线路树:', data.nodes) // console.log('初始化线路树:', data.nodes)
if (data && data.code === 0) { if (data && data.code === 0) {
this.$refs.tree.updateKeyChildren(node.id, data.nodes) this.$refs.tree.updateKeyChildren(node.id, data.nodes)
...@@ -834,12 +926,12 @@ ...@@ -834,12 +926,12 @@
method: 'get', method: 'get',
params: this.$http.adornParams() params: this.$http.adornParams()
}) })
.then(data => { .then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
if (data.bean) { if (data.bean) {
this.station = data.bean this.station = data.bean
this.mapList = data.bean.mapList this.mapList = data.bean.mapList
this.mapList.forEach(element => { this.mapList.forEach((element) => {
element.readPath = this.urlPath + element.filePath element.readPath = this.urlPath + element.filePath
}) })
this.checkedData.lineId = this.station.lineId this.checkedData.lineId = this.station.lineId
...@@ -852,7 +944,7 @@ ...@@ -852,7 +944,7 @@
// this.$refs.tree.setCurrentNode(this.treeData[0].children[0]) // this.$refs.tree.setCurrentNode(this.treeData[0].children[0])
// this.defaultExpandedKeys = [this.checkedData.tierId] // this.defaultExpandedKeys = [this.checkedData.tierId]
if (res) { if (res) {
this.mapList.forEach(e => { this.mapList.forEach((e) => {
if (res.tierId === e.id) { if (res.tierId === e.id) {
this.checkedData.tierId = e.id this.checkedData.tierId = e.id
this.checkedData.tierName = e.name this.checkedData.tierName = e.name
...@@ -885,7 +977,7 @@ ...@@ -885,7 +977,7 @@
}, },
isFlag(data, id) { isFlag(data, id) {
data.forEach(res => { data.forEach((res) => {
if (res.id === id) { if (res.id === id) {
Vue.set(res, 'iconB', true) Vue.set(res, 'iconB', true)
} else { } else {
...@@ -975,7 +1067,7 @@ ...@@ -975,7 +1067,7 @@
this.checkedData.stationId = node.stationId this.checkedData.stationId = node.stationId
this.checkedData.tierId = node.tierId this.checkedData.tierId = node.tierId
this.mapList.forEach(element => { this.mapList.forEach((element) => {
if (element.id === node.tierId) { if (element.id === node.tierId) {
this.stationMap = element this.stationMap = element
return false return false
...@@ -986,7 +1078,7 @@ ...@@ -986,7 +1078,7 @@
this.list = JSON.parse(JSON.stringify(node.children)) this.list = JSON.parse(JSON.stringify(node.children))
// console.log('资源点列表:', this.list) // console.log('资源点列表:', this.list)
this.list.forEach(res => { this.list.forEach((res) => {
Vue.set(res, 'active', false) Vue.set(res, 'active', false)
}) })
this.changeVectorLayer(this.list) this.changeVectorLayer(this.list)
...@@ -994,7 +1086,7 @@ ...@@ -994,7 +1086,7 @@
} else if (level === 6) { } else if (level === 6) {
this.tierMap = node this.tierMap = node
var sysId = '' var sysId = ''
this.systemList.forEach(element => { this.systemList.forEach((element) => {
if (node.subCode === element.value) { if (node.subCode === element.value) {
sysId = element.id sysId = element.id
} }
...@@ -1003,7 +1095,7 @@ ...@@ -1003,7 +1095,7 @@
let subNode = this.$refs.tree.getNode(node.tierId + sysId).data let subNode = this.$refs.tree.getNode(node.tierId + sysId).data
// console.log('当前要选中的层级节点', subNode) // console.log('当前要选中的层级节点', subNode)
this.list = [] this.list = []
subNode.children.forEach(res => { subNode.children.forEach((res) => {
this.list.push(res) this.list.push(res)
}) })
...@@ -1024,7 +1116,7 @@ ...@@ -1024,7 +1116,7 @@
} }
} }
this.iconNameListBottom.forEach(res => { this.iconNameListBottom.forEach((res) => {
if (this.clickItem && res.id === this.clickItem.id) { if (this.clickItem && res.id === this.clickItem.id) {
if ( if (
res.value.substring(res.value.length - 1, res.value.length) == 4 res.value.substring(res.value.length - 1, res.value.length) == 4
...@@ -1064,7 +1156,7 @@ ...@@ -1064,7 +1156,7 @@
this.checkedData.stationId = stationNode.id this.checkedData.stationId = stationNode.id
this.checkedData.stationName = stationNode.name this.checkedData.stationName = stationNode.name
this.stationMap = map this.stationMap = map
this.iconNameListBottom.forEach(res => { this.iconNameListBottom.forEach((res) => {
if (res.id === this.clickItem.id) { if (res.id === this.clickItem.id) {
if ( if (
res.value.substring(res.value.length - 1, res.value.length) == 4 res.value.substring(res.value.length - 1, res.value.length) == 4
...@@ -1088,15 +1180,15 @@ ...@@ -1088,15 +1180,15 @@
let tierNode = this.$refs.tree.getNode(this.checkedData.tierId).data let tierNode = this.$refs.tree.getNode(this.checkedData.tierId).data
// console.log('当前要选中的层级节点', tierNode.children) // console.log('当前要选中的层级节点', tierNode.children)
this.list = [] this.list = []
tierNode.children.forEach(subSystem => { tierNode.children.forEach((subSystem) => {
subSystem.children.forEach(res => { subSystem.children.forEach((res) => {
if (item === null || (item != null && item.id === res.type)) { if (item === null || (item != null && item.id === res.type)) {
this.list.push(res) this.list.push(res)
} }
}) })
}) })
this.list.forEach(res => { this.list.forEach((res) => {
Vue.set(res, 'active', false) Vue.set(res, 'active', false)
}) })
// console.log(this.list, '++++++') // console.log(this.list, '++++++')
...@@ -1106,13 +1198,13 @@ ...@@ -1106,13 +1198,13 @@
let node = this.$refs.tree.getNode(id).data let node = this.$refs.tree.getNode(id).data
this.list = [] this.list = []
if (node.level === 4) { if (node.level === 4) {
node.children.forEach(subSystem => { node.children.forEach((subSystem) => {
subSystem.children.forEach(res => { subSystem.children.forEach((res) => {
this.list.push(res) this.list.push(res)
}) })
}) })
} else { } else {
node.children.forEach(e => { node.children.forEach((e) => {
this.list.push(e) this.list.push(e)
}) })
} }
...@@ -1123,7 +1215,9 @@ ...@@ -1123,7 +1215,9 @@
refreshdatalist(res) { refreshdatalist(res) {
let style = this.getPointStyle(res.imageSrc + '2.png', res.name, '0.3') let style = this.getPointStyle(res.imageSrc + '2.png', res.name, '0.3')
let newItem = this.vectorLayer.getSource().getFeatureById(res.key) let newItem = this.vectorLayer.getSource().getFeatureById(res.key)
let newItemEnd = this.vectorLayer.getSource().getFeatureById(res.key + 'end') let newItemEnd = this.vectorLayer
.getSource()
.getFeatureById(res.key + 'end')
if (newItem) newItem.setStyle(style) if (newItem) newItem.setStyle(style)
if (newItemEnd) newItemEnd.setStyle(style) if (newItemEnd) newItemEnd.setStyle(style)
for (let i in this.list) { for (let i in this.list) {
...@@ -1143,7 +1237,7 @@ ...@@ -1143,7 +1237,7 @@
name: this.searchInput name: this.searchInput
} }
}) })
.then(data => { .then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.treeData = data.tree this.treeData = data.tree
// if (!this.checkedData.sId) { // if (!this.checkedData.sId) {
...@@ -1176,18 +1270,18 @@ ...@@ -1176,18 +1270,18 @@
//console.log(res, '++++++++++') //console.log(res, '++++++++++')
var sysId = '' var sysId = ''
this.systemList.forEach(element => { this.systemList.forEach((element) => {
if (res.subCode === element.value) { if (res.subCode === element.value) {
sysId = element.id sysId = element.id
} }
}) })
var subId = '' var subId = ''
this.treeData.forEach(e => { this.treeData.forEach((e) => {
if (res.stationId === e.id) { if (res.stationId === e.id) {
e.children.forEach(el => { e.children.forEach((el) => {
if (el.id === res.tierId) { if (el.id === res.tierId) {
el.children.forEach(element => { el.children.forEach((element) => {
if (element.id === res.tierId + sysId) { if (element.id === res.tierId + sysId) {
subId = element.id subId = element.id
Vue.set(element, 'iconB', true) Vue.set(element, 'iconB', true)
...@@ -1234,7 +1328,7 @@ ...@@ -1234,7 +1328,7 @@
let flag = true let flag = true
//判断是否有无id的新增资源点 //判断是否有无id的新增资源点
this.list.forEach(res => { this.list.forEach((res) => {
if (res.addOrUpdate === 'save') { if (res.addOrUpdate === 'save') {
flag = false flag = false
return false return false
...@@ -1247,7 +1341,7 @@ ...@@ -1247,7 +1341,7 @@
url: this.$http.adornUrl(`/liResource/updateList`), url: this.$http.adornUrl(`/liResource/updateList`),
method: 'post', method: 'post',
data: paramList data: paramList
}).then(data => { }).then((data) => {
// console.log(data) // console.log(data)
if (data.message) { if (data.message) {
this.addNotify(data.message) this.addNotify(data.message)
...@@ -1276,19 +1370,24 @@ ...@@ -1276,19 +1370,24 @@
}) })
this.submitlDisabled = false this.submitlDisabled = false
} else { } else {
this.$confirm(`未填写信息的新增资源点将被忽略,是否继续?`, '保存资源点', { this.$confirm(
`未填写信息的新增资源点将被忽略,是否继续?`,
'保存资源点',
{
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
closeOnClickModal: false closeOnClickModal: false
}) }
)
.then(() => { .then(() => {
// console.log('当前页面资源点位置:', this.list) // console.log('当前页面资源点位置:', this.list)
this.$http({ this.$http({
url: this.$http.adornUrl(`/liResource/updateList`), url: this.$http.adornUrl(`/liResource/updateList`),
method: 'post', method: 'post',
data: paramList data: paramList
}).then(data => { })
.then((data) => {
// console.log(data) // console.log(data)
if (data && data.code === 0) { if (data && data.code === 0) {
if (data.message) { if (data.message) {
...@@ -1369,7 +1468,7 @@ ...@@ -1369,7 +1468,7 @@
// 移动资源位坐标 // 移动资源位坐标
changeResourceLocation(id, x, y) { changeResourceLocation(id, x, y) {
// console.log('changeResourceLocation:', id, x, y) // console.log('changeResourceLocation:', id, x, y)
this.list.forEach(res => { this.list.forEach((res) => {
if (res.id === id) { if (res.id === id) {
// console.log('移动坐标1:', res.name, res.xpoint, res.ypoint) // console.log('移动坐标1:', res.name, res.xpoint, res.ypoint)
res.xpoint = x res.xpoint = x
...@@ -1420,7 +1519,7 @@ ...@@ -1420,7 +1519,7 @@
stationId: localStorage.getItem('stationId'), stationId: localStorage.getItem('stationId'),
id: ids[i] id: ids[i]
}) })
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
//删除绘制的图标和线 //删除绘制的图标和线
this.delPoint(ids[i]) this.delPoint(ids[i])
...@@ -1492,7 +1591,9 @@ ...@@ -1492,7 +1591,9 @@
if (featureEnd) { if (featureEnd) {
//删除红外探测器或者振动光纤id对应的资源点 //删除红外探测器或者振动光纤id对应的资源点
this.vectorLayer.getSource().removeFeature(featureEnd) this.vectorLayer.getSource().removeFeature(featureEnd)
let lineFeature = this.lineVectorLayer.getSource().getFeatureById(id + 'line') let lineFeature = this.lineVectorLayer
.getSource()
.getFeatureById(id + 'line')
if (lineFeature) { if (lineFeature) {
//删除id对应的连线 //删除id对应的连线
this.lineVectorLayer.getSource().removeFeature(lineFeature) this.lineVectorLayer.getSource().removeFeature(lineFeature)
...@@ -1529,7 +1630,7 @@ ...@@ -1529,7 +1630,7 @@
} }
item.value = item.value + '2' item.value = item.value + '2'
this.typeList.forEach(res => { this.typeList.forEach((res) => {
if (item.id !== res.id) { if (item.id !== res.id) {
if ( if (
res.value.substring(res.value.length - 1, res.value.length) == 2 res.value.substring(res.value.length - 1, res.value.length) == 2
...@@ -1564,7 +1665,7 @@ ...@@ -1564,7 +1665,7 @@
// } // }
this.typeList.forEach(res => { this.typeList.forEach((res) => {
// if ((e.path && e.path[0].id !== res.id) || e.srcElement.id !== res.id) { // if ((e.path && e.path[0].id !== res.id) || e.srcElement.id !== res.id) {
if (e.srcElement.id !== res.id) { if (e.srcElement.id !== res.id) {
if ( if (
...@@ -1608,7 +1709,7 @@ ...@@ -1608,7 +1709,7 @@
// console.log(jw) // console.log(jw)
// } // }
this.mousemoveStatus = false this.mousemoveStatus = false
this.typeList.forEach(res => { this.typeList.forEach((res) => {
if (res.value.substring(res.value.length - 1, res.value.length) == 2) { if (res.value.substring(res.value.length - 1, res.value.length) == 2) {
res.value = res.value.substring(0, res.value.length - 1) res.value = res.value.substring(0, res.value.length - 1)
} }
...@@ -1634,7 +1735,7 @@ ...@@ -1634,7 +1735,7 @@
}, },
iconClick(item) { iconClick(item) {
console.log(this.currentNode) console.log(this.currentNode)
this.iconNameListBottom.forEach(res => { this.iconNameListBottom.forEach((res) => {
if (res.id === item.id) { if (res.id === item.id) {
if ( if (
res.value.substring(res.value.length - 1, res.value.length) != 4 res.value.substring(res.value.length - 1, res.value.length) != 4
...@@ -1651,13 +1752,13 @@ ...@@ -1651,13 +1752,13 @@
}) })
if (this.currentNode.level == 5) { if (this.currentNode.level == 5) {
this.list = [] this.list = []
this.currentNode.children.forEach(el => { this.currentNode.children.forEach((el) => {
if (item.id === el.type) { if (item.id === el.type) {
this.list.push(el) this.list.push(el)
} }
}) })
this.list.forEach(res => { this.list.forEach((res) => {
Vue.set(res, 'active', false) Vue.set(res, 'active', false)
}) })
} else { } else {
...@@ -1673,7 +1774,7 @@ ...@@ -1673,7 +1774,7 @@
params: this.$http.adornParams({ params: this.$http.adornParams({
stationId: localStorage.getItem('stationId') stationId: localStorage.getItem('stationId')
}) })
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.systemList = data.list this.systemList = data.list
} }
...@@ -1686,11 +1787,11 @@ ...@@ -1686,11 +1787,11 @@
params: this.$http.adornParams({ params: this.$http.adornParams({
stationId: localStorage.getItem('stationId') stationId: localStorage.getItem('stationId')
}) })
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.typeList = JSON.parse(JSON.stringify(data.list)) this.typeList = JSON.parse(JSON.stringify(data.list))
this.iconNameListBottom = JSON.parse(JSON.stringify(data.list)) this.iconNameListBottom = JSON.parse(JSON.stringify(data.list))
this.iconNameListBottom.forEach(res => { this.iconNameListBottom.forEach((res) => {
res.value += '3' res.value += '3'
}) })
} }
...@@ -1701,116 +1802,114 @@ ...@@ -1701,116 +1802,114 @@
//console.log(e.width) //console.log(e.width)
} }
} }
}
}
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.dic_tree {
.dic_tree {
background: #f4f4f4; background: #f4f4f4;
font-size: 14px; font-size: 14px;
transform: translateX(-6px); transform: translateX(-6px);
margin-top: 20px; margin-top: 20px;
} }
.dic_tree /deep/ .el-tree-node__content { .dic_tree /deep/ .el-tree-node__content {
padding-left: 0px !important; padding-left: 0px !important;
} }
.dic_tree /deep/ .el-tree-node { .dic_tree /deep/ .el-tree-node {
position: relative; position: relative;
padding-left: 16px; padding-left: 16px;
} }
.dic_tree /deep/ .el-tree-node__children { .dic_tree /deep/ .el-tree-node__children {
padding-left: 10px; padding-left: 10px;
} }
.dic_tree /deep/ .el-tree-node :last-child:before { .dic_tree /deep/ .el-tree-node :last-child:before {
height: 38px; height: 38px;
} }
.dic_tree /deep/ .el-tree > .el-tree-node:before { .dic_tree /deep/ .el-tree > .el-tree-node:before {
border-left: none; border-left: none;
} }
.tree-container /deep/ .el-tree > .el-tree-node:after { .tree-container /deep/ .el-tree > .el-tree-node:after {
border-top: none; border-top: none;
} }
.dic_tree /deep/ .el-tree-node:before { .dic_tree /deep/ .el-tree-node:before {
content: ""; content: '';
left: -4px; left: -4px;
position: absolute; position: absolute;
right: auto; right: auto;
border-width: 1px; border-width: 1px;
} }
.dic_tree /deep/ .el-tree-node:after { .dic_tree /deep/ .el-tree-node:after {
content: ""; content: '';
left: -4px; left: -4px;
position: absolute; position: absolute;
right: auto; right: auto;
border-width: 1px; border-width: 1px;
} }
.dic_tree /deep/ .el-tree-node:before { .dic_tree /deep/ .el-tree-node:before {
border-left: 1px dashed #bfbfbf; border-left: 1px dashed #bfbfbf;
bottom: 0px; bottom: 0px;
height: 100%; height: 100%;
top: -26px; top: -26px;
width: 1px; width: 1px;
} }
.dic_tree /deep/ .el-tree-node:after { .dic_tree /deep/ .el-tree-node:after {
border-top: 1px dashed #bfbfbf; border-top: 1px dashed #bfbfbf;
height: 20px; height: 20px;
top: 12px; top: 12px;
width: 35px; width: 35px;
} }
.tree-container /deep/ .el-tree > .el-tree-node:after { .tree-container /deep/ .el-tree > .el-tree-node:after {
border-top: none; border-top: none;
} }
.tree-container { .tree-container {
/* 树的parent,样式自定 */ /* 树的parent,样式自定 */
} }
.dic_tree /deep/ .el-tree-node__expand-icon.expanded { .dic_tree /deep/ .el-tree-node__expand-icon.expanded {
transform: rotate(0deg); transform: rotate(0deg);
-webkit-transform: rotate(0deg); -webkit-transform: rotate(0deg);
} }
.dic_tree /deep/ .el-icon-caret-right:before { .dic_tree /deep/ .el-icon-caret-right:before {
background: url("../../../assets/images/add.png"); background: url('../../../assets/images/add.png');
content: ""; content: '';
display: block; display: block;
width: 18px; width: 18px;
height: 18px; height: 18px;
font-size: 18px; font-size: 18px;
background-size: 18px; background-size: 18px;
} }
.dic_tree .dic_tree
/deep/ /deep/
.el-tree-node__expand-icon.expanded.el-icon-caret-right:before { .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
background: url("../../../assets/images/sub.png"); background: url('../../../assets/images/sub.png');
content: ""; content: '';
display: block; display: block;
width: 18px; width: 18px;
height: 18px; height: 18px;
font-size: 18px; font-size: 18px;
background-size: 18px; background-size: 18px;
} }
.dic_tree /deep/.el-tree-node__content > .el-tree-node__expand-icon{ .dic_tree /deep/.el-tree-node__content > .el-tree-node__expand-icon {
padding:1px; padding: 1px;
} }
.dic_tree /deep/.el-tree-node__expand-icon.is-leaf::before { .dic_tree /deep/.el-tree-node__expand-icon.is-leaf::before {
opacity: 0; opacity: 0;
} }
.dic_tree /deep/.is-leaf.el-tree-node__expand-icon.el-icon-caret-right { .dic_tree /deep/.is-leaf.el-tree-node__expand-icon.el-icon-caret-right {
// margin-left: -15px !important; // margin-left: -15px !important;
} }
</style> </style>
<style lang='scss'> <style lang="scss">
.line_warp { .line_warp {
// width: 300px; // width: 300px;
height: 45px; height: 45px;
display: flex; display: flex;
...@@ -1826,37 +1925,37 @@ ...@@ -1826,37 +1925,37 @@
height: 50px; height: 50px;
transform: translateX(-14px); transform: translateX(-14px);
} }
} }
.el-tree--highlight-current .el-tree--highlight-current
.el-tree-node.is-current .el-tree-node.is-current
> .el-tree-node__content > .el-tree-node__content
.custom-tree-node { .custom-tree-node {
background-color: #33b0f6 !important; background-color: #33b0f6 !important;
color: aliceblue; color: aliceblue;
} }
.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content { .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
background-color: transparent; background-color: transparent;
} }
</style> </style>
<style lang='scss' scoped> <style lang="scss" scoped>
#map { #map {
/deep/.ol-zoom{ /deep/.ol-zoom {
// display: none; // display: none;
} }
/deep/ .ol-zoom .ol-unselectable .ol-control{ /deep/ .ol-zoom .ol-unselectable .ol-control {
display: none; display: none;
} }
} }
.treeCard { .treeCard {
.el-tree { .el-tree {
overflow-y: scroll; overflow-y: scroll;
height: 640px; height: 640px;
} }
} }
.tree_house { .tree_house {
width: 12px; width: 12px;
height: 18px; height: 18px;
display: inline-block; display: inline-block;
...@@ -1867,8 +1966,8 @@ ...@@ -1867,8 +1966,8 @@
// transform: translateY(-8px); // transform: translateY(-8px);
transform: translateX(-40px); transform: translateX(-40px);
} }
} }
.tree_point { .tree_point {
width: 12px; width: 12px;
height: 18px; height: 18px;
display: inline-block; display: inline-block;
...@@ -1878,8 +1977,8 @@ ...@@ -1878,8 +1977,8 @@
vertical-align: middle; vertical-align: middle;
transform: translateY(-2px); transform: translateY(-2px);
} }
} }
.resource-container { .resource-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
...@@ -1906,15 +2005,15 @@ ...@@ -1906,15 +2005,15 @@
height: 40px; height: 40px;
width: 40px; width: 40px;
} }
} }
.tier-btn { .tier-btn {
.active-tier { .active-tier {
background-color: #409eff; background-color: #409eff;
color: #ffffff; color: #ffffff;
} }
} }
.monitor_point_left_top { .monitor_point_left_top {
height: 42px; height: 42px;
background: #e1edf4; background: #e1edf4;
padding-left: 16px; padding-left: 16px;
...@@ -1958,9 +2057,9 @@ ...@@ -1958,9 +2057,9 @@
font-weight: bold; font-weight: bold;
} }
} }
} }
.top_button { .top_button {
background: url(~@/assets/images/sysiconbg.png); background: url(~@/assets/images/sysiconbg.png);
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment