日期下拉默认修改
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--指标拟合图 -->
|
||||
<TableHeader datePicker @selectChange="selectChange" v-if="fullscreen">
|
||||
<TableHeader
|
||||
datePicker
|
||||
@selectChange="selectChange"
|
||||
v-if="fullscreen"
|
||||
ref="TableHeaderRef"
|
||||
:timeKeyList="['4', '5']"
|
||||
>
|
||||
<template v-slot:select>
|
||||
<el-form-item label="监测点">
|
||||
<el-select v-model="tableStore.table.params.lineId" placeholder="请选择监测点" clearable>
|
||||
@@ -75,6 +81,7 @@ import { useConfig } from '@/stores/config'
|
||||
import { cslineList, fittingData } from '@/api/harmonic-boot/cockpit/cockpit'
|
||||
import { queryByCode, queryCsDictTree } from '@/api/system-boot/dictTree'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getTime } from '@/utils/formatTime'
|
||||
|
||||
const prop = defineProps({
|
||||
w: { type: [String, Number] },
|
||||
@@ -82,9 +89,12 @@ const prop = defineProps({
|
||||
width: { type: [String, Number] },
|
||||
height: { type: [String, Number] },
|
||||
timeKey: { type: [String, Number] },
|
||||
timeValue: { type: Object }
|
||||
timeValue: { type: Object },
|
||||
interval: { type: Number }
|
||||
})
|
||||
|
||||
const TableHeaderRef = ref()
|
||||
|
||||
const config = useConfig()
|
||||
|
||||
const lineList: any = ref()
|
||||
@@ -269,8 +279,17 @@ const tableStore: any = new TableStore({
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
// 设置时间参数
|
||||
tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime || prop.timeValue?.[0]
|
||||
tableStore.table.params.searchEndTime = tableStore.table.params.searchEndTime || prop.timeValue?.[1]
|
||||
// tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime || prop.timeValue?.[0]
|
||||
// tableStore.table.params.searchEndTime = tableStore.table.params.searchEndTime || prop.timeValue?.[1]
|
||||
const time = getTime(
|
||||
prop.interval ?? 0,
|
||||
prop.timeKey,
|
||||
tableStore.table.params.searchBeginTime && tableStore.table.params.searchEndTime
|
||||
? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime]
|
||||
: prop.timeValue
|
||||
)
|
||||
tableStore.table.params.searchBeginTime = time[0]
|
||||
tableStore.table.params.searchEndTime = time[1]
|
||||
|
||||
// 只有当 lineList 已加载且有数据时才设置默认 lineId
|
||||
if (!tableStore.table.params.lineId && lineList.value && lineList.value.length > 0) {
|
||||
@@ -373,6 +392,22 @@ watch(
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
if (fullscreen.value) {
|
||||
if (prop.interval == 4 || prop.interval == 5) {
|
||||
const time = getTime(
|
||||
prop.interval ?? 0,
|
||||
prop.timeKey,
|
||||
tableStore.table.params.searchBeginTime && tableStore.table.params.searchEndTime
|
||||
? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime]
|
||||
: prop.timeValue
|
||||
)
|
||||
tableStore.table.params.searchBeginTime = time[0]
|
||||
tableStore.table.params.searchEndTime = time[1]
|
||||
TableHeaderRef.value.setTimeInterval(prop.timeValue)
|
||||
} else {
|
||||
TableHeaderRef.value.setInterval(5)
|
||||
}
|
||||
}
|
||||
initLineList().then(() => {
|
||||
initCode()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user