电压暂降
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is='config.layout.layoutMode'></component>
|
<component :is="config.layout.layoutMode"></component>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang="ts">
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { useConfig } from '@/stores/config'
|
import { useConfig } from '@/stores/config'
|
||||||
import { useNavTabs } from '@/stores/navTabs'
|
import { useNavTabs } from '@/stores/navTabs'
|
||||||
@@ -94,7 +94,38 @@ const init = () => {
|
|||||||
keepalive: 'auth/role',
|
keepalive: 'auth/role',
|
||||||
extend: 'none',
|
extend: 'none',
|
||||||
children: []
|
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: []
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface TableStoreParams {
|
|||||||
column: TableColumn[]
|
column: TableColumn[]
|
||||||
params?: anyObj
|
params?: anyObj
|
||||||
method?: Method
|
method?: Method
|
||||||
|
isWebPaging?: boolean // 是否前端分页
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TableStore {
|
export default class TableStore {
|
||||||
@@ -16,15 +17,16 @@ export default class TableStore {
|
|||||||
public pk
|
public pk
|
||||||
public method: Method
|
public method: Method
|
||||||
public initData: any = null
|
public initData: any = null
|
||||||
|
public isWebPaging = false
|
||||||
public table: CnTable = reactive({
|
public table: CnTable = reactive({
|
||||||
ref: null,
|
ref: null,
|
||||||
selection: [],
|
selection: [],
|
||||||
data: [],
|
data: [],
|
||||||
|
webPagingData: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
params: {
|
params: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10
|
pageSize: 20
|
||||||
},
|
},
|
||||||
loading: true,
|
loading: true,
|
||||||
column: []
|
column: []
|
||||||
@@ -33,6 +35,7 @@ export default class TableStore {
|
|||||||
constructor(public options: TableStoreParams) {
|
constructor(public options: TableStoreParams) {
|
||||||
this.url = options.url
|
this.url = options.url
|
||||||
this.pk = options.pk || 'id'
|
this.pk = options.pk || 'id'
|
||||||
|
this.isWebPaging = options.isWebPaging || false
|
||||||
this.method = options.method || 'GET'
|
this.method = options.method || 'GET'
|
||||||
this.table.column = options.column
|
this.table.column = options.column
|
||||||
Object.assign(this.table.params, options.params)
|
Object.assign(this.table.params, options.params)
|
||||||
@@ -52,10 +55,12 @@ export default class TableStore {
|
|||||||
requestPayload(this.method, this.table.params)
|
requestPayload(this.method, this.table.params)
|
||||||
)
|
)
|
||||||
).then((res: any) => {
|
).then((res: any) => {
|
||||||
|
|
||||||
this.table.data = res.data.records || res.data
|
this.table.data = res.data.records || res.data
|
||||||
console.log(this.table.data)
|
|
||||||
this.table.total = res.data.total || res.data.length
|
this.table.total = res.data.total || res.data.length
|
||||||
|
if (this.isWebPaging) {
|
||||||
|
this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize)
|
||||||
|
this.table.data = this.table.webPagingData[this.table.params.pageNum - 1]
|
||||||
|
}
|
||||||
this.table.loading = false
|
this.table.loading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -91,15 +96,30 @@ export default class TableStore {
|
|||||||
[
|
[
|
||||||
'page-size-change',
|
'page-size-change',
|
||||||
() => {
|
() => {
|
||||||
this.table.params!.pageSize = data.size
|
this.table.params.pageSize = data.size
|
||||||
|
this.table.params.pageNum = 1
|
||||||
|
|
||||||
|
if (this.isWebPaging) {
|
||||||
|
this.table.webPagingData = window.XEUtils.chunk(
|
||||||
|
window.XEUtils.flatten(this.table.webPagingData),
|
||||||
|
this.table.params.pageSize
|
||||||
|
)
|
||||||
|
this.table.data = this.table.webPagingData[this.table.params.pageNum - 1]
|
||||||
|
} else {
|
||||||
|
this.index()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'current-page-change',
|
'current-page-change',
|
||||||
() => {
|
() => {
|
||||||
this.table.params!.pageNum = data.page
|
this.table.params.pageNum = data.page
|
||||||
|
if (this.isWebPaging) {
|
||||||
|
this.table.data = this.table.webPagingData[data.page - 1]
|
||||||
|
} else {
|
||||||
this.index()
|
this.index()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field-change',
|
'field-change',
|
||||||
|
|||||||
59
src/views/voltage/sags/operationsManagement/index.vue
Normal file
59
src/views/voltage/sags/operationsManagement/index.vue
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<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-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="操作类型">
|
||||||
|
<el-input v-model="tableStore.table.params.loginName" placeholder="Please input" />
|
||||||
|
</el-form-item> -->
|
||||||
|
</template>
|
||||||
|
<template v-slot:operation>
|
||||||
|
<el-button :icon="Plus" type="primary" @click="addMenu">添加</el-button>
|
||||||
|
</template>
|
||||||
|
</TableHeader>
|
||||||
|
<Table ref="tableRef" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Plus } from '@element-plus/icons-vue'
|
||||||
|
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'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'comptroller/list'
|
||||||
|
})
|
||||||
|
const tableStore = new TableStore({
|
||||||
|
isWebPaging: true,
|
||||||
|
url: '/device-boot/runManage/getRuntimeData',
|
||||||
|
method: 'POST',
|
||||||
|
column: [
|
||||||
|
{ title: '序号', type: 'seq', align: 'center', width: 60 },
|
||||||
|
{ title: '区域', field: 'userName', align: 'center', width: 120 },
|
||||||
|
{ title: '供电公司', field: 'operate', align: 'center', width: 220 },
|
||||||
|
{ title: '变电站', field: 'describe', align: 'center', showOverflow: true, minWidth: 200 },
|
||||||
|
{ title: '终端编号', field: 'type', align: 'center', width: 160 },
|
||||||
|
{ title: '投运时间', field: 'type', align: 'center', width: 100 },
|
||||||
|
{ title: '厂家', field: 'ip', align: 'center', width: 160 },
|
||||||
|
{ title: '', field: 'level', align: 'center', width: 100 }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
tableStore.table.params.deptIndex = '5699e5916a18a6381e1ac92da5bd2628'
|
||||||
|
tableStore.table.params.serverName = 'event-boot'
|
||||||
|
tableStore.table.params.statisticalType = {}
|
||||||
|
tableStore.table.params.comFlag = []
|
||||||
|
tableStore.table.params.manufacturer = []
|
||||||
|
tableStore.table.params.runFlag = []
|
||||||
|
provide('tableStore', tableStore)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
tableStore.index()
|
||||||
|
})
|
||||||
|
|
||||||
|
const addMenu = () => {}
|
||||||
|
</script>
|
||||||
14
types/table.d.ts
vendored
14
types/table.d.ts
vendored
@@ -8,6 +8,8 @@ declare global {
|
|||||||
interface CnTable {
|
interface CnTable {
|
||||||
ref: typeof Table | null
|
ref: typeof Table | null
|
||||||
data: TableRow[]
|
data: TableRow[]
|
||||||
|
// 前端分页数据
|
||||||
|
webPagingData: TableRow[][]
|
||||||
// 表格加载状态
|
// 表格加载状态
|
||||||
loading: boolean
|
loading: boolean
|
||||||
// 当前选中行
|
// 当前选中行
|
||||||
@@ -17,8 +19,8 @@ declare global {
|
|||||||
// 数据总量
|
// 数据总量
|
||||||
total: number
|
total: number
|
||||||
params: {
|
params: {
|
||||||
pageNum?: number
|
pageNum: number
|
||||||
pageSize?: number
|
pageSize: number
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,13 +56,7 @@ declare global {
|
|||||||
// 自定义组件/函数渲染
|
// 自定义组件/函数渲染
|
||||||
customRender?: string | Component
|
customRender?: string | Component
|
||||||
// 使用了 render 属性时,渲染前对字段值的预处理方法,请返回新值
|
// 使用了 render 属性时,渲染前对字段值的预处理方法,请返回新值
|
||||||
renderFormatter?: (
|
renderFormatter?: (row: TableRow, field: TableColumn, value: any, column: VxeColumnProps, index: number) => any
|
||||||
row: TableRow,
|
|
||||||
field: TableColumn,
|
|
||||||
value: any,
|
|
||||||
column: VxeColumnProps,
|
|
||||||
index: number
|
|
||||||
) => any
|
|
||||||
// 自定义渲染模板,方法可返回html内容
|
// 自定义渲染模板,方法可返回html内容
|
||||||
customTemplate?: (
|
customTemplate?: (
|
||||||
row: TableRow,
|
row: TableRow,
|
||||||
|
|||||||
Reference in New Issue
Block a user