3 changed files with 26 additions and 71 deletions
-
2src/components/common/FTDatetime/index.vue
-
64src/components/system/EditDate/index.vue
-
31src/views/home/index.vue
@ -1,64 +0,0 @@ |
|||||
<script setup lang="ts"> |
|
||||
import { useServerTime } from 'hooks/useServerTime' |
|
||||
import { FtMessage } from 'libs/message' |
|
||||
import { ref } from 'vue' |
|
||||
|
|
||||
const props = defineProps({ |
|
||||
datetime: { |
|
||||
type: Number, |
|
||||
default: 0, |
|
||||
}, |
|
||||
}) |
|
||||
const emits = defineEmits(['ok', 'close']) |
|
||||
|
|
||||
const form = ref<{ epochMilli?: number }>({ |
|
||||
epochMilli: props.datetime, |
|
||||
}) |
|
||||
|
|
||||
const formRef = ref() |
|
||||
|
|
||||
const rules = { |
|
||||
epochMilli: [ |
|
||||
{ required: true, message: '请选择时间', trigger: 'change' }, |
|
||||
], |
|
||||
} |
|
||||
|
|
||||
const okHandle = async () => { |
|
||||
try { |
|
||||
const valid = await formRef.value.validate() |
|
||||
if (!valid) { |
|
||||
return |
|
||||
} |
|
||||
emits('ok') |
|
||||
} |
|
||||
catch (e) { |
|
||||
console.log(e) |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
const cancel = () => { |
|
||||
emits('close') |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
<template> |
|
||||
<ft-dialog visible title="设置日期与时间" width="40%" :ok-handle="okHandle" @cancel="cancel"> |
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto"> |
|
||||
<el-form-item label="日期与时间" prop="epochMilli"> |
|
||||
<el-date-picker |
|
||||
v-model="form.epochMilli" |
|
||||
:show-now="false" |
|
||||
format="YYYY-MM-DD hh:mm:ss" |
|
||||
value-format="x" |
|
||||
style="width: 100%" |
|
||||
type="datetime" |
|
||||
placeholder="请选择日期和时间" |
|
||||
/> |
|
||||
</el-form-item> |
|
||||
</el-form> |
|
||||
</ft-dialog> |
|
||||
</template> |
|
||||
|
|
||||
<style scoped lang="scss"> |
|
||||
|
|
||||
</style> |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue