日历表格调整
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--指标越限明细 -->
|
||||
<TableHeader :showReset="false" @selectChange="selectChange" datePicker v-if="fullscreen"></TableHeader>
|
||||
<TableHeader
|
||||
:showReset="false"
|
||||
ref="TableHeaderRef"
|
||||
@selectChange="selectChange"
|
||||
datePicker
|
||||
v-if="fullscreen"
|
||||
:timeCacheFlag="false"
|
||||
></TableHeader>
|
||||
<el-calendar
|
||||
v-model="value"
|
||||
:style="{
|
||||
@@ -51,6 +58,8 @@ const headerHeight = ref(57)
|
||||
|
||||
const list = ref()
|
||||
|
||||
const TableHeaderRef = ref()
|
||||
|
||||
dayjs.en.weekStart = 1 //设置日历的周起始日为星期一
|
||||
const value = ref(new Date())
|
||||
|
||||
@@ -82,46 +91,18 @@ const getTextForDate = (date: string) => {
|
||||
}
|
||||
|
||||
const tableStore: any = new TableStore({
|
||||
// url: '/user-boot/role/selectRoleDetail?id=0',
|
||||
url: '/harmonic-boot/limitRateDetailD/limitCalendarData',
|
||||
method: 'POST',
|
||||
showPage: false,
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime || prop.timeValue?.[0]
|
||||
tableStore.table.params.searchEndTime = tableStore.table.params.searchEndTime || prop.timeValue?.[1]
|
||||
if (!fullscreen.value && prop.timeValue && Array.isArray(prop.timeValue)) {
|
||||
tableStore.table.params.searchBeginTime = prop.timeValue[0]
|
||||
tableStore.table.params.searchEndTime = prop.timeValue[1]
|
||||
}
|
||||
},
|
||||
loadCallback: () => {
|
||||
value.value = tableStore.table.params.searchBeginTime
|
||||
// 将后端返回的数据整合到 list 中
|
||||
// tableStore.table.data = [
|
||||
// {
|
||||
// "time": "2025-11-13",
|
||||
// "items": [
|
||||
// "闪变越限",
|
||||
// "谐波电流越限"
|
||||
// ],
|
||||
// "status": 1
|
||||
// },
|
||||
// {
|
||||
// "time": "2025-11-14",
|
||||
// "items": [
|
||||
// "频率偏差越限",
|
||||
// "三相电压不平衡越限",
|
||||
// "谐波电压越限",
|
||||
// "谐波电流越限",
|
||||
// "频率偏差越限",
|
||||
// "三相电压不平衡越限",
|
||||
// "谐波电压越限",
|
||||
// "谐波电流越限",
|
||||
// "频率偏差越限",
|
||||
// "三相电压不平衡越限",
|
||||
// "谐波电压越限",
|
||||
// "谐波电流越限"
|
||||
// ],
|
||||
// "status": 2
|
||||
// }
|
||||
// ]
|
||||
if (tableStore.table.data && tableStore.table.data.length > 0) {
|
||||
list.value = tableStore.table.data.map((item: any) => {
|
||||
// 将 items 数组转换为带换行的文本
|
||||
@@ -162,7 +143,15 @@ const setBackground = (value: string) => {
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
nextTick(() => {
|
||||
if (TableHeaderRef.value && typeof TableHeaderRef.value.setDatePicker === 'function') {
|
||||
TableHeaderRef.value.setDatePicker([{ label: '月份', value: 3 }])
|
||||
}
|
||||
if (fullscreen.value) {
|
||||
TableHeaderRef.value.setInterval(3)
|
||||
}
|
||||
tableStore.index()
|
||||
})
|
||||
})
|
||||
watch(
|
||||
() => prop.timeKey,
|
||||
@@ -172,20 +161,22 @@ watch(
|
||||
)
|
||||
watch(
|
||||
() => prop.timeValue,
|
||||
(newVal, oldVal) => {
|
||||
// 当外部时间值变化时,更新表格的时间参数
|
||||
if (newVal && (!oldVal || newVal[0] !== oldVal[0] || newVal[1] !== oldVal[1])) {
|
||||
tableStore.table.params.searchBeginTime = newVal[0]
|
||||
tableStore.table.params.searchEndTime = newVal[1]
|
||||
tableStore.index()
|
||||
}
|
||||
// (newVal, oldVal) => {
|
||||
// // 当外部时间值变化时,更新表格的时间参数
|
||||
// if (newVal && (!oldVal || newVal[0] !== oldVal[0] || newVal[1] !== oldVal[1])) {
|
||||
// tableStore.table.params.searchBeginTime = newVal[0]
|
||||
// tableStore.table.params.searchEndTime = newVal[1]
|
||||
// tableStore.index()
|
||||
// }
|
||||
// },
|
||||
val => {
|
||||
tableStore.index()
|
||||
},
|
||||
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
|
||||
const addMenu = () => {}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-calendar) {
|
||||
|
||||
Reference in New Issue
Block a user