Browse Source

Merge branch 'zhangtao' of gitadmin/tuoheng_lc_web into develop

tags/v1.2.0
zhangtao 1 year ago
parent
commit
dec35ef086
3 changed files with 23 additions and 15 deletions
  1. +3
    -6
      src/utils/global.js
  2. +12
    -8
      src/views/dashboard/components/Extend.vue
  3. +8
    -1
      src/views/dashboard/index.vue

+ 3
- 6
src/utils/global.js View File

import { fireHeart, updateWarning } from '@/api/early/fire.js' import { fireHeart, updateWarning } from '@/api/early/fire.js'
import { router } from '@/router/index.js' import { router } from '@/router/index.js'
import { ref } from 'vue' import { ref } from 'vue'
import { useDialogReactiveList } from 'naive-ui'
const hasModal = ref(false) const hasModal = ref(false)
const hasTimer = ref(false) const hasTimer = ref(false)




export const timerHeart = async function() { export const timerHeart = async function() {
if (getToken()) { if (getToken()) {
setTimeout(() => { timerHeart() }, 5000)
hasTimer.value = true hasTimer.value = true
const res = await fireHeart() const res = await fireHeart()
if (res.code === 0) { if (res.code === 0) {
} }
} }
) )
} else {
$dialog.colseDialog()
// } else {
// $dialog.colseDialog()
} }
setTimeout(() => {
timerHeart()
}, 5000)
} }
} else { } else {
hasModal.value = false hasModal.value = false

+ 12
- 8
src/views/dashboard/components/Extend.vue View File

}) })
const warn = reactive({ const warn = reactive({
warnList: [ warnList: [
{ icon: camera, label: '监控分布', value: 1, num: 0, list: [] },
{ icon: materials, label: '消防物资', value: 2, num: 0, list: [] },
{ icon: personnel, label: '防护人员', value: 3, num: 0, list: [] }
{ icon: camera, label: '监控分布', value: 'camera', num: 0, list: [] },
{ icon: materials, label: '消防物资', value: 'materials', num: 0, list: [] }
// { icon: personnel, label: '防护人员', value: 'personnel', num: 0, list: [] }
], ],
checkedWarn: [1, 2, 3]
checkedWarn: ['camera', 'materials']
}) })
const task = reactive({ const task = reactive({
taskList: [], taskList: [],
const handleClick = (index) => { const handleClick = (index) => {
data.selectedTab = index data.selectedTab = index
if (index === 1) { if (index === 1) {
data.portalTab = 'task'
ques.checkedQues = QUESTION_TYPE.value?.map((item) => item.value) || null
if (!data.showPatrol) { if (!data.showPatrol) {
queryTaskList() queryTaskList()
const times = [formatDate(ques.times[0]), formatDate(ques.times[1])] const times = [formatDate(ques.times[0]), formatDate(ques.times[1])]
data.showWarning = false data.showWarning = false
} else { } else {
getWarnList() getWarnList()
warn.checkedWarn = ['camera', 'materials']
data.showWarning = true data.showWarning = true
data.showPatrol = false data.showPatrol = false
} }
} }
const res = await getQuestionList(params) const res = await getQuestionList(params)
if (res.code === 0) { if (res.code === 0) {
ques.checkedQues = QUESTION_TYPE.value?.map((item) => item.value) || null
ques.message = res.data?.map((item) => { ques.message = res.data?.map((item) => {
item.icon = ICON_LIST[item.type] item.icon = ICON_LIST[item.type]
return item return item
}) })
emit('send', { tabs: data.selectedTab, data: ques.message, type: ques.checkedQues })
emit('send', { tabs: data.selectedTab, data: ques.message, type: ques.checkedQues, ops: 'query' })
} else { } else {
ques.message = null ques.message = null
} }
warn.warnList[0].list = camera?.data || [] warn.warnList[0].list = camera?.data || []
warn.warnList[1].num = maertral?.data?.length || 0 warn.warnList[1].num = maertral?.data?.length || 0
warn.warnList[1].list = maertral?.data || [] warn.warnList[1].list = maertral?.data || []
emit('send', { tabs: data.selectedTab, data: warn.warnList, type: warn.checkedWarn })
emit('send', { tabs: data.selectedTab, data: warn.warnList, type: warn.checkedWarn, ops: 'query' })
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err)
* @return {*} * @return {*}
*/ */
const handleWarnChange = async(value) => { const handleWarnChange = async(value) => {
emit('send', { tabs: data.selectedTab, data: warn.warnList, type: value })
emit('send', { tabs: data.selectedTab, data: warn.warnList, type: value, ops: 'select' })
} }
/** /**
* @description: 变更僧林巡查问题选择 * @description: 变更僧林巡查问题选择
* @return {*} * @return {*}
*/ */
const handleQuesChange = async(value) => { const handleQuesChange = async(value) => {
emit('send', { tabs: data.selectedTab, data: ques.message, type: value })
emit('send', { tabs: data.selectedTab, data: ques.message, type: value, ops: 'select' })
} }


return { return {

+ 8
- 1
src/views/dashboard/index.vue View File

<template> <template>
<div class="basic"> <div class="basic">
<OneMap /> <OneMap />
<Extend class="extend" @send="getmessage" />
<Extend ref="extendRef" class="extend" @send="getmessage" />
</div> </div>
</template> </template>


import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import OneMap from './components/OneMap.vue' import OneMap from './components/OneMap.vue'
import Extend from './components/Extend.vue' import Extend from './components/Extend.vue'
import { ref, onMounted } from 'vue'
export default { export default {
name: 'HomePage', name: 'HomePage',
components: { OneMap, Extend }, components: { OneMap, Extend },
setup(props) { setup(props) {
const router = useRouter() const router = useRouter()
const extendRef = ref()

function toSystem() { function toSystem() {
router.push({ path: '/login' }) router.push({ path: '/login' })
} }
const getmessage = (data) => { const getmessage = (data) => {
console.log(data) console.log(data)
} }
onMounted(() => {
extendRef.value.handleClick(0)
})
return { return {
toSystem, toSystem,
extendRef,
getmessage getmessage
} }
} }

Loading…
Cancel
Save