diff --git a/package.json b/package.json index e0feb54..83f15c7 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --mode ypt" , "dev:zl": "vite --mode zl", "dev:ypt": "vite --mode ypt", - "build": "vite build", + "build": "vite build --mode ypt", "build:zl": "vite build --mode zl", "build:ypt": "vite build --mode ypt", "preview": "vite preview" diff --git a/src/components/echarts/rmsboxi.vue b/src/components/echarts/rmsboxi.vue index 3d1b50a..2fb5901 100644 --- a/src/components/echarts/rmsboxi.vue +++ b/src/components/echarts/rmsboxi.vue @@ -14,10 +14,17 @@ import html2canvas from 'html2canvas' import $ from 'jquery' import * as echarts from 'echarts' import { mainHeight } from '@/utils/layout' -import { calcRmsYAxisRange, formatAxisLabel } from '@/utils/chartAxisHelper' +import { + calcRmsYAxisRange, + createWaveLineSeries, + formatAxisLabel, + formatWaveAxisTooltip, + WAVE_AXIS_POINTER, + WAVE_DATA_ZOOM +} from '@/utils/chartAxisHelper' import url from '@/assets/img/point.png' import url2 from '@/assets/img/dw.png' -import { buildWaveCacheKey, getWaveCache, setWaveCache } from '@/utils/waveCache' +import { buildWaveCacheKey, getWaveCache, setWaveCache, removeWaveCacheByEvent } from '@/utils/waveCache' import { getRmsWorker, buildWorkerPayload } from '@/utils/waveWorkerPool' import { buildExportBaseName, formatExportDateTime } from '@/utils/echartMethod' let waveRequestId = 0 @@ -186,6 +193,9 @@ onMounted(() => { }) onBeforeUnmount(() => { + waveRequestId++ + pendingCacheKeys.clear() + removeWaveCacheByEvent(props.wp, props.boxoList) backbxlb() window.removeEventListener('resize', handleResize) }) @@ -660,21 +670,9 @@ const initWave = ( tooltip: { top: '10px', trigger: 'axis', + axisPointer: WAVE_AXIS_POINTER, borderColor: 'grey', - formatter: function (params: any) { - let tips = '时刻:' + params[0].data[0] + '
' - for (let i = 0; i < params.length; i++) { - if (params[i].seriesName != '暂降触发点') { - tips += - params[i].marker + - params[i].seriesName + - ':' + - (params[i].value[1] - 0).toFixed(2) + - '
' - } - } - return tips - }, + formatter: (params: any) => formatWaveAxisTooltip(params), textStyle: { color: '#fff', fontStyle: 'normal', @@ -814,52 +812,11 @@ const initWave = ( top: '60px' // containLabel: true }, - dataZoom: [ - { - type: 'inside', - height: 13, - start: 0, - - bottom: '10px', - end: 100, - filterMode: 'none' - }, - { - start: 0, - height: 13, - bottom: '10px', - end: 100, - filterMode: 'none' - } - ], + dataZoom: WAVE_DATA_ZOOM, series: [ - { - name: a, - type: 'line', - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#DAA520' }, - data: radata - }, - { - name: b, - type: 'line', - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#2E8B57' }, - data: rbdata - }, - { - name: c, - type: 'line', - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#A52a2a' }, - data: rcdata - }, + createWaveLineSeries(a, radata, '#DAA520'), + createWaveLineSeries(b, rbdata, '#2E8B57'), + createWaveLineSeries(c, rcdata, '#A52a2a'), { name: '暂降触发点', type: 'scatter', @@ -1024,21 +981,9 @@ const drawPics = ( tooltip: { top: '10px', trigger: 'axis', + axisPointer: WAVE_AXIS_POINTER, borderColor: 'grey', - formatter: function (params: any) { - let tips = '时刻:' + params[0].data[0] + '
' - for (let i = 0; i < params.length; i++) { - if (params[i].seriesName != '暂降触发点') { - tips += - params[i].marker + - params[i].seriesName + - ':' + - (params[i].value[1] - 0).toFixed(2) + - '
' - } - } - return tips - }, + formatter: (params: any) => formatWaveAxisTooltip(params, { showMarker: false }), textStyle: { color: '#fff', fontStyle: 'normal', @@ -1163,52 +1108,11 @@ const drawPics = ( top: '60px' // containLabel: true }, - dataZoom: [ - { - type: 'inside', - height: 13, - start: 0, - - bottom: '10px', - end: 100, - filterMode: 'none' - }, - { - start: 0, - height: 13, - bottom: '10px', - end: 100, - filterMode: 'none' - } - ], + dataZoom: WAVE_DATA_ZOOM, series: [ - { - name: a, - type: 'line', - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#DAA520' }, - data: radata - }, - { - name: b, - type: 'line', - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#2E8B57' }, - data: rbdata - }, - { - name: c, - type: 'line', - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#A52a2a' }, - data: rcdata - } + createWaveLineSeries(a, radata, '#DAA520'), + createWaveLineSeries(b, rbdata, '#2E8B57'), + createWaveLineSeries(c, rcdata, '#A52a2a') ] } diff --git a/src/components/echarts/shushiboxi.vue b/src/components/echarts/shushiboxi.vue index c358f54..5f8cb1a 100644 --- a/src/components/echarts/shushiboxi.vue +++ b/src/components/echarts/shushiboxi.vue @@ -14,9 +14,17 @@ import html2canvas from 'html2canvas' import $ from 'jquery' import * as echarts from 'echarts' import { mainHeight } from '@/utils/layout' -import { calcShuYAxisRange, formatAxisLabel } from '@/utils/chartAxisHelper' +import { + calcShuYAxisRange, + createWaveLineSeries, + formatAxisLabel, + formatWaveAxisTooltip, + WAVE_AXIS_POINTER, + WAVE_DATA_ZOOM +} from '@/utils/chartAxisHelper' import url from '@/assets/img/point.png' -import { buildWaveCacheKey, getWaveCache, setWaveCache } from '@/utils/waveCache' + +import { buildWaveCacheKey, getWaveCache, setWaveCache, removeWaveCacheByEvent } from '@/utils/waveCache' import { getShuWorker, buildWorkerPayload } from '@/utils/waveWorkerPool' import { buildExportBaseName, formatExportDateTime } from '@/utils/echartMethod' @@ -192,6 +200,9 @@ onMounted(() => { }) onBeforeUnmount(() => { + waveRequestId++ + pendingCacheKeys.clear() + removeWaveCacheByEvent(props.wp, props.boxoList) backbxlb() window.removeEventListener('resize', handleResize) }) @@ -430,26 +441,14 @@ const initWave = ( tooltip: { top: '10px', trigger: 'axis', + axisPointer: WAVE_AXIS_POINTER, borderColor: 'grey', style: { color: '#fff', fontSize: '15px', padding: 10 }, - formatter: function (params: any) { - let tips = '时刻:' + params[0].data[0] + '
' - for (let i = 0; i < params.length; i++) { - if (params[i].seriesName != '暂降触发点') { - tips += - params[i].marker + - params[i].seriesName + - ':' + - (params[i].value[1] - 0).toFixed(2) + - '
' - } - } - return tips - }, + formatter: (params: any) => formatWaveAxisTooltip(params), textStyle: { color: '#fff', fontStyle: 'normal', @@ -577,55 +576,11 @@ const initWave = ( bottom: '45px', top: '60px' }, - dataZoom: [ - { - type: 'inside', - height: 13, - start: 0, - - bottom: '10px', - end: 100, - filterMode: 'none' - }, - { - start: 0, - height: 13, - bottom: '10px', - end: 100, - filterMode: 'none' - } - ], + dataZoom: WAVE_DATA_ZOOM, series: [ - { - name: a, - type: 'line', - large: true, - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#DAA520' }, - data: adata - }, - { - name: b, - type: 'line', - large: true, - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#2E8B57' }, - data: bdata - }, - { - name: c, - type: 'line', - large: true, - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#A52a2a' }, - data: cdata - }, + createWaveLineSeries(a, adata, '#DAA520'), + createWaveLineSeries(b, bdata, '#2E8B57'), + createWaveLineSeries(c, cdata, '#A52a2a'), { name: '暂降触发点', type: 'scatter', @@ -778,16 +733,9 @@ const drawPics = ( const option = { tooltip: { trigger: 'axis', + axisPointer: WAVE_AXIS_POINTER, borderColor: 'grey', - formatter: function (params: any) { - let tips = '时刻:' + params[0].data[0] + '
' - for (let i = 0; i < params.length; i++) { - if (params[i].seriesName != '暂降触发点') { - tips += params[i].seriesName + ':' + (params[i].value[1] - 0).toFixed(2) + '
' - } - } - return tips - }, + formatter: (params: any) => formatWaveAxisTooltip(params, { showMarker: false }), textStyle: { color: '#fff', fontStyle: 'normal', @@ -905,55 +853,11 @@ const drawPics = ( top: '60px' // containLabel: true }, - dataZoom: [ - { - type: 'inside', - height: 13, - start: 0, - - bottom: '10px', - end: 100, - filterMode: 'none' - }, - { - start: 0, - height: 13, - bottom: '10px', - end: 100, - filterMode: 'none' - } - ], + dataZoom: WAVE_DATA_ZOOM, series: [ - { - name: a, - type: 'line', - large: true, - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#DAA520' }, - data: adata - }, - { - name: b, - type: 'line', - large: true, - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#2E8B57' }, - data: bdata - }, - { - name: c, - type: 'line', - large: true, - smooth: true, - symbol: 'none', - sampling: 'average', - itemStyle: { color: '#A52a2a' }, - data: cdata - } + createWaveLineSeries(a, adata, '#DAA520'), + createWaveLineSeries(b, bdata, '#2E8B57'), + createWaveLineSeries(c, cdata, '#A52a2a') ] } diff --git a/src/components/icon/index.vue b/src/components/icon/index.vue index b904197..c277375 100644 --- a/src/components/icon/index.vue +++ b/src/components/icon/index.vue @@ -16,7 +16,7 @@ export default defineComponent({ required: true }, size: { - type: String, + type: [String, Number], default: '18px' }, color: { @@ -27,7 +27,7 @@ export default defineComponent({ setup(props) { const iconStyle = computed((): CSSProperties => { const { size, color } = props - let s = `${size.replace('px', '')}px` + const s = typeof size === 'number' ? `${size}px` : `${String(size).replace('px', '')}px` return { fontSize: s, color: color diff --git a/src/components/icon/svg/index.vue b/src/components/icon/svg/index.vue index 3f13c08..77c1cf7 100644 --- a/src/components/icon/svg/index.vue +++ b/src/components/icon/svg/index.vue @@ -10,7 +10,7 @@ import { computed, type CSSProperties } from 'vue' import { isExternal } from '@/utils/common' interface Props { name: string - size: string + size: string | number color: string } @@ -20,19 +20,21 @@ const props = withDefaults(defineProps(), { color: '#000000', }) -const s = `${props.size.replace('px', '')}px` +const s = computed(() => + typeof props.size === 'number' ? `${props.size}px` : `${String(props.size).replace('px', '')}px` +) const iconName = computed(() => `#${props.name}`) const iconStyle = computed((): CSSProperties => { return { color: props.color, - fontSize: s, + fontSize: s.value, } }) const isUrl = computed(() => isExternal(props.name)) const urlIconStyle = computed(() => { return { - width: s, - height: s, + width: s.value, + height: s.value, mask: `url(${props.name}) no-repeat 50% 50%`, '-webkit-mask': `url(${props.name}) no-repeat 50% 50%`, } diff --git a/src/components/table/defaultAttribute.ts b/src/components/table/defaultAttribute.ts index f6c41be..a1d30a9 100644 --- a/src/components/table/defaultAttribute.ts +++ b/src/components/table/defaultAttribute.ts @@ -1,16 +1,16 @@ -import { VxeTableProps } from 'vxe-table' - -export const defaultAttribute: VxeTableProps = { - align: 'center', - headerCellClassName: 'table-header-cell', - border: true, - stripe: true, - size: 'small', - columnConfig: { resizable: true }, - rowConfig: { isCurrent: true, isHover: true }, - scrollX: { scrollToLeftOnChange: true }, - scrollY: { scrollToTopOnChange: true, enabled: true, gt: 100 }, - customConfig: { enabled: true, allowFixed: false, showFooter: false, immediate: true ,mode:'default'}, - showOverflow: 'tooltip', - showHeaderOverflow: false -} +import { VxeTableProps } from 'vxe-table' + +export const defaultAttribute: VxeTableProps = { + align: 'center', + headerCellClassName: 'table-header-cell', + border: true, + stripe: true, + size: 'small', + columnConfig: { resizable: true }, + rowConfig: { isCurrent: true, isHover: true }, + scrollX: { scrollToLeftOnChange: true }, + scrollY: { scrollToTopOnChange: true, enabled: true, gt: 100 }, + customConfig: { enabled: true, allowFixed: false, showFooter: false, immediate: true ,mode:'default'}, + showOverflow: 'tooltip', + showHeaderOverflow: false +} diff --git a/src/components/tree/point.vue b/src/components/tree/point.vue index 7f051af..bdc5b71 100644 --- a/src/components/tree/point.vue +++ b/src/components/tree/point.vue @@ -25,7 +25,7 @@ + @@ -199,47 +201,35 @@ provide('tableStore', tableStore) // "type": "", // "userId": "" tableStore.table.params.searchValue = '' -// tableStore.table.params.cascader = '' -// tableStore.table.params.level = '' -// tableStore.table.params.engineeringid = '' -// tableStore.table.params.projectId = '' -// tableStore.table.params.deviceId = '' +tableStore.table.params.engineeringid = '' +tableStore.table.params.projectId = '' +tableStore.table.params.deviceId = '' +tableStore.table.params.lineId = '' +tableStore.table.params.cascader = '' tableStore.table.params.type = 3 -// tableStore.table.params.eventIds = [] -// tableStore.table.params.status = '' -// tableStore.table.params.target = [] -// tableStore.table.params.userId = '' -// tableStore.table.params.deviceTypeId = '' -// tableStore.table.params.deviceTypeName = '' -const deviceTreeOptions = ref(props.deviceTree) -deviceTreeOptions.value.map((item: any, index: any) => { - if (item?.children.length == 0) { - deviceTreeOptions.value.splice(index, 1) - } -}) +tableStore.table.params.level = '' + const filterNode = createTreeFilterNode() -const sourceChange = (e: any) => { - tableStore.table.params.deviceTypeId = '' + +const onTreeClear = () => { tableStore.table.params.engineeringid = '' tableStore.table.params.projectId = '' tableStore.table.params.deviceId = '' - if (e) { - let name = deviceTreeOptions.value.filter((item: any) => { - return item.id == e[0] - })[0].name - tableStore.table.params.deviceTypeName = name - if (name == '便携式设备') { - tableStore.table.params.deviceTypeId = e[0] || '' - tableStore.table.params.deviceId = e[1] || '' - } else { - tableStore.table.params.deviceTypeId = e[0] || '' - tableStore.table.params.engineeringid = e[1] || '' - tableStore.table.params.projectId = e[2] || '' - tableStore.table.params.deviceId = e[3] || '' - } - } + tableStore.table.params.lineId = '' } +const sourceChange = (e: any) => { + onTreeClear() + if (e.level == 0) { + tableStore.table.params.engineeringid = e.id + } else if (e.level == 1) { + tableStore.table.params.projectId = e.id + } else if (e.level == 2) { + tableStore.table.params.deviceId = e.id + } else if (e.level == 3) { + tableStore.table.params.lineId = e.id + } +} onMounted(() => { tableStore.index() }) diff --git a/src/views/govern/alarm/Steady.vue b/src/views/govern/alarm/Steady.vue index 40a19af..461d69c 100644 --- a/src/views/govern/alarm/Steady.vue +++ b/src/views/govern/alarm/Steady.vue @@ -1,26 +1,32 @@