联调二级评估新增功能

This commit is contained in:
guanj
2025-06-18 16:39:28 +08:00
parent 49b476ebc8
commit 226031a451
4 changed files with 269 additions and 242 deletions

View File

@@ -2,11 +2,19 @@
<el-collapse-item :title="item.name" v-for="(item, index) in column" :key="index" :name="index + 3">
<div class="mb10">
<el-button type="primary" size="small" icon="el-icon-Plus" @click="addFform(item)">新增</el-button>
<el-button type="primary" size="small" icon="el-icon-Delete">删除</el-button>
<el-button type="primary" size="small" icon="el-icon-Download">导出</el-button>
<el-button type="primary" size="small" icon="el-icon-Delete" @click="deleteFform(item, index)">
删除
</el-button>
<!-- <el-button type="primary" size="small" icon="el-icon-Download">导出</el-button> -->
</div>
<div style="height: 200px">
<vxe-table height="auto" :data="dataList[item.key]" v-bind="defaultAttribute">
<div style="height: 250px">
<vxe-table
height="auto"
ref="xTableRef"
:data="dataList[item.key]"
v-bind="defaultAttribute"
v-loading="item.loading"
>
<vxe-column type="checkbox" width="60"></vxe-column>
<vxe-column type="seq" title="序号" width="60px"></vxe-column>
@@ -26,20 +34,37 @@
</div>
</el-collapse-item>
<!-- 新增 -->
<addform ref="addformRef" />
<addform ref="addformRef" @init="info" />
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import addform from './addform.vue'
import { assessTransformerParamList, transformerList } from '@/api/advance-boot/assess'
import { useDictData } from '@/stores/dictData'
import {
assessTransformerParamList,
transformerList,
assessTransformerParamDelete,
capacitorList,
capacitorDelete,
windPowerList,
windPowerDelete
} from '@/api/advance-boot/assess'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
const props = defineProps({
assessId: { type: String, required: true }
})
const transformer = ref([])
const dictData = useDictData()
//字典获取电压等级
const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand')
const transformer: any = ref([])
const addformRef = ref()
const xTableRef = ref()
const column: any = ref([
{
loading: false,
name: '变压器参数维护',
key: 'transformerList',
child: [
@@ -58,33 +83,37 @@ const column: any = ref([
]
},
{
loading: false,
name: '电容器组参数维护',
key: 'capacitorList',
child: [
{
title: '用户电容器名称',
field: 'name'
field: 'capacitorName'
},
{
title: '电容器组数量',
field: 'name1'
field: 'capacitorNum'
},
{
title: '单组容量(kVar)',
field: 'name2'
field: 'capacitorCapacity'
},
{
title: '电抗率(%)',
field: 'name3'
field: 'capacitorReactance'
},
{
title: '电压等级',
field: 'name4'
field: 'capacitorScale'
}
]
},
{
loading: false,
name: '风电参数',
key: 'windPowerList',
child: [
{
@@ -102,7 +131,9 @@ const column: any = ref([
]
},
{
loading: false,
name: '用户负荷',
key: 'loadList',
child: [
{
@@ -140,7 +171,9 @@ const column: any = ref([
]
},
{
loading: false,
name: '冲击性负荷',
key: 'impactList',
child: [
{
@@ -202,8 +235,49 @@ const addFform = (item: any) => {
addformRef.value.open({
title: '新增',
item: item,
assessId: props.assessId,
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'
}).then(() => {
if (i == 0) {
assessTransformerParamDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.transId)).then(
res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
info(i)
}
)
} else if (i == 1) {
capacitorDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.capacitorId)).then(res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
info(i)
})
} else if (i == 2) {
windPowerDelete(xTableRef.value[i].getCheckboxRecords().map(item => item.windgeneratorId)).then(res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
info(i)
})
}
})
}
// 编辑
@@ -211,25 +285,42 @@ const edit = (item: any, row: any) => {
addformRef.value.open({
title: '编辑',
item: item,
row: row,
assessId: props.assessId
row: row
})
}
// 过滤数据
const formatter = (row: any) => {
if (row.column.field == 'transtypeId') {
return transformer.value.find(item => item.transtypeId == row.cellValue)?.transtypeName
const found = transformer.value.find((item: any) => item.transtypeId == row.cellValue)
return found.transtypeName || '' // 使用可选链并提供默认值
} else if (row.column.field == 'capacitorScale') {
const found = voltageleveloption.find((item: any) => item.id == row.cellValue)
return found.name || ''
} else {
return row.cellValue
}
}
const info = () => {
assessTransformerParamList({ assessId: props.assessId }).then(res => {
dataList.value.transformerList = res.data
})
const info = async (i: number) => {
column.value[i].loading = true
if (i == 0) {
// 变压器参数维护
await assessTransformerParamList({ assessId: props.assessId }).then(res => {
dataList.value.transformerList = res.data
})
} else if (i == 1) {
await capacitorList({ assessId: props.assessId }).then(res => {
dataList.value.capacitorList = res.data
})
} else if (i == 2) {
await windPowerList({ assessId: props.assessId }).then(res => {
dataList.value.windPowerList = res.data
})
}
column.value[i].loading = false
}
// 字典
const dictionary = () => {
// 获取变压器参数字典列表
@@ -237,9 +328,12 @@ const dictionary = () => {
transformer.value = res.data
})
}
onMounted(() => {
dictionary()
info()
onMounted(async () => {
await dictionary()
info(0) // 变压器参数维护
info(1) // 变压器参数维护
info(2) // 变压器参数维护
// info(3) // 变压器参数维护
})
</script>
<style lang="scss" scoped></style>