页面刷新

This commit is contained in:
仲么了
2024-02-28 11:16:40 +08:00
parent 268b8547f2
commit 6443edfb43
11 changed files with 28 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
import { createRouter, createWebHashHistory } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router'
import staticRoutes from '@/router/static' import staticRoutes from '@/router/static'
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
import NProgress from 'nprogress' import NProgress from 'nprogress'
@@ -21,7 +21,7 @@ router.beforeEach((to, from, next) => {
// 登录或者注册才可以往下进行 // 登录或者注册才可以往下进行
next() next()
} else if (to.path == '/admin/center/homePage') { } else if (to.path == '/admin/center/homePage') {
window.open(window.location.origin + '/homePage') window.open(window.location.origin + '/homePage/#/')
} else { } else {
// 获取 token // 获取 token
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()

View File

@@ -60,6 +60,7 @@ export default class TableStore {
} }
index() { index() {
this.table.beforeSearchFun && this.table.beforeSearchFun()
this.table.data = [] this.table.data = []
this.table.loading = true this.table.loading = true
// 重置用的数据数据 // 重置用的数据数据
@@ -96,7 +97,6 @@ export default class TableStore {
[ [
'search', 'search',
() => { () => {
this.table.beforeSearchFun && this.table.beforeSearchFun()
this.table.params.pageNum = 1 this.table.params.pageNum = 1
this.index() this.index()
} }

View File

@@ -49,6 +49,7 @@ const options = ref({})
const init = () => { const init = () => {
loading.value = true loading.value = true
formData.lineIndex = monitoringPoint.state.lineId
formData.startTime = datePickerRef.value.timeValue[0] formData.startTime = datePickerRef.value.timeValue[0]
formData.endTime = datePickerRef.value.timeValue[1] formData.endTime = datePickerRef.value.timeValue[1]
getPlot(formData).then( getPlot(formData).then(

View File

@@ -49,6 +49,7 @@ const options = ref({})
const init = () => { const init = () => {
loading.value = true loading.value = true
formData.lineIndex = monitoringPoint.state.lineId
formData.startTime = datePickerRef.value.timeValue[0] formData.startTime = datePickerRef.value.timeValue[0]
formData.endTime = datePickerRef.value.timeValue[1] formData.endTime = datePickerRef.value.timeValue[1]
getPlot(formData).then( getPlot(formData).then(

View File

@@ -32,6 +32,7 @@ const options = ref({})
const init = () => { const init = () => {
loading.value = true loading.value = true
formData.lineIndex = monitoringPoint.state.lineId
formData.startTime = datePickerRef.value.timeValue[0] formData.startTime = datePickerRef.value.timeValue[0]
formData.endTime = datePickerRef.value.timeValue[1] formData.endTime = datePickerRef.value.timeValue[1]
getProbabilityDistribution(formData).then( getProbabilityDistribution(formData).then(

View File

@@ -90,6 +90,7 @@ const thirdData = ref([])
const chartsData = ref([]) const chartsData = ref([])
const init = () => { const init = () => {
formData.lineIndex = monitoringPoint.state.lineId
formData.startTime = datePickerRef.value.timeValue[0] formData.startTime = datePickerRef.value.timeValue[0]
formData.endTime = datePickerRef.value.timeValue[1] formData.endTime = datePickerRef.value.timeValue[1]
loading.value = true loading.value = true

View File

@@ -45,6 +45,7 @@ const thirdData = ref<any>([])
const init = () => { const init = () => {
loading.value = true loading.value = true
formData.lineIndex = monitoringPoint.state.lineId
formData.startTime = datePickerRef.value.timeValue[0] formData.startTime = datePickerRef.value.timeValue[0]
formData.endTime = datePickerRef.value.timeValue[1] formData.endTime = datePickerRef.value.timeValue[1]
formData.flag = datePickerRef.value.interval formData.flag = datePickerRef.value.interval

View File

@@ -32,6 +32,7 @@ const options = ref({})
const init = () => { const init = () => {
loading.value = true loading.value = true
formData.lineIndex = monitoringPoint.state.lineId
formData.startTime = datePickerRef.value.timeValue[0] formData.startTime = datePickerRef.value.timeValue[0]
formData.endTime = datePickerRef.value.timeValue[1] formData.endTime = datePickerRef.value.timeValue[1]
getProbabilityDistribution(formData).then( getProbabilityDistribution(formData).then(

View File

@@ -74,6 +74,10 @@ const tableStore = new TableStore({
] ]
} }
], ],
beforeSearchFun: () => {
tableStore.table.params.lineId = monitoringPoint.state.lineId
console.log('beforeSearchFun')
},
loadCallback: () => { loadCallback: () => {
tableStore.table.data.forEach((item: any) => { tableStore.table.data.forEach((item: any) => {
item.eventTypeName = eventTypeOptions.find(item2 => item2.id === item.eventType)?.name item.eventTypeName = eventTypeOptions.find(item2 => item2.id === item.eventType)?.name
@@ -82,7 +86,6 @@ const tableStore = new TableStore({
} }
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
tableStore.table.params.lineId = monitoringPoint.state.lineId
tableStore.table.params.searchState = 0 tableStore.table.params.searchState = 0
onMounted(() => { onMounted(() => {
// 加载数据 // 加载数据

View File

@@ -4,13 +4,13 @@
<el-tab-pane label='导航' name='1' :style='height' lazy> <el-tab-pane label='导航' name='1' :style='height' lazy>
<Navigation @changeTab='changeTab' /> <Navigation @changeTab='changeTab' />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label='事件统计' name='2' lazy> <el-tab-pane label='事件统计' name='2' lazy v-if='!isReload'>
<EventStatistics /> <EventStatistics />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label='事件分析' name='3' lazy> <el-tab-pane label='事件分析' name='3' lazy v-if='!isReload'>
<EventStudy /> <EventStudy />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label='运行情况' name='4' lazy :style='height'> <el-tab-pane label='运行情况' name='4' lazy :style='height' v-if='!isReload'>
<RunningCondition /> <RunningCondition />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@@ -18,7 +18,7 @@
</div> </div>
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { defineOptions, ref, watch } from 'vue' import { defineOptions, nextTick, ref, watch } from 'vue'
import Navigation from './navigation/index.vue' import Navigation from './navigation/index.vue'
import EventStatistics from './eventStatistics/index.vue' import EventStatistics from './eventStatistics/index.vue'
import EventStudy from './eventStudy/index.vue' import EventStudy from './eventStudy/index.vue'
@@ -30,6 +30,7 @@ import { useMonitoringPoint } from '@/views/pqs/voltageSags/monitoringPoint/onli
defineOptions({ defineOptions({
name: 'Descentsystem/monitoringpoint' name: 'Descentsystem/monitoringpoint'
}) })
const isReload = ref(false)
const monitoringPoint = useMonitoringPoint() const monitoringPoint = useMonitoringPoint()
const height = mainHeight(82) const height = mainHeight(82)
const activeName = ref('1') const activeName = ref('1')
@@ -43,6 +44,13 @@ watch(
}, },
{ immediate: true } { immediate: true }
) )
watch(() => monitoringPoint.state.lineId, () => {
// 刷新页面
isReload.value = true
nextTick(() => {
isReload.value = false
})
})
const changeTab = (e: string) => { const changeTab = (e: string) => {
activeName.value = e activeName.value = e
} }

View File

@@ -24,7 +24,7 @@
</div> </div>
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { nextTick, onMounted, reactive, ref } from 'vue' import { nextTick, onMounted, reactive, ref, watch } from 'vue'
import DatePicker from '@/components/form/datePicker/index.vue' import DatePicker from '@/components/form/datePicker/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue' import MyEchart from '@/components/echarts/MyEchart.vue'
import { useMonitoringPoint } from '@/views/pqs/voltageSags/monitoringPoint/online/store' import { useMonitoringPoint } from '@/views/pqs/voltageSags/monitoringPoint/online/store'
@@ -35,7 +35,7 @@ const datePickerRef = ref()
const loading = ref(true) const loading = ref(true)
const monitoringPoint = useMonitoringPoint() const monitoringPoint = useMonitoringPoint()
const formData = reactive({ const formData = reactive({
id: monitoringPoint.state.lineId, id: '',
searchBeginTime: '', searchBeginTime: '',
searchEndTime: '', searchEndTime: '',
timeFlag: 1 timeFlag: 1
@@ -45,10 +45,9 @@ const secondOptions = ref<any>({})
const firstData = ref<any>([]) const firstData = ref<any>([])
const secondData = ref<any>([]) const secondData = ref<any>([])
const init = () => { const init = () => {
loading.value = true loading.value = true
formData.id = monitoringPoint.state.lineId
formData.searchBeginTime = datePickerRef.value.timeValue[0] formData.searchBeginTime = datePickerRef.value.timeValue[0]
formData.searchEndTime = datePickerRef.value.timeValue[1] formData.searchEndTime = datePickerRef.value.timeValue[1]
formData.timeFlag = datePickerRef.value.interval formData.timeFlag = datePickerRef.value.interval