提交代码

This commit is contained in:
guanj
2025-11-14 15:00:10 +08:00
parent 49dcf440ff
commit 0af955d05c
7 changed files with 38 additions and 27 deletions

View File

@@ -13,6 +13,7 @@
:sort-config="{ remote: true }" :sort-config="{ remote: true }"
@sort-change="handleSortChange" @sort-change="handleSortChange"
> >
<!-- Column 组件内部是 el-table-column --> <!-- Column 组件内部是 el-table-column -->
<template v-if="isGroup"> <template v-if="isGroup">
<GroupColumn :column="tableStore.table.column" /> <GroupColumn :column="tableStore.table.column" />
@@ -91,6 +92,8 @@ const props = withDefaults(defineProps<Props>(), {
}) })
onMounted(() => { onMounted(() => {
tableStore.table.ref = tableRef.value as VxeTableInstance tableStore.table.ref = tableRef.value as VxeTableInstance
}) })
// console.log(props) // console.log(props)
const onTableSizeChange = (val: number) => { const onTableSizeChange = (val: number) => {

View File

@@ -1,4 +1,4 @@
import { number } from "vue-types" import { number } from 'vue-types'
const dataProcessing = (arr: any[]) => { const dataProcessing = (arr: any[]) => {
return arr return arr
@@ -24,9 +24,10 @@ const calculateValue = (o: number, value: number, num: number, isMin: boolean) =
base = 1 base = 1
} else { } else {
const multiple = 1 / 0.1 const multiple = 1 / 0.1
// 先放大→向上取整→再缩小
return Math.ceil(Math.abs(o) * multiple) / multiple base = Math.ceil(Math.abs(o) * multiple) / multiple
} }
let calculatedValue let calculatedValue
if (isMin) { if (isMin) {
if (value < 0) { if (value < 0) {
@@ -39,7 +40,6 @@ const calculateValue = (o: number, value: number, num: number, isMin: boolean) =
calculatedValue = value - num * value calculatedValue = value - num * value
} else { } else {
calculatedValue = value + num * value calculatedValue = value + num * value
} }
} }
@@ -62,7 +62,7 @@ export const yMethod = (arr: any) => {
let min = 0 let min = 0
maxValue = Math.max(...numList) maxValue = Math.max(...numList)
minValue = Math.min(...numList) minValue = Math.min(...numList)
const o = maxValue - minValue const o = maxValue - minValue == 0 ? maxValue : maxValue - minValue
min = calculateValue(o, minValue, num, true) min = calculateValue(o, minValue, num, true)
max = calculateValue(o, maxValue, num, false) max = calculateValue(o, maxValue, num, false)

View File

@@ -51,7 +51,8 @@ export default class TableStore {
exportProcessingData: null, exportProcessingData: null,
beforeSearchFun: null, beforeSearchFun: null,
height: '', height: '',
publicHeight: 0 publicHeight: 0,
filename: '',
}) })
constructor(public options: TableStoreParams) { constructor(public options: TableStoreParams) {
@@ -105,8 +106,10 @@ export default class TableStore {
this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize) this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize)
this.table.data = this.table.webPagingData[this.table.params.pageNum - 1] this.table.data = this.table.webPagingData[this.table.params.pageNum - 1]
} }
this.table.loadCallback && this.table.loadCallback() this.table.loadCallback && this.table.loadCallback()
this.table.loading = false this.table.loading = false
}) })
.catch(() => { .catch(() => {
this.table.loading = false this.table.loading = false
@@ -142,6 +145,7 @@ export default class TableStore {
'selection-change', 'selection-change',
() => { () => {
this.table.selection = data as TableRow[] this.table.selection = data as TableRow[]
} }
], ],
[ [

View File

@@ -3,7 +3,12 @@
<TableHeader :showSearch="false" v-show="flag"> <TableHeader :showSearch="false" v-show="flag">
<template v-slot:select> <template v-slot:select>
<el-form-item label="日期"> <el-form-item label="日期">
<DatePicker ref="datePickerRef" :nextFlag="false" :theCurrentTime="true" @change="handleDatePickerChange"></DatePicker> <DatePicker
ref="datePickerRef"
:nextFlag="false"
:theCurrentTime="true"
@change="handleDatePickerChange"
></DatePicker>
</el-form-item> </el-form-item>
</template> </template>
<template v-slot:operation> <template v-slot:operation>
@@ -64,7 +69,7 @@ import DatePicker from '@/components/form/datePicker/index.vue'
import { useDebounceFn } from '@vueuse/core' import { useDebounceFn } from '@vueuse/core'
import { queryActivatePage, queryByPagePath } from '@/api/system-boot/csstatisticalset' import { queryActivatePage, queryByPagePath } from '@/api/system-boot/csstatisticalset'
import RoutingConfig from '@/views/pqs/cockpit/homePage/components/routingConfig.vue' import RoutingConfig from '@/views/pqs/cockpit/homePage/components/routingConfig.vue'
import { useRouter,useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache' import { useTimeCacheStore } from '@/stores/timeCache'
const { push } = useRouter() const { push } = useRouter()
const datePickerRef = ref() const datePickerRef = ref()
@@ -170,13 +175,16 @@ const zoom = (value: any) => {
if (flag.value) { if (flag.value) {
layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }] layout.value = [{ ...value, x: 0, y: 0, w: 12, h: 6 }]
} else { } else {
layout.value = layoutCopy.value.map((item:any, index: number) => ({ layout.value = layoutCopy.value.map((item: any, index: number) => ({
...item, ...item,
i: item.i || index, // 确保有唯一标识 i: item.i || index, // 确保有唯一标识
component: registerComponent(item.path) component: registerComponent(item.path)
})) }))
} }
console.log("🚀 ~ zoom ~ layout.value:", layout.value)
flag.value = !flag.value flag.value = !flag.value
initRowHeight() initRowHeight()
key.value += 1 key.value += 1
} }
@@ -214,7 +222,7 @@ const fetchLayoutData = async () => {
// 窗口大小变化处理 - 使用防抖 // 窗口大小变化处理 - 使用防抖
const handleResize = useDebounceFn(() => { const handleResize = useDebounceFn(() => {
initRowHeight() initRowHeight()
key.value += 1 // key.value += 1
}, 200) }, 200)
// 修改 // 修改
@@ -232,14 +240,9 @@ const settings = () => {
// 处理 DatePicker 值变化事件 // 处理 DatePicker 值变化事件
const handleDatePickerChange = (value: any) => { const handleDatePickerChange = (value: any) => {
// 将值缓存到 timeCache // 将值缓存到 timeCache
if (value) { if (value) {
timeCacheStore.setCache( timeCacheStore.setCache(route.path, value.interval, value.timeValue)
route.path,
value.interval,
value.timeValue
)
} }
} }

View File

@@ -59,7 +59,7 @@ const tableStore: any = new TableStore({
method: 'POST', method: 'POST',
showPage: false, showPage: false,
exportName: '主要监测点列表',
column: [ column: [
{ {
field: 'index', field: 'index',

View File

@@ -358,11 +358,11 @@ const onSubmit = () => {
formRef.value.validate(async (valid: boolean) => { formRef.value.validate(async (valid: boolean) => {
let url = '' let url = ''
await html2canvas(document.querySelector('.GridLayout'), { // await html2canvas(document.querySelector('.GridLayout'), {
useCORS: true // useCORS: true
}).then(canvas => { // }).then(canvas => {
url = canvas.toDataURL('image/png') // url = canvas.toDataURL('image/png')
}) // })
form.pagePath = form.pagePath || '' form.pagePath = form.pagePath || ''
if (valid) { if (valid) {

1
types/table.d.ts vendored
View File

@@ -9,6 +9,7 @@ declare global {
ref: VxeTableInstance | null ref: VxeTableInstance | null
data: TableRow[] | any data: TableRow[] | any
allData: TableRow[] | any allData: TableRow[] | any
copyData: TableRow[] | any
filename: any filename: any
allFlag: Boolean allFlag: Boolean
// 前端分页数据 // 前端分页数据