修改测试问题

This commit is contained in:
guanj
2026-01-07 21:01:28 +08:00
parent 02a95c1dcd
commit 545e3836d1
24 changed files with 969 additions and 568 deletions

View File

@@ -37,7 +37,7 @@ import TableHeader from '@/components/table/header/index.vue'
import { getTemplateList } from '@/api/harmonic-boot/luckyexcel'
import { getListByIds } from '@/api/harmonic-boot/cockpit/cockpit'
import { getTime } from '@/utils/formatTime'
import { ElMessage } from 'element-plus'
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number] },
@@ -118,12 +118,15 @@ const tableStore: any = new TableStore({
column: [],
beforeSearchFun: () => {
setTime()
if (!tableStore.table.params.sensitiveUserId && idList.value?.length > 0) {
tableStore.table.params.sensitiveUserId = idList.value[0].id
}
if (!tableStore.table.params.tempId && templateList.value?.length > 0) {
tableStore.table.params.tempId = templateList.value[0].id
}
// if (!tableStore.table.params.sensitiveUserId && idList.value?.length > 0) {
// tableStore.table.params.sensitiveUserId = idList.value[0].id
// }
// if (!tableStore.table.params.tempId && templateList.value?.length > 0) {
// tableStore.table.params.tempId = templateList.value[0].id
// }
// if( !tableStore.table.params.tempId){
// return ElMessage.warning('请选择模板')
// }
},
loadCallback: () => {
luckysheet.create({

View File

@@ -14,7 +14,7 @@
<el-option
v-for="item in options"
:key="item.lineId"
:label="item.name"
:label="item.lineName"
:value="item.lineId"
/>
</el-select>
@@ -24,11 +24,7 @@
<Table ref="tableRef" @cell-click="cellClickEvent" isGroup :height="height"></Table>
</el-dialog>
<!-- 谐波电流谐波电压占有率 -->
<HarmonicRatio
ref="harmonicRatioRef"
@close="onHarmonicRatioClose"
v-if="dialogFlag"
/>
<HarmonicRatio ref="harmonicRatioRef" @close="onHarmonicRatioClose" v-if="dialogFlag" />
</div>
</template>
<script setup lang="ts">
@@ -144,9 +140,10 @@ const tableStore: any = new TableStore({
provide('tableStore', tableStore)
tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = ''
const open = async (row: any,searchBeginTime:any,searchEndTime:any) => {
const open = async (row: any,searchBeginTime:any,searchEndTime:any,data:any=[]) => {
dialogVisible.value = true
initCSlineList()
// initCSlineList()
options.value = data
tableStore.table.params.lineId = row.lineId
nextTick(() => {

View File

@@ -1,7 +1,14 @@
<template>
<div>
<!--主要监测点列表 -->
<TableHeader :showReset="false" :timeKeyList="prop.timeKey" @selectChange="selectChange" v-if="fullscreen" datePicker ref="TableHeaderRef">
<TableHeader
:showReset="false"
:timeKeyList="prop.timeKey"
@selectChange="selectChange"
v-if="fullscreen"
datePicker
ref="TableHeaderRef"
>
<template v-slot:select>
<el-form-item label="关键词">
<el-input v-model="tableStore.table.params.keywords" clearable placeholder="请输关键字" />
@@ -32,7 +39,7 @@ const prop = defineProps({
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: Array as () => string[] },
timeKey: { type: Array as () => string[] },
timeValue: { type: Object },
interval: { type: Number }
})
@@ -98,13 +105,16 @@ const tableStore: any = new TableStore({
{
title: '是否治理',
field: 'govern',
minWidth: '70'
minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
},
{ title: '主要存在的电能质量问题', field: 'problems', minWidth: '150', showOverflow: true }
],
beforeSearchFun: () => {
setTime()
setTime()
},
loadCallback: () => {
tableStore.table.height = `calc(${prop.height} - 80px)`
@@ -122,7 +132,8 @@ const cellClickEvent = ({ row, column }: any) => {
OverLimitDetailsRef.value.open(
row,
tableStore.table.params.searchBeginTime || prop.timeValue?.[0],
tableStore.table.params.searchEndTime || prop.timeValue?.[1]
tableStore.table.params.searchEndTime || prop.timeValue?.[1],
tableStore.table.data
)
}
}

View File

@@ -129,20 +129,55 @@ const tableStore: any = new TableStore({
return `<span style='cursor: pointer;text-decoration: underline;'>${row.lineName}</span>`
}
},
{ title: '监测类型', field: 'position', minWidth: '80' },
{
title: '监测类型',
field: 'position',
minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
},
// {
// title: '监测点状态',
// field: 'runStatus',
// minWidth: '90',
// render: 'customTemplate',
// customTemplate: (row: any) => {
// return `<span style='color: ${row.runStatus === '中断' ? '#FF0000' : ''}'>${row.runStatus==null?'/':row.runStatus}</span>`
// }
// },
{
title: '监测点状态',
field: 'runStatus',
minWidth: '90',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='color: ${row.runStatus === '中断' ? '#FF0000' : ''}'>${row.runStatus}</span>`
render: 'tag',
width: 100,
custom: {
停运: 'danger',
退运: 'danger',
运行: 'success',
中断: 'warning',
检修: 'warning',
调试: 'warning',
null: 'info'
},
replaceValue: {
运行: '运行',
退运: '退运',
停运: '停运',
中断: '中断',
检修: '检修',
调试: '调试',
null: '/'
}
},
{
title: '治理对象',
field: 'sensitiveUser',
minWidth: '90'
minWidth: '90',
formatter: (row: any) => {
return row.cellValue || '/'
}
},
{
@@ -153,7 +188,10 @@ const tableStore: any = new TableStore({
{
title: '是否治理',
field: 'govern',
minWidth: '80'
minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
},
{
@@ -169,18 +207,30 @@ const tableStore: any = new TableStore({
}
}
},
// {
// title: '报告',
// field: 'reportFilePath',
// minWidth: '120',
// render: 'customTemplate',
// customTemplate: (row: any) => {
// return row.reportFilePath == null
// ? '/'
// : `<span style='cursor: pointer;text-decoration: underline;'>${row.reportFilePath
// .split('/')
// .pop()}</span>`
// }
// },
{
title: '报告',
field: 'lineId',
field: 'reportFilePath',
minWidth: '120',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.lineId}</span>`
formatter: (row: any) => {
return row.cellValue == null ? '/' : row.cellValue.split('/').pop()
}
},
{
title: '操作',
minWidth: 80,
width: 150,
// fixed: 'right',
render: 'buttons',
buttons: [
@@ -198,19 +248,19 @@ const tableStore: any = new TableStore({
}
},
// {
// name: 'productSetting',
// title: '下载报告',
// type: 'primary',
// icon: 'el-icon-EditPen',
// render: 'basicButton',
// click: row => {
// downloadTheReport(row.lineId)
// },
// disabled: row => {
// return row.reportFilePath == null || row.reportFilePath.length == 0
// }
// },
{
name: 'productSetting',
title: '下载报告',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
downloadTheReport(row.lineId, row.reportFilePath)
},
disabled: row => {
return row.reportFilePath == null || row.reportFilePath.length == 0
}
},
{
name: 'productSetting',
title: '重新上传',
@@ -267,22 +317,47 @@ const cellClickEvent = ({ row, column }: any) => {
tableStore.table.params.searchBeginTime || prop.timeValue?.[0],
tableStore.table.params.searchEndTime || prop.timeValue?.[1]
)
}else if (column.field == 'lineId') {
downloadTheReport(row.lineId)
}
}
// 下载报告
const downloadTheReport = (lineId: string) => {
const downloadTheReport = (lineId: string, name: string) => {
getReportUrl({ lineId: lineId }).then((res: any) => {
const link = document.createElement('a')
link.href = res.data
link.download = '治理报告'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
forceDownloadPdf(res.data, name.split('/').pop() || '')
})
}
const forceDownloadPdf = async (pdfUrl, fileName = '文件.pdf') => {
try {
// 1. 请求 PDF 并转为 Blob关键绕开浏览器直接解析
const response = await fetch(pdfUrl, {
method: 'GET'
// 若需要鉴权,添加请求头(如 token
})
// 校验响应是否成功
if (!response.ok) throw new Error(`请求失败:${response.status}`)
// 2. 将响应转为 Blob指定类型为 PDF确保兼容性
const blob = await response.blob()
const pdfBlob = new Blob([blob], { type: 'application/pdf' })
// 3. 创建临时 URL 并触发下载
const blobUrl = URL.createObjectURL(pdfBlob)
const a = document.createElement('a')
a.href = blobUrl
a.download = fileName // 此时 Blob URL 是同源的download 必生效
a.style.display = 'none'
document.body.appendChild(a)
a.click() // 触发下载
// 4. 清理资源(避免内存泄漏)
document.body.removeChild(a)
URL.revokeObjectURL(blobUrl)
} catch (error) {
console.error('PDF 下载失败:', error)
// ElMessage.error('文件下载失败,请检查网络或文件地址') // 适配 Element Plus
}
}
// 上传报告
const uploadReportRow = (row: any) => {
@@ -336,7 +411,6 @@ const beforeUpload = (file: any) => {
}
const handleUpload = async () => {
console.log(123, fileList.value)
// return
const formData = new FormData()

View File

@@ -14,7 +14,7 @@
<el-option
v-for="item in options"
:key="item.lineId"
:label="item.name"
:label="item.lineName"
:value="item.lineId"
/>
</el-select>
@@ -139,9 +139,10 @@ const tableStore: any = new TableStore({
provide('tableStore', tableStore)
tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = ''
const open = async (row: any,searchBeginTime:any,searchEndTime:any) => {
const open = async (row: any,searchBeginTime:any,searchEndTime:any,data: any) => {
dialogVisible.value = true
initCSlineList()
// initCSlineList()
options.value = data
tableStore.table.params.lineId = row.lineId
nextTick(() => {

View File

@@ -217,7 +217,8 @@ const cellClickEvent = ({ row, column }: any) => {
OverLimitDetailsRef.value.open(
row,
tableStore.table.params.searchBeginTime || prop.timeValue?.[0],
tableStore.table.params.searchEndTime || prop.timeValue?.[1]
tableStore.table.params.searchEndTime || prop.timeValue?.[1],
tableStore.table.data
)
}
}

View File

@@ -6,7 +6,8 @@
:showReset="false"
@selectChange="selectChange"
datePicker
v-if="fullscreen" :timeKeyList="prop.timeKey"
v-if="fullscreen"
:timeKeyList="prop.timeKey"
></TableHeader>
<Table
ref="tableRef"
@@ -29,7 +30,7 @@ const prop = defineProps({
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: Array as () => string[] },
timeKey: { type: Array as () => string[] },
timeValue: { type: Object },
interval: { type: Number }
})
@@ -94,12 +95,18 @@ const tableStore: any = new TableStore({
{
title: '是否监测',
field: 'isMonitor',
minWidth: '80'
minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
},
{
title: '是否治理',
field: 'isGovern',
minWidth: '80'
minWidth: '80',
formatter: (row: any) => {
return row.cellValue || '/'
}
}
],
beforeSearchFun: () => {

View File

@@ -266,8 +266,7 @@ self.onmessage = function (e) {
} else if (boxoList.systemType == 'ZL') {
titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 项目名称:' +
boxoList.engineeringName +
' 监测点名称:' +
boxoList.equipmentName +
' 发生时刻:' +
@@ -280,8 +279,7 @@ self.onmessage = function (e) {
} else if (boxoList.systemType == 'YPT') {
titles =
(boxoList.engineeringName == undefined ? '' : ' 项目名称:' + boxoList.engineeringName) +
' 项目名称:' +
boxoList.engineeringName +
' 监测点名称:' +
boxoList.lineName +
' 发生时刻:' +