fix: 修改timePick组件 时间显示不对的问题

This commit is contained in:
zhangyu
2022-01-04 10:55:36 +08:00
parent e328bd0241
commit 9056ff5acb
8 changed files with 20 additions and 12 deletions

View File

@@ -30,8 +30,8 @@
clearable
:time-arrow-control="true"
placeholder="Moment"
:value-format="endpointQueryTime"
:format="endpointQueryTime"
:value-format="timeFormatStrToDatePickFormat(endpointQueryTime)"
:format="timeFormatStrToDatePickFormat(endpointQueryTime)"
>
</my-date-picker><button @click="changeTime(10)" class="nz-btn nz-btn-size-normal nz-btn-style-light change-time-height nz-input-group-append"><i class="el-icon-d-arrow-right"></i></button>
</div>

View File

@@ -40,8 +40,8 @@
clearable
:time-arrow-control="true"
placeholder="Moment"
:value-format="endpointQueryTabTime"
:format="endpointQueryTabTime"
:value-format="timeFormatStrToDatePickFormat(endpointQueryTabTime)"
:format="timeFormatStrToDatePickFormat(endpointQueryTabTime)"
@change="pickTime"
>
</my-date-picker><button @click="changeTime(10)" class="nz-btn nz-btn-size-normal nz-btn-style-light change-time-height nz-input-group-append"><i class="el-icon-d-arrow-right"></i></button>

View File

@@ -4,7 +4,7 @@
<transition>
<div v-show="showDropdown" id="panel-calender" class="calendar">
<my-date-picker prefix-icon=" " size="mini" ref="calendar"
:format="multipleTime" class="panel-time-picker-hidden" @change="dateChange" v-model="startTime" type="datetime"
:format="timeFormatStrToDatePickFormat(multipleTime)" class="panel-time-picker-hidden" @change="dateChange" v-model="startTime" type="datetime"
popper-class="panel-time-picker-popper"
align="right">
</my-date-picker>

View File

@@ -109,13 +109,13 @@ const NewPopper = {
const DEFAULT_FORMATS = {
date: 'yyyy-MM-dd',
month: 'yyyy-MM',
datetime: 'YYYY-MM-DD HH:mm:ss',
datetime: 'yyyy-MM-dd HH:mm:ss',
time: 'HH:mm:ss',
week: 'yyyywWW',
timerange: 'HH:mm:ss',
daterange: 'yyyy-MM-dd',
monthrange: 'yyyy-MM',
datetimerange: 'YYYY-MM-DD HH:mm:ss',
datetimerange: 'yyyy-MM-dd HH:mm:ss',
year: 'yyyy'
}
const HAVE_TRIGGER_TYPES = [

View File

@@ -38,7 +38,7 @@
<div class="datepicker-box">
<span class="datepicker-title">{{ $t("overall.startTime") }}</span>
<my-date-picker ref="calendar" v-model="editAlertSilence.startAt" :clearable="false" :placeholder="$t('dashboard.panel.startTime')"
align="right" class=" " :format="alertSilenceTime"
align="right" class=" " :format="timeFormatStrToDatePickFormat(alertSilenceTime)"
popper-class="panel-time-picker-popper right-box-select-top"
prefix-icon=" "
size="mini"
@@ -50,7 +50,7 @@
<div class="datepicker-box">
<span class="datepicker-title">{{ $t("overall.endTime") }}</span>
<my-date-picker ref="calendar" v-model="editAlertSilence.endAt" :clearable="false" :placeholder="$t('dashboard.panel.startTime')"
align="right" class=" " :format="alertSilenceTime"
align="right" class=" " :format="timeFormatStrToDatePickFormat(alertSilenceTime)"
popper-class="panel-time-picker-popper right-box-select-top"
prefix-icon=" "
size="mini"

View File

@@ -1,7 +1,7 @@
<template>
<div id="panel-calender" :class="{'calendar--small': size === 'small'}" class="calendar">
<my-date-picker prefix-icon=" " class="panel-time-picker-hidden " size="mini" ref="calendar"
:format="timePicker" @change="dateChange" v-model="searchTime" type="datetimerange"
:format="timeFormatStrToDatePickFormat(timePicker)" @change="dateChange" v-model="searchTime" type="datetimerange"
popper-class="panel-time-picker-popper time-picker-popover__select-top"
:default-time="['00:00:00', '23:59:59']"
:range-separator="$t('dashboard.panel.to')"

View File

@@ -55,8 +55,8 @@
style="width: 100%;"
v-model="scope.row[item.prop]"
prefix-icon=" " size="small" ref="calendar"
:format="apiKeyTableTime"
:value-format="apiKeyTableTime"
:format="timeFormatStrToDatePickFormat(apiKeyTableTime)"
:value-format="timeFormatStrToDatePickFormat(apiKeyTableTime)"
type="datetime"
popper-class="item-system-table right-public-box-dropdown-top right-box-select-top"
:picker-options="pickerOptions"

View File

@@ -161,6 +161,14 @@ Vue.mixin({
translation (key) {
return i18n.t(key)
},
timeFormatStrToDatePickFormat (str) {
// str.replace(//)
const reg = /Y/g
str = str.replace(reg, 'y')
const reg1 = /D/g
str = str.replace(reg1, 'd')
return str
},
copyRow (row, rightBoxValKey, idKey = 'id', show = false, format, callback) {
/*
row 表格当前行