用户管理添加监测报告,评估报告
This commit is contained in:
@@ -41,11 +41,7 @@
|
||||
<Table ref="tableRef" />
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<el-dialog title="定检详情" width="1000px" v-model="dialogShow" v-if="dialogShow">
|
||||
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-dialog title="定检详情" width="1000px" v-model="dialogShow" v-if="dialogShow"></el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -60,7 +56,7 @@ import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { terminalCheckPage } from '@/api/device-boot/device'
|
||||
|
||||
defineOptions({
|
||||
name: 'BusinessAdministrator/PowerQualityCheck'
|
||||
name: 'terminal/terminaCkeck'
|
||||
})
|
||||
|
||||
// 公共依赖
|
||||
@@ -106,17 +102,15 @@ const tableStore = new TableStore({
|
||||
width: 80,
|
||||
render: 'customRender',
|
||||
customRender: props => {
|
||||
console.log(props.renderValue)
|
||||
const val = props.renderValue
|
||||
console.log(val)
|
||||
let text = ''
|
||||
let color = ''
|
||||
if (val === 1) {
|
||||
text = '是'
|
||||
color = '#f53f3f'
|
||||
color = '#f56c6c'
|
||||
} else if (val === 0) {
|
||||
text = '否'
|
||||
color = '#00b42a'
|
||||
color = '#67c23a'
|
||||
}
|
||||
return h('span', { style: { color, fontWeight: 'bold' } }, text)
|
||||
}
|
||||
@@ -132,10 +126,10 @@ const tableStore = new TableStore({
|
||||
let color = ''
|
||||
if (val > 0) {
|
||||
text = val
|
||||
color = '#f53f3f'
|
||||
color = '#f56c6c'
|
||||
} else if (val > -30) {
|
||||
text = Math.abs(val).toString() + '天后将逾期'
|
||||
color = 'rgba(236,143,21,0.92)'
|
||||
color = '#e6a23c'
|
||||
} else {
|
||||
text = '/'
|
||||
}
|
||||
@@ -167,9 +161,7 @@ const tableStore = new TableStore({
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
|
||||
}
|
||||
click: row => {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -181,9 +173,9 @@ const tableStore = new TableStore({
|
||||
})
|
||||
|
||||
// 初始化查询参数
|
||||
tableStore.table.params.areaName = ''
|
||||
tableStore.table.params.bdName = ''
|
||||
tableStore.table.params.devName = ''
|
||||
tableStore.table.params.city = ''
|
||||
tableStore.table.params.substation = ''
|
||||
tableStore.table.params.terminalName = ''
|
||||
tableStore.table.params.orgId = adminInfo.$state.deptId
|
||||
|
||||
// 打开详情弹窗
|
||||
@@ -193,9 +185,7 @@ const openDetail = (id: string) => {
|
||||
}
|
||||
|
||||
// 新增按钮
|
||||
const addFormModel = () => {
|
||||
|
||||
}
|
||||
const addFormModel = () => {}
|
||||
|
||||
// 批量删除
|
||||
const deleteEven = () => {
|
||||
@@ -225,14 +215,13 @@ const props = defineProps({
|
||||
})
|
||||
watch(
|
||||
() => props.id,
|
||||
async (newVal) => {
|
||||
async newVal => {
|
||||
if (newVal === 'null') return
|
||||
const fullId = newVal.split('@')[0]
|
||||
const routeTime = Number(newVal.split('@')[1])
|
||||
if (isNaN(routeTime) || Date.now() - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return
|
||||
const res = await getPqCheckById(fullId)
|
||||
if (res.code === 'A0000') {
|
||||
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
@@ -245,8 +234,5 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.default-main {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -368,6 +368,48 @@
|
||||
show-word-limit
|
||||
/>
|
||||
</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-input
|
||||
type="textarea"
|
||||
@@ -390,7 +432,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, reactive, defineExpose, defineProps, defineEmits, watch, onUnmounted } from 'vue'
|
||||
// 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 { useDictData } from '@/stores/dictData'
|
||||
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 dialogFormVisible = ref(false)
|
||||
// .doc,.docx,.xlsx,.xls,.pdf
|
||||
const acceptType = ''
|
||||
const acceptType = '.pdf,.docx'
|
||||
const form: any = ref({})
|
||||
const loading = ref(false)
|
||||
const control: any = ref(true)
|
||||
@@ -533,6 +575,10 @@ const defaultProps = {
|
||||
const nonlinearDeviceTypeList: any = ref('')
|
||||
//获取登陆用户姓名和部门
|
||||
const adminInfo = useAdminInfo()
|
||||
// 电能质量检测报告
|
||||
const detectionFile = ref('')
|
||||
// 电能质量评估报告
|
||||
const evaluationFile = ref('')
|
||||
const resetForm = () => {
|
||||
form.value = {
|
||||
reporter: '', //填报人 1
|
||||
@@ -559,6 +605,8 @@ const resetForm = () => {
|
||||
pccPoint: '', //PCC点 1
|
||||
evaluationType: evaluationTypeList[0].id, //评估类型 1
|
||||
evaluationChekDept: '', //预测评估审单位 1
|
||||
detection: [], //电能质量检测报告
|
||||
evaluation: [], //电能质量评估报告
|
||||
minShortCircuitCapacity: '', //系统最小短路容量(MVA) 1
|
||||
userAgreementCapacity: '', //用户用电协议容量(MVA) 1
|
||||
needGovernance: 0, //是否需要治理 1
|
||||
@@ -582,6 +630,8 @@ const resetForm = () => {
|
||||
delete form.value.loadLevel
|
||||
delete form.value.powerSupplyInfo
|
||||
}
|
||||
detectionFile.value = ''
|
||||
evaluationFile.value = ''
|
||||
}
|
||||
//初始化数据
|
||||
resetForm()
|
||||
@@ -901,6 +951,10 @@ const open = async (row: any) => {
|
||||
} else {
|
||||
resendId.value = ''
|
||||
form.value.userType = userTypeList.value[0].value
|
||||
detectionFile.value = ''
|
||||
evaluationFile.value = ''
|
||||
form.value.detection = []
|
||||
form.value.evaluation = []
|
||||
}
|
||||
await getSubstationSelect().then(res => {
|
||||
stationList.value = res.data
|
||||
@@ -918,18 +972,36 @@ async function handleResponse(data: any) {
|
||||
// userType logic is commented out; if needed, implement accordingly
|
||||
if (data.userReportProjectPO) {
|
||||
form.value = { ...data, ...data.userReportProjectPO }
|
||||
fileRaw(data, 'userReportProjectPO')
|
||||
} else if (data.userReportSubstationPO) {
|
||||
form.value = { ...data, ...data.userReportSubstationPO }
|
||||
fileRaw(data, 'userReportSubstationPO')
|
||||
} else if (data.userReportSensitivePO) {
|
||||
form.value = {
|
||||
...data,
|
||||
...data.userReportSensitivePO,
|
||||
energyQualityIndex: data.userReportSensitivePO.energyQualityIndex.split(', ')
|
||||
}
|
||||
fileRaw(data, 'userReportSensitivePO')
|
||||
}
|
||||
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 = () => {
|
||||
//重置表单内容
|
||||
//取消表单校验状态
|
||||
@@ -948,14 +1020,25 @@ const handleExceed: UploadProps['onExceed'] = files => {
|
||||
file.uid = genFileId()
|
||||
uploadRef.value!.handleStart(file)
|
||||
}
|
||||
let uploadName = ref('')
|
||||
//上传报告字段名称
|
||||
const uploadFileName = (val: any) => {
|
||||
uploadName.value = val
|
||||
}
|
||||
//移除文件上传
|
||||
const removeFile = (file: any, uploadFiles: any) => {
|
||||
console.log(file, uploadFiles)
|
||||
const removeFile = (val: string) => {
|
||||
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.orgId = adminInfo.$state.deptId
|
||||
let confirmFormData = JSON.parse(JSON.stringify(subForm.value))
|
||||
confirmFormData.detection = detectionFile.value
|
||||
confirmFormData.evaluation = evaluationFile.value
|
||||
//1.判断是否上传
|
||||
if (subForm.value.userType == '0' || subForm.value.userType == '1') {
|
||||
{
|
||||
//其他报告非必填
|
||||
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,
|
||||
detection: detectionFile.value,
|
||||
evaluation: evaluationFile.value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1009,7 +1098,9 @@ const confirmForm = async (flag: boolean) => {
|
||||
{
|
||||
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))
|
||||
}
|
||||
const setcontroFlag = () => {
|
||||
|
||||
|
||||
controFlag.value = true
|
||||
}
|
||||
defineExpose({ open, filterUsers, setcontroFlag })
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<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 Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
|
||||
Reference in New Issue
Block a user