diff --git a/src/views/pqs/business/terminal/terminaCkeck/index.vue b/src/views/pqs/business/terminal/terminaCkeck/index.vue index f415a5aa..fdf06212 100644 --- a/src/views/pqs/business/terminal/terminaCkeck/index.vue +++ b/src/views/pqs/business/terminal/terminaCkeck/index.vue @@ -41,11 +41,7 @@ - - - - - + @@ -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)' + text = Math.abs(val).toString() + '天后将逾期' + 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(() => { \ No newline at end of file + + diff --git a/src/views/pqs/business/terminal/userLedger/components/addForm.vue b/src/views/pqs/business/terminal/userLedger/components/addForm.vue index cbf344bc..e59473b6 100644 --- a/src/views/pqs/business/terminal/userLedger/components/addForm.vue +++ b/src/views/pqs/business/terminal/userLedger/components/addForm.vue @@ -368,6 +368,48 @@ show-word-limit /> + + + + + + + + + + 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 }) diff --git a/src/views/pqs/business/terminal/userLedger/index.vue b/src/views/pqs/business/terminal/userLedger/index.vue index e5f82951..3accb547 100644 --- a/src/views/pqs/business/terminal/userLedger/index.vue +++ b/src/views/pqs/business/terminal/userLedger/index.vue @@ -45,7 +45,7 @@