Commit ef68a0a1 authored by liuzhaoh's avatar liuzhaoh

Merge branch 'dev' of http://app.bmetech.com/liuzhaohui/dctomproject into dev

parents d109cbdd 644f1b7a
......@@ -11,9 +11,9 @@
:collapse-transition="false"
:router="true"
>
<template v-for="(item, index) in routerList" :key="item.path">
<template v-for="(item, index) in filteredRouterList" :key="item.path">
<el-sub-menu
:index="index + ''"
:index="item.path"
v-if="item.children && item.children.length > 0"
class="submenu-box"
>
......@@ -22,16 +22,20 @@
<img class="menu-icon" :src="`/src/assets/menu/${item.meta.icon}.png`" alt="">
<span>{{getMenuTitle(item)}}</span>
</template>
<el-menu-item v-for="(item_son, index_son) in item.children"
:key="item_son.path"
:index="item_son.path"
@click="handleClick(item_son.path)"
class="submenu-title-noDropdown"
>
<span>{{getMenuTitle(item_son)}}</span>
</el-menu-item>
<el-menu-item
v-for="(item_son, index_son) in item.children"
:key="item_son.path"
:index="item_son.path"
class="submenu-title-noDropdown"
>
<span>{{getMenuTitle(item_son)}}</span>
</el-menu-item>
</el-sub-menu>
<el-menu-item v-else :index="index + ''" class="submenu-box" @click="handleClick(item.path)">
<el-menu-item
v-else
:index="item.path"
class="submenu-box"
>
<!-- <el-icon><setting /></el-icon> -->
<img class="menu-icon" :src="`/src/assets/menu/${item.meta.icon}.png`" alt="">
<span>{{getMenuTitle(item)}}</span>
......@@ -43,7 +47,7 @@
</template>
<script setup>
import { computed } from 'vue';
import { computed, ref, onMounted } from 'vue';
import {
Document,
Menu as IconMenu,
......@@ -54,32 +58,59 @@ import {routes} from "../router/index.js";
import { useRoute, useRouter } from 'vue-router';
import { menuStore } from '@/pinia/menu.js';
import { storeToRefs } from 'pinia';
const route = useRoute();
const router = useRouter();
const { sidebar } = storeToRefs(menuStore());
const handleClick = (path) => {
console.log(path);
if (path.startsWith('/')) {
router.push(path) // 绝对路径,直接跳转
} else {
router.push('/' + path) // 相对路径,补全
}
}
const routerList = routes[0].children;
const menuListData = ref(JSON.parse(sessionStorage.getItem("menuList")) || []);
// 递归过滤路由
const filterRoutes = (routes) => {
if (!routes) return [];
return routes.filter(route => {
// 检查当前路由是否在菜单列表中
const isInMenuList = menuListData.value.some(menuItem =>
menuItem.name === route.meta?.title &&
menuItem.url === route.path
);
// 如果当前路由有子路由,递归过滤子路由
if (route.children && route.children.length > 0) {
const filteredChildren = filterRoutes(route.children);
// 如果子路由有匹配项,保留父路由并更新子路由
if (filteredChildren.length > 0) {
route.children = filteredChildren;
return true;
}
}
const activeMenu = computed(()=>{
console.log('123--', route.path);
return route.path;
// 如果当前路由在菜单列表中,或者有匹配的子路由,则保留
return isInMenuList;
});
};
// 过滤后的路由列表
const filteredRouterList = computed(() => {
if (!menuListData.value || menuListData.value.length === 0) {
return [];
}
return filterRoutes(routerList);
});
onMounted(() => {
});
const activeMenu = computed(() => route.path);
const handleOpen = (key, keyPath) => {
console.log(key, keyPath);
};
const handleClose = (key, keyPath) => {
console.log(key, keyPath);
};
const getMenuTitle = (item) => {
return item.meta && item.meta.title || '未命名菜单'
}
......@@ -164,7 +195,7 @@ const getMenuTitle = (item) => {
}
.el-menu-item {
background: #055F7CFF !important;
// background: #055F7CFF !important;
}
.submenu-box .is-active {
......
......@@ -9,6 +9,8 @@ import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import { createPinia } from "pinia";
import moment from 'moment';
import { startPermissionCheck } from '@/utils/permissionChecker';
const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component);
......@@ -19,3 +21,8 @@ app
.use(moment)
.use(createPinia())
.mount("#app");
// 启动权限轮询检查,每5秒检查一次
router.isReady().then(() => {
startPermissionCheck(5000);
});
import { createWebHistory, createRouter } from 'vue-router'
import Dashboard from '../views/dashboard/index.vue'
import DustOverview from '../views/dustOverview/index.vue'
import AboutView from '../views/AboutView/AboutView.vue'
import CollectorList from '../views/collectorList/collectorList.vue'
import User from '../views/user.vue'
import Layout from '../layout/index.vue'
import Login from '../views/login/index.vue'
import equipmentManagement from '../views/equipmentManagement/index.vue'
import suspendManagement from '../views/equipmentManagement/suspendManagement/suspendManagement.vue'
import dustMonitoring from '../views/dustMonitoring/index.vue'
import bagMonitoring from '../views/dustMonitoring/bag-monitoring.vue'
// 检查路由是否在授权菜单中的函数
const checkRoutePermission = (route, menuList) => {
// 检查当前路由
const hasPermission = menuList.some(menu =>
menu.name === route.meta?.title &&
menu.url === route.path
);
if (hasPermission) return true;
// 如果有子路由,递归检查
if (route.children) {
return route.children.some(child => checkRoutePermission(child, menuList));
}
return false;
};
// 递归查找匹配的路由配置
const findMatchedRoute = (path, routes) => {
for (const route of routes) {
if (route.path === path) return route;
if (route.children) {
const found = findMatchedRoute(path, route.children);
if (found) return found;
}
}
return null;
};
import myAgency from '@/views/closeManage/myAgency.vue';
import myDone from '@/views/closeManage/myDone.vue';
const routes = [
{
path: '/',
......@@ -23,12 +40,12 @@ const routes = [
children: [
{
path: '/dashboard',
component: Dashboard,
component: () => import('../views/dashboard/index.vue'),
meta: { title: '首页', icon: 'dashboard', },
},
{
path: '/dust-overview',
component: DustOverview,
component: () => import('../views/dustOverview/index.vue'),
meta: { title: '除尘器总览', icon: 'dustOverview' },
},
{
......@@ -37,34 +54,34 @@ const routes = [
children: [
{
path: '/management/device-management',
component: equipmentManagement,
component: () => import('../views/equipmentManagement/index.vue'),
meta: { title: '设备管理' },
},
{
path: '/management/suspend-management',
component: suspendManagement,
component: () => import('../views/equipmentManagement/suspendManagement/suspendManagement.vue'),
meta: { title: '挂起设备管理' },
},
]
},
{
path: '/monitor',
component: dustMonitoring,
component: () => import('../views/dustMonitoring/index.vue'),
meta: { title: '除尘器监控', icon: 'monitor' },
},
{
path: '/collectorList',
component: CollectorList,
component: () => import('../views/collectorList/collectorList.vue'),
meta: { title: '布袋周期', icon: 'collectorList' },
},
{
path: '/bag-monitor',
component: bagMonitoring,
component: () => import('../views/dustMonitoring/bag-monitoring.vue'),
meta: { title: 'BME布袋监测', icon: 'collectorList' },
},
{
path: '/alerts',
component: AboutView,
component: () => import('../views/AboutView/AboutView.vue'),
meta: { title: '告警总览', icon: 'warnning' },
},
{
......@@ -73,12 +90,12 @@ const routes = [
children: [
{
path: '/my-loop/myAgency',
component: myAgency,
component: () => import('@/views/closeManage/myAgency.vue'),
meta: { title: '我的待办' },
},
{
path: '/my-loop/myDone',
component: myDone,
component: () => import('@/views/closeManage/myDone.vue'),
meta: { title: '我的已办' },
},
]
......@@ -87,7 +104,7 @@ const routes = [
},
{
path: '/login',
component: Login,
component: () => import('../views/login/index.vue'),
meta: {
title: '登录'
}
......@@ -99,6 +116,36 @@ const router = createRouter({
routes,
})
// 添加全局路由守卫
router.beforeEach((to, from, next) => {
// 登录页面不需要权限验证
if (to.path === '/login') {
next();
return;
}
// 获取存储的菜单列表
const menuList = JSON.parse(sessionStorage.getItem('menuList') || '[]');
// 如果没有菜单列表且不是登录页,跳转到登录页
if (!menuList.length) {
next('/login');
return;
}
// 查找目标路由的配置
const targetRoute = findMatchedRoute(to.path, routes[0].children || []);
// 如果找不到路由配置,或者路由没有权限,跳转到首页或显示无权限页面
if (!targetRoute || !checkRoutePermission(targetRoute, menuList)) {
// 可以根据需求跳转到不同页面,比如 403 页面或首页
next('/dashboard');
return;
}
next();
});
export {
routes,
router
......
......@@ -53,9 +53,9 @@ router.beforeEach(async (to, from, next) => {
// debugger
// get user info
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
const roles = await store.getInfo()
// const roles = await store.getInfo()
// generate accessible routes map based on roles
const menuLimitsObj = await store.menuLimitsObj
// const menuLimitsObj = await store.menuLimitsObj
// const accessRoutes = await store.dispatch('permission/generateRoutes', { roles, menuLimitsObj })
// console.log("accessRoutes",accessRoutes)
// dynamically add accessible routes
......
......@@ -69,10 +69,9 @@ export const getDustLineOption = (xData = [], seriesData = []) => ({
containLabel: true,
},
legend: {
data: ["健康度指数(%)"],
data: ["周期(天数)"],
bottom: "0%",
icon: "circle",
itemWidth: 10,
itemWidth: 20,
itemHeight: 10,
itemGap: 10,
},
......@@ -105,7 +104,7 @@ export const getDustLineOption = (xData = [], seriesData = []) => ({
},
series: [
{
name: "",
name: "周期(天数)",
type: "line",
color: "#399DFA",
data: seriesData,
......
import { getDataFun } from '@/request/method';
import { router } from '@/router';
import { ElMessage } from 'element-plus';
let permissionInterval = null;
let previousPermissionData = null;
/**
* 开始权限轮询检查
* @param {Number} interval - 轮询间隔,默认5000ms
*/
export function startPermissionCheck(interval = 10000) {
// 如果已经存在轮询,先清除
if (permissionInterval) {
clearInterval(permissionInterval);
}
// 初始化获取一次权限数据
checkUserPermission();
// 设置定时轮询
permissionInterval = setInterval(() => {
checkUserPermission();
}, interval);
}
/**
* 停止权限轮询检查
*/
export function stopPermissionCheck() {
if (permissionInterval) {
clearInterval(permissionInterval);
permissionInterval = null;
}
}
/**
* 检查用户权限
*/
async function checkUserPermission() {
try {
const response = await getDataFun('/management/admin/userDataPermission', {
userId: sessionStorage.getItem('userId') || 1
});
// 如果请求成功
if (response && response.code === 1) {
const currentPermissionData = JSON.stringify(response.data);
// 将当前权限数据存储到 sessionStorage
sessionStorage.setItem('userPermission', currentPermissionData);
// 如果之前有权限数据,比较是否有变化
if (previousPermissionData && previousPermissionData !== currentPermissionData) {
// 权限发生变化,退出登录
ElMessage({
type: 'warning',
message: '您的权限已变更,系统将自动退出登录',
duration: 2000,
onClose: () => {
logout();
}
});
}
// 更新之前的权限数据
previousPermissionData = currentPermissionData;
}
} catch (error) {
console.error('权限检查失败:', error);
}
}
/**
* 退出登录
*/
function logout() {
// 清除所有相关的存储数据
sessionStorage.removeItem('menuList');
sessionStorage.removeItem('userPermission');
// 可能还有其他需要清除的数据,如 token 等
// 跳转到登录页
router.push('/login');
}
export default {
startPermissionCheck,
stopPermissionCheck
};
\ No newline at end of file
......@@ -13,7 +13,7 @@
</el-form-item>
<el-form-item label="发生位置">
<el-input
v-model="formInline.position"
v-model="formInline.name"
placeholder="请输入发生位置"
style="width: 200px"
clearable
......@@ -21,19 +21,19 @@
</el-form-item>
<el-form-item label="除尘器名称">
<el-input
v-model="formInline.deviceName"
v-model="formInline.dusterName"
placeholder="请输入除尘器名称"
style="width: 200px"
clearable
/>
</el-form-item>
<el-form-item label="设备类型">
<el-select v-model="formInline.type" style="width: 200px">
<el-select v-model="formInline.deviceType" style="width: 200px">
<el-option
v-for="i in dustList.list"
v-for="i in typeList.list"
:key="i"
:label="`${i.deviceName}`"
:value="i.deviceNo"
:label="`${i.desc}`"
:value="i.code"
/>
</el-select>
</el-form-item>
......@@ -48,7 +48,7 @@
/>
</el-form-item>
<el-form-item>
<el-button type="default" class="default-btn" @click="onSubmit"
<el-button type="default" class="default-btn" @click="onReset"
>重置</el-button
>
<el-button type="primary" class="search-btn" @click="onSubmit"
......@@ -64,10 +64,10 @@
</el-form-item>
<br />
<el-form-item>
<el-radio-group v-model="formInline.warnType">
<el-radio-group v-model="formInline.suspendFlag" @change="onSubmit">
<el-radio value="1">挂起期间告警</el-radio>
<el-radio value="2">非挂起期间告警</el-radio>
<el-radio value="3">全部告警</el-radio>
<el-radio value="0">非挂起期间告警</el-radio>
<el-radio value="2">全部告警</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
......@@ -76,7 +76,8 @@
<common-table
:data="tableData.list"
:columns="tableColumns"
:default-page-size="10"
:total="total"
:default-page-size="pageSize"
@pagination-change="handlePaginationChange"
:pagination-texts="{
total: '共',
......@@ -89,18 +90,55 @@
<template #index="{ $index }">
{{ getIndex($index) }}
</template>
<!-- <template #deviceName="{ row }">
<span class="health-score" @dblclick="openDialog(row.deviceName)">{{
row.deviceName
}}</span>
</template> -->
<!-- <template #operation="{ row }">
<span class="view-btn" @click="handleView(row)">详情</span>
<span class="edit-btn" @click="handleEdit(row)">编辑</span>
</template> -->
<template #operate="{ row }">
<span class="health-score" @click="openDialog(row)">暂挂起</span>
</template>
</common-table>
</div>
</div>
<!-- 设备挂起 -->
<el-dialog
class="equWarnDialog"
v-model="equDialog"
title=""
width="500px"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<div class="equd_body">
<span
>是否要对<span class="bold">{{ clickItem.name }}</span
>不再告警:</span
>
<el-form-item>
<el-radio-group v-model="equSubmitInfo.noAlarm" @change="onSubmit">
<el-radio value="1"></el-radio>
<el-radio value="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="开始时间">
<el-date-picker
v-model="equSubmitInfo.startTime"
type="datetime"
placeholder="选择开始时间"
/>
</el-form-item>
<el-form-item label="结束时间">
<el-date-picker
v-model="equSubmitInfo.endTime"
type="datetime"
placeholder="选择结束时间"
/>
</el-form-item>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="equDialog = false">取消</el-button>
<el-button type="primary" @click="equPending"> 确认 </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
......@@ -108,19 +146,22 @@
import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue";
import CommonTable from "@/components/commonTable/index.vue";
import { useRoute, useRouter } from "vue-router";
import { getDataFun, postDataJSON } from "@/request/method.js";
import moment from "moment";
const router = useRouter();
const formInline = ref({
eventName: "",
deviceName: "",
position: "",
type: "",
name: "",
dusterName: "",
deviceType: "",
suspendFlag: "2",
date: "",
warnType: "3",
});
const currentPage = ref(1);
const pageSize = ref(10);
const pageSize = ref(20);
const equDialog = ref(false);
const tableColumns = ref([
{
......@@ -129,42 +170,42 @@ const tableColumns = ref([
width: "5%",
},
{
prop: "deviceName",
prop: "eventName",
label: "事件名称",
width: "9%",
},
{
prop: "compart",
prop: "name",
label: "发生位置",
width: "9%",
},
{
prop: "position",
prop: "deviceType",
label: "设备类型",
width: "9%",
},
{
prop: "changeDateRemind",
prop: "alarmIndicators",
label: "告警指标",
width: "9%",
},
{
prop: "changeDate",
prop: "value",
label: "监测值",
width: "9%",
},
{
prop: "changePeo",
prop: "eventTime",
label: "告警时间",
width: "9%",
},
{
prop: "ownerdeviceName",
prop: "isSuspendAlarm",
label: "是否挂起期间告警",
width: "9%",
},
{
prop: "lastAlarmTime",
prop: "operate",
label: "操作",
width: "10%",
},
......@@ -182,30 +223,22 @@ const tableData = reactive({
ownerdeviceName: "xx",
lastAlarmTime: "xx",
changeRound: "xx",
operate: "挂起",
},
],
});
const dustList = reactive({
const typeList = reactive({
list: [],
});
const getDustList = () => {
dustList.list = [
{
deviceName: "1#除尘器",
deviceNo: "11111",
},
{
deviceName: "2#除尘器",
deviceNo: "22222",
},
{
deviceName: "3#除尘器",
deviceNo: "333333",
},
];
const getTypeList = () => {
const url = "/alarm/getDeviceType";
return getDataFun(url, "").then((res) => {
if (res && res.data) {
typeList.list = res.data || [];
}
});
};
getDustList();
const getIndex = (index) => {
return (currentPage.value - 1) * pageSize.value + index + 1;
......@@ -214,18 +247,104 @@ const getIndex = (index) => {
const handlePaginationChange = (pagination) => {
currentPage.value = pagination.currentPage;
pageSize.value = pagination.pageSize;
console.log("分页变化", pagination);
getAlarmList();
};
const onSubmit = () => {
console.log("submit!", formInline.value);
getAlarmList();
};
const onReset = () => {
formInline.value = {
eventName: "",
name: "",
dusterName: "",
deviceType: "",
suspendFlag: "2",
date: [],
};
currentPage.value = 1;
pageSize.value = 20;
getAlarmList();
};
const openRound = () => {
router.push({ path: "/management/suspend-management" });
};
onMounted(async () => {});
const clickItem = ref({});
const openDialog = (item) => {
clickItem.value = item;
equDialog.value = true;
};
const total = ref(0);
const getAlarmList = () => {
const url = "/alarm/getAlarmListPage";
const params = {
eventName: formInline.value.eventName,
name: formInline.value.name,
dusterName: formInline.value.dusterName,
deviceType: formInline.value.deviceType,
suspendFlag: formInline.value.suspendFlag,
startTime: formInline.value.date[0]
? moment(new Date(formInline.value.date[0]).getTime()).format(
"YYYY-MM-DD HH:mm:ss"
)
: "",
endTime: formInline.value.date[1]
? moment(new Date(formInline.value.date[1]).getTime()).format(
"YYYY-MM-DD HH:mm:ss"
)
: "",
pageNo: currentPage.value,
pageSize: pageSize.value,
};
return getDataFun(url, params).then((res) => {
if (res && res.data) {
tableData.list = res.data.list || [];
total.value = res.data.total;
} else {
return [];
}
});
};
const equSubmitInfo = ref({
noAlarm: "0",
startTime: "",
endTime: "",
});
const equPending = () => {
const url = "/alarm/suspendDevice";
const params = {
id: clickItem.value.id,
noAlarm: equSubmitInfo.value.noAlarm,
startTime: equSubmitInfo.value.startTime
? moment(new Date(equSubmitInfo.value.startTime).getTime()).format(
"YYYY-MM-DD HH:mm:ss"
)
: "",
endTime: equSubmitInfo.value.endTime
? moment(new Date(equSubmitInfo.value.endTime).getTime()).format(
"YYYY-MM-DD HH:mm:ss"
)
: "",
};
return getDataFun(url, params).then((res) => {
if (res && res.code == 1) {
equDialog.value = false;
getAlarmList();
}
});
};
onMounted(async () => {
getTypeList();
getAlarmList();
});
onBeforeUnmount(() => {});
</script>
......@@ -427,5 +546,16 @@ onBeforeUnmount(() => {});
background-color: #fef0f0;
}
}
.equWarnDialog {
.equd_body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.bold {
font-weight: bold;
}
}
}
}
</style>
......@@ -750,7 +750,7 @@ const getBagRowLine = (no) => {
const getCol = ()=>{
rowLineMap.value.forEach(item => {
if (item.row === bagRow.value) {
colList.value.push(item.column);
colList.value.push(item.columns);
}
});
}
......
......@@ -28,7 +28,7 @@
<el-option label="全部" value="" />
<el-option
v-for="(item, index) in basicConfiguration.deviceList"
index="item.id"
:key="item.code"
:label="item.desc"
:value="item.code"
>
......@@ -831,7 +831,7 @@ const getBagRowLine = (no) => {
const getCol = ()=>{
rowLineMap.value.forEach(item => {
if (item.row === bagRow.value) {
colList.value.push(item.column);
colList.value.push(item.columns);
}
});
}
......@@ -901,9 +901,9 @@ const getIndex = (index) => {
};
const basicConfiguration = reactive({
ticketEventName: [{ name: "全部", id: "" }],
ticketEventName: [],
branchFactoryList: [{ branchFactory: "全部", branchFactoryId: "" }],
deviceList: [{ name: "全部", id: "" }]
deviceList: []
});
const workSheetDetail = ref(null);
......
......@@ -5,7 +5,7 @@
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="仓室">
<el-input
v-model="formInline.deviceName"
v-model="formInline.compart"
placeholder="请输入仓室名称"
style="width: 180px"
clearable
......@@ -13,7 +13,7 @@
</el-form-item>
<el-form-item label="除尘器名称">
<el-input
v-model="formInline.deviceName"
v-model="formInline.dusterName"
placeholder="请输入除尘器名称"
style="width: 180px"
clearable
......@@ -30,7 +30,7 @@
/>
</el-form-item>
<el-form-item>
<el-button type="default" class="default-btn" @click="onSubmit"
<el-button type="default" class="default-btn" @click="onReset"
>重置</el-button
>
<el-button type="primary" class="search-btn" @click="onSubmit"
......@@ -50,7 +50,8 @@
<common-table
:data="tableData.list"
:columns="tableColumns"
:default-page-size="10"
:default-page-size="20"
:total="total"
@pagination-change="handlePaginationChange"
:pagination-texts="{
total: '共',
......@@ -63,9 +64,9 @@
<template #index="{ $index }">
{{ getIndex($index) }}
</template>
<template #deviceName="{ row }">
<span class="health-score" @dblclick="openDialog(row.deviceName)">{{
row.deviceName
<template #dusterName="{ row }">
<span class="health-score" @dblclick="openDialog(row.dusterName)">{{
row.dusterName
}}</span>
</template>
<!-- <template #operation="{ row }">
......@@ -95,8 +96,8 @@
<el-option
v-for="i in dustList.list"
:key="i"
:label="`${i.deviceName}`"
:value="i.deviceNo"
:label="`${i.dusterName}`"
:value="i.dusterNo"
/>
</el-select>
</div>
......@@ -118,16 +119,19 @@
<script setup>
import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue";
import CommonTable from "@/components/commonTable/index.vue";
import { getToken, removeToken, setToken } from "@/utils/auth";
import chartLine from "./components/chart-line.vue";
import { getDataFun, postDataJSON } from "@/request/method.js";
import moment from "moment";
const formInline = ref({
compart: "",
dusterName: "",
date: "",
date: ["", ""],
});
const currentPage = ref(1);
const pageSize = ref(10);
const pageSize = ref(20);
const dustLineisShow = ref(false);
const tableColumns = ref([
......@@ -137,7 +141,7 @@ const tableColumns = ref([
width: "5%",
},
{
prop: "deviceName",
prop: "dusterName",
label: "除尘器名称",
width: "8%",
},
......@@ -147,37 +151,32 @@ const tableColumns = ref([
width: "8%",
},
{
prop: "position",
prop: "bagLocation",
label: "布袋位置(排/列)",
width: "8%",
},
{
prop: "changeDateRemind",
prop: "bagChangeNextTime",
label: "布袋更换提醒时间",
width: "8%",
},
{
prop: "changeDate",
prop: "bagChangeTime",
label: "更换时间",
width: "8%",
},
{
prop: "changePeo",
prop: "bagChangeAuthor",
label: "更换人",
width: "8%",
},
{
prop: "ownerdeviceName",
prop: "dusterName",
label: "所属除尘器",
width: "8%",
},
{
prop: "lastAlarmTime",
label: "布袋更换提醒时间",
width: "10%",
},
{
prop: "changeRound",
prop: "bagChangePeriod",
label: "更换周期(与上次更换比)",
width: "6%",
},
......@@ -199,39 +198,66 @@ const tableData = reactive({
],
});
const total = ref(0);
const getAllDustList = () => {
const url = "/bag/cycle/getReplaceListPage";
console.log(formInline.value.date);
const params = {
compart: formInline.value.compart,
dusterName: formInline.value.dusterName,
startTime: formInline.value.date[0]
? moment(new Date(formInline.value.date[0]).getTime()).format(
"YYYY-MM-DD HH:mm:ss"
)
: "",
endTime: formInline.value.date[1]
? moment(new Date(formInline.value.date[1]).getTime()).format(
"YYYY-MM-DD HH:mm:ss"
)
: "",
pageNo: currentPage.value,
pageSize: pageSize.value,
customerId: getToken("customerId"),
};
return getDataFun(url, params).then((res) => {
if (res && res.data) {
tableData.list = res.data.records || [];
total.value = res.data.total;
} else {
return [];
}
});
};
const selectDustNo = ref("");
const dustList = reactive({
list: [],
});
const getHealthScoreColor = (score) => {
const value = parseInt(score);
if (value >= 90) return "#67C23A";
if (value >= 70) return "#E6A23C";
return "#F56C6C";
};
const getIndex = (index) => {
return (currentPage.value - 1) * pageSize.value + index + 1;
};
const handleView = (row) => {
console.log("查看详情", row);
};
const handleEdit = (row) => {
console.log("编辑", row);
};
const handlePaginationChange = (pagination) => {
currentPage.value = pagination.currentPage;
pageSize.value = pagination.pageSize;
console.log("分页变化", pagination);
getAllDustList();
};
const onSubmit = () => {
console.log("submit!", formInline.value);
getAllDustList();
};
const onReset = () => {
formInline.value = {
compart: "",
dusterName: "",
date: ["", ""],
};
currentPage.value = 1;
pageSize.value = 20;
getAllDustList();
};
const dustLineInfo = reactive({ list: [{}] });
......@@ -242,49 +268,48 @@ const openDialog = (deviceName) => {
};
const getDustList = () => {
return [
{
deviceName: "1#除尘器",
deviceNo: "11111",
},
{
deviceName: "2#除尘器",
deviceNo: "22222",
},
{
deviceName: "3#除尘器",
deviceNo: "333333",
},
];
const url = "/bag/cycle/getDusterList";
return getDataFun(url, "").then((res) => {
if (res && res.data) {
return res.data;
} else {
return [];
}
});
};
const getDustListInfo = () => {
return [
{ time: "1", value: "20" },
{ time: "2", value: "30" },
{ time: "4", value: "40" },
{ time: "8", value: "45" },
{ time: "10", value: "15" },
{ time: "周期", value: "20" },
];
const getDustInfo = () => {
const url = "/bag/cycle/getReplaceAnalysis";
const params = {
dusterNo: selectDustNo.value,
};
return getDataFun(url, params).then((res) => {
if (res && res.data) {
return res.data;
} else {
return [];
}
});
};
const changeDust = (deviceName) => {
dustList.list = getDustList();
if (deviceName) {
const changeDust = async (dusterName) => {
dustList.list = await getDustList();
if (dusterName) {
dustList.list.forEach((i) => {
if (i.deviceName == deviceName) {
selectDustNo.value = i.deviceNo;
if (i.dusterName == dusterName) {
selectDustNo.value = i.dusterNo;
}
});
} else {
selectDustNo.value = dustList.list[0].deviceNo || "";
selectDustNo.value = dustList.list[0].dusterNo || "";
}
let list = getDustListInfo();
let list = await getDustInfo();
dustLineInfo.list = list;
};
onMounted(async () => {});
onMounted(async () => {
getAllDustList();
});
onBeforeUnmount(() => {});
</script>
......
......@@ -25,8 +25,8 @@ const initChart = () => {
let seriesData = [];
if (props.dustLineInfo) {
props.dustLineInfo.forEach((i) => {
xData.push(i.time);
seriesData.push(i.value);
xData.push(i.replaceTime);
seriesData.push(i.period);
});
}
chartInstance = echarts.init(chartDustRef.value);
......@@ -49,7 +49,6 @@ watch(
);
onMounted(() => {
initChart();
window.addEventListener("resize", () => {
chartInstance?.resize();
});
......@@ -62,6 +61,7 @@ onBeforeUnmount(() => {
<style lang="scss" scoped>
.chart-line {
margin-top: 20px;
canvas {
width: 100%;
height: 100%;
......
......@@ -4,38 +4,38 @@
<div class="search">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="项目名称">
<el-select v-model="formInline.name" style="width: 200px">
<el-select v-model="formInline.projectId" style="width: 200px">
<el-option
v-for="i in nameList.list"
:key="i"
:label="`${i.label}`"
:value="i.value"
:label="`${i.name}`"
:value="i.id"
/>
</el-select>
</el-form-item>
<el-form-item label="设备类别">
<el-select v-model="formInline.type" style="width: 200px">
<el-select v-model="formInline.deviceType" style="width: 200px">
<el-option
v-for="i in typeList.list"
:key="i"
:label="`${i.label}`"
:value="i.value"
:label="`${i.desc}`"
:value="i.code"
/>
</el-select>
</el-form-item>
<el-form-item label="原因分类">
<el-select v-model="formInline.reason" style="width: 200px">
<el-select v-model="formInline.reasonCategory" style="width: 200px">
<el-option
v-for="i in reasonList.list"
:key="i"
:label="`${i.label}`"
:value="i.value"
:label="`${i.value}`"
:value="i.key"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="default" class="default-btn" @click="onSubmit"
<el-button type="default" class="default-btn" @click="onReset"
>重置</el-button
>
<el-button type="primary" class="search-btn" @click="onSubmit"
......@@ -48,7 +48,8 @@
<common-table
:data="tableData.list"
:columns="tableColumns"
:default-page-size="10"
:default-page-size="20"
:total="total"
@pagination-change="handlePaginationChange"
:pagination-texts="{
total: '共',
......@@ -79,18 +80,16 @@
<script setup>
import { ref, onMounted, onBeforeUnmount, computed, reactive } from "vue";
import CommonTable from "@/components/commonTable/index.vue";
import { getDataFun, postDataJSON } from "@/request/method.js";
const formInline = ref({
eventName: "",
deviceName: "",
position: "",
type: "",
date: "",
warnType: "3",
projectId: "",
deviceType: "",
reasonCategory: "",
});
const currentPage = ref(1);
const pageSize = ref(10);
const pageSize = ref(20);
const tableColumns = ref([
{
......@@ -99,62 +98,62 @@ const tableColumns = ref([
width: "5%",
},
{
prop: "deviceName",
prop: "projectName",
label: "项目名称",
width: "7%",
},
{
prop: "compart",
prop: "deviceNo",
label: "设备编号",
width: "7%",
},
{
prop: "position",
prop: "deviceType",
label: "设备类型",
width: "7%",
},
{
prop: "changeDateRemind",
prop: "deviceName",
label: "设备名称",
width: "7%",
},
{
prop: "changeDate",
prop: "signalNo",
label: "设备信号编号",
width: "7%",
},
{
prop: "changePeo",
prop: "location",
label: "设备所在位置",
width: "7%",
},
{
prop: "ownerdeviceName",
prop: "suspendStartTime",
label: "挂起开始时间",
width: "7%",
},
{
prop: "ownerdeviceName",
prop: "suspendEndTime",
label: "结束时间",
width: "7%",
},
{
prop: "ownerdeviceName",
prop: "reasonCategory",
label: "原因分类",
width: "7%",
},
{
prop: "ownerdeviceName",
prop: "reasonDesc",
label: "原因描述",
width: "7%",
},
{
prop: "ownerdeviceName",
prop: "createTime",
label: "创建时间",
width: "7%",
},
{
prop: "ownerdeviceName",
prop: "createUser",
label: "创建人",
width: "7%",
},
......@@ -184,61 +183,39 @@ const tableData = reactive({
const nameList = reactive({
list: [],
});
const getNameList = () => {
nameList.list = [
{
label: "1#除尘器",
value: "11111",
},
{
label: "2#除尘器",
value: "22222",
},
{
label: "3#除尘器",
value: "333333",
},
];
const url = "/alarm/getProjectEnumList";
return getDataFun(url, "").then((res) => {
if (res && res.data) {
nameList.list = res.data || [];
}
});
};
const typeList = reactive({
list: [],
});
const getTypeList = () => {
typeList.list = [
{
label: "1#除尘器",
value: "11111",
},
{
label: "2#除尘器",
value: "22222",
},
{
label: "3#除尘器",
value: "333333",
},
];
const url = "/alarm/getDeviceType";
return getDataFun(url, "").then((res) => {
if (res && res.data) {
typeList.list = res.data || [];
}
});
};
const reasonList = reactive({
list: [],
});
const getReasonList = () => {
reasonList.list = [
{
label: "1#除尘器",
value: "11111",
},
{
label: "2#除尘器",
value: "22222",
},
{
label: "3#除尘器",
value: "333333",
},
];
const url = "/alarm/reasonCategoryEnumList";
return getDataFun(url, "").then((res) => {
if (res && res.data) {
reasonList.list = res.data || [];
}
});
};
const getIndex = (index) => {
......@@ -248,17 +225,48 @@ const getIndex = (index) => {
const handlePaginationChange = (pagination) => {
currentPage.value = pagination.currentPage;
pageSize.value = pagination.pageSize;
console.log("分页变化", pagination);
getManagementList();
};
const onSubmit = () => {
console.log("submit!", formInline.value);
getManagementList();
};
const onReset = () => {
formInline.value = {
deviceType: "",
reasonCategory: "",
projectId: "",
};
currentPage.value = 1;
pageSize.value = 20;
getManagementList();
};
const total = ref(0);
const getManagementList = () => {
const url = "/alarm/getSuspendDeviceListPage";
const params = {
deviceType: formInline.value.deviceType,
reasonCategory: formInline.value.reasonCategory,
projectId: formInline.value.projectId,
pageNo: currentPage.value,
pageSize: pageSize.value,
};
tableData.list = [];
return getDataFun(url, params).then((res) => {
if (res && res.data) {
tableData.list = res.data.list || [];
total.value = res.data.total;
}
});
};
onMounted(async () => {
getNameList();
getTypeList();
getReasonList();
getManagementList();
});
onBeforeUnmount(() => {});
......
......@@ -275,6 +275,7 @@ import { getData, getDataFun, postData } from "@/request/method";
import { ElMessage } from "element-plus";
import { MD5 } from "crypto-js";
import { encryptUtf8ToBase64, encryptBase64ToUtf8 } from "@/utils/tools.js";
import { startPermissionCheck } from '@/utils/permissionChecker';
export default {
name: "Login",
data() {
......@@ -930,27 +931,21 @@ export default {
this.dialogPhoneBind = false;
}
setToken("permissions", 0);
if (homeFlag == 0) {
this.$router.push({
path: "/newHome/homePage",
});
} else {
this.$router.push({
path: this.redirect || "/",
query: this.otherQuery,
});
}
this.getMenuList(data.data.id);
this.loading = false;
})
.catch((data) => {
this.store.istrue = false;
this.$router.push({
path: this.redirect || "/",
query: this.otherQuery,
});
this.getMenuList(1);
// this.$router.push({
// path: this.redirect || "/",
// query: this.otherQuery,
// });
this.loading = false;
});
},
getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => {
if (cur !== "redirect" && cur !== "token") {
......@@ -1056,28 +1051,47 @@ export default {
}
document.onkeydown = undefined;
setToken("permissions", 0);
if (homeFlag == 0) {
this.$router.push({
path: "/newHome/homePage",
});
} else {
this.$router.push({
path: this.redirect || "/",
query: this.otherQuery,
});
}
this.getMenuList(data.data.id);
// if (homeFlag == 0) {
// this.$router.push({
// path: "/newHome/homePage",
// });
// } else {
// this.$router.push({
// path: this.redirect || "/",
// query: this.otherQuery,
// });
// }
this.oldloading = false;
})
.catch((data) => {
// this.store.dispatch("settings/changeSetting", false);
this.$router.push({
path: this.redirect || "/",
query: this.otherQuery,
});
this.getMenuList(1);
// this.$router.push({
// path: this.redirect || "/",
// query: this.otherQuery,
// });
this.oldloading = false;
});
},
getMenuList(userId) {
getData(
"/system/permission?appCode=bme-dc-tom-service&userId=" + userId,
true
)
.then((result) => {
sessionStorage.setItem("menuList", JSON.stringify(result.data));
this.$router.push({
path: this.redirect || "/",
query: this.otherQuery,
});
startPermissionCheck();
})
.catch((e) => {
console.log("error fetch verify code!!" + e);
});
},
getPermissionData(userId) {
return new Promise((resolve) => {
const url = "/management/admin/userDataPermission";
......@@ -1152,9 +1166,9 @@ $cursor: #ccc;
width: 95%;
}
.dialogChangePasswordform {
.el-input__wrapper {
width: 80%;
}
.el-input {
display: flex !important;
}
}
.captcha {
......@@ -1168,9 +1182,12 @@ $cursor: #ccc;
border: none;
border-bottom: 1px solid #fff;
background: #fff;
padding-right: 10px;
box-sizing: border-box;
}
}
</style>
<style lang="scss" scoped>
......@@ -1180,9 +1197,11 @@ $light_gray: #eee;
.captcha-btn {
position: absolute;
top: 1%;
right: 17%;
height: 100%;
top: 1px;
right: 0;
height: calc(100% - 2px);
border-top: none;
border-bottom: none;
}
.login-container {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment