Explorar el Código

Merge branch 'develop' of gitadmin/tuoheng_lc_web into release

tags/v1.1.0^2
zhangtao hace 1 año
padre
commit
9f6b053d8b
Se han modificado 1 ficheros con 31 adiciones y 36 borrados
  1. +31
    -36
      src/views/dashboard/components/OneMap.vue

+ 31
- 36
src/views/dashboard/components/OneMap.vue Ver fichero

@@ -73,10 +73,11 @@
</div>
<div v-else class="listDetail">
<n-date-picker
v-model:value="times"
:on-update:formatted-value="changeDate"
:default-formatted-value="lastSevenDateList"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="daterange"

:is-date-disabled="disablePreviousDate"
style="margin-bottom: 15px"
/>
@@ -160,6 +161,7 @@ import { useMessage, useDialog } from 'naive-ui'
import { implement } from '@/api/task/index.js'
import { get as getProjection } from 'ol/proj.js'
import { getTopLeft, getWidth } from 'ol/extent.js'
import { formatDate } from '@/utils/index.js'
const projection = getProjection('EPSG:4326')
const projectionExtent = projection.getExtent()
const size = getWidth(projectionExtent) / 256
@@ -204,23 +206,7 @@ export default {
listShow: false,
// 时间范围是一周前至今天
efg: '',
initDate: 0,
clickListNum: 0,
listIcon: new URL(
'../../../assets/images/listChecked.png',
import.meta.url
).href,

airportIcon: new URL(
'../../../assets/images/airportChecked.png',
import.meta.url
).href,
listFontStyle: {
color: '#666666'
},
airportFontStyle: {
color: '#1890FF'
},
problemPopupShow: false,
tabIndex: 1,
page: ref(1),
@@ -233,7 +219,7 @@ export default {
airportSelected: true,
problemLayerList: [],
airportPopupShow: false,
lastSevenDateList: [],
times: null,
paginationShow: false
})
watch(
@@ -244,6 +230,11 @@ export default {
}
}
)
watch(() => data.listChecked, (val) => {
if (val) {
initSevenDate()
}
})
const getMapOptions = computed(() => {
return {
id: props.id
@@ -387,12 +378,11 @@ export default {
data.map.on('click', (evt) => {
showAirInfo(evt)
})

// console.log(new Date().getFullYear())
}
// 获取近7天的日期
const initSevenDate = () => {
data.lastSevenDateList = [getDay(-7), getDay(0)]
const time = new Date().getTime()
data.times = [time - 1000 * 60 * 60 * 24 * 7, time]
}
/**
* 展示机场信息
@@ -484,16 +474,10 @@ export default {
}
const changeDate = (value) => {
if (value) {
data.lastSevenDateList = value
}
if (data.initDate == 0) {
// 默认加载近7天的问题图层
// 获取近7天的日期
getQuestionInfo(getDay(-7), getDay(0))
} else {
getQuestionInfo(value[0], value[1])
} else {
getQuestionInfo(getDay(-7), getDay(0))
}
data.initDate += 1
}
// 获取问题图层数据
const getQuestionInfo = (startTime, endTime) => {
@@ -545,7 +529,7 @@ export default {
const doHandleMonth = (month) => {
var m = month

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

@@ -571,7 +555,6 @@ export default {
geometry: new Point(fromLonLat([problem.lng, problem.lat]))
})
let icon

switch (iitem.type) {
case '002000':
icon = problemSpot_icon
@@ -630,7 +613,7 @@ export default {
data.taskList = res.data.records

data.pageCount = res.data.pages
if (data.pageCount == 1) {
if (data.pageCount === 1) {
data.paginationShow = false
} else {
data.paginationShow = true
@@ -673,11 +656,23 @@ export default {
*/
const showList = () => {
// 判断是不是第一次点击列表按钮
if (data.clickListNum == 0) {
// 第一次点击列表按钮会显示问题图层
// if (data.clickListNum === 0) {
// // 第一次点击列表按钮会显示问题图层
// changeDate()
// data.clickListNum += 1
// }
if (data.listChecked) {
if (data.problemLayerList.length > 0) {
data.problemLayerList.forEach(layer => {
if (layer !== null) {
data.map.removeLayer(layer)
}
})
data.problemLayerList.length = 0
}
} else {
changeDate()
}
data.clickListNum += 1
data.listChecked = !data.listChecked
}
/**

Cargando…
Cancelar
Guardar