代码优化

This commit is contained in:
仲么了
2023-12-29 16:30:26 +08:00
parent 1a826fb0fa
commit de3e42282e
7 changed files with 162 additions and 199 deletions

View File

@@ -39,7 +39,7 @@
:row='scope.row' :row='scope.row'
:column='scope.column' :column='scope.column'
:index='scope.rowIndex' :index='scope.rowIndex'
:key='child.field+scope.rowIndex' :key=" key + '-' + child.render + '-' + (child.field ? '-' + child.field + '-' + scope.row[child.field] : '')"
/> />
</template> </template>
</Column> </Column>
@@ -59,8 +59,7 @@
:row='scope.row' :row='scope.row'
:column='scope.column' :column='scope.column'
:index='scope.rowIndex' :index='scope.rowIndex'
:key='item.field+scope.rowIndex' :key=" key + '-' +item.render +'-' +(item.field ? '-' + item.field + '-' + scope.row[item.field] : '')" />
/>
</template> </template>
</Column> </Column>

View File

@@ -50,13 +50,13 @@ onBeforeMount(() => {
}) })
const init = async () => { const init = async () => {
// await Promise.all([ await Promise.all([
// getAreaList(), getAreaList(),
// dictDataCache() dictDataCache()
// ]).then(res => { ]).then(res => {
// dictData.state.area = res[0].data dictData.state.area = res[0].data
// dictData.state.basic = res[1].data dictData.state.basic = res[1].data
// }) })
/** /**
* 后台初始化请求,获取站点配置,动态路由等信息 * 后台初始化请求,获取站点配置,动态路由等信息
*/ */

View File

@@ -74,6 +74,7 @@ onMounted(() => {
if (typeof navTabs.state.activeRoute?.meta.keepalive == 'string') { if (typeof navTabs.state.activeRoute?.meta.keepalive == 'string') {
addKeepAliveComponentName(navTabs.state.activeRoute?.meta.keepalive) addKeepAliveComponentName(navTabs.state.activeRoute?.meta.keepalive)
} }
console.log(state.keepAliveComponentNameList)
}) })
watch( watch(

View File

@@ -48,6 +48,7 @@ export default class TableStore {
} }
index() { index() {
this.table.loading = true
// 重置用的数据数据 // 重置用的数据数据
if (!this.initData) { if (!this.initData) {
this.initData = JSON.parse(JSON.stringify(this.table.params)) this.initData = JSON.parse(JSON.stringify(this.table.params))

View File

@@ -49,9 +49,9 @@ tableStore.table.params.type = ''
tableStore.table.params.pageSize = 100 tableStore.table.params.pageSize = 100
provide('tableStore', tableStore) provide('tableStore', tableStore)
saveLogParam().then(res => { // saveLogParam().then(res => {
console.log(res) // console.log(res)
}) // })
onMounted(() => { onMounted(() => {
// tableStore.index() // tableStore.index()

View File

@@ -1,46 +1,60 @@
<template> <template>
<div class='default-main'> <div class="default-main">
<TableHeader date-picker :showOperation='false'> <TableHeader date-picker :showOperation="false">
<template v-slot:select> <template v-slot:select>
<el-form-item label='区域'> <el-form-item label="区域">
<Area v-model='tableStore.table.params.deptIndex' /> <Area v-model="tableStore.table.params.deptIndex" />
</el-form-item> </el-form-item>
<el-form-item label='终端状态'> <el-form-item label="终端状态">
<el-select multiple clearable collapse-tags v-model='tableStore.table.params.runFlag' <el-select
placeholder='请选择'> multiple
<el-option label='投运' value='0' /> clearable
<el-option label='热备用' value='1' /> collapse-tags
<el-option label='停运' value='2' /> 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-select>
</el-form-item> </el-form-item>
<el-form-item label='通讯状态'> <el-form-item label="通讯状态">
<el-select multiple clearable collapse-tags v-model='tableStore.table.params.comFlag' <el-select
placeholder='请选择'> multiple
<el-option label='正常' value='1' /> clearable
<el-option label='中断' value='0' /> collapse-tags
v-model="tableStore.table.params.comFlag"
placeholder="请选择"
>
<el-option label="正常" value="1" />
<el-option label="中断" value="0" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='厂家'> <el-form-item label="厂家">
<el-select multiple clearable collapse-tags v-model='manufacturerForm' placeholder='请选择' <el-select
@change='onManufacturerChange'> multiple
<el-option clearable
v-for='item in manufacturer' collapse-tags
:key='item.id' v-model="manufacturerForm"
:label='item.name' placeholder="请选择"
:value='item.id' @change="onManufacturerChange"
/> >
<el-option v-for="item in manufacturer" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='筛选数据'> <el-form-item label="筛选数据">
<el-input v-model='tableStore.table.params.searchValue' <el-input
placeholder='根据变电站,终端编号,型号或网络参数查询' style='width:300px' /> v-model="tableStore.table.params.searchValue"
placeholder="根据变电站,终端编号,型号或网络参数查询"
style="width: 300px"
/>
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
<Table ref='tableRef' /> <Table ref="tableRef" />
</div> </div>
</template> </template>
<script setup lang='tsx'> <script setup lang="tsx">
import { ref, onMounted, provide, reactive } from 'vue' import { ref, onMounted, provide, reactive } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
@@ -49,7 +63,7 @@ import { useDictData } from '@/stores/dictData'
import Area from '@/components/form/area/index.vue' import Area from '@/components/form/area/index.vue'
defineOptions({ defineOptions({
name: 'comptroller/list' name: 'voltage/sags/operationsManagement/index'
}) })
const dictData = useDictData() const dictData = useDictData()
const manufacturer = dictData.getBasicData('Dev_Manufacturers') const manufacturer = dictData.getBasicData('Dev_Manufacturers')
@@ -83,19 +97,19 @@ const tableStore = new TableStore({
return <span></span> return <span></span>
} else if (props.renderValue * 100 > 90) { } else if (props.renderValue * 100 > 90) {
return ( return (
<el-tag effect='dark' type='success'> <el-tag effect="dark" type="success">
</el-tag> </el-tag>
) )
} else if (props.renderValue * 100 > 60) { } else if (props.renderValue * 100 > 60) {
return ( return (
<el-tag effect='dark' type='warning'> <el-tag effect="dark" type="warning">
</el-tag> </el-tag>
) )
} else { } else {
return ( return (
<el-tag effect='dark' type='danger'> <el-tag effect="dark" type="danger">
</el-tag> </el-tag>
) )
@@ -121,14 +135,16 @@ onMounted(() => {
}) })
const onManufacturerChange = () => { const onManufacturerChange = () => {
tableStore.table.params.manufacturer = manufacturer.filter(item => { tableStore.table.params.manufacturer = manufacturer
return manufacturerForm.value.includes(item.id) .filter(item => {
}).map(item => { return manufacturerForm.value.includes(item.id)
return { })
...item, .map(item => {
label: item.name, return {
value: item.id ...item,
} label: item.name,
}) value: item.id
}
})
} }
</script> </script>

View File

@@ -1,50 +1,62 @@
<template> <template>
<div class='default-main'> <div class="default-main">
<TableHeader date-picker :showOperation='false'> <TableHeader date-picker :showOperation="false">
<template v-slot:select> <template v-slot:select>
<el-form-item label='区域'> <el-form-item label="区域"><Area v-model="tableStore.table.params.deptIndex" /></el-form-item>
<Area v-model='tableStore.table.params.deptIndex' /> <el-form-item label="干扰源类型">
</el-form-item> <el-select
<el-form-item label='干扰源类型'> multiple
<el-select multiple clearable collapse-tags v-model='interferenceSourceForm' placeholder='请选择' clearable
@change='onLoadTypeChange'> collapse-tags
<el-option v-model="interferenceSourceForm"
v-for='item in interferenceSource' placeholder="请选择"
:key='item.id' @change="onLoadTypeChange"
:label='item.name'
:value='item.id'
/>
</el-select>
</el-form-item>
<el-form-item label='电压等级'>
<el-select multiple clearable collapse-tags v-model='scaleForm' placeholder='请选择'
@change='onScaleChange'
> >
<el-option <el-option
v-for='item in level' v-for="item in interferenceSource"
:key='item.id' :key="item.id"
:label='item.name' :label="item.name"
:value='item.id' :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='通讯状态'> <el-form-item label="电压等级">
<el-select multiple clearable collapse-tags v-model='tableStore.table.params.comFlag' <el-select
placeholder='请选择'> multiple
<el-option label='正常' value='1' /> clearable
<el-option label='中断' value='0' /> collapse-tags
v-model="scaleForm"
placeholder="请选择"
@change="onScaleChange"
>
<el-option v-for="item in level" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='筛选数据'> <el-form-item label="通讯状态">
<el-input v-model='tableStore.table.params.searchValue' <el-select
placeholder='根据变电站,终端编号,型号或网络参数查询' style='width:300px' /> multiple
clearable
collapse-tags
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-input
v-model="tableStore.table.params.searchValue"
placeholder="根据变电站,终端编号,型号或网络参数查询"
style="width: 300px"
/>
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
<Table isGroup ref='tableRef' /> <Table isGroup ref="tableRef" />
</div> </div>
</template> </template>
<script setup lang='tsx'> <script setup lang="tsx">
import { ref, onMounted, provide, reactive } from 'vue' import { ref, onMounted, provide, reactive } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
@@ -53,7 +65,7 @@ import { useDictData } from '@/stores/dictData'
import Area from '@/components/form/area/index.vue' import Area from '@/components/form/area/index.vue'
defineOptions({ defineOptions({
name: 'comptroller/list' name: 'voltage/sags/operationsManagement/point'
}) })
const dictData = useDictData() const dictData = useDictData()
const interferenceSource = dictData.getBasicData('Interference_Source') const interferenceSource = dictData.getBasicData('Interference_Source')
@@ -72,54 +84,26 @@ const tableStore = new TableStore({
{ field: 'bdName', title: '所属变电站', width: 120 }, { field: 'bdName', title: '所属变电站', width: 120 },
{ field: 'loadType', title: '干扰源类型', width: 120 }, { field: 'loadType', title: '干扰源类型', width: 120 },
{ field: 'objName', title: '监测对象名称', width: 180 }, { field: 'objName', title: '监测对象名称', width: 180 },
{ { field: 'shortCapacity', title: '最小短路容量(MVA)', width: 190 },
field: 'shortCapacity', title: '最小短路容量(MVA)', width: 190 { field: 'devCapacity', title: '供电设备容量(MVA )', width: 190 },
}, { field: 'dealCapacity', title: '用户协议容量(MVA)', width: 190 },
{
field: 'devCapacity', title: '供电设备容量(MVA )', width: 190
},
{
field: 'dealCapacity', title: '用户协议容量(MVA)', width: 190
},
{ field: 'comFlag', title: '通讯状态 ', width: 120 }, { field: 'comFlag', title: '通讯状态 ', width: 120 },
{ field: 'id', title: '监测点序号', width: 120 }, { field: 'id', title: '监测点序号', width: 120 },
{ field: 'devName', title: '监测终端编号 ', width: 140 }, { field: 'devName', title: '监测终端编号 ', width: 140 },
{ field: 'ptType', title: '监测终端接线方式', width: 160 }, { field: 'ptType', title: '监测终端接线方式', width: 160 },
{ { field: 'voltageDev', title: '电压偏差上限(%)', width: 160 },
field: 'voltageDev', title: '电压偏差限(%)', width: 160 { field: 'uvoltageDev', title: '电压偏差限(%)', width: 160 },
},
{
field: 'uvoltageDev', title: '电压偏差下限(%)', width: 160
},
{ {
field: 'limitValue', field: 'limitValue',
title: '限值', title: '限值',
children: [{ field: 'freqDev', title: '频率(Hz)', width: 120 }, { children: [
field: 'ubalance', { field: 'freqDev', title: '频率(Hz)', width: 120 },
title: '三相电压不平衡度(%)', { field: 'ubalance', title: '三相电压不平衡度(%)', width: 190 },
width: 190 { field: 'ineg', title: '负序电流(A)', width: 120 },
{ field: 'flicker', title: '长时间闪变', width: 120 },
}, { field: 'ineg', title: '负序电流(A)', width: 120 }, { { field: 'uaberrance', title: '电压总谐波畸变率(%)', width: 190 },
field: 'flicker', { field: 'oddHarm', title: '奇数次谐波电压(%)', width: 180 },
title: '长时间闪变', { field: 'evenHarm', title: '偶数次谐波电压(%)', width: 180 }
width: 120
}, {
field: 'uaberrance', title: '电压总谐波畸变率(%)', width: 190
},
{
field: 'oddHarm',
title: '奇数次谐波电压(%)',
width: 180
},
{
field: 'evenHarm',
title: '偶数次谐波电压(%)',
width: 180
}
] ]
}, },
{ {
@@ -135,57 +119,23 @@ const tableStore = new TableStore({
{ field: 'iharm8', title: '8次谐波(A)', width: 120 }, { field: 'iharm8', title: '8次谐波(A)', width: 120 },
{ field: 'iharm9', title: '9次谐波(A)', width: 120 }, { field: 'iharm9', title: '9次谐波(A)', width: 120 },
{ field: 'iharm10', title: '10次谐波(A)', width: 140 }, { field: 'iharm10', title: '10次谐波(A)', width: 140 },
{ { field: 'iharm11', title: '11次谐波(A)', width: 140 },
field: 'iharm11', title: '11次谐波(A)', width: 140 { field: 'iharm12', title: '12次谐波(A)', width: 140 },
}, { field: 'iharm13', title: '13次谐波(A)', width: 140 },
{ { field: 'iharm14', title: '14次谐波(A)', width: 140 },
field: 'iharm12', title: '12次谐波(A)', width: 140 { field: 'iharm15', title: '15次谐波(A)', width: 140 },
}, { field: 'iharm16', title: '16次谐波(A)', width: 140 },
{ { field: 'iharm17', title: '17次谐波(A)', width: 140 },
field: 'iharm13', title: '13次谐波(A)', width: 140 { field: 'iharm18', title: '18次谐波(A)', width: 140 },
}, { field: 'iharm19', title: '19次谐波(A)', width: 140 },
{ { field: 'iharm10', title: '20次谐波(A)', width: 140 },
field: 'iharm14', title: '14次谐波(A)', width: 140 { field: 'iharm21', title: '21次谐波(A)', width: 140 },
}, { field: 'iharm22', title: '22次谐波(A)', width: 140 },
{ { field: 'iharm23', title: '23次谐波(A)', width: 140 },
field: 'iharm15', title: '15次谐波(A)', width: 140 { field: 'iharm24', title: '24次谐波(A)', width: 140 },
}, { field: 'iharm25', title: '25次谐波(A)', width: 140 },
{ { field: 'inUharm', title: '0.5-1.5次间谐波(A)', width: 180 },
field: 'iharm16', title: '16次谐波(A)', width: 140 { field: 'inUharm16', title: '2.5-15.5次间谐波(A)', width: 190 }
},
{
field: 'iharm17', title: '17次谐波(A)', width: 140
},
{
field: 'iharm18', title: '18次谐波(A)', width: 140
},
{
field: 'iharm19', title: '19次谐波(A)', width: 140
},
{
field: 'iharm10', title: '20次谐波(A)', width: 140
},
{
field: 'iharm21', title: '21次谐波(A)', width: 140
},
{
field: 'iharm22', title: '22次谐波(A)', width: 140
},
{
field: 'iharm23', title: '23次谐波(A)', width: 140
},
{
field: 'iharm24', title: '24次谐波(A)', width: 140
},
{
field: 'iharm25', title: '25次谐波(A)', width: 140
},
{
field: 'inUharm', title: '0.5-1.5次间谐波(A)', width: 180
},
{
field: 'inUharm16', title: '2.5-15.5次间谐波(A)', width: 190
}
] ]
} }
], ],
@@ -208,25 +158,21 @@ onMounted(() => {
}) })
const onLoadTypeChange = () => { const onLoadTypeChange = () => {
tableStore.table.params.loadType = interferenceSource.filter(item => { tableStore.table.params.loadType = interferenceSource
return interferenceSourceForm.value.includes(item.id) .filter(item => {
}).map(item => { return interferenceSourceForm.value.includes(item.id)
return { })
...item, .map(item => {
label: item.name, return { ...item, label: item.name, value: item.id }
value: item.id })
}
})
} }
const onScaleChange = () => { const onScaleChange = () => {
tableStore.table.params.scale = level.filter(item => { tableStore.table.params.scale = level
return scaleForm.value.includes(item.id) .filter(item => {
}).map(item => { return scaleForm.value.includes(item.id)
return { })
...item, .map(item => {
label: item.name, return { ...item, label: item.name, value: item.id }
value: item.id })
}
})
} }
</script> </script>