用户管理添加监测报告,评估报告

This commit is contained in:
guanj
2026-07-07 13:52:53 +08:00
parent 1a44a2f9e0
commit 83a1128884
3 changed files with 119 additions and 44 deletions

View File

@@ -41,11 +41,7 @@
<Table ref="tableRef" /> <Table ref="tableRef" />
<!-- 详情弹窗 --> <!-- 详情弹窗 -->
<el-dialog title="定检详情" width="1000px" v-model="dialogShow" v-if="dialogShow"> <el-dialog title="定检详情" width="1000px" v-model="dialogShow" v-if="dialogShow"></el-dialog>
</el-dialog>
</div> </div>
</template> </template>
@@ -60,7 +56,7 @@ import { useAdminInfo } from '@/stores/adminInfo'
import { terminalCheckPage } from '@/api/device-boot/device' import { terminalCheckPage } from '@/api/device-boot/device'
defineOptions({ defineOptions({
name: 'BusinessAdministrator/PowerQualityCheck' name: 'terminal/terminaCkeck'
}) })
// 公共依赖 // 公共依赖
@@ -106,17 +102,15 @@ const tableStore = new TableStore({
width: 80, width: 80,
render: 'customRender', render: 'customRender',
customRender: props => { customRender: props => {
console.log(props.renderValue)
const val = props.renderValue const val = props.renderValue
console.log(val)
let text = '' let text = ''
let color = '' let color = ''
if (val === 1) { if (val === 1) {
text = '是' text = '是'
color = '#f53f3f' color = '#f56c6c'
} else if (val === 0) { } else if (val === 0) {
text = '否' text = '否'
color = '#00b42a' color = '#67c23a'
} }
return h('span', { style: { color, fontWeight: 'bold' } }, text) return h('span', { style: { color, fontWeight: 'bold' } }, text)
} }
@@ -132,10 +126,10 @@ const tableStore = new TableStore({
let color = '' let color = ''
if (val > 0) { if (val > 0) {
text = val text = val
color = '#f53f3f' color = '#f56c6c'
} else if (val > -30) { } else if (val > -30) {
text = Math.abs(val).toString()+'天后将逾期' text = Math.abs(val).toString() + '天后将逾期'
color = 'rgba(236,143,21,0.92)' color = '#e6a23c'
} else { } else {
text = '/' text = '/'
} }
@@ -167,9 +161,7 @@ const tableStore = new TableStore({
type: 'primary', type: 'primary',
icon: 'el-icon-Open', icon: 'el-icon-Open',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {}
}
} }
] ]
} }
@@ -181,9 +173,9 @@ const tableStore = new TableStore({
}) })
// 初始化查询参数 // 初始化查询参数
tableStore.table.params.areaName = '' tableStore.table.params.city = ''
tableStore.table.params.bdName = '' tableStore.table.params.substation = ''
tableStore.table.params.devName = '' tableStore.table.params.terminalName = ''
tableStore.table.params.orgId = adminInfo.$state.deptId tableStore.table.params.orgId = adminInfo.$state.deptId
// 打开详情弹窗 // 打开详情弹窗
@@ -193,9 +185,7 @@ const openDetail = (id: string) => {
} }
// 新增按钮 // 新增按钮
const addFormModel = () => { const addFormModel = () => {}
}
// 批量删除 // 批量删除
const deleteEven = () => { const deleteEven = () => {
@@ -225,14 +215,13 @@ const props = defineProps({
}) })
watch( watch(
() => props.id, () => props.id,
async (newVal) => { async newVal => {
if (newVal === 'null') return if (newVal === 'null') return
const fullId = newVal.split('@')[0] const fullId = newVal.split('@')[0]
const routeTime = Number(newVal.split('@')[1]) const routeTime = Number(newVal.split('@')[1])
if (isNaN(routeTime) || Date.now() - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return if (isNaN(routeTime) || Date.now() - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return
const res = await getPqCheckById(fullId) const res = await getPqCheckById(fullId)
if (res.code === 'A0000') { if (res.code === 'A0000') {
} }
}, },
{ immediate: true } { immediate: true }
@@ -245,8 +234,5 @@ onMounted(() => {
</script> </script>
<style scoped> <style scoped>
.default-main {
width: 100%; </style>
height: 100%;
}
</style>

View File

@@ -368,6 +368,48 @@
show-word-limit show-word-limit
/> />
</el-form-item> </el-form-item>
<el-form-item
class="uploadFile"
for="-"
label="电能质量检测报告:"
prop="detection"
>
<el-upload
v-model:file-list="form.detection"
ref="uploadRef"
action=""
:accept="acceptType"
:limit="1"
:on-change="(file) => choose(file, 'detection')"
:auto-upload="false"
:on-remove="removeFile('detection')"
>
<template #trigger>
<el-button type="primary" >上传文件</el-button>
</template>
</el-upload>
</el-form-item>
<el-form-item
class="uploadFile"
for="-"
label="电能质量评估报告"
prop="evaluation"
>
<el-upload
v-model:file-list="form.evaluation"
ref="uploadRef"
action=""
:accept="acceptType"
:limit="1"
:on-change="(file) => choose(file, 'evaluation')"
:auto-upload="false"
:on-remove="removeFile('evaluation')"
>
<template #trigger>
<el-button type="primary">上传文件</el-button>
</template>
</el-upload>
</el-form-item>
<el-form-item for="-" label="预测评估结论" style="width: 100%"> <el-form-item for="-" label="预测评估结论" style="width: 100%">
<el-input <el-input
type="textarea" type="textarea"
@@ -390,7 +432,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, reactive, defineExpose, defineProps, defineEmits, watch, onUnmounted } from 'vue' import { ref, onMounted, reactive, defineExpose, defineProps, defineEmits, watch, onUnmounted } from 'vue'
// import { upload, insertTerminal, updateTerminal } from '@/api/process-boot/terminal' // import { upload, insertTerminal, updateTerminal } from '@/api/process-boot/terminal'
import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus' import type { UploadFile, UploadInstance, UploadProps, UploadRawFile } from 'element-plus'
import { genFileId, ElMessage } from 'element-plus' import { genFileId, ElMessage } from 'element-plus'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
import type { ComponentSize, FormInstance, FormRules } from 'element-plus' import type { ComponentSize, FormInstance, FormRules } from 'element-plus'
@@ -439,7 +481,7 @@ const IS_LN = import.meta.env.VITE_NAME == 'LN' || import.meta.env.VITE_NAME ==
const dictData = useDictData() const dictData = useDictData()
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
// .doc,.docx,.xlsx,.xls,.pdf // .doc,.docx,.xlsx,.xls,.pdf
const acceptType = '' const acceptType = '.pdf,.docx'
const form: any = ref({}) const form: any = ref({})
const loading = ref(false) const loading = ref(false)
const control: any = ref(true) const control: any = ref(true)
@@ -533,6 +575,10 @@ const defaultProps = {
const nonlinearDeviceTypeList: any = ref('') const nonlinearDeviceTypeList: any = ref('')
//获取登陆用户姓名和部门 //获取登陆用户姓名和部门
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
// 电能质量检测报告
const detectionFile = ref('')
// 电能质量评估报告
const evaluationFile = ref('')
const resetForm = () => { const resetForm = () => {
form.value = { form.value = {
reporter: '', //填报人 1 reporter: '', //填报人 1
@@ -559,6 +605,8 @@ const resetForm = () => {
pccPoint: '', //PCC点 1 pccPoint: '', //PCC点 1
evaluationType: evaluationTypeList[0].id, //评估类型 1 evaluationType: evaluationTypeList[0].id, //评估类型 1
evaluationChekDept: '', //预测评估审单位 1 evaluationChekDept: '', //预测评估审单位 1
detection: [], //电能质量检测报告
evaluation: [], //电能质量评估报告
minShortCircuitCapacity: '', //系统最小短路容量MVA 1 minShortCircuitCapacity: '', //系统最小短路容量MVA 1
userAgreementCapacity: '', //用户用电协议容量MVA 1 userAgreementCapacity: '', //用户用电协议容量MVA 1
needGovernance: 0, //是否需要治理 1 needGovernance: 0, //是否需要治理 1
@@ -582,6 +630,8 @@ const resetForm = () => {
delete form.value.loadLevel delete form.value.loadLevel
delete form.value.powerSupplyInfo delete form.value.powerSupplyInfo
} }
detectionFile.value = ''
evaluationFile.value = ''
} }
//初始化数据 //初始化数据
resetForm() resetForm()
@@ -901,6 +951,10 @@ const open = async (row: any) => {
} else { } else {
resendId.value = '' resendId.value = ''
form.value.userType = userTypeList.value[0].value form.value.userType = userTypeList.value[0].value
detectionFile.value = ''
evaluationFile.value = ''
form.value.detection = []
form.value.evaluation = []
} }
await getSubstationSelect().then(res => { await getSubstationSelect().then(res => {
stationList.value = res.data stationList.value = res.data
@@ -918,18 +972,36 @@ async function handleResponse(data: any) {
// userType logic is commented out; if needed, implement accordingly // userType logic is commented out; if needed, implement accordingly
if (data.userReportProjectPO) { if (data.userReportProjectPO) {
form.value = { ...data, ...data.userReportProjectPO } form.value = { ...data, ...data.userReportProjectPO }
fileRaw(data, 'userReportProjectPO')
} else if (data.userReportSubstationPO) { } else if (data.userReportSubstationPO) {
form.value = { ...data, ...data.userReportSubstationPO } form.value = { ...data, ...data.userReportSubstationPO }
fileRaw(data, 'userReportSubstationPO')
} else if (data.userReportSensitivePO) { } else if (data.userReportSensitivePO) {
form.value = { form.value = {
...data, ...data,
...data.userReportSensitivePO, ...data.userReportSensitivePO,
energyQualityIndex: data.userReportSensitivePO.energyQualityIndex.split(', ') energyQualityIndex: data.userReportSensitivePO.energyQualityIndex.split(', ')
} }
fileRaw(data, 'userReportSensitivePO')
} }
form.value.orgId = adminInfo.$state.deptName form.value.orgId = adminInfo.$state.deptName
} }
// 处理上传文件回显
const fileRaw = (row: any, key: string) => {
const fileFields = ['detection', 'evaluation']
for (const field of fileFields) {
const filePath = row[key]?.[field] ?? row[field]
if (filePath != null && filePath.length > 0) {
form.value[field] = [{ name: filePath.split('/')[2] }]
} else {
form.value[field] = []
}
}
detectionFile.value = row[key]?.detection ?? row.detection ?? ''
evaluationFile.value = row[key]?.evaluation ?? row.evaluation ?? ''
}
const close = () => { const close = () => {
//重置表单内容 //重置表单内容
//取消表单校验状态 //取消表单校验状态
@@ -948,14 +1020,25 @@ const handleExceed: UploadProps['onExceed'] = files => {
file.uid = genFileId() file.uid = genFileId()
uploadRef.value!.handleStart(file) uploadRef.value!.handleStart(file)
} }
let uploadName = ref('')
//上传报告字段名称
const uploadFileName = (val: any) => {
uploadName.value = val
}
//移除文件上传 //移除文件上传
const removeFile = (file: any, uploadFiles: any) => { const removeFile = (val: string) => {
console.log(file, uploadFiles) return (_file: UploadFile, fileList: UploadFile[]) => {
if (val === 'detection') {
detectionFile.value = ''
} else if (val === 'evaluation') {
evaluationFile.value = ''
}
form.value[val] = fileList
}
}
const choose = (e: any, field: string) => {
uploadFile(e.raw, '/supervision/').then(res => {
if (field === 'detection') {
detectionFile.value = res.data.name
} else if (field === 'evaluation') {
evaluationFile.value = res.data.name
}
})
} }
// 关联终端 // 关联终端
@@ -982,12 +1065,16 @@ const confirmForm = async (flag: boolean) => {
subForm.value.reporter = adminInfo.$state.id subForm.value.reporter = adminInfo.$state.id
subForm.value.orgId = adminInfo.$state.deptId subForm.value.orgId = adminInfo.$state.deptId
let confirmFormData = JSON.parse(JSON.stringify(subForm.value)) let confirmFormData = JSON.parse(JSON.stringify(subForm.value))
confirmFormData.detection = detectionFile.value
confirmFormData.evaluation = evaluationFile.value
//1.判断是否上传 //1.判断是否上传
if (subForm.value.userType == '0' || subForm.value.userType == '1') { if (subForm.value.userType == '0' || subForm.value.userType == '1') {
{ {
//其他报告非必填 //其他报告非必填
confirmFormData.userReportProjectPO = { confirmFormData.userReportProjectPO = {
...confirmFormData.userReportProjectPO ...confirmFormData.userReportProjectPO,
detection: detectionFile.value,
evaluation: evaluationFile.value
} }
} }
} }
@@ -1000,7 +1087,9 @@ const confirmForm = async (flag: boolean) => {
) { ) {
{ {
confirmFormData.userReportSubstationPO = { confirmFormData.userReportSubstationPO = {
...confirmFormData.userReportSubstationPO ...confirmFormData.userReportSubstationPO,
detection: detectionFile.value,
evaluation: evaluationFile.value
} }
} }
} }
@@ -1009,7 +1098,9 @@ const confirmForm = async (flag: boolean) => {
{ {
confirmFormData.userReportSensitivePO = { confirmFormData.userReportSensitivePO = {
...confirmFormData.userReportSensitivePO, ...confirmFormData.userReportSensitivePO,
energyQualityIndex: confirmFormData.userReportSensitivePO.energyQualityIndex.join(', ') energyQualityIndex: confirmFormData.userReportSensitivePO.energyQualityIndex.join(', '),
detection: detectionFile.value,
evaluation: evaluationFile.value
} }
} }
} }
@@ -1061,8 +1152,6 @@ const filterUsers = (arr: any) => {
userTypeList.value = userTypeList.value.filter(item => !arr.includes(item.value)) userTypeList.value = userTypeList.value.filter(item => !arr.includes(item.value))
} }
const setcontroFlag = () => { const setcontroFlag = () => {
controFlag.value = true controFlag.value = true
} }
defineExpose({ open, filterUsers, setcontroFlag }) defineExpose({ open, filterUsers, setcontroFlag })

View File

@@ -45,7 +45,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, provide, nextTick, watch } from 'vue' import { ref, onMounted, reactive, provide, nextTick, watch, onUnmounted } 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'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'