修改测试bug

This commit is contained in:
guanj
2026-06-08 18:34:49 +08:00
parent 4f907a80c4
commit 03d302ded8
133 changed files with 3991 additions and 3442 deletions

View File

@@ -6,10 +6,10 @@
</el-row>
<el-row class="ba-array-item" v-for="(item, idx) in state.value" :gutter="10" :key="idx">
<el-col :span="10">
<el-input v-model="item.key"></el-input>
<el-input maxlength="32" show-word-limit v-model="item.key"></el-input>
</el-col>
<el-col :span="10">
<el-input v-model="item.value"></el-input>
<el-input maxlength="32" show-word-limit v-model="item.value"></el-input>
</el-col>
<el-col :span="4">
<el-button @click="onDelArrayItem(idx)" size="small" icon="el-icon-Delete" circle />

View File

@@ -61,7 +61,7 @@
</transition>
</div>
<template #reference>
<el-input
<el-input maxlength="32" show-word-limit
v-model="state.inputValue"
:size="size"
:disabled="disabled"

View File

@@ -1,37 +1,18 @@
<template>
<div>
<!--治理效果报表 -->
<TableHeader
:showReset="false"
:timeKeyList="prop.timeKey"
ref="TableHeaderRef"
datePicker
@selectChange="selectChange"
v-if="fullscreen"
>
<TableHeader :showReset="false" :timeKeyList="prop.timeKey" ref="TableHeaderRef" datePicker
@selectChange="selectChange" v-if="fullscreen">
<template v-slot:select>
<el-form-item label="模板策略">
<el-select
filterable
v-model="tableStore.table.params.tempId"
placeholder="请选择模板策略"
clearable
>
<el-option
v-for="item in templateList"
:key="item.id"
:label="item.excelName"
:value="item.id"
/>
<el-select filterable v-model="tableStore.table.params.tempId" placeholder="请选择模板策略" clearable>
<el-option v-for="item in templateList" :key="item.id" :label="item.excelName"
:value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="监测对象">
<el-select
filterable
v-model="tableStore.table.params.sensitiveUserId"
placeholder="请选择监测对象"
clearable
>
<el-select filterable v-model="tableStore.table.params.sensitiveUserId" placeholder="请选择监测对象"
clearable>
<el-option v-for="item in idList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
@@ -40,14 +21,12 @@
<el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出</el-button>
</template>
</TableHeader>
<div style="display: flex">
<div
id="luckysheet"
:style="{
width: `calc(${prop.width} )`,
height: `calc(${prop.height} - 57px + ${fullscreen ? 0 : 56}px)`
}"
></div>
<div style="display: flex" >
<div id="luckysheet" :style="{
width: `calc(${prop.width} )`,
height: `calc(${prop.height} - 57px + ${fullscreen ? 0 : 56}px)`
}"></div>
</div>
</div>
</template>
@@ -118,6 +97,7 @@ const downloadExcel = () => {
}
onMounted(() => {
initListByIds()
})
onUnmounted(() => {
@@ -199,6 +179,12 @@ watch(
tableStore.index()
}
)
watch(
() => prop.height,
val => {
renderLuckysheetReport('luckysheet', tableStore.table.data, { allowEdit: false })
}
)
watch(
() => prop.timeValue,
(newVal, oldVal) => {

View File

@@ -11,7 +11,7 @@
>
<template v-slot:select>
<el-form-item label="关键字筛选">
<el-input v-model="tableStore.table.params.keywords" clearable placeholder="请输入监测点名称" />
<el-input maxlength="32" show-word-limit v-model="tableStore.table.params.keywords" clearable placeholder="请输入监测点名称" />
</el-form-item>
</template>
</TableHeader>

View File

@@ -10,9 +10,9 @@
>
<template #select>
<el-form-item label="关键字筛选">
<el-input
maxlength="32"
show-word-limit
<el-input maxlength="32" show-word-limit
style="width: 240px"
v-model.trim="tableStore.table.params.searchValue"
clearable
@@ -342,10 +342,11 @@ const cellClickEvent = ({ row, column }: any) => {
// 下载报告
const downloadTheReport = (lineId: string, name: string) => {
getReportUrl({ lineId: lineId }).then((res: any) => {
ElMessage.info('下载中......')
forceDownloadPdf(res.data, name.split('/').pop() || '')
})
}
const forceDownloadPdf = async (pdfUrl, fileName = '文件.pdf') => {
const forceDownloadPdf = async (pdfUrl:any, fileName = '文件.pdf') => {
try {
// 1. 请求 PDF 并转为 Blob关键绕开浏览器直接解析
const response = await fetch(pdfUrl, {
@@ -372,8 +373,9 @@ const forceDownloadPdf = async (pdfUrl, fileName = '文件.pdf') => {
// 4. 清理资源(避免内存泄漏)
document.body.removeChild(a)
URL.revokeObjectURL(blobUrl)
ElMessage.success('下载成功')
} catch (error) {
console.error('PDF 下载失败:', error)
console.error('下载失败:', error)
// ElMessage.error('文件下载失败,请检查网络或文件地址') // 适配 Element Plus
}
}

View File

@@ -10,9 +10,9 @@
>
<template #select>
<el-form-item label="关键字筛选">
<el-input
maxlength="32"
show-word-limit
<el-input maxlength="32" show-word-limit
style="width: 240px"
v-model.trim="tableStore.table.params.searchValue"
clearable

View File

@@ -258,7 +258,7 @@ self.onmessage = function (e) {
boxoList.measurementPointName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'%  持续时间:' +
boxoList.duration +
@@ -270,7 +270,7 @@ self.onmessage = function (e) {
boxoList.equipmentName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
boxoList.evtParamVVaDepth +
'% 持续时间:' +
boxoList.evtParamTm +
@@ -282,7 +282,7 @@ self.onmessage = function (e) {
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.persistTime +
@@ -295,7 +295,7 @@ self.onmessage = function (e) {
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.duration +

View File

@@ -609,7 +609,7 @@ const initWave = (
$(`#${rmsId}`).css('height', picHeight).css('width', vw.value).css('min-height', '200px')
}
} else {
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降(骤升)幅值:${(
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降幅值:${(
Number(eventValue.value) * 1
).toFixed(0)}% 持续时间:${persistTime.value}s`
}
@@ -854,7 +854,7 @@ const initWave = (
data: rmscu
},
{
name: '最小暂降(骤升)幅值',
name: '最小暂降幅值',
type: 'scatter',
symbol: 'image://' + url2,
itemStyle: { width: 45, height: 45 },

View File

@@ -131,7 +131,7 @@ self.addEventListener('message', function (e) {
boxoList.measurementPointName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.duration +
@@ -143,7 +143,7 @@ self.addEventListener('message', function (e) {
boxoList.equipmentName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
boxoList.evtParamVVaDepth +
'% 持续时间:' +
boxoList.evtParamTm +
@@ -155,7 +155,7 @@ self.addEventListener('message', function (e) {
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.persistTime +
@@ -168,7 +168,7 @@ self.addEventListener('message', function (e) {
boxoList.lineName +
' 发生时刻:' +
boxoList.startTime +
' 暂降(骤升)幅值:' +
' 暂降幅值:' +
(boxoList.featureAmplitude * 100).toFixed(2) +
'% 持续时间:' +
boxoList.duration +

View File

@@ -375,7 +375,7 @@ const initWave = (
$(`#${waveId}`).css('height', picHeight).css('width', vw.value).css('min-height', '200px')
}
} else {
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降(骤升)幅值:${(
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 暂降幅值:${(
Number(eventValue.value) * 1
).toFixed(0)}% 持续时间:${persistTime.value}s`
}

View File

@@ -95,6 +95,7 @@ const shortcuts = [
// 计算过滤后的 timeOptions
const filteredTimeOptions = computed(() => {
console.log("🚀 ~ props.timeKeyList :", props.timeKeyList )
if (!props.timeKeyList || props.timeKeyList.length === 0) {
return timeOptions.value
}

View File

@@ -1,6 +1,6 @@
<template>
<div class="mac-address-input" :class="{ disabled: disabled }">
<el-input
<el-input show-word-limit
ref="inputRef"
placeholder="请输入设备mac地址"
v-model="macValue"

View File

@@ -81,7 +81,7 @@ import { defineProps } from 'vue'
import { useTimeCacheStore } from '@/stores/timeCache'
import { useRoute } from 'vue-router'
const emit = defineEmits(['selectChange'])
const emit = defineEmits(['selectChange','onResetForm'])
const tableStore = inject('tableStore') as TableStore
const tableHeader = ref()
@@ -244,6 +244,7 @@ const setDatePicker = (list: any) => {
const onResetForm = () => {
//时间重置成默认值
datePickerRef.value?.setInterval(3)
emit('onResetForm')
tableStore.onTableAction('reset', {})
}
const setInterval = (val: any) => {

View File

@@ -14,7 +14,7 @@
/> -->
<div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1 }">
<div style="display: flex; align-items: center" class="mb10">
<el-input maxlength="32" v-model.trim="filterText" placeholder="请输入内容" clearable>
<el-input maxlength="32" show-word-limit v-model.trim="filterText" placeholder="请输入内容" clearable>
<template #prefix>
<Icon name="el-icon-Search" style="font-size: 16px" />
</template>

View File

@@ -11,7 +11,7 @@
/> -->
<div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1 }">
<div style="display: flex; align-items: center" class="mb10">
<el-input maxlength="32" v-model.trim="filterText" placeholder="请输入内容" clearable>
<el-input maxlength="32" show-word-limit v-model.trim="filterText" placeholder="请输入内容" clearable>
<template #prefix>
<Icon name="el-icon-Search" style="font-size: 16px" />
</template>

View File

@@ -12,8 +12,8 @@
/> -->
<div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1 }">
<div style="display: flex; align-items: center" class="mb10">
<el-input
maxlength="32"
<el-input maxlength="32" show-word-limit
v-model.trim="filterText"
autocomplete="off"
placeholder="请输入内容"
@@ -202,10 +202,10 @@ const props = withDefaults(defineProps<Props>(), {
leafMode: 'line'
})
const treeType = ref('1')
const treeType = ref('2')
const options = [
{ label: '工程', value: '2' },
{ label: '设备', value: '1' },
{ label: '工程', value: '2' }
]
const { proxy } = useCurrentInstance()
@@ -379,7 +379,7 @@ const changeTreeType = (val: string) => {
}
onMounted(() => {
treeType.value = props.engineering ? '2' : '1'
// treeType.value = props.engineering ? '2' : '1'
})
</script>

View File

@@ -62,9 +62,8 @@ async function loadTree() {
}
await selectTreeNode(treRef.value, node, {
level: 3,
onSelect: selected => {
emit('init', { ...selected, level: 3 })
emit('init', { ...selected, level: selected.level ?? 3 })
changePointType('4', selected)
}
})

View File

@@ -1,12 +1,12 @@
<template>
<Tree ref="treRef" @check-change="handleCheckChange" :default-checked-keys="defaultCheckedKeys"
<Tree ref="treRef" @check-change="handleCheckChange" :default-checked-keys="defaultCheckedKeys" default-expand-all
:show-checkbox="props.showCheckbox" :data="tree" :height="props.height" @changeDeviceType="changeDeviceType"
@changeTreeType="loadTree" :engineering="props.engineering" leaf-mode="device" />
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { throttle } from 'lodash'
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { debounce } from 'lodash-es'
import Tree from '../device.vue'
import { getDeviceTree } from '@/api/cs-device-boot/csLedger'
import { useConfig } from '@/stores/config'
@@ -39,7 +39,11 @@ const tree = ref<any[]>([])
const treRef = ref<InstanceType<typeof Tree>>()
const decorators = createLineTreeDecorators(() => config.getColorVal('elementUiPrimary'))
const changeDeviceType = (val: any, obj: any) => emit('deviceTypeChange', val, obj)
const changeDeviceType = debounce((val: any, obj: any) => {
emit('deviceTypeChange', val, obj)
}, 300)
onBeforeUnmount(() => changeDeviceType.cancel())
async function selectInitialNode(type: string | undefined, leaves: LineTreeLeaves) {
const candidates: { refKey: TreeRefKey; list: any[]; level: number }[] =
@@ -70,7 +74,7 @@ const loadTree = (type?: string) => {
})
}
onMounted(() => loadTree(props.engineering ? '2' : '1'))
onMounted(() => loadTree( '2' ))
const handleCheckChange =
(data: any, checked: any, indeterminate: any) => {

View File

@@ -18,7 +18,8 @@ export interface LineTreeDecorators {
export function createLineTreeDecorators(getPrimaryColor: () => string): LineTreeDecorators {
const offlineColor = '#e26257 !important'
const statusColor = (comFlag: number) => (comFlag === 2 ? getPrimaryColor() : offlineColor)
// const statusColor = (comFlag: number) => (comFlag === 2 ? getPrimaryColor() : offlineColor)
const statusColor = (comFlag: number) => (comFlag === 2 ? "#2ab914" : offlineColor)
const applyMeta = (
node: any,
@@ -85,7 +86,7 @@ export function decorateLineTree(
})
grand.children?.forEach((leaf: any) => {
applyMeta(leaf, {
icon: 'el-icon-Platform',
icon: 'local-监测点',
color: statusColor(leaf.comFlag),
...LINE_LEAF_META
})
@@ -110,7 +111,7 @@ export function decorateLineTree(
})
l3.children?.forEach((l4: any) => {
applyMeta(l4, {
icon: 'el-icon-Platform',
icon: 'local-监测点',
color: statusColor(l4.comFlag),
...LINE_LEAF_META
})
@@ -124,7 +125,7 @@ export function decorateLineTree(
applyMeta(l1, { icon: 'el-icon-Platform', color: statusColor(l1.comFlag) })
l1.children?.forEach((l2: any) => {
applyMeta(l2, {
icon: 'el-icon-Platform',
icon: 'local-监测点',
color: statusColor(l2.comFlag),
...LINE_LEAF_META
})
@@ -145,7 +146,7 @@ export function decorateLineTree(
})
l3.children?.forEach((l4: any) => {
applyMeta(l4, {
icon: 'el-icon-Platform',
icon: 'local-监测点',
color: statusColor(l4.comFlag),
...LINE_LEAF_META
})

View File

@@ -76,6 +76,7 @@ async function selectInitialNode(type: string | undefined, leaves: LineTreeLeave
}
const loadTree = (type?: string) => {
console.log("🚀 ~ loadTree ~ type:", type)
tree.value = []
getLineTree({ type: type === '2' ? 'engineering' : '' }).then(res => {
const leaves = decorateLineTree(res.data, type, decorators, { disableParents: false })
@@ -89,11 +90,13 @@ function bootstrap() {
querySysExcel({})
.then((res: any) => {
emit('Policy', res.data)
loadTree()
loadTree('2')
})
.catch(() => loadTree())
} else {
loadTree()
} else {
loadTree('2')
}
}

View File

@@ -3,7 +3,7 @@
<div style="transition: all 0.3s; overflow: hidden; height: 100%">
<div class="cn-tree">
<div style="display: flex; align-items: center" class="mb10">
<el-input maxlength="32" v-model.trim="filterText" placeholder="请输入内容" clearable>
<el-input maxlength="32" show-word-limit v-model.trim="filterText" placeholder="请输入内容" clearable>
<template #prefix>
<Icon name="el-icon-Search" style="font-size: 16px" />
</template>

View File

@@ -30,11 +30,27 @@ export async function selectTreeNode(
) {
if (!node) return false
const treeInstance = await waitForSingleTreeRef(treRef)
treeInstance?.setCurrentKey(node.id)
if (!treeInstance) return false
await nextTick()
expandTreeNodePath(treeInstance, node.id)
treeInstance.setCurrentKey(node.id)
options?.onSelect?.(node)
return true
}
/** 展开到目标节点的全部祖先,保证深层节点可见 */
export function expandTreeNodePath(treeInstance: any, nodeId: string) {
const target = treeInstance.getNode?.(nodeId)
if (!target) return
let parent = target.parent
while (parent && parent.level > 0) {
parent.expanded = true
parent = parent.parent
}
}
export function bootstrapWithTemplate(
template: boolean,
loadFn: () => void,

View File

@@ -13,8 +13,8 @@
/> -->
<div class="cn-tree" :class="{ 'is-hidden': menuCollapse }">
<div class="cn-tree__toolbar">
<el-input
maxlength="32"
<el-input maxlength="32" show-word-limit
v-model.trim="filterText"
placeholder="请输入内容"
clearable

View File

@@ -13,7 +13,7 @@
/> -->
<div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1, display: menuCollapse ? 'none' : '' }">
<div style="display: flex; align-items: center" class="mb10">
<el-input maxlength="32" v-model.trim="filterText" placeholder="请输入内容" clearable>
<el-input v-model.trim="filterText" placeholder="请输入内容" clearable>
<template #prepend>
<el-select v-model="treeType" @change="changeTreeType" style="min-width: 75px">
<el-option
@@ -193,10 +193,10 @@ const props = withDefaults(defineProps<Props>(), {
const route = useRoute()
const { proxy } = useCurrentInstance()
const treeType = ref('1')
const treeType = ref('2')
const options = [
{ label: '工程', value: '2' },
{ label: '设备', value: '1' },
{ label: '工程', value: '2' }
]
const menuCollapse = ref(false)

View File

@@ -11,7 +11,7 @@
/> -->
<div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1 }">
<div style="display: flex; align-items: center" class="mb10">
<el-input maxlength="32" v-model.trim="filterText" placeholder="请输入内容" clearable>
<el-input maxlength="32" show-word-limit v-model.trim="filterText" placeholder="请输入内容" clearable>
<template #prefix>
<Icon name="el-icon-Search" style="font-size: 16px" />
</template>