feat:添加时间选择器的组件(10%)
This commit is contained in:
62
src/components/common/TimeRange/DateTimeRange.vue
Normal file
62
src/components/common/TimeRange/DateTimeRange.vue
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<div v-click-outside="{object: {a:1}, func: changeDropdown}">
|
||||||
|
<el-row @click="showDropdown">
|
||||||
|
<el-col :span="10" class="calendar-popover-text">{{dayJs.tz(startTime).format('YYYY-MM-DD HH:mm:ss')}}</el-col>
|
||||||
|
<el-col :span="4"> = </el-col>
|
||||||
|
<el-col :span="10" class="calendar-popover-text">{{dayJs.tz(endTime).format('YYYY-MM-DD HH:mm:ss')}}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<div v-if="dropdownFlag" >
|
||||||
|
123123123123123123
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import MyDatePicker from '../MyDatePicker'
|
||||||
|
export default {
|
||||||
|
name: 'DateTimeRange',
|
||||||
|
props: {
|
||||||
|
startTime: {
|
||||||
|
type: Number,
|
||||||
|
default: window.$dayJs.tz().valueOf() - 60 * 60 * 1000
|
||||||
|
},
|
||||||
|
endTime: {
|
||||||
|
type: Number,
|
||||||
|
default: window.$dayJs.tz().valueOf()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
emits: ['change'],
|
||||||
|
components: {
|
||||||
|
MyDatePicker
|
||||||
|
},
|
||||||
|
setup (props, ctx) {
|
||||||
|
// data
|
||||||
|
const myStartTime = ref(props.startTime)
|
||||||
|
const dropdownFlag = ref(false)
|
||||||
|
// methods
|
||||||
|
const showDropdown = () => {
|
||||||
|
dropdownFlag.value = !dropdownFlag.value
|
||||||
|
}
|
||||||
|
const changeDropdown = () => {
|
||||||
|
console.log(123123123)
|
||||||
|
if (dropdownFlag.value){
|
||||||
|
dropdownFlag.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
watch(myStartTime, (newValue, oldValue) => {
|
||||||
|
console.log('The new counter value is: ' + myStartTime.value)
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
myStartTime,
|
||||||
|
dropdownFlag,
|
||||||
|
showDropdown,
|
||||||
|
changeDropdown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -5,9 +5,6 @@
|
|||||||
<!-- 顶部工具栏 -->
|
<!-- 顶部工具栏 -->
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<div class="top-tools">
|
<div class="top-tools">
|
||||||
<myDatePicker
|
|
||||||
v-model="value1"
|
|
||||||
type="datetime"/>
|
|
||||||
<div class="top-tool-left" style="min-width: 300px">
|
<div class="top-tool-left" style="min-width: 300px">
|
||||||
<slot name="top-tool-left"></slot>
|
<slot name="top-tool-left"></slot>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,13 +42,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import columnCustomize from '@/components/table/ColumnCustomize'
|
import columnCustomize from '@/components/table/ColumnCustomize'
|
||||||
import myDatePicker from '../common/MyDatePicker'
|
|
||||||
import { fromRoute } from '@/utils/constants'
|
import { fromRoute } from '@/utils/constants'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'cnDataList',
|
name: 'cnDataList',
|
||||||
components: {
|
components: {
|
||||||
myDatePicker,
|
|
||||||
columnCustomize
|
columnCustomize
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { tableSort } from '@/utils/tools'
|
|||||||
import { defaultPageSize, fromRoute, position } from '@/utils/constants'
|
import { defaultPageSize, fromRoute, position } from '@/utils/constants'
|
||||||
import { get, del } from '@/utils/http'
|
import { get, del } from '@/utils/http'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import pagination from '@/components/common/pagination'
|
import pagination from '@/components/common/Pagination'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
pagination
|
pagination
|
||||||
|
|||||||
@@ -1,24 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="cn-panel">
|
<div>
|
||||||
<chart v-for="(chart, index) in chartList" :key="index" :chart="chart"></chart>
|
<DateTimeRange />
|
||||||
<!-- <grid-layout v-model:layout="chartList"
|
<div class="cn-panel">
|
||||||
:col-num="12"
|
<chart v-for="(chart, index) in chartList" :key="index" :chart="chart"></chart>
|
||||||
:row-height="30"
|
<!-- <grid-layout v-model:layout="chartList"
|
||||||
:is-draggable="draggable"
|
:col-num="12"
|
||||||
:is-resizable="resizable"
|
:row-height="30"
|
||||||
:vertical-compact="compact"
|
:is-draggable="draggable"
|
||||||
:use-css-transforms="true"
|
:is-resizable="resizable"
|
||||||
>
|
:vertical-compact="compact"
|
||||||
<grid-item v-for="item in chartList" :key="item.i"
|
:use-css-transforms="true"
|
||||||
:x="item.x"
|
>
|
||||||
:y="item.y"
|
<grid-item v-for="item in chartList" :key="item.i"
|
||||||
:w="item.w"
|
:x="item.x"
|
||||||
:h="item.h"
|
:y="item.y"
|
||||||
:i="item.i"
|
:w="item.w"
|
||||||
>
|
:h="item.h"
|
||||||
<span class="text">{{ item.i }}</span>
|
:i="item.i"
|
||||||
</grid-item>
|
>
|
||||||
</grid-layout>-->
|
<span class="text">{{ item.i }}</span>
|
||||||
|
</grid-item>
|
||||||
|
</grid-layout>-->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -28,11 +31,13 @@ import { ref } from 'vue'
|
|||||||
import { panelTypeAndRouteMapping } from '@/utils/constants'
|
import { panelTypeAndRouteMapping } from '@/utils/constants'
|
||||||
import { api, getPanelList, getChartList } from '@/utils/api'
|
import { api, getPanelList, getChartList } from '@/utils/api'
|
||||||
import Chart from './Chart'
|
import Chart from './Chart'
|
||||||
|
import DateTimeRange from '@/components/common/TimeRange/DateTimeRange'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Panel',
|
name: 'Panel',
|
||||||
components: {
|
components: {
|
||||||
Chart
|
Chart,
|
||||||
|
DateTimeRange
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user