瀏覽代碼

mc

tags/v1.2.0
lixin 1 年之前
父節點
當前提交
fd420a45b1
共有 1 個文件被更改,包括 6 次插入21 次删除
  1. +6
    -21
      src/views/dashboard/components/OneMap.vue

+ 6
- 21
src/views/dashboard/components/OneMap.vue 查看文件

import { get as getProjection } from 'ol/proj.js' import { get as getProjection } from 'ol/proj.js'
import { getTopLeft, getWidth } from 'ol/extent.js' import { getTopLeft, getWidth } from 'ol/extent.js'
import { formatDate } from '@/utils/index.js' import { formatDate } from '@/utils/index.js'
import { da } from 'date-fns/locale'
const projection = getProjection('EPSG:4326') const projection = getProjection('EPSG:4326')
const projectionExtent = projection.getExtent() const projectionExtent = projection.getExtent()
const size = getWidth(projectionExtent) / 256 const size = getWidth(projectionExtent) / 256
listShow: false, listShow: false,
// 时间范围是一周前至今天 // 时间范围是一周前至今天
efg: '', efg: '',
clickListNum: 0,
problemPopupShow: false, problemPopupShow: false,
tabIndex: 1, tabIndex: 1,
page: ref(1), page: ref(1),
data.problemPopupShow = true data.problemPopupShow = true
data.map.addOverlay(data.problemOverlay) data.map.addOverlay(data.problemOverlay)
data.problemOverlay.setPosition(coord) data.problemOverlay.setPosition(coord)

// data.problemOverlay.setPosition(coord)
// data.map.addOverlay(data.problemOverlay)
} }
} }
} }
const hideProblemInfo = () => { const hideProblemInfo = () => {
if (data.map.getOverlayById('problem_overlay')) { if (data.map.getOverlayById('problem_overlay')) {
data.problemDetail = {} data.problemDetail = {}

data.map.removeOverlay(data.problemOverlay) data.map.removeOverlay(data.problemOverlay)
} }
} }
// 获取日期 // 获取日期
const getDay = (day) => { const getDay = (day) => {
var today = new Date() var today = new Date()

var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day

today.setTime(targetday_milliseconds) // 注意,这行是关键代码 today.setTime(targetday_milliseconds) // 注意,这行是关键代码

var tYear = today.getFullYear() var tYear = today.getFullYear()

var tMonth = today.getMonth() var tMonth = today.getMonth()

var tDate = today.getDate() var tDate = today.getDate()

tMonth = doHandleMonth(tMonth + 1) tMonth = doHandleMonth(tMonth + 1)

tDate = doHandleMonth(tDate) tDate = doHandleMonth(tDate)

return tYear + '-' + tMonth + '-' + tDate return tYear + '-' + tMonth + '-' + tDate
} }
const doHandleMonth = (month) => { const doHandleMonth = (month) => {
var m = month var m = month

if (month.toString().length === 1) { if (month.toString().length === 1) {
m = '0' + month m = '0' + month
} }

return m return m
} }
// 添加问题图层 // 添加问题图层
* @description:是否展示列表 * @description:是否展示列表
*/ */
const showList = () => { const showList = () => {
// 判断是不是第一次点击列表按钮
// if (data.clickListNum === 0) {
// // 第一次点击列表按钮会显示问题图层
// changeDate()
// data.clickListNum += 1
// }
if (data.listChecked) { if (data.listChecked) {
// 关闭问题图层
if (data.problemLayerList.length > 0) { if (data.problemLayerList.length > 0) {
data.problemLayerList.forEach(layer => { data.problemLayerList.forEach(layer => {
if (layer !== null) { if (layer !== null) {
}) })
data.problemLayerList.length = 0 data.problemLayerList.length = 0
} }
// 关闭问题弹窗
hideProblemInfo()
} else { } else {
changeDate() changeDate()
} }
* *
*/ */
const handleProblemTypeValue = (value) => { const handleProblemTypeValue = (value) => {
// 关闭问题弹窗
hideProblemInfo()
if (data.problemLayerList.length > 0) { if (data.problemLayerList.length > 0) {
data.problemLayerList.map((layer) => { data.problemLayerList.map((layer) => {
const a = value.indexOf(layer.getProperties().type) const a = value.indexOf(layer.getProperties().type)

Loading…
取消
儲存