2024-03-04 20:33:32 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="default-main">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<TableHeader datePicker ref="TableHeaderRef">
|
|
|
|
|
|
<template #select>
|
|
|
|
|
|
<el-form-item label="用户类型">
|
2024-03-21 20:13:25 +08:00
|
|
|
|
<el-select v-model="tableStore.table.params.userType" clearable placeholder="请选择用户类型">
|
2024-03-06 20:37:36 +08:00
|
|
|
|
<el-option v-for="item in uesrList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
|
</el-select>
|
2024-03-04 20:33:32 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #operation>
|
|
|
|
|
|
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</TableHeader>
|
|
|
|
|
|
<Table ref="tableRef" />
|
2024-04-01 11:16:28 +08:00
|
|
|
|
<el-dialog draggable v-model="dialogVisible" :title="title" width="600" :before-close="handleClose">
|
2024-03-07 19:02:49 +08:00
|
|
|
|
<el-form ref="ruleFormRef" :model="form" label-width="180px" :disabled="disabled" :rules="rules">
|
2024-03-06 20:37:36 +08:00
|
|
|
|
<el-form-item label="用户名称:" prop="userName">
|
|
|
|
|
|
<el-input v-model="form.userName" clearable placeholder="请输入用户名称" />
|
2024-03-04 20:33:32 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="用户类型:" prop="userType">
|
2024-03-21 20:13:25 +08:00
|
|
|
|
<el-select v-model="form.userType" clearable placeholder="请选择用户类型" @change="useChange">
|
2024-03-04 20:33:32 +08:00
|
|
|
|
<el-option v-for="item in uesrList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
2024-03-06 20:37:36 +08:00
|
|
|
|
<el-form-item label="电压等级:" prop="voltage">
|
|
|
|
|
|
<el-select v-model="form.voltage" clearable collapse-tags placeholder="请选择电压等级">
|
2024-03-04 20:33:32 +08:00
|
|
|
|
<el-option v-for="item in levelList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
2024-03-07 19:02:49 +08:00
|
|
|
|
<el-form-item
|
2024-03-28 15:21:58 +08:00
|
|
|
|
:label="userShow == 'Power_Station_Users' ? '拟接入容量(MVA):' : '用户协议容量(MVA):'"
|
2024-03-07 19:02:49 +08:00
|
|
|
|
prop="protocolCapacity"
|
|
|
|
|
|
>
|
|
|
|
|
|
<!-- <el-input v-model="form.protocolCapacity" clearable placeholder="请输入用户协议容量" /> -->
|
|
|
|
|
|
<el-input-number
|
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
|
v-model="form.protocolCapacity"
|
|
|
|
|
|
:min="0"
|
|
|
|
|
|
placeholder="请输入用容量"
|
|
|
|
|
|
/>
|
2024-03-04 20:33:32 +08:00
|
|
|
|
</el-form-item>
|
2024-03-07 19:02:49 +08:00
|
|
|
|
|
|
|
|
|
|
<el-form-item label="区域" prop="regionList">
|
|
|
|
|
|
<el-cascader v-model="form.regionList" style="width: 100%" :props="props" :options="areaList" />
|
2024-03-04 20:33:32 +08:00
|
|
|
|
</el-form-item>
|
2024-03-07 19:02:49 +08:00
|
|
|
|
<el-form-item label="详细地址:" prop="area">
|
2024-03-04 20:33:32 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
clearable
|
2024-03-07 19:02:49 +08:00
|
|
|
|
v-model="form.area"
|
2024-03-04 20:33:32 +08:00
|
|
|
|
:autosize="{ minRows: 2, maxRows: 4 }"
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
placeholder="请输入详细地址"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
<template #footer v-if="!disabled">
|
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
|
<el-button @click="handleClose">取消</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="onSubmit">确定</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
2024-03-21 20:13:25 +08:00
|
|
|
|
<!-- 设备 -->
|
|
|
|
|
|
<equipment ref="equipmentRef" />
|
2024-03-04 20:33:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
2024-03-07 19:02:49 +08:00
|
|
|
|
import { ref, onMounted, provide, nextTick } from 'vue'
|
2024-03-04 20:33:32 +08:00
|
|
|
|
import TableStore from '@/utils/tableStore'
|
|
|
|
|
|
import Table from '@/components/table/index.vue'
|
|
|
|
|
|
import TableHeader from '@/components/table/header/index.vue'
|
|
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
import { mainHeight } from '@/utils/layout'
|
|
|
|
|
|
import { useDictData } from '@/stores/dictData'
|
2024-03-21 20:13:25 +08:00
|
|
|
|
import equipment from './equipment.vue'
|
2024-03-06 20:37:36 +08:00
|
|
|
|
import { addUse, updateUse, removeUse } from '@/api/advance-boot/bearingCapacity'
|
2024-03-04 20:33:32 +08:00
|
|
|
|
defineOptions({
|
2024-03-12 11:16:54 +08:00
|
|
|
|
name: 'estimate/photovoltaic'
|
2024-03-04 20:33:32 +08:00
|
|
|
|
})
|
|
|
|
|
|
const dictData = useDictData()
|
|
|
|
|
|
const levelList = dictData.getBasicData('Dev_Voltage_Stand')
|
2024-03-07 19:02:49 +08:00
|
|
|
|
const uesrList = dictData.getBasicData('CARRY_CAPCITY_USER_TYPE')
|
2024-03-04 20:33:32 +08:00
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
|
const disabled = ref(false)
|
|
|
|
|
|
const TableHeaderRef = ref()
|
2024-03-21 20:13:25 +08:00
|
|
|
|
const equipmentRef = ref()
|
2024-03-04 20:33:32 +08:00
|
|
|
|
const title = ref('')
|
2024-03-07 19:02:49 +08:00
|
|
|
|
const areaList: any = dictData.areaSelect()
|
|
|
|
|
|
const userShow: any = ref('Power_Station_Users')
|
2024-03-28 15:21:58 +08:00
|
|
|
|
|
|
|
|
|
|
const form = ref({
|
2024-03-06 20:37:36 +08:00
|
|
|
|
area: '',
|
|
|
|
|
|
city: '',
|
|
|
|
|
|
province: '',
|
2024-03-07 19:02:49 +08:00
|
|
|
|
protocolCapacity: 0,
|
2024-03-06 20:37:36 +08:00
|
|
|
|
region: '',
|
|
|
|
|
|
userName: '',
|
|
|
|
|
|
userType: '',
|
2024-03-07 19:02:49 +08:00
|
|
|
|
voltage: '',
|
|
|
|
|
|
regionList: []
|
2024-03-04 20:33:32 +08:00
|
|
|
|
})
|
|
|
|
|
|
const rules = {
|
2024-03-06 20:37:36 +08:00
|
|
|
|
userName: [{ required: true, message: '请输入用户名称', trigger: 'blur' }],
|
2024-03-04 20:33:32 +08:00
|
|
|
|
userType: [{ required: true, message: '请选择用户类型', trigger: 'change' }],
|
2024-03-06 20:37:36 +08:00
|
|
|
|
voltage: [{ required: true, message: '请选择电压等级', trigger: 'change' }],
|
2024-03-07 19:02:49 +08:00
|
|
|
|
protocolCapacity: [{ required: true, message: '请输入容量', trigger: 'change' }],
|
|
|
|
|
|
regionList: [{ required: true, message: '请选择区域', trigger: 'change' }],
|
2024-03-04 20:33:32 +08:00
|
|
|
|
mav2: [{ required: true, message: '请输入拟接入容量', trigger: 'blur' }],
|
2024-03-07 19:02:49 +08:00
|
|
|
|
area: [{ required: true, message: '请输入详细地址', trigger: 'blur' }]
|
2024-03-04 20:33:32 +08:00
|
|
|
|
}
|
2024-03-07 19:02:49 +08:00
|
|
|
|
const props = { label: 'name', value: 'id' }
|
2024-03-04 20:33:32 +08:00
|
|
|
|
const ruleFormRef = ref()
|
2024-03-21 20:13:25 +08:00
|
|
|
|
const tableStore: any = new TableStore({
|
2024-03-06 20:37:36 +08:00
|
|
|
|
url: '/advance-boot/carrycapacityuser/queyDetailUser',
|
2024-03-12 11:16:54 +08:00
|
|
|
|
// url: '/hzj/carrycapacityuser/queyDetailUser',
|
2024-03-04 20:33:32 +08:00
|
|
|
|
method: 'POST',
|
|
|
|
|
|
column: [
|
2024-03-07 19:02:49 +08:00
|
|
|
|
// { width: '60', type: 'checkbox' },
|
2024-03-04 20:33:32 +08:00
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'index',
|
|
|
|
|
|
title: '序号',
|
|
|
|
|
|
width: '60',
|
|
|
|
|
|
formatter: (row: any) => {
|
|
|
|
|
|
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-03-07 19:02:49 +08:00
|
|
|
|
{ field: 'userName', title: '用户名称' },
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'userType',
|
|
|
|
|
|
title: '用户类型',
|
|
|
|
|
|
formatter: (row: any) => {
|
|
|
|
|
|
return uesrList.filter(item => item.id == row.cellValue)[0].name
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-03-04 20:33:32 +08:00
|
|
|
|
|
2024-03-28 15:21:58 +08:00
|
|
|
|
// { field: 'area', title: '所属区域' },
|
2024-03-07 19:02:49 +08:00
|
|
|
|
{
|
|
|
|
|
|
field: 'voltage',
|
|
|
|
|
|
title: '电压等级(V)',
|
|
|
|
|
|
formatter: (row: any) => {
|
|
|
|
|
|
return levelList.filter(item => item.id == row.cellValue)[0].name
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'protocolCapacity',
|
|
|
|
|
|
title: '用户协议容量(MVA)',
|
|
|
|
|
|
formatter: (row: any) => {
|
2024-03-12 11:16:54 +08:00
|
|
|
|
return uesrList.filter(item => item.id == row.row.userType)[0].code != 'Power_Station_Users'
|
2024-03-07 19:02:49 +08:00
|
|
|
|
? row.cellValue
|
|
|
|
|
|
: '/'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'protocolCapacity',
|
|
|
|
|
|
title: '拟接入容量(MVA)',
|
|
|
|
|
|
formatter: (row: any) => {
|
2024-03-12 11:16:54 +08:00
|
|
|
|
return uesrList.filter(item => item.id == row.row.userType)[0].code == 'Power_Station_Users'
|
2024-03-07 19:02:49 +08:00
|
|
|
|
? row.cellValue
|
|
|
|
|
|
: '/'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{ field: 'area', title: '详细地址' },
|
|
|
|
|
|
{ field: 'createBy', title: '创建者' },
|
|
|
|
|
|
{ field: 'createTime', title: '创建日期' },
|
2024-03-04 20:33:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '操作',
|
|
|
|
|
|
width: '180',
|
|
|
|
|
|
render: 'buttons',
|
|
|
|
|
|
buttons: [
|
2024-03-21 20:13:25 +08:00
|
|
|
|
{
|
|
|
|
|
|
name: 'edit',
|
|
|
|
|
|
title: '设备 ',
|
|
|
|
|
|
type: 'primary',
|
|
|
|
|
|
icon: 'el-icon-Plus',
|
|
|
|
|
|
render: 'basicButton',
|
|
|
|
|
|
click: row => {
|
|
|
|
|
|
equipmentRef.value.open(row)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-03-04 20:33:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
name: 'edit',
|
|
|
|
|
|
title: '查看',
|
|
|
|
|
|
type: 'primary',
|
|
|
|
|
|
|
|
|
|
|
|
icon: 'el-icon-Plus',
|
|
|
|
|
|
render: 'basicButton',
|
|
|
|
|
|
click: row => {
|
|
|
|
|
|
disabled.value = true
|
2024-03-07 19:02:49 +08:00
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
|
dialogVisible.value = true
|
2024-03-04 20:33:32 +08:00
|
|
|
|
title.value = '查看承载能力预评估用户'
|
|
|
|
|
|
form.value = JSON.parse(JSON.stringify(row))
|
2024-03-07 19:02:49 +08:00
|
|
|
|
form.value.regionList = [form.value.province, form.value.city, form.value.region]
|
2024-03-04 20:33:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: 'edit',
|
|
|
|
|
|
title: '编辑',
|
2024-03-21 20:13:25 +08:00
|
|
|
|
type: 'primary',
|
2024-03-04 20:33:32 +08:00
|
|
|
|
icon: 'el-icon-Plus',
|
|
|
|
|
|
render: 'basicButton',
|
2024-03-07 19:02:49 +08:00
|
|
|
|
click: async row => {
|
2024-03-04 20:33:32 +08:00
|
|
|
|
disabled.value = false
|
2024-03-07 19:02:49 +08:00
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
|
await nextTick
|
2024-03-04 20:33:32 +08:00
|
|
|
|
title.value = '编辑承载能力预评估用户'
|
|
|
|
|
|
form.value = JSON.parse(JSON.stringify(row))
|
2024-03-07 19:02:49 +08:00
|
|
|
|
form.value.regionList = [form.value.province, form.value.city, form.value.region]
|
2024-03-04 20:33:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: 'del',
|
|
|
|
|
|
text: '删除',
|
|
|
|
|
|
type: 'danger',
|
|
|
|
|
|
icon: 'el-icon-Delete',
|
|
|
|
|
|
render: 'confirmButton',
|
|
|
|
|
|
popconfirm: {
|
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
confirmButtonType: 'danger',
|
|
|
|
|
|
title: '确定删除?'
|
|
|
|
|
|
},
|
|
|
|
|
|
click: row => {
|
2024-03-07 19:02:49 +08:00
|
|
|
|
removeUse({ userIds: row.userId }).then(res => {
|
2024-03-06 20:37:36 +08:00
|
|
|
|
ElMessage.success('删除成功')
|
2024-03-07 19:02:49 +08:00
|
|
|
|
tableStore.index()
|
2024-03-06 20:37:36 +08:00
|
|
|
|
})
|
2024-03-04 20:33:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
|
2024-03-12 11:16:54 +08:00
|
|
|
|
loadCallback: () => {
|
2024-03-21 20:13:25 +08:00
|
|
|
|
console.log(tableStore.table.data)
|
2024-03-12 11:16:54 +08:00
|
|
|
|
}
|
2024-03-04 20:33:32 +08:00
|
|
|
|
})
|
2024-03-06 20:37:36 +08:00
|
|
|
|
|
2024-03-07 19:02:49 +08:00
|
|
|
|
tableStore.table.params.userType = ''
|
2024-03-04 20:33:32 +08:00
|
|
|
|
|
|
|
|
|
|
provide('tableStore', tableStore)
|
|
|
|
|
|
onMounted(() => {
|
2024-03-21 20:13:25 +08:00
|
|
|
|
tableStore.index()
|
2024-03-04 20:33:32 +08:00
|
|
|
|
})
|
2024-03-07 19:02:49 +08:00
|
|
|
|
const useChange = (e: string) => {
|
|
|
|
|
|
userShow.value = uesrList.filter(item => item.id == e)[0].code
|
|
|
|
|
|
}
|
2024-03-04 20:33:32 +08:00
|
|
|
|
// 新增
|
|
|
|
|
|
const add = () => {
|
|
|
|
|
|
disabled.value = false
|
|
|
|
|
|
title.value = '新增承载能力预评估用户'
|
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
// 保存
|
|
|
|
|
|
const onSubmit = () => {
|
|
|
|
|
|
ruleFormRef.value.validate((valid: boolean) => {
|
|
|
|
|
|
if (valid) {
|
2024-03-07 19:02:49 +08:00
|
|
|
|
form.value.province = form.value.regionList[0] || ''
|
|
|
|
|
|
form.value.city = form.value.regionList[1] || ''
|
|
|
|
|
|
form.value.region = form.value.regionList[2] || ''
|
2024-03-04 20:33:32 +08:00
|
|
|
|
if (title.value == '新增承载能力预评估用户') {
|
2024-03-06 20:37:36 +08:00
|
|
|
|
addUse(form.value).then(res => {
|
2024-03-07 19:02:49 +08:00
|
|
|
|
ElMessage.success('新增成功!')
|
|
|
|
|
|
dialogVisible.value = false
|
2024-03-06 20:37:36 +08:00
|
|
|
|
tableStore.index()
|
|
|
|
|
|
})
|
2024-03-04 20:33:32 +08:00
|
|
|
|
} else if (title.value == '编辑承载能力预评估用户') {
|
2024-03-06 20:37:36 +08:00
|
|
|
|
updateUse(form.value).then(res => {
|
2024-03-07 19:02:49 +08:00
|
|
|
|
ElMessage.success('修改成功!')
|
|
|
|
|
|
dialogVisible.value = false
|
2024-03-06 20:37:36 +08:00
|
|
|
|
tableStore.index()
|
|
|
|
|
|
})
|
2024-03-04 20:33:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 取消
|
|
|
|
|
|
const handleClose = () => {
|
2024-03-28 15:21:58 +08:00
|
|
|
|
form.value = {
|
|
|
|
|
|
area: '',
|
|
|
|
|
|
city: '',
|
|
|
|
|
|
province: '',
|
|
|
|
|
|
protocolCapacity: 0,
|
|
|
|
|
|
region: '',
|
|
|
|
|
|
userName: '',
|
|
|
|
|
|
userType: '',
|
|
|
|
|
|
voltage: '',
|
|
|
|
|
|
regionList: []
|
|
|
|
|
|
}
|
2024-03-07 19:02:49 +08:00
|
|
|
|
ruleFormRef.value?.resetFields()
|
2024-03-04 20:33:32 +08:00
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|