F el-date

This commit is contained in:
zhenorzz 2021-05-25 11:03:17 +08:00
parent fe0daf0ba8
commit dfbe296ed3
2 changed files with 24 additions and 9 deletions

View File

@ -63,11 +63,14 @@
v-model="filterParams.commitDate" v-model="filterParams.commitDate"
:shortcuts="shortcuts" :shortcuts="shortcuts"
type="daterange" type="daterange"
format="yyyy-MM-dd HH:mm:ss" format="YYYY-MM-DD"
range-separator="-" range-separator="-"
:start-placeholder="$t('startDate')" :start-placeholder="$t('startDate')"
:end-placeholder="$t('endDate')" :end-placeholder="$t('endDate')"
:default-time="['00:00:00', '23:59:59']" :default-time="[
new Date(2000, 1, 1, 0, 0, 0),
new Date(2000, 2, 1, 23, 59, 59),
]"
style="flex: 1" style="flex: 1"
/> />
</el-row> </el-row>
@ -79,11 +82,14 @@
v-model="filterParams.deployDate" v-model="filterParams.deployDate"
:shortcuts="shortcuts" :shortcuts="shortcuts"
type="daterange" type="daterange"
format="yyyy-MM-dd HH:mm:ss" format="YYYY-MM-DD"
range-separator="-" range-separator="-"
:start-placeholder="$t('startDate')" :start-placeholder="$t('startDate')"
:end-placeholder="$t('endDate')" :end-placeholder="$t('endDate')"
:default-time="['00:00:00', '23:59:59']" :default-time="[
new Date(2000, 1, 1, 0, 0, 0),
new Date(2000, 2, 1, 23, 59, 59),
]"
style="flex: 1" style="flex: 1"
/> />
</el-row> </el-row>
@ -325,6 +331,7 @@ import { role } from '@/utils/namespace'
import { empty, parseGitURL, parseTime } from '@/utils' import { empty, parseGitURL, parseTime } from '@/utils'
import { ElMessageBox, ElMessage, ElDatePicker } from 'element-plus' import { ElMessageBox, ElMessage, ElDatePicker } from 'element-plus'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs'
import { computed, watch, defineComponent, ref, reactive } from 'vue' import { computed, watch, defineComponent, ref, reactive } from 'vue'
export default defineComponent({ export default defineComponent({
@ -357,6 +364,7 @@ export default defineComponent({
() => props.modelValue, () => props.modelValue,
(val: typeof props['modelValue']) => { (val: typeof props['modelValue']) => {
if (val === true) { if (val === true) {
refreshFilterParams()
getPreviewList(props.projectRow.id) getPreviewList(props.projectRow.id)
new NamespaceUserOption().request().then((response) => { new NamespaceUserOption().request().then((response) => {
userOption.value = response.data.list userOption.value = response.data.list
@ -367,7 +375,6 @@ export default defineComponent({
) )
const filterloading = ref(false) const filterloading = ref(false)
const filterParams = reactive<Record<string, any>>({ const filterParams = reactive<Record<string, any>>({
loading: false,
userId: '', userId: '',
state: '', state: '',
filename: '', filename: '',
@ -413,10 +420,18 @@ export default defineComponent({
{ {
projectId: projectId, projectId: projectId,
commitDate: filterParams.commitDate commitDate: filterParams.commitDate
? filterParams.commitDate.join(',') ? filterParams.commitDate
.map((date: string) =>
dayjs(date).format('YYYY-MM-DD HH:mm:ss')
)
.join(',')
: '', : '',
deployDate: filterParams.deployDate deployDate: filterParams.deployDate
? filterParams.deployDate.join(',') ? filterParams.deployDate
.map((date: string) =>
dayjs(date).format('YYYY-MM-DD HH:mm:ss')
)
.join(',')
: '', : '',
branch: filterParams.branch, branch: filterParams.branch,
commit: filterParams.commit, commit: filterParams.commit,

View File

@ -132,7 +132,7 @@
prop="operation" prop="operation"
:label="$t('op')" :label="$t('op')"
width="310" width="310"
fixed="right" :fixed="$store.state.app.device === 'mobile' ? false : 'right'"
align="center" align="center"
> >
<template #default="scope"> <template #default="scope">
@ -230,7 +230,7 @@
:page-size="pagination.rows" :page-size="pagination.rows"
background background
:page-sizes="[20, 50, 100]" :page-sizes="[20, 50, 100]"
layout="sizes, total, prev, pager, next, jumper" layout="prev, pager, next, jumper"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handlePageChange" @current-change="handlePageChange"
/> />