解决日期问题

This commit is contained in:
wangchengming 2025-06-17 01:42:02 +08:00
parent f17db170f4
commit 9b4c7b7107
2 changed files with 27 additions and 28 deletions

View File

@ -32,8 +32,10 @@
</a-col> </a-col>
<a-col :md="8" :sm="8"> <a-col :md="8" :sm="8">
<a-form-item label="时间范围"> <a-form-item label="时间范围">
<a-range-picker :default-value="defaultTime" show-time :show-time="{ format: 'HH:mm:ss' }" <!-- <a-range-picker :default-value="defaultTime" show-time :show-time="{ format: 'HH:mm:ss' }"
:format="dateFormat" @change="onChangeTime" /> :format="dateFormat" @change="onChangeTime" /> -->
<a-range-picker :show-time="{ format: 'HH:mm:ss' }" v-model="defaultTime" format="YYYY-MM-DD HH:mm:ss"
@change="onChangeTime" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="5" :sm="5"> <a-col :md="5" :sm="5">
@ -57,7 +59,7 @@
<a-col :md="6"> <a-col :md="6">
<div class="linese"></div> <div class="linese"></div>
<!-- 分类区域 --> <!-- 分类区域 -->
<div style="height:calc(100vh - 316px);overflow: auto;background: #e6e9f1;padding:10px;" ref="treeContainer"> <div style="height:calc(100vh - 366px);overflow: auto;background: #e6e9f1;padding:10px;" ref="treeContainer">
<a-tree :tree-data="treeDate" @select="onSelect" /> <a-tree :tree-data="treeDate" @select="onSelect" />
</div> </div>
<div class="linese"></div> <div class="linese"></div>
@ -65,7 +67,7 @@
<a-col :md="18"> <a-col :md="18">
<div class="linese"></div> <div class="linese"></div>
<!-- 表格区域 --> <!-- 表格区域 -->
<div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;"> <div style="height:calc(100vh - 366px);background: #e6e9f1;overflow:hidden;padding: 15px;">
<a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading" <a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading"
:pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 450px)' }" rowKey="序号" :pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 450px)' }" rowKey="序号"
@change="handleTableChange"> @change="handleTableChange">
@ -161,14 +163,11 @@ export default {
this.allTask = res.result this.allTask = res.result
if (res.result.length > 0) { if (res.result.length > 0) {
this.activeTaskId = res.result[0].id this.activeTaskId = res.result[0].id
const start = moment(res.result[0].startTime)
const start = moment(res.result[0].startTime).set({ hour: 0, minute: 0, second: 0 }) const end = moment(res.result[0].endTime)
const end = moment(res.result[0].endTime).set({ hour: 23, minute: 59, second: 59 }) this.defaultTime.push(start, end)
this.defaultTime = [start, end];
console.log('riq', this.defaultTime)
this.tableParams.startTime = start.format(this.dateFormat); this.tableParams.startTime = start.format(this.dateFormat);
this.tableParams.endTime = end.format(this.dateFormat) this.tableParams.endTime = end.format(this.dateFormat)
} }
} else { } else {
this.$message.warning(res.message); this.$message.warning(res.message);
@ -177,11 +176,9 @@ export default {
}, },
handleTaskChange(value) { handleTaskChange(value) {
var curTask = this.allTask.filter(item => item.id == value) var curTask = this.allTask.filter(item => item.id == value)
console.log(curTask)
const start = moment(curTask.startTime) const start = moment(curTask.startTime)
const end = moment(curTask.endTime) const end = moment(curTask.endTime)
this.defaultTime = [start, end]; this.defaultTime.push(start, end)
this.tableParams.startTime = start.format(this.dateFormat); this.tableParams.startTime = start.format(this.dateFormat);
this.tableParams.endTime = end.format(this.dateFormat) this.tableParams.endTime = end.format(this.dateFormat)

View File

@ -46,17 +46,19 @@
</div> </div>
<!-- table区域-begin --> <!-- table区域-begin -->
<div style="height:calc(100vh - 316px);overflow:hidden; background: #e6e9f1 !important;"> <div class="linese"></div>
<div class="linese"></div> <!-- 表格区域 -->
<a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading" <div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;">
:pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 310px)' }" rowKey="序号" <a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading"
@change="handleTableChange"> :pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 450px)' }" rowKey="序号"
<template slot="operation" slot-scope="text, record"> @change="handleTableChange">
<a-button type="primary" @click="handelEdit(record)">编辑</a-button> <template slot="operation" slot-scope="text, record">
</template> <a-button type="primary" @click="handelEdit(record)">编辑</a-button>
</a-table> </template>
<div class="linese"></div> </a-table>
</div> </div>
<div class="linese"></div>
<!-- table区域-end --> <!-- table区域-end -->
<!-- 表单区域 --> <!-- 表单区域 -->