Browse Source

部分问题修复

develop
fuguobin 1 year ago
parent
commit
49f52aa954
  1. 27
      src/api/waring/index.ts
  2. 19
      src/api/waring/types.ts
  3. 52
      src/assets/iconfont/demo_index.html
  4. 14
      src/assets/iconfont/iconfont.css
  5. 2
      src/assets/iconfont/iconfont.js
  6. 14
      src/assets/iconfont/iconfont.json
  7. BIN
      src/assets/iconfont/iconfont.ttf
  8. BIN
      src/assets/iconfont/iconfont.woff
  9. BIN
      src/assets/iconfont/iconfont.woff2
  10. 0
      src/assets/images/waring_bg.png
  11. 6
      src/mock/routes.json
  12. 142
      src/styles/index.scss
  13. 5
      src/types/components.d.ts
  14. 8
      src/utils/socket.ts
  15. 131
      src/views/monitoring/components/header.vue
  16. 28
      src/views/monitoring/components/menu.vue
  17. 2
      src/views/monitoring/devicemanage/components/menu.vue
  18. 30
      src/views/monitoring/screen/components/main.vue
  19. 2
      src/views/monitoring/screen/components/menu.vue
  20. 7
      src/views/monitoring/screen/index.scss
  21. 2
      src/views/monitoring/screen/index.vue
  22. 2
      vite.config.ts

27
src/api/waring/index.ts

@ -0,0 +1,27 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { waringVo } from './types';
/**
*
*
* @param params status状态
*/
export function getWarList(params: number): AxiosPromise<waringVo> {
return request({
url: '/dc/dcBusiAlertJob/list/'+params,
method: 'get'
});
}
/**
*
*
* @param params id
*/
export function process(id: string) {
return request({
url: '/dc/dcBusiAlertJob/process/' + id,
method: 'post',
});
}

19
src/api/waring/types.ts

@ -0,0 +1,19 @@
/**
*
*/
export interface waringVo {
alertFirstTime: string;
alertLastTime: string;
alertLevel: number;
alertName: string;
alertTime:string
alertReadTime: string;
deviceName: string;
deviceUuid: string;
id: number;
paramCode: string;
paramName: string;
processStatus: number;
processUserId: number;
totalCounts: number;
}

52
src/assets/iconfont/demo_index.html

@ -54,6 +54,18 @@
<div class="content unicode" style="display: block;"> <div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe621;</span>
<div class="name">编辑</div>
<div class="code-name">&amp;#xe621;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6e7;</span>
<div class="name">箭头</div>
<div class="code-name">&amp;#xe6e7;</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont">&#xe845;</span> <span class="icon iconfont">&#xe845;</span>
<div class="name">up</div> <div class="name">up</div>
@ -396,9 +408,9 @@
<pre><code class="language-css" <pre><code class="language-css"
>@font-face { >@font-face {
font-family: 'iconfont'; font-family: 'iconfont';
src: url('iconfont.woff2?t=1694076506316') format('woff2'), src: url('iconfont.woff2?t=1694485516205') format('woff2'),
url('iconfont.woff?t=1694076506316') format('woff'), url('iconfont.woff?t=1694485516205') format('woff'),
url('iconfont.ttf?t=1694076506316') format('truetype'); url('iconfont.ttf?t=1694485516205') format('truetype');
} }
</code></pre> </code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@ -424,6 +436,24 @@
<div class="content font-class"> <div class="content font-class">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-edit-icon"></span>
<div class="name">
编辑
</div>
<div class="code-name">.icon-edit-icon
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-jiantou"></span>
<div class="name">
箭头
</div>
<div class="code-name">.icon-jiantou
</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont icon-arrow-up"></span> <span class="icon iconfont icon-arrow-up"></span>
<div class="name"> <div class="name">
@ -937,6 +967,22 @@
<div class="content symbol"> <div class="content symbol">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-edit-icon"></use>
</svg>
<div class="name">编辑</div>
<div class="code-name">#icon-edit-icon</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-jiantou"></use>
</svg>
<div class="name">箭头</div>
<div class="code-name">#icon-jiantou</div>
</li>
<li class="dib"> <li class="dib">
<svg class="icon svg-icon" aria-hidden="true"> <svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-arrow-up"></use> <use xlink:href="#icon-arrow-up"></use>

14
src/assets/iconfont/iconfont.css

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 3987011 */ font-family: "iconfont"; /* Project id 3987011 */
src: url('iconfont.woff2?t=1694076506316') format('woff2'), src: url('iconfont.woff2?t=1694485516205') format('woff2'),
url('iconfont.woff?t=1694076506316') format('woff'), url('iconfont.woff?t=1694485516205') format('woff'),
url('iconfont.ttf?t=1694076506316') format('truetype'); url('iconfont.ttf?t=1694485516205') format('truetype');
} }
.iconfont { .iconfont {
@ -13,6 +13,14 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-edit-icon:before {
content: "\e621";
}
.icon-jiantou:before {
content: "\e6e7";
}
.icon-arrow-up:before { .icon-arrow-up:before {
content: "\e845"; content: "\e845";
} }

2
src/assets/iconfont/iconfont.js

File diff suppressed because one or more lines are too long

14
src/assets/iconfont/iconfont.json

@ -5,6 +5,20 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "33987167",
"name": "编辑",
"font_class": "edit-icon",
"unicode": "e621",
"unicode_decimal": 58913
},
{
"icon_id": "9371505",
"name": "箭头",
"font_class": "jiantou",
"unicode": "e6e7",
"unicode_decimal": 59111
},
{ {
"icon_id": "34453072", "icon_id": "34453072",
"name": "up", "name": "up",

BIN
src/assets/iconfont/iconfont.ttf

Binary file not shown.

BIN
src/assets/iconfont/iconfont.woff

Binary file not shown.

BIN
src/assets/iconfont/iconfont.woff2

Binary file not shown.

0
src/assets/images/20230908-091531.png → src/assets/images/waring_bg.png

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

6
src/mock/routes.json

@ -8,7 +8,7 @@
"title": "监控系统", "title": "监控系统",
"icon": "multi_level", "icon": "multi_level",
"hidden": false, "hidden": false,
"roles": ["admin"], "roles": ["biadmin"],
"keepAlive": true "keepAlive": true
}, },
"children": [ "children": [
@ -20,7 +20,7 @@
"title": "数据大屏", "title": "数据大屏",
"icon": "document", "icon": "document",
"hidden": false, "hidden": false,
"roles": ["admin"], "roles": ["biadmin"],
"keepAlive": true "keepAlive": true
} }
}, },
@ -32,7 +32,7 @@
"title": "设备管理", "title": "设备管理",
"icon": "system", "icon": "system",
"hidden": false, "hidden": false,
"roles": ["admin"], "roles": ["biadmin"],
"keepAlive": true "keepAlive": true
} }
} }

142
src/styles/index.scss

@ -7,6 +7,7 @@
.app-container { .app-container {
padding: 20px; padding: 20px;
.search { .search {
padding: 18px 0 0 10px; padding: 18px 0 0 10px;
margin-bottom: 10px; margin-bottom: 10px;
@ -18,3 +19,144 @@
} }
.n-drawer-container {
.waringDrawer {
color: #fff;
background: #0f2856;
backdrop-filter: blur(10px);
overflow: hidden;
.n-drawer-header {
color: #fff;
border-bottom: 1px solid #1a3960;
.n-drawer-header__main {
flex: 1;
.title {
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
.button {
font-size: 14px;
color: #b1e3ff;
padding-right: 20px;
}
}
}
.n-base-close {
color: #fff;
}
}
.waringList {
padding: 10px;
background: #08173e;
.item {
padding-bottom: 10px;
border-bottom: 1px solid #1a3960;
margin-bottom: 10px;
.name {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
span {
font-size: 16px;
}
span.time {
font-size: 14px;
color: #b1e3ff;
}
}
.info {
display: flex;
justify-content: space-between;
align-items: center;
span {
color: #b1e3ff;
}
.n-button {
background-color: #022a5a !important;
border: 1px solid #114073;
}
}
}
.item:last-child {
border-bottom: none;
margin-bottom: 0;
}
}
}
}
.n-modal-container {
.waringModal {
width: 70%;
height: 500px;
background: url(@/assets/images/waring_bg.png) no-repeat;
background-size: 100% 100%;
.n-card__content {
position: relative;
padding-top: 0;
padding: 80px;
.waringTable {
background-color: transparent;
border: 1px solid #053872;
.el-table__inner-wrapper::before {
content: none;
}
.headerRowClass {
.headerCellClass {
color: #fff;
background-color: #001D40;
border-bottom: none;
}
}
.rowClass {
background-color: transparent;
.cellClass {
color: #B1E3FF;
border-bottom: none;
background-color: #01153A;
.confirm {
background-color: #022a5a !important;
border: 1px solid #114073;
}
}
}
.rowClass.el-table__row--striped {
.cellClass {
background-color: #001D40;
}
}
}
.warClose {
width: 50px;
cursor: pointer;
color: #B1E3FF;
margin: 100px auto 0 auto;
}
}
}
}

5
src/types/components.d.ts

@ -27,20 +27,23 @@ declare module '@vue/runtime-core' {
ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree'] ElTree: typeof import('element-plus/es')['ElTree']
Hamburger: typeof import('./../components/Hamburger/index.vue')['default'] Hamburger: typeof import('./../components/Hamburger/index.vue')['default']
LangSelect: typeof import('./../components/LangSelect/index.vue')['default'] LangSelect: typeof import('./../components/LangSelect/index.vue')['default']
MultiUpload: typeof import('./../components/Upload/MultiUpload.vue')['default'] MultiUpload: typeof import('./../components/Upload/MultiUpload.vue')['default']
NAvatar: typeof import('naive-ui')['NAvatar']
NBadge: typeof import('naive-ui')['NBadge'] NBadge: typeof import('naive-ui')['NBadge']
NButton: typeof import('naive-ui')['NButton'] NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCollapse: typeof import('naive-ui')['NCollapse'] NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem'] NCollapseItem: typeof import('naive-ui')['NCollapseItem']
NDrawer: typeof import('naive-ui')['NDrawer'] NDrawer: typeof import('naive-ui')['NDrawer']
NDrawerContent: typeof import('naive-ui')['NDrawerContent'] NDrawerContent: typeof import('naive-ui')['NDrawerContent']
NIcon: typeof import('naive-ui')['NIcon'] NIcon: typeof import('naive-ui')['NIcon']
NMenu: typeof import('naive-ui')['NMenu'] NMenu: typeof import('naive-ui')['NMenu']
NModal: typeof import('naive-ui')['NModal']
NScrollbar: typeof import('naive-ui')['NScrollbar'] NScrollbar: typeof import('naive-ui')['NScrollbar']
NSpin: typeof import('naive-ui')['NSpin'] NSpin: typeof import('naive-ui')['NSpin']
NTooltip: typeof import('naive-ui')['NTooltip'] NTooltip: typeof import('naive-ui')['NTooltip']

8
src/utils/socket.ts

@ -51,10 +51,16 @@ class WebSocketService {
onMessage(event: MessageEvent): void { onMessage(event: MessageEvent): void {
if (event.data != '连接成功') { if (event.data != '连接成功') {
const response = JSON.parse(event.data); const response = JSON.parse(event.data);
console.log(response); // console.log(response);
this.data = response; this.data = response;
// 处理返回的数据 // 处理返回的数据
if (response.code === 'datareal') {
console.log('table');
mitt.emit('tableMessage', response); mitt.emit('tableMessage', response);
} else if (response.code === 'alertDev') {
console.log('waring');
mitt.emit('waringMessage', response);
}
// const oldData = tableStoreCounter.tableDataStore; // const oldData = tableStoreCounter.tableDataStore;
// const index = oldData.findIndex((obj) => obj.id === response.id); // const index = oldData.findIndex((obj) => obj.id === response.id);
// if (index !== -1) { // if (index !== -1) {

131
src/views/monitoring/components/header.vue

@ -36,11 +36,11 @@
</template> </template>
</n-button> </n-button>
</template> </template>
返回 返回上一
</n-tooltip> </n-tooltip>
<n-tooltip trigger="hover" v-if="warningShow"> <n-tooltip trigger="hover" v-if="warningShow">
<template #trigger> <template #trigger>
<n-badge class="warningbadge" :value="warningData.length" :max="15"> <n-badge class="warningbadge" :value="waringData.length" :max="15">
<n-button class="tooltips" circle quaternary @click="waringClick"> <n-button class="tooltips" circle quaternary @click="waringClick">
<template #icon> <template #icon>
<n-icon> <n-icon>
@ -56,23 +56,71 @@
<n-drawer class="waringDrawer" v-model:show="waringDrawer" :default-width="420" resizable placement="right"> <n-drawer class="waringDrawer" v-model:show="waringDrawer" :default-width="420" resizable placement="right">
<n-drawer-content closable> <n-drawer-content closable>
<template #header> <template #header>
消息 <div class="title">
<span>消息</span>
<span class="button" @click="waringMore">更多</span>
</div>
</template> </template>
啊呀呀呀呀 <div class="waringList">
<div class="item" v-for="(item, index) in waringData" :key="index">
<div class="name">
<span>{{ item.deviceName }}</span>
<span class="time">{{ item.alertTime }}</span>
</div>
<div class="info">
<span>{{ item.paramName }}</span>
<n-button type="info" size="small" @click="waringConfirm(item)">确认</n-button>
</div>
</div>
</div>
</n-drawer-content> </n-drawer-content>
</n-drawer> </n-drawer>
<n-modal class="waringModal" v-model:show="waringModal">
<n-card :bordered="false" size="huge" role="dialog" aria-modal="true">
<el-table class="waringTable" :data="waringList" header-row-class-name="headerRowClass"
header-cell-class-name="headerCellClass" row-class-name="rowClass" cell-class-name="cellClass" height="350"
stripe>
<el-table-column prop="deviceName" label="设备名称" align="center" />
<el-table-column prop="paramName" label="变量名称" align="center" />
<el-table-column prop="alertName" label="告警级别" align="center" />
<el-table-column prop="totalCounts" label="告警累计" align="center" />
<el-table-column prop="alertFirstTime" label="首次告警时间" align="center" />
<el-table-column fixed="right" label="操作" align="center">
<template #default="scope">
<el-button class="confirm" type="info" size="small" @click="waringConfirm(scope.row)">确认</el-button>
</template>
</el-table-column>
</el-table>
<div class="warClose" @click="warClose">
<CloseCircleOutline />
</div>
</n-card>
</n-modal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import router from '@/router'; import { useRoute, useRouter } from "vue-router";
import { getWeather } from '@/api/user/index'; import { getWeather } from '@/api/user/index';
import { getWarList, process } from '@/api/waring/index';
import { waringVo } from '@/api/waring/types';
import { Filter, Maximize, Settings, Power, Bell } from '@vicons/tabler'; import { Filter, Maximize, Settings, Power, Bell } from '@vicons/tabler';
import { CloseCircleOutline } from '@vicons/ionicons5';
import { useDateFormat, useNow } from '@vueuse/core'; import { useDateFormat, useNow } from '@vueuse/core';
const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss'); import { uniqueArrayObject } from '@/utils/index';
import mitt from '@/plugins/bus';
import calendar from '@/utils/lunar'; import calendar from '@/utils/lunar';
const route = useRoute()
const router = useRouter()
const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss');
const emit = defineEmits(['showModalClick', 'returnClick']); const emit = defineEmits(['showModalClick', 'returnClick']);
const timer = ref() const timer = ref()
const isCurrentRoute = ref(true) const isCurrentRoute = ref(true)
const waringDrawer = ref(false) const waringDrawer = ref(false)
const waringModal = ref(false)
const waringData = ref<waringVo[]>([])
const waringList = ref<waringVo[]>([])
const routerType = ref('')
const weatherData = ref( const weatherData = ref(
{ city: "", weather: "", temperature: "", weatherImg: "" } { city: "", weather: "", temperature: "", weatherImg: "" }
@ -95,17 +143,23 @@ const props = defineProps({
warningShow: { warningShow: {
type: Boolean, type: Boolean,
default: false default: false
},
warningData: {
type: Array,
default: [1, 2, 3],
} }
}); });
onMounted(() => { onMounted(() => {
routerType.value = route.query?.id === undefined ? "0" : "1"
getWeatherData() getWeatherData()
}); });
mitt.on('waringMessage', (res: any) => {
//
console.log(res.data);
waringData.value.push(res.data)
console.log("waringData--", waringData.value);
waringData.value = uniqueArrayObject(waringData.value, "id")
console.log("waringData--", waringData.value);
});
function showClick() { function showClick() {
/// ///
emit('showModalClick', true); emit('showModalClick', true);
@ -114,8 +168,15 @@ function showClick() {
function returnBack() { function returnBack() {
// //
// emit('returnClick', ''); // emit('returnClick', '');
if (routerType.value === '1'&&route.path!="/screen") {
router.push({
path: "/screen",
query: { id: sessionStorage.getItem('id') }
})
} else {
router.replace("/dashboard") router.replace("/dashboard")
} }
}
function waringClick() { function waringClick() {
// //
waringDrawer.value = true waringDrawer.value = true
@ -146,6 +207,47 @@ function getWeatherData() {
} }
}); });
} }
function waringMore() {
//
waringDrawer.value = false
waringModal.value = true
getwaringList()
}
function getwaringList() {
const params = 0;
getWarList(params).then((res: any) => {
if (res.code === 200) {
waringList.value = res.rows;
}
});
}
function waringConfirm(item: any) {
//
ElMessageBox.confirm('是否确认?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
const params = item.id;
process(params).then((res: any) => {
if (res.code === 200) {
waringList.value = res.data;
// waringDrawer.value = false
// waringModal.value = false
getwaringList()
ElMessage({
message: res.msg,
type: 'success',
})
}
});
}).catch(() => { })
}
function warClose() {
//
waringModal.value = false
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -235,13 +337,4 @@ function getWeatherData() {
margin-left: 10px; margin-left: 10px;
} }
} }
.n-drawer-container {
color: red;
.waringDrawer {
background: #0f2856;
backdrop-filter: blur(10px);
overflow: hidden;
}
}
</style> </style>

28
src/views/monitoring/components/menu.vue

@ -5,6 +5,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useRoute } from "vue-router";
import type { MenuOption } from 'naive-ui'; import type { MenuOption } from 'naive-ui';
// import { NEllipsis } from 'naive-ui'; // import { NEllipsis } from 'naive-ui';
import { getMenu } from '@/api/table/list'; import { getMenu } from '@/api/table/list';
@ -12,9 +13,15 @@ import { getMenuData } from '@/api/device/index';
import { getFirstNodeLastLevel } from '@/utils/index'; import { getFirstNodeLastLevel } from '@/utils/index';
import useStorage from '@/utils/useStorage' import useStorage from '@/utils/useStorage'
import mitt from '@/plugins/bus'; import mitt from '@/plugins/bus';
const router = useRoute()
const menuOptions = ref([]); const menuOptions = ref([]);
const selectedKey = ref(); const selectedKey = ref();
const sessionStorageIns = useStorage('sessionStorage'); const sessionStorageIns = useStorage('sessionStorage');
const routerType = ref('')
const id = ref(0)
const deptId = ref(0)
const menuDeptKey = ref(0)
const menuIdKey = ref(0)
const emit = defineEmits(['tableMenuData']); const emit = defineEmits(['tableMenuData']);
@ -26,6 +33,9 @@ const props = defineProps({
}); });
onMounted(() => { onMounted(() => {
routerType.value = router.query?.id === undefined ? "0" : "1"
id.value = sessionStorage.getItem('id') === null ? 0 : Number(sessionStorage.getItem('id'))
deptId.value = sessionStorage.getItem('deptId') === null ? 0 : Number(sessionStorage.getItem('deptId'))
if (props.menuType === '1') { if (props.menuType === '1') {
menuApi(); menuApi();
} else if (props.menuType === '2') { } else if (props.menuType === '2') {
@ -37,12 +47,12 @@ function menuApi() {
// //
getMenu().then((res: any) => { getMenu().then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
const key = getFirstNodeLastLevel(res.data).deptId menuDeptKey.value = routerType.value === '1' ? deptId.value : getFirstNodeLastLevel(res.data).deptId
removeChildren(res.data); removeChildren(res.data);
menuOptions.value = res.data; menuOptions.value = res.data;
selectedKey.value = key; selectedKey.value = menuDeptKey.value;
sessionStorageIns.setUseStorage('deptId', key); sessionStorageIns.setUseStorage('deptId', menuDeptKey.value);
mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', key); mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', menuDeptKey.value);
emit('tableMenuData', res.data); emit('tableMenuData', res.data);
} }
}); });
@ -51,12 +61,12 @@ function comMenuApi() {
// //
getMenuData().then((res: any) => { getMenuData().then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
const key = getFirstNodeLastLevel(res.data).deptId menuIdKey.value = routerType.value === '1' ? id.value : getFirstNodeLastLevel(res.data).deptId
removeChildren(res.data); removeChildren(res.data);
menuOptions.value = res.data; menuOptions.value = res.data;
selectedKey.value = key; selectedKey.value = menuIdKey.value;
sessionStorageIns.setUseStorage('deptId', key); sessionStorageIns.setUseStorage('deptId', routerType.value === '1' ? deptId.value : menuIdKey.value);
mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', key); mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', menuIdKey.value);
emit('tableMenuData', res.data); emit('tableMenuData', res.data);
} }
}); });
@ -84,7 +94,7 @@ function renderMenuLabel(option: MenuOption) {
function menuUpdateValue(key: string, item: MenuOption) { function menuUpdateValue(key: string, item: MenuOption) {
// //
sessionStorageIns.setUseStorage('deptId', key); sessionStorageIns.setUseStorage(props.menuType === '1' ? 'deptId' : 'id', key);
mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', key); mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', key);
console.log(key, item); console.log(key, item);
} }

2
src/views/monitoring/devicemanage/components/menu.vue

@ -58,7 +58,7 @@ function renderMenuLabel(option: MenuOption) {
function menuUpdateValue(key: string, item: MenuOption) { function menuUpdateValue(key: string, item: MenuOption) {
// //
sessionStorageIns.setUseStorage('deptId', key); sessionStorageIns.setUseStorage('id', key);
mitt.emit('deviceMenuKey', key); mitt.emit('deviceMenuKey', key);
console.log(key, item); console.log(key, item);
} }

30
src/views/monitoring/screen/components/main.vue

@ -67,6 +67,9 @@ import { TableVo } from '@/api/table/types';
import { tableStore } from '@/store/modules/table'; import { tableStore } from '@/store/modules/table';
import mitt from '@/plugins/bus'; import mitt from '@/plugins/bus';
import socket from '@/utils/socket'; import socket from '@/utils/socket';
import useStorage from '@/utils/useStorage'
const sessionStorageIns = useStorage('sessionStorage');
// import { uniqueArrayObject } from '@/utils/index';
const tableStoreCounter = tableStore(); const tableStoreCounter = tableStore();
// import type { MenuOption } from 'naive-ui' // import type { MenuOption } from 'naive-ui'
@ -76,10 +79,11 @@ const tableStoreCounter = tableStore();
const loadingShow = ref(false); const loadingShow = ref(false);
const editModal = ref(false); const editModal = ref(false);
const modalTitle = ref(''); const modalTitle = ref('');
const menuKey = ref(''); const menuKey = ref(0);
const tableColumn = ref([]); const tableColumn = ref([]);
const tableData = ref<TableVo[]>(); const tableData = ref<TableVo[]>();
const tableRef = ref<VxeGridInstance<TableVo>>(); const tableRef = ref<VxeGridInstance<TableVo>>();
// const waringArrow = ref([])
interface FormDataVO { interface FormDataVO {
url: string; url: string;
@ -112,6 +116,7 @@ const formRules = ref<VxeFormPropTypes.Rules>({
const userStorageInfo = sessionStorage.getItem('userInfo') const userStorageInfo = sessionStorage.getItem('userInfo')
const userInfo = JSON.parse(userStorageInfo === null ? '' : userStorageInfo); const userInfo = JSON.parse(userStorageInfo === null ? '' : userStorageInfo);
// const loginIp = userInfo.loginIp.split('.').join(''); // const loginIp = userInfo.loginIp.split('.').join('');
// const baseApi = "http://172.1.2.106:9000"//websocket
const baseApi = "http://10.10.10.56:9000"//websocket const baseApi = "http://10.10.10.56:9000"//websocket
// const baseApi = import.meta.env.VITE_APP_BASE_API // const baseApi = import.meta.env.VITE_APP_BASE_API
const apiUrl = baseApi.replace(/https?:/, ''); const apiUrl = baseApi.replace(/https?:/, '');
@ -189,16 +194,22 @@ mitt.on('treeData', (res: any) => {
mitt.on('tableMessage', (res: any) => { mitt.on('tableMessage', (res: any) => {
// //
console.log(res); console.log(res.data);
const $table = tableRef.value; const $table = tableRef.value;
const index = tableData.value.findIndex((obj) => obj.id === res.id); if ($table) {
console.log("tableRef--", tableRef.value)
// if (res.code === 'datareal') {
const index = tableData.value.findIndex((obj) => obj.id === res.data.id);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1, res); tableData.value.splice(index, 1, res.data);
} }
// console.log("tableData:",tableData.value)
// tableStoreCounter.tableDataAction(res.data);
// tableData.value = oldData;
$table.loadData(tableData.value); $table.loadData(tableData.value);
}
// } else if (res.code === 'alertDev') {
// waringArrow.value.push(res.data)
// waringArrow.value = uniqueArrayObject(waringArrow.value, "devUuid")
// }
// console.log("waringArrow:", waringArrow.value)
}); });
function stationInfo() { function stationInfo() {
@ -263,7 +274,7 @@ function tableHeader() {
// console.log('', gridOptions.value.columns); // console.log('', gridOptions.value.columns);
emit('tableHeaderData', res.data); emit('tableHeaderData', res.data);
// mitt.emit('tableHeaderData', res.data); // mitt.emit('tableHeaderData', res.data);
tableDatas(); // tableDatas();
}); });
} }
@ -301,7 +312,7 @@ const formatRole: VxeColumnPropTypes.Formatter<HeaderVo> = ({ cellValue }) => {
//object //object
// const iconFont=cellValue.changeProp===-1?'<i class="iconfont icon-decline" />':(cellValue.changeProp===1?'<i class="iconfont icon-rise" />':'<i/>') // const iconFont=cellValue.changeProp===-1?'<i class="iconfont icon-decline" />':(cellValue.changeProp===1?'<i class="iconfont icon-rise" />':'<i/>')
// const cellData = `<span class="cellClass ${cellValue.alertProp===1?'warning':''}">${cellValue.val}</span>${iconFont}`; // const cellData = `<span class="cellClass ${cellValue.alertProp===1?'warning':''}">${cellValue.val}</span>${iconFont}`;
const cellData = `<span class="cellClass ${cellValue.alertProp === 1 ? 'warning' : ''}">${cellValue.val}</span><i class="iconfont ${cellValue.changeProp === -1 ? 'icon-decline' : (cellValue.changeProp === 1 ? 'icon-rise' : '')}" />`; const cellData = `<span class="cellClass ${cellValue.alertProp === 1 ? 'warning' : ''}">${cellValue.val}</span><i class="iconfont ${cellValue.changeProp === -1 ? 'icon-decline' : (cellValue.changeProp === 1 ? 'icon-rise' : '')}" ></i>${cellValue.canBeControl === '1'?'<i class="iconfont icon-edit-icon"></i>':''}`;
return cellData; return cellData;
}; };
@ -326,6 +337,7 @@ const submitEvent: VxeFormEvents.Submit = () => {
function nameClick(row: any) { function nameClick(row: any) {
// //
console.log(row) console.log(row)
sessionStorageIns.setUseStorage('id', row.id);
router.push({ path: '/devicemanage', query: { id: row.id } }); router.push({ path: '/devicemanage', query: { id: row.id } });
} }

2
src/views/monitoring/screen/components/menu.vue

@ -58,7 +58,7 @@ function renderMenuLabel(option: MenuOption) {
function menuUpdateValue(key: string, item: MenuOption) { function menuUpdateValue(key: string, item: MenuOption) {
// //
sessionStorageIns.setUseStorage('deptId', key); sessionStorageIns.setUseStorage('id', key);
mitt.emit('menuKey', key); mitt.emit('menuKey', key);
console.log(key, item); console.log(key, item);
} }

7
src/views/monitoring/screen/index.scss

@ -386,6 +386,11 @@
.iconfont.icon-decline { .iconfont.icon-decline {
color: red; color: red;
} }
.iconfont.icon-edit-icon {
font-size: 16px;
margin-left: 5px;
}
} }
} }
} }
@ -432,7 +437,7 @@
} }
.vxe-table--fixed-left-wrapper.scrolling--middle { .vxe-table--fixed-left-wrapper.scrolling--middle {
background: -webkit-linear-gradient(top, #020e38 0%, #04195b 100%); background: -webkit-linear-gradient(top, #000825 0%, #000c2b 100%);
box-shadow: inset 0px 0px 10px rgb(36, 90, 124) !important; box-shadow: inset 0px 0px 10px rgb(36, 90, 124) !important;
} }
} }

2
src/views/monitoring/screen/index.vue

@ -1,7 +1,7 @@
<template> <template>
<div ref="screenRef" class="screen"> <div ref="screenRef" class="screen">
<section ref="titleRef" class="header"> <section ref="titleRef" class="header">
<Header :titleData="titleData" :settingShow="true" :warningShow="false" @showModalClick="showModalClick" @returnClick="returnClick" /> <Header :titleData="titleData" :settingShow="true" :warningShow="true" @showModalClick="showModalClick" @returnClick="returnClick" />
<!-- <div class="title"> <!-- <div class="title">
<h3>{{ titleData }}</h3> <h3>{{ titleData }}</h3>
</div> </div>

2
vite.config.ts

@ -45,7 +45,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
hmr: true,//配置HMR hmr: true,//配置HMR
proxy: { proxy: {
[env.VITE_APP_BASE_API]: { [env.VITE_APP_BASE_API]: {
// target: 'http://172.1.2.157:9000/',//本地接口地址 // target: 'http://172.1.2.106:9000/',//本地接口地址
// target: 'http://172.1.2.48:9000/',//本地接口地址 // target: 'http://172.1.2.48:9000/',//本地接口地址
target: 'http://10.10.10.56:9000/',//线上接口地址 target: 'http://10.10.10.56:9000/',//线上接口地址
changeOrigin: true, changeOrigin: true,

Loading…
Cancel
Save