Files
admin-sjzx/src/views/pqs/runManage/assessment/components/uese/tabFrom.vue

458 lines
14 KiB
Vue
Raw Normal View History

2025-06-17 15:48:22 +08:00
<template>
2025-08-26 11:07:11 +08:00
<el-collapse-item :title="item.name" v-for="(item, index) in column" :key="index" :name="index + 3" >
2025-06-17 15:48:22 +08:00
<div class="mb10">
2025-08-26 11:07:11 +08:00
<el-button
type="primary"
size="small"
icon="el-icon-Plus"
@click="addFform(item)"
:disabled="item.key === 'capacitorList' && props.isWithCapacitor === '00' || props.disabled"
>
新增</el-button>
<el-button
type="primary"
size="small"
icon="el-icon-Delete"
@click="deleteFform(item, index)"
:disabled="item.key === 'capacitorList' && props.isWithCapacitor === '00' || props.disabled"
>
2025-06-18 16:39:28 +08:00
删除
</el-button>
2025-06-17 15:48:22 +08:00
</div>
2025-06-18 16:39:28 +08:00
<div style="height: 250px">
<vxe-table
height="auto"
ref="xTableRef"
:data="dataList[item.key]"
v-bind="defaultAttribute"
v-loading="item.loading"
>
2025-06-17 15:48:22 +08:00
<vxe-column type="checkbox" width="60"></vxe-column>
2025-08-11 16:13:51 +08:00
<vxe-column type="seq" title="序号" width="80px"></vxe-column>
2025-06-17 15:48:22 +08:00
<vxe-column
v-for="(k, index) in item.child"
:key="index"
:field="k.field"
:title="k.title"
:formatter="formatter"
2025-08-26 11:07:11 +08:00
2025-06-17 15:48:22 +08:00
></vxe-column>
<vxe-column title="操作" width="150px">
<template #default="{ row }">
2025-08-26 11:07:11 +08:00
<el-button
type="text"
@click="edit(item, row)"
:disabled="item.key === 'capacitorList' && props.isWithCapacitor === '00' || props.disabled"
>
编辑</el-button>
2025-06-17 15:48:22 +08:00
</template>
</vxe-column>
</vxe-table>
</div>
</el-collapse-item>
<!-- 新增 -->
2025-06-18 16:39:28 +08:00
<addform ref="addformRef" @init="info" />
2025-06-17 15:48:22 +08:00
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import addform from './addform.vue'
2025-06-18 16:39:28 +08:00
import { useDictData } from '@/stores/dictData'
import {
assessTransformerParamList,
transformerList,
2025-07-10 16:32:49 +08:00
characteristicList,
2025-06-18 16:39:28 +08:00
assessTransformerParamDelete,
capacitorList,
capacitorDelete,
windPowerList,
2025-07-10 16:32:49 +08:00
windPowerDelete,
loadParamList,
loadParamDelete,
shockList,
2025-08-26 11:07:11 +08:00
shockDelete,
loadList
2025-06-18 16:39:28 +08:00
} from '@/api/advance-boot/assess'
2025-06-17 15:48:22 +08:00
import { defaultAttribute } from '@/components/table/defaultAttribute'
2025-06-18 16:39:28 +08:00
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
2025-06-17 15:48:22 +08:00
const props = defineProps({
2025-08-26 11:07:11 +08:00
assessId: {
type: String,
required: true
},
isWindfarm: {
type: String,
default: ''
},
isWithCapacitor:{
type: String,
default: ''
},
disabled: { // 定义 disabled prop
type: Boolean,
required: false,
default: false
}
2025-06-17 15:48:22 +08:00
})
2025-06-18 16:39:28 +08:00
const dictData = useDictData()
//字典获取电压等级
const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand')
const transformer: any = ref([])
2025-07-10 16:32:49 +08:00
const characteristic: any = ref([])
2025-08-26 11:07:11 +08:00
const shockRef: any = ref([])
2025-06-17 15:48:22 +08:00
const addformRef = ref()
2025-06-18 16:39:28 +08:00
const xTableRef = ref()
2025-06-17 15:48:22 +08:00
const column: any = ref([
{
2025-06-18 16:39:28 +08:00
loading: false,
2025-06-17 15:48:22 +08:00
name: '变压器参数维护',
key: 'transformerList',
child: [
{
2025-08-26 11:07:11 +08:00
2025-06-17 15:48:22 +08:00
title: '用户变压器名称',
field: 'transName'
},
{
title: '变压器型号',
field: 'transtypeId'
},
{
title: '变压器台数',
field: 'transNum'
}
]
},
{
2025-06-18 16:39:28 +08:00
loading: false,
2025-06-17 15:48:22 +08:00
name: '电容器组参数维护',
key: 'capacitorList',
child: [
{
title: '用户电容器名称',
2025-06-18 16:39:28 +08:00
field: 'capacitorName'
2025-06-17 15:48:22 +08:00
},
{
title: '电容器组数量',
2025-06-18 16:39:28 +08:00
field: 'capacitorNum'
2025-06-17 15:48:22 +08:00
},
{
title: '单组容量(kVar)',
2025-06-18 16:39:28 +08:00
field: 'capacitorCapacity'
2025-06-17 15:48:22 +08:00
},
{
title: '电抗率(%)',
2025-06-18 16:39:28 +08:00
field: 'capacitorReactance'
2025-06-17 15:48:22 +08:00
},
{
title: '电压等级',
2025-06-18 16:39:28 +08:00
field: 'capacitorScale'
2025-06-17 15:48:22 +08:00
}
]
},
{
2025-06-18 16:39:28 +08:00
loading: false,
2025-06-17 15:48:22 +08:00
name: '风电参数',
2025-06-18 16:39:28 +08:00
2025-06-17 15:48:22 +08:00
key: 'windPowerList',
child: [
{
title: '风机名称',
2025-07-10 16:32:49 +08:00
field: 'windgeneratorName'
2025-06-17 15:48:22 +08:00
},
{
2025-07-10 16:32:49 +08:00
title: '闪变系数',
field: 'flickerCoeff'
2025-06-17 15:48:22 +08:00
},
{
2025-07-10 16:32:49 +08:00
title: '额定视在功率(kVA)',
field: 's'
2025-06-17 15:48:22 +08:00
}
]
},
{
2025-06-18 16:39:28 +08:00
loading: false,
2025-06-17 15:48:22 +08:00
name: '用户负荷',
2025-06-18 16:39:28 +08:00
2025-06-17 15:48:22 +08:00
key: 'loadList',
child: [
{
2025-07-10 16:32:49 +08:00
title: '负荷名称',
field: 'loadName'
2025-06-17 15:48:22 +08:00
},
{
title: '进线电压',
2025-07-10 16:32:49 +08:00
field: 'linevoltageScale'
2025-06-17 15:48:22 +08:00
},
{
title: '配变容量(kVA)',
2025-07-10 16:32:49 +08:00
field: 'transhighCapacity'
2025-06-17 15:48:22 +08:00
},
{
title: '配电变压器阻抗(%)',
2025-07-10 16:32:49 +08:00
field: 'transImpedance'
2025-06-17 15:48:22 +08:00
},
{
title: '谐波源特性',
2025-07-10 16:32:49 +08:00
field: 'harmId'
2025-06-17 15:48:22 +08:00
},
{
title: '配变低压侧电压',
2025-07-10 16:32:49 +08:00
field: 'translowScale'
2025-06-17 15:48:22 +08:00
},
{
title: '非线性负荷功率(kW)',
2025-07-10 16:32:49 +08:00
field: 'nonlinearloadPower'
2025-06-17 15:48:22 +08:00
},
{
2025-07-10 16:32:49 +08:00
title: '功率因数',
field: 'powerFactor'
2025-06-17 15:48:22 +08:00
}
]
},
{
2025-06-18 16:39:28 +08:00
loading: false,
2025-07-10 16:32:49 +08:00
name: '冲击负荷',
2025-06-18 16:39:28 +08:00
2025-06-17 15:48:22 +08:00
key: 'impactList',
child: [
{
title: '冲击负荷类型',
2025-07-10 16:32:49 +08:00
field: 'inpactloadtypeId'
2025-06-17 15:48:22 +08:00
},
2025-08-26 11:07:11 +08:00
{
title: '启动方式',
field: 'inpactloadStartup',
},
2025-08-11 16:13:51 +08:00
2025-06-17 15:48:22 +08:00
{
title: '数量',
2025-07-10 16:32:49 +08:00
field: 'inpactloadNum'
2025-06-17 15:48:22 +08:00
},
{
2025-07-10 16:32:49 +08:00
title: '容量',
field: 'inpactloadPower'
2025-06-17 15:48:22 +08:00
},
2025-07-10 16:32:49 +08:00
2025-06-17 15:48:22 +08:00
{
2025-07-10 16:32:49 +08:00
title: '是否隔离变',
field: 'isIsolationtrans'
2025-06-17 15:48:22 +08:00
},
{
2025-07-10 16:32:49 +08:00
title: '隔离变阻抗(%)',
field: 'isolationtransImpedance'
2025-06-17 15:48:22 +08:00
},
{
2025-07-10 16:32:49 +08:00
title: '高压侧电压',
field: 'inpactloadhighScale'
2025-06-17 15:48:22 +08:00
},
{
title: '低压侧电压',
2025-07-10 16:32:49 +08:00
field: 'inpactloadlowScale'
2025-06-17 15:48:22 +08:00
},
{
2025-07-10 16:32:49 +08:00
title: '负荷频度',
2025-08-26 11:07:11 +08:00
field: 'inpactloadFreq',
2025-06-17 15:48:22 +08:00
},
{
title: '闪变叠加系数',
2025-07-10 16:32:49 +08:00
field: 'flickerCoeff'
2025-06-17 15:48:22 +08:00
}
]
}
])
2025-08-26 11:07:11 +08:00
const filteredColumn = computed(() => {
// const windfarmValue = props.isWindfarm;
// if (windfarmValue === '01') {
// // 如果是风电场,显示除冲击负荷外的所有项
// return column.value.filter((item: any) => item.key !== 'impactList')
// } else {
// // 如果不是风电场,显示除风电参数外的所有项
// return column.value.filter((item: any) => item.key !== 'windPowerList')
// }
})
2025-06-17 15:48:22 +08:00
const dataList = ref({
transformerList: [], //变压器参数维护
capacitorList: [], //电容器
windPowerList: [], //风电
loadList: [], //用户负荷
impactList: [] //冲击性负荷
})
// 新增
const addFform = (item: any) => {
addformRef.value.open({
title: '新增',
item: item,
2025-06-18 16:39:28 +08:00
assessId: props.assessId
})
}
// 删除
const deleteFform = (item: any, i: any) => {
if (xTableRef.value[i].getCheckboxRecords().length == 0) {
return ElMessage({
type: 'warning',
message: '请选择要删除的数据'
})
}
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
2025-07-10 16:32:49 +08:00
}).then(async () => {
2025-06-18 16:39:28 +08:00
if (i == 0) {
2025-07-10 16:32:49 +08:00
await assessTransformerParamDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.transId)).then(
2025-06-18 16:39:28 +08:00
res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
}
)
} else if (i == 1) {
2025-07-10 16:32:49 +08:00
await capacitorDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.capacitorId)).then(res => {
2025-06-18 16:39:28 +08:00
ElMessage({
type: 'success',
message: '删除成功!'
})
})
} else if (i == 2) {
2025-07-10 16:32:49 +08:00
await windPowerDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.windgeneratorId)).then(
res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
}
)
} else if (i == 3) {
await loadParamDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.loadId)).then(res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
})
} else if (i == 4) {
await shockDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.inpactloadId)).then(res => {
2025-06-18 16:39:28 +08:00
ElMessage({
type: 'success',
message: '删除成功!'
})
})
}
2025-07-10 16:32:49 +08:00
info(i)
2025-06-17 15:48:22 +08:00
})
}
// 编辑
const edit = (item: any, row: any) => {
addformRef.value.open({
title: '编辑',
item: item,
2025-06-18 16:39:28 +08:00
row: row
2025-06-17 15:48:22 +08:00
})
}
2025-06-18 16:39:28 +08:00
const info = async (i: number) => {
2025-08-26 11:07:11 +08:00
//column.value[i].loading = true
2025-06-18 16:39:28 +08:00
if (i == 0) {
// 变压器参数维护
await assessTransformerParamList({ assessId: props.assessId }).then(res => {
dataList.value.transformerList = res.data
})
} else if (i == 1) {
2025-07-10 16:32:49 +08:00
// 电容器参数维护
2025-06-18 16:39:28 +08:00
await capacitorList({ assessId: props.assessId }).then(res => {
dataList.value.capacitorList = res.data
})
} else if (i == 2) {
2025-07-10 16:32:49 +08:00
// 风电参数
2025-06-18 16:39:28 +08:00
await windPowerList({ assessId: props.assessId }).then(res => {
dataList.value.windPowerList = res.data
})
2025-07-10 16:32:49 +08:00
} else if (i == 3) {
// 用户负荷参数
await loadParamList({ assessId: props.assessId }).then(res => {
dataList.value.loadList = res.data
})
} else if (i == 4) {
// 冲击性负荷
2025-08-26 11:07:11 +08:00
await shockList({ assessId: props.assessId }).then((res: { data: never[] }) => {
2025-07-10 16:32:49 +08:00
dataList.value.impactList = res.data
})
2025-06-18 16:39:28 +08:00
}
column.value[i].loading = false
2025-08-26 11:07:11 +08:00
2025-06-17 15:48:22 +08:00
}
2025-08-26 11:07:11 +08:00
const typeId = ref(null)
2025-07-10 16:32:49 +08:00
// 过滤数据
const formatter = (row: any) => {
if (row.column.field == 'transtypeId') {
const found = transformer.value.find((item: any) => item.transtypeId == row.cellValue)
return found.transtypeName || '' // 使用可选链并提供默认值
2025-08-26 11:07:11 +08:00
}else if(row.column.field =='inpactloadtypeId'){
const found = shockRef.value.find((item: any) => item.inpactloadtypeId == row.cellValue)
typeId.value = found.inpactloadtypeId
return found.inpactloadtypeName|| '' // 使用可选链并提供默认值
}else if(row.column.field =='inpactloadStartup'){
const found = shockRef.value.find((item: any) => item.inpactloadtypeId == typeId.value)
return found.inpactloadStartup
}
else if(row.column.field == 'isIsolationtrans'){
return row.cellValue == '01' ? '是' : '否'
}else if(row.column.field =='inpactloadFreq'){
if(row.cellValue == '01'){
return 'N≤4次/d'
}else if(row.cellValue == '02'){
return 'N>4次/d且N≤2次/h'
}else{
return '2次/h<N≤10次/h'
}
}
else if (row.column.field == 'harmId') {
2025-07-10 16:32:49 +08:00
const found = characteristic.value.find((item: any) => item.harmId == row.cellValue)
return found.harmName || '' // 使用可选链并提供默认值
} else if (
row.column.field == 'capacitorScale' ||
row.column.field == 'linevoltageScale' ||
2025-08-11 16:13:51 +08:00
row.column.field == 'translowScale' ||
row.column.field == 'inpactloadhighScale'|| row.column.field == 'inpactloadlowScale'
2025-07-10 16:32:49 +08:00
) {
const found = voltageleveloption.find((item: any) => item.id == row.cellValue)
2025-08-11 16:13:51 +08:00
return found?.name || ''
2025-07-10 16:32:49 +08:00
} else {
return row.cellValue
}
}
2025-06-17 15:48:22 +08:00
// 字典
const dictionary = () => {
// 获取变压器参数字典列表
transformerList({}).then((res: any) => {
transformer.value = res.data
})
2025-07-10 16:32:49 +08:00
// 谐波源特特性
characteristicList({}).then((res: any) => {
characteristic.value = res.data
})
2025-08-26 11:07:11 +08:00
//冲击负荷类型
loadList({}).then((res: any) => {
shockRef.value = res.data
})
2025-06-17 15:48:22 +08:00
}
2025-06-18 16:39:28 +08:00
onMounted(async () => {
await dictionary()
info(0) // 变压器参数维护
2025-07-10 16:32:49 +08:00
info(1) // 电容器参数维护
info(2) // 风电参数
info(3) // 用户负荷
info(4) // 冲击性负荷
2025-06-17 15:48:22 +08:00
})
</script>
<style lang="scss" scoped></style>