Browse Source

Merge branch 'develop' of gitadmin/tuoheng_lc_web into release

tags/v1.1.0^2
zhangtao 1 year ago
parent
commit
ef8d3d999e
1 changed files with 121 additions and 136 deletions
  1. +121
    -136
      src/views/dashboard/components/OneMap.vue

+ 121
- 136
src/views/dashboard/components/OneMap.vue View File

<template> <template>
<div class="map-container" :="getMapOptions" />


<div
class="map-container"
:="getMapOptions"
/>

<div

id="airOverlay"
class="airport-overlay"
>
<span
id="closeAir"
class="close-overlay"
@click="hideAirInfo"
>x</span>
<div id="airOverlay" class="airport-overlay">
<span id="closeAir" class="close-overlay" @click="hideAirInfo">x</span>
<air-info :data="airDetail" /> <air-info :data="airDetail" />
</div> </div>
<div

v-show="problemPopupShow"
id="problemOverlay"
class="problem-overlay"
>
<span
class="close-overlay"
@click="hideProblemInfo"
>x</span>
<div v-show="problemPopupShow" id="problemOverlay" class="problem-overlay">
<span class="close-overlay" @click="hideProblemInfo">x</span>
<problem-info :detail="problemDetail" /> <problem-info :detail="problemDetail" />
</div> </div>


<div
v-show="listChecked"
class="menu"
>
<div v-show="listChecked" class="menu">
<div class="tabBar"> <div class="tabBar">
<span <span
:class="[tabIndex==1?'checkedColor':'uncheckedColor']"
style="margin-right:97px"
:class="[tabIndex == 1 ? 'checkedColor' : 'uncheckedColor']"
style="margin-right: 97px"
@click="showTask" @click="showTask"
>任务</span> >任务</span>
<span <span
:class="[tabIndex==1?'uncheckedColor':'checkedColor']"
:class="[tabIndex == 1 ? 'uncheckedColor' : 'checkedColor']"
@click="showProblem" @click="showProblem"
>问题</span> >问题</span>
</div> </div>
<div
v-if="tabIndex==1"
class="listDetail"
>
<div v-if="tabIndex == 1" class="listDetail">
<ul> <ul>
<li <li
v-for="(item,index) in taskList"
v-for="(item, index) in taskList"
:key="index" :key="index"
style="display:flex;font-size:14px"
style="font-size: 14px"
> >
<div style="width:145px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">{{ item.date }}&nbsp;&nbsp;{{ item.taskName }}</div>
<div style="width:42px">{{ item.statusInfo }}</div>
<div
style="
width: 150px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right:20px;
"
>
{{ item.date }}&nbsp;&nbsp;{{ item.taskName }}
</div>
<div style="margin-right:30px">{{ item.statusInfo }}</div>


<n-popconfirm <n-popconfirm
v-if="item.status==1"
v-if="item.status == 1"
style="float:left"
@positive-click="handlePositiveClick(item)" @positive-click="handlePositiveClick(item)"
@negative-click="handleNegativeClick" @negative-click="handleNegativeClick"
> >
<template #trigger> <template #trigger>
<span style="color:#22D33D">立即执行</span>
<span style="color: #22d33d">立即执行</span>
</template> </template>
是否立即开始执行任务? 是否立即开始执行任务?
</n-popconfirm> </n-popconfirm>
<div
v-else
style="color:#1890FF"
@click="liveShow(item)"
>直播</div>
<div v-else style="color: #1890ff" @click="liveShow(item)">直播</div>
</li> </li>

</ul> </ul>
<n-pagination <n-pagination
v-model:page="page" v-model:page="page"
:page-count="pageCount" :page-count="pageCount"
:page-slot="7" :page-slot="7"
style="color:#FFFFFF;position:absolute;bottom:10px;left:10px"
style="color: #ffffff; position: absolute; bottom: 10px; left: 10px"
/> />
</div> </div>
<div
v-else
class="listDetail"
>
<div v-else class="listDetail">
<n-date-picker <n-date-picker
:on-update:formatted-value="abc" :on-update:formatted-value="abc"
:default-formatted-value="efg" :default-formatted-value="efg"
type="daterange" type="daterange"
:default-value="[Date.now() - 6.048e8, Date.now()]" :default-value="[Date.now() - 6.048e8, Date.now()]"
:is-date-disabled="disablePreviousDate" :is-date-disabled="disablePreviousDate"
style="margin-bottom:15px"
style="margin-bottom: 15px"
/> />
<!-- 多选框 --> <!-- 多选框 -->
<n-checkbox-group <n-checkbox-group
v-model:value="problemTypeSelected" v-model:value="problemTypeSelected"
@update:value="handleProblemTypeValue" @update:value="handleProblemTypeValue"
> >
<div
v-for="(item,index) in problemTypeList"
:key="index"
>
<div v-for="(item, index) in problemTypeList" :key="index">
<n-checkbox <n-checkbox
:value="item.content" :value="item.content"
:label="item.content" :label="item.content"
style="color:#FFFFFF"
style="color: #ffffff"
/> />
</div> </div>

</n-checkbox-group> </n-checkbox-group>

</div> </div>
</div> </div>
<div class="menuControl"> <div class="menuControl">
<div <div
style="border-bottom:1px solid rgba(1122,112,112,0.65)"
style="border-bottom: 1px solid rgba(1122, 112, 112, 0.65)"
class="item" class="item"
> >
<div @click="showList"> <div @click="showList">
<img <img
v-if="listChecked==true"
v-if="listChecked == true"
src="../../../assets/images/listChecked.png" src="../../../assets/images/listChecked.png"
> >
<img
v-else
src="../../../assets/images/listUnchecked.png"
>
<img v-else src="../../../assets/images/listUnchecked.png">
</div> </div>


<span :style="{'color':listChecked?'#1890FF':'#666666'}">列表</span>
<span :style="{ color: listChecked ? '#1890FF' : '#666666' }">列表</span>
</div> </div>
<div class="item"> <div class="item">
<div @click="showAirportList"> <div @click="showAirportList">
<img <img
v-if="airportSelected==true"
v-if="airportSelected == true"
src="../../../assets/images/airportChecked.png" src="../../../assets/images/airportChecked.png"
> >
<img
v-else
src="../../../assets/images/airportUnchecked.png"
>
<img v-else src="../../../assets/images/airportUnchecked.png">
</div> </div>


<span :style="{'color':airportSelected?'#1890FF':'#666666'}">机场</span>
<span :style="{ color: airportSelected ? '#1890FF' : '#666666' }">机场</span>
</div> </div>
</div> </div>

</template> </template>


<script> <script>
import fireHazard_icon from '@/assets/images/fireHazard.png' import fireHazard_icon from '@/assets/images/fireHazard.png'
import { reactive, toRefs, onMounted, computed, ref, watch } from 'vue' import { reactive, toRefs, onMounted, computed, ref, watch } from 'vue'
import { Point } from 'ol/geom' import { Point } from 'ol/geom'
import { airportList, getMissionList, getQuestionType, getQuestionList } from '@/api/dashboard/index.js'
import {
airportList,
getMissionList,
getQuestionType,
getQuestionList
} from '@/api/dashboard/index.js'
import { getQuestions } from '@/api/task/index.js' import { getQuestions } from '@/api/task/index.js'
import { gcj02towgs84 } from '@/utils/coordinate-util.js' import { gcj02towgs84 } from '@/utils/coordinate-util.js'
import AirInfo from './AirInfo.vue' import AirInfo from './AirInfo.vue'
listShow: false, listShow: false,
// 时间范围是一周前至今天 // 时间范围是一周前至今天
efg: '', efg: '',
listIcon: new URL('../../../assets/images/listChecked.png', import.meta.url).href,

airportIcon: new URL('../../../assets/images/airportChecked.png', import.meta.url).href,
listIcon: new URL(
'../../../assets/images/listChecked.png',
import.meta.url
).href,

airportIcon: new URL(
'../../../assets/images/airportChecked.png',
import.meta.url
).href,
listFontStyle: { listFontStyle: {
'color': '#666666'
color: '#666666'
}, },
airportFontStyle: { airportFontStyle: {
'color': '#1890FF'
color: '#1890FF'
}, },
problemPopupShow: false, problemPopupShow: false,
tabIndex: 1, tabIndex: 1,
page: ref(1), page: ref(1),
pageCount: 1, pageCount: 1,
taskList: [], taskList: [],
range: (['2012-09-10', '2022-09-10']),
range: ['2012-09-10', '2022-09-10'],
problemTypeSelected: null, problemTypeSelected: null,
problemTypeList: [], problemTypeList: [],
listChecked: false, listChecked: false,
airportPopupShow: false, airportPopupShow: false,
problemlayer: null problemlayer: null
}) })
watch(() => data.page, (newValue, oldValue) => {
if (newValue !== oldValue) {
initTaskList()
watch(
() => data.page,
(newValue, oldValue) => {
if (newValue !== oldValue) {
initTaskList()
}
} }
})
)
const getMapOptions = computed(() => { const getMapOptions = computed(() => {
return { return {
id: props.id id: props.id


const initMap = () => { const initMap = () => {
// 天地图影像图 // 天地图影像图
const tdtImgMap =
new Tile({
visible: true,
source: new XYZ({
url: 'https://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=f634525a82da65f715d168d7ba1899c0'
})
const tdtImgMap = new Tile({
visible: true,
source: new XYZ({
url: 'https://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=f634525a82da65f715d168d7ba1899c0'
}) })
})
var wmsSource = new Tile({ var wmsSource = new Tile({
source: new TileWMS({ source: new TileWMS({
url: 'https://geoserver.t-aaron.com:4080/geoserver/jiangning/wms', url: 'https://geoserver.t-aaron.com:4080/geoserver/jiangning/wms',
params: { 'LAYERS': 'jiangning:town' }
params: { LAYERS: 'jiangning:town' }
}) })
}) })
data.map = new Map({ data.map = new Map({
zoom: 11, zoom: 11,
maxZoom: 17 maxZoom: 17
}), }),
layers: [
tdtImgMap

],
layers: [tdtImgMap],
controls: control.defaults({ controls: control.defaults({
attribution: false, attribution: false,
rotate: false, rotate: false,
zoom: false zoom: false
}) })

}) })
data.map.addLayer(wmsSource) data.map.addLayer(wmsSource)
wmsSource.setOpacity(0.3) wmsSource.setOpacity(0.3)
/** /**
* @description:分页器改变时改变任务列表信息 * @description:分页器改变时改变任务列表信息
*/ */
const changePage = (v) => {

}
const changePage = (v) => {}
/** /**
* 展示机场 * 展示机场
*/ */
if (data.airportsAll.length > 0) { if (data.airportsAll.length > 0) {
for (let i = 0; i < data.airportsAll.length; i++) { for (let i = 0; i < data.airportsAll.length; i++) {
const airport = data.airportsAll[i] const airport = data.airportsAll[i]
const lngLat = gcj02towgs84(parseFloat(airport.longitude), parseFloat(airport.latitude))
const lngLat = gcj02towgs84(
parseFloat(airport.longitude),
parseFloat(airport.latitude)
)
const feature = new Feature({ const feature = new Feature({
geometry: new Point(fromLonLat(lngLat)) geometry: new Point(fromLonLat(lngLat))
}) })
const performTask = (item) => { const performTask = (item) => {
// console.log(router, '路径') // console.log(router, '路径')


router.push({ path: '/taskManage/all', query: { rowInfo: JSON.stringify(item) }})
router.push({
path: '/taskManage/all',
query: { rowInfo: JSON.stringify(item) }
})
} }
const abc = (value) => { const abc = (value) => {
getQuestionList({ getQuestionList({
startTime: value[0], startTime: value[0],
endTime: value[1] endTime: value[1]
}).then(res => {
}).then((res) => {
if (res.code === 0) { if (res.code === 0) {
const arr = res.data const arr = res.data


var n = resArr.indexOf(arr[i].typeName) var n = resArr.indexOf(arr[i].typeName)
if (n == -1) { if (n == -1) {
resArr.push(arr[i].typeName) resArr.push(arr[i].typeName)
narr.push({ 'name': arr[i].typeName, fraction: [arr[i]] })
narr.push({ name: arr[i].typeName, fraction: [arr[i]] })
} else { } else {
narr[n].fraction.push(arr[i]) narr[n].fraction.push(arr[i])
} }
element: document.getElementById('problemOverlay'), element: document.getElementById('problemOverlay'),
// autoPan: true, // autoPan: true,
offset: [10, 10] offset: [10, 10]

}) })
narr.map((item) => { narr.map((item) => {
const Features = [] const Features = []
if (item.fraction.length > 0) { if (item.fraction.length > 0) {
item.fraction.map((iitem) => { item.fraction.map((iitem) => {
const problem = iitem const problem = iitem
const lngLat = gcj02towgs84(parseFloat(problem.lng), parseFloat(problem.lat))
const lngLat = gcj02towgs84(
parseFloat(problem.lng),
parseFloat(problem.lat)
)
const feature = new Feature({ const feature = new Feature({
geometry: new Point(fromLonLat(lngLat)) geometry: new Point(fromLonLat(lngLat))
}) })
getMissionList({ getMissionList({
page: data.page, page: data.page,
limit: 8 limit: 8
}).then(res => {
}).then((res) => {
if (res.code === 0) { if (res.code === 0) {
data.taskList = res.data.records data.taskList = res.data.records

data.pageCount = res.data.pages data.pageCount = res.data.pages
// console.log(data.pageCount, '页数') // console.log(data.pageCount, '页数')
data.taskList.map((item, index) => { data.taskList.map((item, index) => {
const arr = item.executionStartTime.split(/[ ]+/)// 以空格分开
const arr = item.executionStartTime.split(/[ ]+/) // 以空格分开
item.date = arr[0] item.date = arr[0]
item.taskName = item.name item.taskName = item.name


* 获取问题多选类型 * 获取问题多选类型
*/ */
const initProblemType = () => { const initProblemType = () => {
getQuestionType().then(res => {
getQuestionType().then((res) => {
if (res.code === 0) { if (res.code === 0) {
data.problemTypeList = res.data data.problemTypeList = res.data
data.problemTypeSelected = [] data.problemTypeSelected = []
* 展示直播视频 * 展示直播视频
*/ */
const liveShow = (rowInfo) => { const liveShow = (rowInfo) => {
router.push({ path: '/taskManage/all', query: { rowInfo: JSON.stringify(rowInfo), type: 1 }})
router.push({
path: '/taskManage/all',
query: { rowInfo: JSON.stringify(rowInfo), type: 1 }
})
} }
onMounted(() => { onMounted(() => {
initMap() initMap()
const d = 864e5 const d = 864e5
// return ts > Date.now() // return ts > Date.now()
if (type === 'start' && range !== null) { if (type === 'start' && range !== null) {
return startOfDay(range[1]).valueOf() - startOfDay(ts).valueOf() >= d * 8
return (
startOfDay(range[1]).valueOf() - startOfDay(ts).valueOf() >= d * 8
)
} }
if (type === 'end' && range !== null) { if (type === 'end' && range !== null) {
return startOfDay(ts).valueOf() - startOfDay(range[0]).valueOf() >= d * 8
return (
startOfDay(ts).valueOf() - startOfDay(range[0]).valueOf() >= d * 8
)
} }
return ts > Date.now() return ts > Date.now()
}, },
}, },
handlePositiveClick(row) { handlePositiveClick(row) {
$message.info('机场设备开始自检,请稍等') $message.info('机场设备开始自检,请稍等')
implement(row.id)
.then(res => {
if (res.code === 0) {
$message.info('操作成功')
}
})
},
handleNegativeClick() {

implement(row.id).then((res) => {
if (res.code === 0) {
$message.info('操作成功')
}
})
}, },
handleNegativeClick() {},
liveShow liveShow

} }
} }
} }
</script> </script>


<style lang="scss" scoped> <style lang="scss" scoped>
.container{
width:100vw;
height:100vh;
position:relative;
overflow:hidden;
.container {
width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
} }
.map-container { .map-container {
position:absolute;
top:0px;
left:0px;
right:0px;
bottom:0px;

position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
} }


.layer-management { .layer-management {
padding: 10px 19px; padding: 10px 19px;
ul { ul {
li { li {
display: flex;
justify-content: space-between;

padding: 5px 2px; padding: 5px 2px;
margin-bottom: 3px; margin-bottom: 3px;
div{
float:left;
}
} }
} }
} }

Loading…
Cancel
Save