This commit is contained in:
DESKTOP-VMMLSOQ\wangzg 2024-08-19 22:26:28 +08:00
parent 432199be72
commit 6616b60bf4
11 changed files with 93 additions and 41 deletions

View File

@ -20,11 +20,6 @@ const mapLayerTypeToPointIcon = {
}
export default {
async asyncData({ $axios }) {
const { data } = await $axios.$get('http://101.43.201.20:5000/api/Home/view');
return { pageTitle: data.home.title }; // { data: '' }
},
name: "Map",
data () {
return {
@ -41,18 +36,23 @@ export default {
default: 'big'
}
},
mounted() {
this.$nextTick(() => {
if (this.$refs.mapRef) {
const win = window.top
this.$http.get('http://101.43.201.20:5000/api/Home/view').then(({ data }) => {
win.document.title = data.home.title
this.setTitle(data.home.title)
this.setInfo(data)
this.initMap(data.home.center)
})
watch: {
info: {
immediate: true,
deep: true,
handler (info) {
if (info) {
this.$nextTick(() => {
if (this.$refs.mapRef) {
this.initMap(info.home.center)
}
})
}
}
})
}
},
mounted() {
this.$evBus.$on('setVisibility', (layerType, show) => {
this.setVisibility(layerType, show)
})
@ -70,6 +70,7 @@ export default {
shisc: state => state.map.shisc,
wz: state => state.map.wz,
jkd: state => state.map.jkd,
info: state => state.system.info
})
},
methods: {
@ -79,7 +80,6 @@ export default {
const { lon, lat } = center
ms3dConfig.scene.center.lng = lon
ms3dConfig.scene.center.lat = lat
console.log('ms3dConfig:', ms3dConfig);
this.map = new mars3d.Map(this.$refs.mapRef, ms3dConfig)
this.map.on("load", () => {
Object.keys(mapLayerTypeToPointIcon).forEach(layerType => {

View File

@ -5,7 +5,7 @@
<div class="progress-item" v-for="(item, index) in rate" :key="index">
<BFC>
<div class="percent" slot="right">
{{ item.val * 100 }}
{{ (item.val * 100).toFixed(0) }}
<div class="unit">%</div>
</div>
<div class="info" slot="center">

36
layouts/default.vue Normal file
View File

@ -0,0 +1,36 @@
<template>
<div>
<nuxt />
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
name: "default",
computed: {
...mapState({
info: state => state.system.info
})
},
created() {
this.getViewData()
},
methods: {
...mapActions('system', ['setInfo']),
async getViewData () {
if (!this.info) {
const { data } = await this.$get('/api/Home/view');
this.setInfo(data)
}
}
}
}
</script>
<style scoped lang="less">
</style>

17
layouts/loginLayout.vue Normal file
View File

@ -0,0 +1,17 @@
<template>
<div>
<nuxt />
</div>
</template>
<script>
export default {
name: "LoginLayout"
}
</script>
<style scoped lang="less">
</style>

View File

@ -2,7 +2,7 @@
<template>
<new-bg>
<flex-col>
<system-title custom-title="清洁运输" show-back />
<system-title show-back />
<ModuleContent padding="20px">
<flex-col>
<ModuleContent padding="0 20px 20px">
@ -269,12 +269,6 @@ export default {
this.getDataSource()
this.$nextTick(() => {
const win = window.top
this.$get('http://101.43.201.20:5000/api/Home/view').then(({data}) => {
win.document.title = data.home.title
this.setTitle(data.home.title)
this.setInfo(data)
})
if (this.$refs.module) {
const offsetHeight = this.$refs.module.$el.offsetHeight - 40
this.tableH = offsetHeight

View File

@ -41,8 +41,8 @@
清洁运输比例
<template slot="action">
<butgroup2 style="height: 20px;line-height: 20px;">
<cus-button4 @click="active = 'Yesterday'" :selected="active === 'Yesterday'">昨日</cus-button4>
<cus-button4 @click="active = 'LastWeek'" :selected="active === 'LastWeek'">上周</cus-button4>
<cus-button4 @click="active = 'yesterday'" :selected="active === 'yesterday'">昨日</cus-button4>
<cus-button4 @click="active = 'lastWeek'" :selected="active === 'lastWeek'">上周</cus-button4>
</butgroup2>
</template>
</web3-title>
@ -57,10 +57,10 @@
<ModuleContent padding="20px 0 0" height="140">
<div class="pf">
<div class="t">当前VOC的日排放量</div>
<div class="v">{{ todaypf.voc || 0 }}mg/m3</div>
<div class="v">{{ todaypf.today?.voc || 0 }}mg/m3</div>
</div><div class="pf">
<div class="t">当前CEMS的日排放量</div>
<div class="v">{{ todaypf.cems || 0 }}mg/m3</div>
<div class="v">{{ todaypf.today?.cems || 0 }}mg/m3</div>
</div>
</ModuleContent>
@ -261,7 +261,7 @@ export default {
data () {
return {
mapTab: 'rl',
active: 'Yesterday',
active: 'yesterday',
columnsForTable: [
{
@ -271,12 +271,12 @@ export default {
},
{
title: '报警时间',
dataIndex: 'CreateDateTime',
dataIndex: 'time',
width: '33.333%'
},
{
title: '报警内容',
dataIndex: 'AlertContent',
dataIndex: 'alarmName',
width: '33.333%'
},
]

View File

@ -42,6 +42,7 @@ function hasErrors(fieldsError) {
return Object.keys(fieldsError).some(field => fieldsError[field]);
}
export default {
layout: 'LoginLayout',
data() {
return {
hasErrors,

View File

@ -176,12 +176,6 @@ export default {
mounted() {
this.$nextTick(() => {
const win = window.top
this.$get('http://101.43.201.20:5000/api/Home/view').then(({data}) => {
win.document.title = data.home.title
this.setTitle(data.home.title)
this.setInfo(data)
})
if (this.$refs.module) {
const offsetHeight = this.$refs.module.$el.offsetHeight - 40
this.tableH = offsetHeight

View File

@ -1,4 +1,3 @@
import Vue from 'vue'
Vue.prototype.$evBus = new Vue()

View File

@ -1,6 +1,6 @@
export const state = {
title: '',
info: {}
info: null
}
export const mutations = {
@ -15,8 +15,10 @@ export const mutations = {
export const actions = {
setTitle ({ commit }, title) {
commit('setTitle', title)
document.title = title
},
setInfo ({ commit }, info) {
setInfo ({ commit, dispatch }, info) {
commit('setInfo', info)
dispatch('setTitle', info.home?.title || '')
}
}

9
webpack.config.js Normal file
View File

@ -0,0 +1,9 @@
const path = require('path');
module.exports = {
resolve: {
alias: {
'@': path.resolve(__dirname, './'),
}
}
};