yunxinguanli

This commit is contained in:
仲么了
2023-12-29 10:05:09 +08:00
parent edead841b8
commit dc5f97b6dc
10 changed files with 239 additions and 172 deletions

View File

@@ -4,6 +4,14 @@ import createAxios from '@/utils/request'
export function saveLogParam() {
return createAxios({
url: '/system-boot/audit/saveLogParam',
method:'POST'
method: 'POST'
})
}
// 区域列表
export function getAreaList() {
return createAxios({
url: '/user-boot/dept/deptTree',
method: 'POST'
})
}

View File

@@ -0,0 +1,26 @@
<template>
<el-cascader v-bind='$attrs' :options='options' :props='cascaderProps' />
</template>
<script lang='ts' setup>
import { defineComponent } from 'vue'
defineOptions({
name: 'Area'
})
import { useDictData } from '@/stores/dictData'
const cascaderProps = {
label: 'name',
value: 'id',
checkStrictly: true,
showAllLevels: false
}
const dictData = useDictData()
const options = dictData.state.area
</script>
<style scoped>
</style>

View File

@@ -31,7 +31,7 @@
<script setup lang='ts'>
import { inject, ref } from 'vue'
import type TableStore from '@/utils/tableStore'
import DatePicker from '@/components/datePicker/index.vue'
import DatePicker from '@/components/form/datePicker/index.vue'
const tableStore = inject('tableStore') as TableStore
const date = ref([window.XEUtils.toDateString(new Date(), 'yyyy-MM-dd'), window.XEUtils.toDateString(new Date(), 'yyyy-MM-dd')])

View File

@@ -1,8 +1,8 @@
<template>
<component :is="config.layout.layoutMode"></component>
<component :is='config.layout.layoutMode'></component>
</template>
<script setup lang="ts">
<script setup lang='ts'>
import { reactive } from 'vue'
import { useConfig } from '@/stores/config'
import { useNavTabs } from '@/stores/navTabs'
@@ -21,6 +21,8 @@ import { isEmpty } from 'lodash-es'
import { setNavTabsWidth } from '@/utils/layout'
import { adminBaseRoutePath } from '@/router/static'
import { getRouteMenu, dictDataCache } from '@/api/auth'
import { getAreaList } from '@/api/common'
import { BasicDictData } from '@/stores/interface'
defineOptions({
components: { Default, Classic, Streamline, Double }
@@ -30,7 +32,7 @@ const navTabs = useNavTabs()
const config = useConfig()
const route = useRoute()
const adminInfo = useAdminInfo()
const DictData = useDictData()
const dictData = useDictData()
const state = reactive({
autoMenuCollapseLock: false
})
@@ -47,151 +49,159 @@ onBeforeMount(() => {
useEventListener(window, 'resize', onAdaptiveLayout)
})
const init = () => {
const init = async () => {
await Promise.all([
getAreaList(),
dictDataCache()
]).then(res => {
dictData.state.area = res[0].data
dictData.state.basic = res[1].data
})
/**
* 后台初始化请求,获取站点配置,动态路由等信息
*/
const arr = [
{
id: 1,
pid: 0,
type: 'menu',
title: '控制台',
name: 'dashboard',
path: 'dashboard',
icon: 'el-icon-Platform',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/index.vue',
keepalive: 'dashboard',
extend: 'none',
children: []
},
{
id: 3,
pid: 0,
type: 'menu',
title: '审计管理',
name: 'test',
path: 'test',
icon: 'el-icon-List',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/test.vue',
keepalive: 'test',
extend: 'none',
children: [
{
id: 1,
pid: 3,
type: 'menu',
title: '审计列表',
name: 'comptroller/list',
path: 'comptroller/list',
icon: 'el-icon-List',
menu_type: 'tab',
url: '',
component: '/src/views/comptroller/list.vue',
keepalive: 'auth/role',
extend: 'none',
children: []
}
]
},
{
id: 3,
pid: 0,
type: 'menu',
title: '电压暂降',
name: 'voltage/sags',
path: 'voltage/sags',
icon: 'el-icon-BellFilled',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/test.vue',
keepalive: 'voltage/sags',
extend: 'none',
children: [
{
id: 1,
pid: 3,
type: 'menu',
title: '运行管理',
name: 'voltage/sags/operationsManagement',
path: 'voltage/sags/operationsManagement',
icon: 'el-icon-Management',
menu_type: 'tab',
url: '',
component: '/src/views/voltage/sags/operationsManagement/index.vue',
keepalive: 'voltage/sags/operationsManagement',
extend: 'none',
children: []
},
{
id: 2,
pid: 3,
type: 'menu',
title: '区域',
name: 'Event-boot/Region/distribution',
path: 'Event-boot/Region/distribution',
icon: 'el-icon-Management',
menu_type: 'tab',
url: '',
component: '/src/views/Event-boot/Region/distribution.vue',
keepalive: 'Event-boot/Region/distribution',
extend: 'none',
children: []
}
]
},
{
id: 2,
pid: 0,
type: 'menu_dir',
title: '权限管理',
name: 'auth',
path: 'auth',
icon: 'el-icon-Tools',
menu_type: null,
url: '',
component: '',
keepalive: 0,
extend: 'none',
children: [
{
id: 3,
pid: 2,
type: 'menu',
title: '角色管理',
name: 'auth/role',
path: 'auth/role',
icon: 'el-icon-Avatar',
menu_type: 'tab',
url: '',
component: '/src/views/auth/role.vue',
keepalive: 'auth/role',
extend: 'none',
children: []
},
{
id: 13,
pid: 2,
type: 'menu',
title: '菜单规则管理',
name: 'auth/menu',
path: 'auth/menu',
icon: 'el-icon-Menu',
menu_type: 'tab',
url: '',
component: '/src/views/auth/menu/index.vue',
keepalive: 'auth/menu',
extend: 'none',
children: []
}
]
}
]
getRouteMenu().then((res: any) => {
const arr = [
{
id: 1,
pid: 0,
type: 'menu',
title: '控制台',
name: 'dashboard',
path: 'dashboard',
icon: 'el-icon-Platform',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/index.vue',
keepalive: 'dashboard',
extend: 'none',
children: []
},
{
id: 3,
pid: 0,
type: 'menu',
title: '审计管理',
name: 'test',
path: 'test',
icon: 'el-icon-List',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/test.vue',
keepalive: 'test',
extend: 'none',
children: [
{
id: 1,
pid: 3,
type: 'menu',
title: '审计列表',
name: 'comptroller/list',
path: 'comptroller/list',
icon: 'el-icon-List',
menu_type: 'tab',
url: '',
component: '/src/views/comptroller/list.vue',
keepalive: 'auth/role',
extend: 'none',
children: []
}
]
},
{
id: 3,
pid: 0,
type: 'menu',
title: '电压暂降',
name: 'voltage/sags',
path: 'voltage/sags',
icon: 'el-icon-BellFilled',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/test.vue',
keepalive: 'voltage/sags',
extend: 'none',
children: [
{
id: 1,
pid: 3,
type: 'menu',
title: '运行管理',
name: 'voltage/sags/operationsManagement',
path: 'voltage/sags/operationsManagement',
icon: 'el-icon-Management',
menu_type: 'tab',
url: '',
component: '/src/views/voltage/sags/operationsManagement/index.vue',
keepalive: 'voltage/sags/operationsManagement',
extend: 'none',
children: []
},
{
id: 2,
pid: 3,
type: 'menu',
title: '区域',
name: 'Event-boot/Region/distribution',
path: 'Event-boot/Region/distribution',
icon: 'el-icon-Management',
menu_type: 'tab',
url: '',
component: '/src/views/Event-boot/Region/distribution.vue',
keepalive: 'Event-boot/Region/distribution',
extend: 'none',
children: []
}
]
},
{
id: 2,
pid: 0,
type: 'menu_dir',
title: '权限管理',
name: 'auth',
path: 'auth',
icon: 'el-icon-Tools',
menu_type: null,
url: '',
component: '',
keepalive: 0,
extend: 'none',
children: [
{
id: 3,
pid: 2,
type: 'menu',
title: '角色管理',
name: 'auth/role',
path: 'auth/role',
icon: 'el-icon-Avatar',
menu_type: 'tab',
url: '',
component: '/src/views/auth/role.vue',
keepalive: 'auth/role',
extend: 'none',
children: []
},
{
id: 13,
pid: 2,
type: 'menu',
title: '菜单规则管理',
name: 'auth/menu',
path: 'auth/menu',
icon: 'el-icon-Menu',
menu_type: 'tab',
url: '',
component: '/src/views/auth/menu/index.vue',
keepalive: 'auth/menu',
extend: 'none',
children: []
}
]
}
]
const handlerMenu = (data: any) => {
data.forEach((item: any) => {
item.path = item.routeName || item.title
@@ -223,9 +233,6 @@ const init = () => {
console.log(firstRoute)
if (firstRoute) routePush(firstRoute.path)
})
dictDataCache().then(res => {
DictData.setBasicData(res.data)
})
}
const onAdaptiveLayout = () => {

View File

@@ -7,7 +7,7 @@
class="default-main ba-main-loading"
></div>
<div v-if="state.showReload" class="loading-footer">
<el-button @click="refresh" type="warning">utils.Reload</el-button>
<el-button @click="refresh" type="warning">重新加载</el-button>
</div>
</div>
</template>

View File

@@ -8,17 +8,14 @@ export const useDictData = defineStore(
() => {
const state: DictData = reactive({
basic: [],
area: []
// 其他接口获取的字典,比如区域
})
const setBasicData = (data: BasicDictData[]) => {
state.basic = data
}
const getBasicData = (code: string) => {
return state.basic.filter(item => item.code === code)[0]?.children || []
}
return {
state,
setBasicData,
getBasicData
}
},

View File

@@ -47,6 +47,7 @@ export interface AdminInfo {
export interface DictData {
basic: BasicDictData[]
area: BasicDictData[]
}
export interface BasicDictData {

View File

@@ -54,7 +54,7 @@ saveLogParam().then(res => {
})
onMounted(() => {
tableStore.index()
// tableStore.index()
})
const addMenu = () => {}

View File

@@ -1,30 +1,58 @@
<template>
<div class="default-main">
<div class='default-main'>
<TableHeader date-picker>
<template v-slot:select>
<!-- <el-form-item label="用户名">
<el-select v-model="value" class="m-2" placeholder="Select" size="large">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
<el-form-item label='区域'>
<Area v-model='tableStore.table.params.deptIndex' />
</el-form-item>
<el-form-item label='终端状态'>
<el-select v-model='tableStore.table.params.runFlag'
placeholder='请选择'>
<el-option label='投运' value='0' />
<el-option label='热备用' value='1' />
<el-option label='停运' value='2' />
</el-select>
</el-form-item>
<el-form-item label="操作类型">
<el-input v-model="tableStore.table.params.loginName" placeholder="Please input" />
</el-form-item> -->
<el-form-item label='通讯状态'>
<el-select v-model='tableStore.table.params.comFlag'
placeholder='请选择'>
<el-option label='正常' value='1' />
<el-option label='中断' value='0' />
</el-select>
</el-form-item>
<el-form-item label='厂家'>
<el-select v-model='tableStore.table.params.manufacturer'
placeholder='请选择'
>
<el-option
v-for='item in manufacturer'
:key='item.id'
:label='item.name'
:value='item.id'
/>
</el-select>
</el-form-item>
<el-form-item label='筛选数据'>
<el-input v-model='tableStore.table.params.searchValue' placeholder='请输入' />
</el-form-item>
</template>
</TableHeader>
<Table ref="tableRef" />
<Table ref='tableRef' />
</div>
</template>
<script setup lang="tsx">
import { Plus } from '@element-plus/icons-vue'
<script setup lang='tsx'>
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData'
import Area from '@/components/form/area/index.vue'
defineOptions({
name: 'comptroller/list'
})
const dictData = useDictData()
const manufacturer = dictData.getBasicData('Dev_Manufacturers')
const tableStore = new TableStore({
isWebPaging: true,
url: '/device-boot/runManage/getRuntimeData',
@@ -54,19 +82,19 @@ const tableStore = new TableStore({
return <span></span>
} else if (props.renderValue * 100 > 90) {
return (
<el-tag effect="dark" type="success">
<el-tag effect='dark' type='success'>
</el-tag>
)
} else if (props.renderValue * 100 > 60) {
return (
<el-tag effect="dark" type="warning">
<el-tag effect='dark' type='warning'>
</el-tag>
)
} else {
return (
<el-tag effect="dark" type="danger">
<el-tag effect='dark' type='danger'>
</el-tag>
)
@@ -76,16 +104,16 @@ const tableStore = new TableStore({
]
})
tableStore.table.params.deptIndex = '5699e5916a18a6381e1ac92da5bd2628'
tableStore.table.params.serverName = 'event-boot'
tableStore.table.params.statisticalType = {}
tableStore.table.params.runFlag = []
tableStore.table.params.comFlag = []
tableStore.table.params.manufacturer = []
tableStore.table.params.runFlag = []
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
const addMenu = () => {}
const addMenu = () => {
}
</script>