台账调整、用户调整

This commit is contained in:
GGJ
2025-03-24 18:26:50 +08:00
parent 1154b7e69c
commit d4c7a9b0ca
17 changed files with 3585 additions and 124 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,631 @@
<template>
<div class="default-main">
<el-descriptions :column="2" border>
<el-descriptions-item label="所在地市">
{{ detailData.city }}
</el-descriptions-item>
<el-descriptions-item label="项目名称">
{{ detailData.projectName }}
</el-descriptions-item>
<el-descriptions-item label="工程预期投产日期">
{{ formatDate(detailData.expectedProductionDate, 'YYYY-MM-DD') }}
</el-descriptions-item>
<el-descriptions-item label="用户性质">
{{
userTypeList.find(item => {
return item.value == detailData.userType
})?.label
}}
</el-descriptions-item>
<el-descriptions-item label="归口管理部门">
{{ detailData.responsibleDepartment }}
</el-descriptions-item>
<el-descriptions-item label="用户状态">
{{
userStateList.find(item => {
return item.value == detailData.userStatus
})?.label
}}
</el-descriptions-item>
<el-descriptions-item label="厂站名称">
{{ detailData.substation }}
</el-descriptions-item>
<el-descriptions-item label="电压等级">
{{
voltageLevelList.find(item => {
return item.id == detailData.voltageLevel
})?.name
}}
</el-descriptions-item>
<el-descriptions-item label="非线性终端类型" v-if="detailData.userType == 0 || detailData.userType == 1">
{{ proviteData.nonlinearDeviceType ? proviteData.nonlinearDeviceType : '-' }}
</el-descriptions-item>
<el-descriptions-item label="预测评估单位">
{{ detailData.evaluationDept }}
</el-descriptions-item>
<el-descriptions-item label="预测评估结论" :span="2">
{{ detailData.evaluationConclusion }}
</el-descriptions-item>
<el-descriptions-item
:label="
detailData.userType == '4' || detailData.userType == '5' ? '非线性设备类型: ' : '非线性负荷类型:'
"
v-if="
detailData.userType == '2' ||
detailData.userType == '3' ||
detailData.userType == '4' ||
detailData.userType == '5'
"
>
{{ proviteData.nonlinearLoadType }}
</el-descriptions-item>
<el-descriptions-item label="是否需要治理">
<span v-if="detailData.userType == 0 || detailData.userType == 1">
{{ proviteData.needGovernance == 0 ? '否' : '是' }}
</span>
<span
v-if="
detailData.userType == 2 ||
detailData.userType == 3 ||
detailData.userType == 4 ||
detailData.userType == 5
"
>
{{ proviteData.needGovernance == 0 ? '否' : '是' }}
</span>
<span v-if="detailData.userType == 6">{{ proviteData.needGovernance == 0 ? '否' : '是' }}</span>
</el-descriptions-item>
<el-descriptions-item label="是否开展背景测试">
<span v-if="detailData.userType == 0 || detailData.userType == 1">
{{ proviteData.backgroundTestPerformed == 0 ? '否' : '是' }}
</span>
<span
v-if="
detailData.userType == 2 ||
detailData.userType == 3 ||
detailData.userType == 4 ||
detailData.userType == 5
"
>
{{ proviteData.backgroundTestPerformed == 0 ? '否' : '是' }}
</span>
<span v-if="detailData.userType == 6">
{{ proviteData.backgroundTestPerformed == 0 ? '否' : '是' }}
</span>
</el-descriptions-item>
<el-descriptions-item label="是否开展抗扰度测试" v-if="detailData.userType == 6">
<span>
{{ proviteData.antiInterferenceTest == 0 ? '否' : '是' }}
</span>
</el-descriptions-item>
<el-descriptions-item
label="用户协议容量MVA"
v-if="detailData.userType == 0 || detailData.userType == 1"
>
{{ proviteData.agreementCapacity }}
</el-descriptions-item>
<el-descriptions-item
label="PCC供电设备容量MVA"
v-if="
detailData.userType == '2' ||
detailData.userType == '3' ||
detailData.userType == '4' ||
detailData.userType == '5'
"
>
{{ proviteData.pccEquipmentCapacity }}
</el-descriptions-item>
<el-descriptions-item
label="基准短路容量MVA"
v-if="
detailData.userType == '2' ||
detailData.userType == '3' ||
detailData.userType == '4' ||
detailData.userType == '5'
"
>
{{ proviteData.baseShortCircuitCapacity }}
</el-descriptions-item>
<el-descriptions-item
label="系统最小短路容量MVA"
v-if="
detailData.userType == '2' ||
detailData.userType == '3' ||
detailData.userType == '4' ||
detailData.userType == '5'
"
>
{{ proviteData?.minShortCircuitCapacity }}
</el-descriptions-item>
<el-descriptions-item
label="用户用电协议容量MVA"
v-if="
detailData.userType == '2' ||
detailData.userType == '3' ||
detailData.userType == '4' ||
detailData.userType == '5'
"
>
{{ proviteData?.userAgreementCapacity }}
</el-descriptions-item>
<el-descriptions-item label="PCC点" v-if="detailData.userType != 0 && detailData.userType != 1">
{{ proviteData?.pccPoint }}
</el-descriptions-item>
<el-descriptions-item label="评估类型" v-if="detailData.userType != 0 && detailData.userType != 1">
{{
evaluationTypeList.find(item => {
return item.id == proviteData?.evaluationType
})?.name
}}
</el-descriptions-item>
<el-descriptions-item label="预测评估评审单位" v-if="detailData.userType != 0 && detailData.userType != 1">
{{ proviteData?.evaluationChekDept }}
</el-descriptions-item>
<el-descriptions-item label="行业" v-if="detailData.userType == 6">
{{
industryList.find(item => {
return item.id == proviteData.industry
})?.name
}}
</el-descriptions-item>
<el-descriptions-item label="敏感终端名称" v-if="detailData.userType == 6">
{{ proviteData.deviceName }}
</el-descriptions-item>
<!-- <el-descriptions-item label="供电电源数量" v-if="detailData.userType == 6">-->
<!-- {{ proviteData.powerSupplyCount }}-->
<!-- </el-descriptions-item>-->
<el-descriptions-item label="供电电源情况" v-if="detailData.userType == 6">
{{
powerSupplyInfoOptionList.find(item => {
return item.id == proviteData.powerSupplyInfo
})?.name
}}
</el-descriptions-item>
<el-descriptions-item label="供电电源" :span="2" v-if="detailData.userType == 6">
{{ proviteData.powerSupply }}
</el-descriptions-item>
<el-descriptions-item label="负荷级别" v-if="detailData.userType == 6">
{{
loadLevelOptionList.find(item => {
return item.id == proviteData.loadLevel
})?.name
}}
</el-descriptions-item>
<el-descriptions-item label="敏感电能质量指标" v-if="detailData.userType == 6">
{{
energyQualityIndexList.find(item => {
return item.id == proviteData.energyQualityIndex
})?.name
}}
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref, reactive, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { formatDate } from '@/utils/formatTime'
import { propTypes } from '@/utils/propTypes'
import { getUserReportById, getUserReportUpdateById } from '@/api/supervision-boot/userReport/form'
import { getDictTreeById } from '@/api/system-boot/dictTree'
import { useDictData } from '@/stores/dictData'
import { getFileNameAndFilePath } from '@/api/system-boot/file'
import { Link, View } from '@element-plus/icons-vue'
import PreviewFile from '@/components/PreviewFile/index.vue'
import { getByDeptDevLine } from '@/api/supervision-boot/interfere/index'
import { addOrUpdateFile, getFileById } from '@/api/supervision-boot/interfere/index'
defineOptions({ name: 'BpmUserReportDetail' })
const { query } = useRoute() // 查询参数
const props = defineProps({
id: propTypes.string.def(undefined),
update: {
type: Boolean,
default: false
},
openType: {
type: String,
default: 'create'
}
})
const detailLoading = ref(false) // 表单的加载中
const detailData = ref<any>({}) // 详情数据
const devIdList = ref([])
const queryId = query.id as unknown as string // 从 URL 传递过来的 id 编号
const openFile = (name: any) => {
window.open(window.location.origin + '/#/previewFile?/supervision/' + name)
}
const netInReportList: any = ref([])
const governReportList: any = ref([])
//用户性质数组
const userTypeList = reactive([
{
label: '新建电网工程',
value: '0'
},
{
label: '扩建电网工程',
value: '1'
},
{
label: '新建非线性负荷用户',
value: '2'
},
{
label: '扩建非线性负荷用户',
value: '3'
},
{
label: '新建新能源发电站',
value: '4'
},
{
label: '扩建新能源发电站',
value: '5'
},
{
label: '敏感及重要用户',
value: '6'
}
])
//用户状态数组
const userStateList = reactive([
{
label: '可研',
value: '0'
},
{
label: '建设',
value: '1'
},
{
label: '运行',
value: '2'
},
{
label: '退运',
value: '3'
}
])
const form: any = ref({
NetReport: [], //入网设计方案审查报告:
governReport: [], //治理工程验收报告
informationSecurityTestReport: [], //信息安全检测报告
acceptanceInspectionReportSingle: [], //信息安全检测报告
acceptanceInspectionReport: [], //验收检验报告:
typeExperimentReport: [], //型式实验报告
factoryInspectionReport: [], //出厂检验报告:
performanceTestReport: [], //性能检测报告
mainWiringDiagram: [], //主接线图:
runTheReport: [] //试运行报告
})
const dictData = useDictData()
//字典获取所在地市
const areaOptionList = dictData.getBasicData('jibei_area')
//字典获取敏感电能质量指标
const energyQualityIndexList = dictData.getBasicData('Indicator_Type')
//字典获取行业类型
const industryList = dictData.getBasicData('industry_type_jb')
//字典电压等级
const voltageLevelList = dictData.getBasicData('Dev_Voltage_Stand')
//字典评估类型
const evaluationTypeList = dictData.getBasicData('Evaluation_Type')
//字典预测评估单位
const evaluationDeptList = dictData.getBasicData('evaluation_dept')
const loadLevelOptionList = dictData.getBasicData('load_level')
const powerSupplyInfoOptionList = dictData.getBasicData('supply_condition')
/** 获得数据 */
const getInfo = async () => {
detailLoading.value = true
try {
if (props.update) {
await getUserReportUpdateById(props.id || queryId).then(res => {
detailData.value = res.data.userReportMessageJson
getProviteData()
})
} else {
await getUserReportById(props.id || queryId).then(res => {
detailData.value = res.data
getProviteData()
})
}
} finally {
detailLoading.value = false
}
if (props.openType == 'sourcesOfInterference') {
queryFiles()
}
}
const proviteData = ref()
//可研报告
const feasibilityReportRef: any = ref(null)
//项目初步设计说明书
const preliminaryDesignDescriptionRef: any = ref(null)
//预测评估报告
const predictionEvaluationReportRef: any = ref(null)
//预测评估评审意见报告
const predictionEvaluationReviewOpinionsRef: any = ref(null)
//用户接入变电站主接线示意图
const substationMainWiringDiagramRef: any = ref(null)
//主要敏感终端清单
const sensitiveDevicesRef: any = ref(null)
//抗扰度测试报告
const antiInterferenceReportRef: any = ref(null)
//背景电能质量测试报告
const powerQualityReportRef: any = ref(null)
//其他附件
const additionalAttachmentsRef: any = ref(null)
//预览
const preview = (val: any, url: any) => {
nextTick(() => {
//可研报告
if (val == 'feasibilityReport') {
feasibilityReportRef?.value.open(url)
}
//项目初步设计说明书
if (val == 'preliminaryDesignDescription') {
preliminaryDesignDescriptionRef?.value.open(url)
}
//预测评估报告
if (val == 'predictionEvaluationReport') {
console.log(url, '9999999')
predictionEvaluationReportRef?.value.open(url)
}
//预测评估评审意见报告
if (val == 'predictionEvaluationReviewOpinions') {
predictionEvaluationReviewOpinionsRef?.value.open(url)
}
//用户接入变电站主接线示意图
if (val == 'substationMainWiringDiagram') {
substationMainWiringDiagramRef?.value.open(url)
}
//主要敏感终端清单
if (val == 'sensitiveDevices') {
sensitiveDevicesRef?.value.open(url)
}
//抗扰度测试报告
if (val == 'antiInterferenceReport') {
antiInterferenceReportRef?.value.open(url)
}
//背景电能质量测试报告
if (val == 'powerQualityReport') {
powerQualityReportRef?.value.open(url)
}
//其他附件
if (val == 'additionalAttachments') {
additionalAttachmentsRef?.value.open(url)
}
})
}
const queryFiles = () => {
getFileById({ id: props.id }).then(res => {
res.data.forEach((item: any) => {
if (item.url.length > 0) getFileNamePaths(item.url, item.name)
})
})
}
//判断userType选择取用的对象
const getProviteData = async () => {
if (detailData.value.userType == '0' || detailData.value.userType == '1') {
proviteData.value = detailData.value.userReportProjectPO
//查询非线性终端类型
await getDictTreeById(proviteData.value.nonlinearDeviceType).then(res => {
proviteData.value.nonlinearDeviceType = res.data?.name
})
} else if (
detailData.value.userType == '2' ||
detailData.value.userType == '3' ||
detailData.value.userType == '4' ||
detailData.value.userType == '5'
) {
proviteData.value = detailData.value.userReportSubstationPO
//查询非线性负荷类型
await getDictTreeById(proviteData.value.nonlinearLoadType).then(res => {
proviteData.value.nonlinearLoadType = res.data?.name
})
} else {
proviteData.value = detailData.value.userReportSensitivePO
}
//可研报告
if (proviteData.value.feasibilityReport) {
await getFileNamePath(proviteData.value.feasibilityReport, 'feasibilityReport')
}
//项目初步设计说明书
if (proviteData.value.preliminaryDesignDescription) {
await getFileNamePath(proviteData.value.preliminaryDesignDescription, 'preliminaryDesignDescription')
}
//预测评估报告
if (proviteData.value.predictionEvaluationReport) {
await getFileNamePath(proviteData.value.predictionEvaluationReport, 'predictionEvaluationReport')
}
//预测评估评审意见报告
if (proviteData.value.predictionEvaluationReviewOpinions) {
await getFileNamePath(
proviteData.value.predictionEvaluationReviewOpinions,
'predictionEvaluationReviewOpinions'
)
}
//用户接入变电站主接线示意图
if (proviteData.value.substationMainWiringDiagram) {
await getFileNamePath(proviteData.value.substationMainWiringDiagram, 'substationMainWiringDiagram')
}
//主要敏感终端清单
if (proviteData.value.sensitiveDevices) {
await getFileNamePath(proviteData.value.sensitiveDevices, 'sensitiveDevices')
}
//抗扰度测试报告
if (proviteData.value.antiInterferenceReport) {
await getFileNamePath(proviteData.value.antiInterferenceReport, 'antiInterferenceReport')
}
//背景电能质量测试报告
if (proviteData.value.powerQualityReport) {
await getFileNamePath(proviteData.value.powerQualityReport, 'powerQualityReport')
}
//其他附件
if (proviteData.value.additionalAttachments) {
getFileNamePath(proviteData.value.additionalAttachments, 'additionalAttachments')
}
// 入网评估报告
if (detailData.value.netInReport.length > 0) {
netInReportList.value = []
detailData.value.netInReport.forEach((item: any) => {
if (item != null) {
getFileNamePath(item, 'netInReport')
}
})
}
// 治理评估告"
if (detailData.value.governReport.length > 0) {
governReportList.value = []
detailData.value.governReport.forEach((item: any) => {
if (item != null) {
getFileNamePath(item, 'governReport')
}
})
}
// 调用关联终端接口
getByDeptDevLine({ id: detailData.value.orgId }).then(res => {
devIdList.value = res.data.filter((item: any) => item.devId == detailData.value.devId)
})
}
//根据文件名请求
const getFileNamePath = async (val: any, pathName: any) => {
await getFileNameAndFilePath({ filePath: val }).then(res => {
if (res.data && res.data.name && res.data.url) {
//可研报告
if (pathName == 'feasibilityReport' && proviteData.value.feasibilityReport) {
proviteData.value.feasibilityReport = {
name: res.data.fileName,
url: res.data.url
}
}
//项目初步设计说明书
else if (pathName == 'preliminaryDesignDescription' && proviteData.value.preliminaryDesignDescription) {
proviteData.value.preliminaryDesignDescription = {
name: res.data.fileName,
url: res.data.url
}
}
//预测评估报告
else if (pathName == 'predictionEvaluationReport' && proviteData.value.predictionEvaluationReport) {
proviteData.value.predictionEvaluationReport = {
name: res.data.fileName,
url: res.data.url
}
}
//预测评估评审意见报告
else if (
pathName == 'predictionEvaluationReviewOpinions' &&
proviteData.value.predictionEvaluationReviewOpinions
) {
proviteData.value.predictionEvaluationReviewOpinions = {
name: res.data.fileName,
url: res.data.url
}
}
//用户接入变电站主接线示意图
else if (pathName == 'substationMainWiringDiagram' && proviteData.value.substationMainWiringDiagram) {
proviteData.value.substationMainWiringDiagram = {
name: res.data.fileName,
url: res.data.url
}
}
//主要敏感终端清单
else if (pathName == 'sensitiveDevices' && proviteData.value.sensitiveDevices) {
proviteData.value.sensitiveDevices = {
name: res.data.fileName,
url: res.data.url
}
}
//抗扰度测试报告
else if (pathName == 'antiInterferenceReport' && proviteData.value.antiInterferenceReport) {
proviteData.value.antiInterferenceReport = {
name: res.data.fileName,
url: res.data.url
}
}
//背景电能质量测试报告
else if (pathName == 'powerQualityReport' && proviteData.value.powerQualityReport) {
proviteData.value.powerQualityReport = {
name: res.data.fileName,
url: res.data.url
}
}
//其他附件
else if (pathName == 'additionalAttachments' && proviteData.value.additionalAttachments) {
proviteData.value.additionalAttachments = {
name: res.data.fileName,
url: res.data.url
}
}
if (pathName == 'netInReport') {
netInReportList.value.push({
name: res.data.fileName,
url: res.data.url
})
} else if (pathName == 'governReport') {
governReportList.value.push({
name: res.data.fileName,
url: res.data.url
})
}
}
})
}
const getFileNamePaths = async (val: any, pathName: any) => {
let data = val.split(',')
for (let i = 0; i < data.length; i++) {
await getFileNameAndFilePath({ filePath: '/supervision/' + data[i] }).then(res => {
res.data.name = res.data.fileName
form.value[pathName].push(res.data)
})
}
}
defineExpose({ open: getInfo }) // 提供 open 方法,用于打开弹窗
watch(
() => props.id,
(val, oldVal) => {
val && getInfo()
}
)
/** 初始化 **/
onMounted(() => {
getInfo()
})
</script>
<style lang="scss">
::v-deep.el-icon svg {
// margin: 5px !important;
// position: absolute !important;
// top: 20px !important;
// float: right;
}
// .el-icon {
// float: left;
// }
// a {
// display: block;
// width: 200px;
// float: right;
// }
.elView {
cursor: pointer;
margin-right: 10px;
}
</style>

View File

@@ -0,0 +1,238 @@
<template>
<el-dialog
draggable
class='cn-operate-dialog'
v-model='eventDataUploadVisible'
:title='title'
style='width: 415px'
top='25vh'
>
<el-scrollbar>
<el-form :inline='false' :model='form' label-width='120px' ref='formRef'>
<el-form-item label='用户数据文件'>
<el-upload
v-model:file-list='fileList'
ref='uploadEventData'
action=''
:limit='1'
:on-exceed='handleExceed'
:auto-upload='false'
:on-change='choose'
>
<template #trigger>
<el-button type='primary'>选择数据文件</el-button>
</template>
</el-upload>
</el-form-item>
</el-form>
</el-scrollbar>
<template #footer>
<span class='dialog-footer'>
<el-button @click='eventDataUploadVisible = false'>取消</el-button>
<el-button type='primary' @click='submit'>确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang='ts'>
import { ref, reactive, inject } from 'vue'
import TableStore from '@/utils/tableStore'
import { ElMessage } from 'element-plus'
import type { UploadInstance, UploadProps, UploadRawFile, UploadUserFile } from 'element-plus'
import { genFileId } from 'element-plus'
import { importSensitiveUserData, importSensitiveReportData } from '@/api/supervision-boot/userReport/form'
const fileList = ref<UploadUserFile[]>([])
const formRef = ref()
const tableStore = inject('tableStore') as TableStore
const eventDataUploadVisible = ref(false)
const title = ref('')
const uploadEventData = ref<UploadInstance>()
// 注意不要和表单ref的命名冲突
const form = reactive({
file: null
})
//弹出界面,默认选择用户的第一个生产线的第一条进线进行数据导入
const open = async (text: string) => {
title.value = text
resetForm()
form.file = null
fileList.value = []
eventDataUploadVisible.value = true
}
//重置表单内容
const resetForm = () => {
if (formRef.value) {
formRef.value.resetFields()
}
}
/**
* 选择待上传文件
*/
const choose = (e: any) => {
form.file = e.raw
}
const handleExceed: UploadProps['onExceed'] = files => {
uploadEventData.value!.clearFiles()
const file = files[0] as UploadRawFile
file.uid = genFileId()
uploadEventData.value!.handleStart(file)
fileList.value = [{ name: file.name, url: '' }]
}
/**
* 提交用户表单数据
*/
const submit = async () => {
if (form.file) {
formRef.value.validate(async (valid: any) => {
if (valid) {
let data = new FormData()
data.append('file', form.file)
const allowedTypes = ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
if (!allowedTypes.includes(form.file.type)) {
return ElMessage.warning('只能上传 Excel 文件 (.xls 或 .xlsx)!')
}
if (title.value === '导入干扰源用户') {
await importSensitiveReportData(data)
.then(res => handleImportResponse(title.value, res))
.finally(() => {
tableStore.index()
eventDataUploadVisible.value = false
})
} else {
await importSensitiveUserData(data)
.then(res => handleImportResponse(title.value, res))
.finally(() => {
tableStore.index()
eventDataUploadVisible.value = false
})
}
// if (title.value == '导入干扰源用户') {
// await importSensitiveReportData(data)
// .then((res: any) => {
// if (res.type === 'application/json') {
// // 说明是普通对象数据,读取信息
// const fileReader = new FileReader()
// fileReader.onloadend = () => {
// try {
// const jsonData = JSON.parse(fileReader.result)
// // 后台信息
// if (jsonData.code === 'A0000') {
// ElMessage.success('导入成功')
// } else {
// ElMessage.error('导入失败,请查看下载附件!')
// }
// } catch (err) {
// console.log(err)
// }
// }
// fileReader.readAsText(res)
// } else {
// ElMessage.error('导入失败,请查看下载附件!')
// let blob = new Blob([res], {
// type: 'application/vnd.ms-excel'
// })
// const url = window.URL.createObjectURL(blob)
// const link = document.createElement('a')
// link.href = url
// link.download = '干扰源用户失败列表'
// document.body.appendChild(link)
// link.click()
// link.remove()
// }
// })
// .finally(() => {
// tableStore.index()
// eventDataUploadVisible.value = false
// })
// } else {
// await importSensitiveUserData(data)
// .then((res: any) => {
// if (res.type === 'application/json') {
// // 说明是普通对象数据,读取信息
// const fileReader = new FileReader()
// fileReader.onloadend = () => {
// try {
// const jsonData = JSON.parse(fileReader.result)
// // 后台信息
// if (jsonData.code === 'A0000') {
// ElMessage.success('导入成功')
// } else {
// ElMessage.error('导入失败,请查看下载附件!')
// }
// } catch (err) {
// console.log(err)
// }
// }
// fileReader.readAsText(res)
// } else {
// ElMessage.error('导入失败,请查看下载附件!')
// let blob = new Blob([res], {
// type: 'application/vnd.ms-excel'
// })
// const url = window.URL.createObjectURL(blob)
// const link = document.createElement('a')
// link.href = url
// link.download = '敏感及重要用户失败列表'
// document.body.appendChild(link)
// link.click()
// link.remove()
// }
// })
// .finally(() => {
// tableStore.index()
// eventDataUploadVisible.value = false
// })
// }
}
})
} else {
ElMessage.error('请选择数据文件')
}
}
async function handleImportResponse(title: any, res: any) {
if (res.type === 'application/json') {
const fileReader = new FileReader()
fileReader.onloadend = () => {
try {
const jsonData = JSON.parse(fileReader.result)
if (jsonData.code === 'A0000') {
ElMessage.success('导入成功')
} else {
ElMessage.error('导入失败,请查看下载附件!')
}
} catch (err) {
console.log(err)
}
}
fileReader.readAsText(res)
} else {
ElMessage.error('导入失败,请查看下载附件!')
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = title.includes('干扰源用户') ? '干扰源用户失败列表' : '敏感及重要用户失败列表'
document.body.appendChild(link)
link.click()
link.remove()
}
}
defineExpose({ open })
</script>
<style scoped>
.el-form-item__content div {
width: 100% !important;
}
</style>

View File

@@ -0,0 +1,301 @@
<template>
<div class="default-main">
<TableHeader ref="TableHeaderRef">
<template #select>
<el-form-item label="项目名称">
<el-input
style="width: 200px"
placeholder="请输入项目名称"
v-model="tableStore.table.params.projectName"
clearable
maxlength="32"
show-word-limit
></el-input>
</el-form-item>
<el-form-item label="所在地市">
<el-select v-model="tableStore.table.params.city" clearable placeholder="请选择所在地市">
<el-option
v-for="item in areaOptionList"
:key="item.id"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</el-form-item>
</template>
<template #operation>
<el-button icon="el-icon-Plus" type="primary" @click="addFormModel">新增</el-button>
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button>
<el-button icon="el-icon-Download" type="primary" @click="exportExcelTemplate" :loading="loading">
模板下载
</el-button>
<el-button icon="el-icon-Upload" type="primary" @click="importUserData">批量导入</el-button>
</template>
</TableHeader>
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
<el-dialog title="详情" width="60%" v-model="dialogShow" v-if="dialogShow">
<DetailInfo :id="userId" :openType="'sourcesOfInterference'"></DetailInfo>
</el-dialog>
<!-- 批量导入 -->
<sensitive-user-popup ref="sensitiveUserPopup" />
<!-- 查看详情 detail 新增/修改 create-->
<addForm ref="addForms" @onSubmit="tableStore.index()" :openType="'sourcesOfInterference'"></addForm>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, nextTick, watch } from 'vue'
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 addForm from './components/addForm.vue'
import SensitiveUserPopup from './components/sensitiveUserPopup.vue'
import { useDictData } from '@/stores/dictData'
import { useRouter } from 'vue-router'
import { downloadSensitiveReportTemplate } from '@/api/supervision-boot/userReport/form'
import DetailInfo from './components/detail.vue'
import { cancelFormData, getUserReportById } from '@/api/supervision-boot/interfere/index'
import { deleteUserReport } from '@/api/supervision-boot/delete/index'
const addForms = ref()
const dictData = useDictData()
const sensitiveUserPopup = ref()
const TableHeaderRef = ref()
const loading = ref(false)
const areaOptionList = dictData.getBasicData('jibei_area')
const { push, options, currentRoute } = useRouter()
import { useAdminInfo } from '@/stores/adminInfo'
//获取登陆用户姓名和部门
const adminInfo = useAdminInfo()
const tableStore = new TableStore({
url: '/supervision-boot/userReport/getInterferenceUserPage',
// publicHeight: 65,
method: 'POST',
column: [
{
width: '60',
type: 'checkbox'
},
{
title: '序号',
width: 80,
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{ field: 'city', title: '所在地市', minWidth: 80 },
{ field: 'substation', title: '厂站名称', minWidth: 100 },
{ field: 'projectName', title: '项目名称', minWidth: 170 },
{
field: 'userType',
title: '用户性质',
minWidth: 150,
formatter: (obj: any) => {
const userType = obj.row.userType
return getUserTypeName(userType)
}
},
{ field: 'responsibleDepartment', title: '归口管理部门', minWidth: 130 },
{
title: '操作',
minWidth: 150,
fixed: 'right',
render: 'buttons',
buttons: [
{
name: 'productSetting',
title: '详细信息',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
lookInfo(row.id)
}
},
{
name: 'edit',
title: '编辑',
type: 'primary',
icon: 'el-icon-Open',
render: 'basicButton',
click: row => {
addForms.value.filterUsers([6])
addForms.value.open({
title: '编辑',
row: row
})
}
},
]
}
],
beforeSearchFun: () => {
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
}
})
tableStore.table.params.city = ''
tableStore.table.params.orgId = adminInfo.$state.deptId
tableStore.table.params.projectName = ''
tableStore.table.params.loadType = ''
tableStore.table.params.userName = ''
tableStore.table.params.relationUserName = ''
tableStore.table.params.aisFileUpload = ''
const userId = ref()
const dialogShow = ref(false)
const lookInfo = (id: string) => {
userId.value = id
dialogShow.value = true
}
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
// 禁止点击
const checkboxConfig = reactive({
checkMethod: ({ row }) => {
return adminInfo.roleCode.includes('delete_info')
? true
: row.createBy == adminInfo.$state.id && row.status == 0
}
})
const deleteEven = () => {
if (tableStore.table.selection.length == 0) {
ElMessage({
type: 'warning',
message: '请选择要删除的数据'
})
} else {
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteUserReport(tableStore.table.selection.map(item => item.id)).then(res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
tableStore.index()
})
})
}
}
/**取消流程操作*/
const cancelLeave = async (row: any) => {
// 二次确认
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputType: 'textarea',
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
inputErrorMessage: '取消原因不能为空'
})
// 发起取消
let data = {
id: row.id,
processInstanceId: row.processInstanceId,
dataType: 1,
reason: value
}
await cancelFormData(data)
ElMessage.success('取消成功')
// 加载数据
tableStore.index()
}
// 新增
const addFormModel = () => {
addForms.value.filterUsers([6])
setTimeout(() => {
addForms.value.open({
title: '用户档案录入'
})
})
}
/**获取用户性质*/
const getUserTypeName = (userType: any) => {
if (userType === 0) {
return '新建电网工程'
}
if (userType === 1) {
return '扩建电网工程'
}
if (userType === 2) {
return '新建非线性负荷用户'
}
if (userType === 3) {
return '扩建非线性负荷用户'
}
if (userType === 4) {
return '新建新能源发电站'
}
if (userType === 5) {
return '扩建新能源发电站'
}
if (userType === 6) {
return '敏感及重要用户'
}
return '新建电网工程'
}
//导出模板
const exportExcelTemplate = async () => {
loading.value = true
await downloadSensitiveReportTemplate().then((res: any) => {
let blob = new Blob([res], {
type: 'application/vnd.ms-excel'
})
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '干扰源用户台账模板'
document.body.appendChild(link)
link.click()
link.remove()
})
await setTimeout(() => {
loading.value = false
}, 0)
}
//批量导入用户数据
const importUserData = () => {
sensitiveUserPopup.value.open('导入干扰源用户')
}
const props = defineProps({ id: { type: String, default: 'null' } })
watch(
() => props.id,
async (newValue, oldValue) => {
if (newValue === 'null') return // 直接返回,避免后续逻辑执行
const fullId = newValue.split('@')[0]
let nowTime = Date.now()
const routeTime = Number(newValue.split('@')[1])
if (isNaN(routeTime) || nowTime - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return // 路由时间超过500ms则不执行
await getUserReportById(fullId).then(res => {
if (res && res.code == 'A0000') {
addForms.value.setcontroFlag()
addForms.value.open({
title: '重新发起',
row: res.data
})
}
})
},
{ immediate: true }
)
</script>