多租户前端修改提交

This commit is contained in:
yaoyn
2024-07-19 17:47:11 +08:00
parent d85c09bd83
commit 8034e9b090
23 changed files with 958 additions and 43 deletions

View File

@ -1,58 +1,58 @@
<template>
<a-date-picker
:size="size"
v-model:value="modelValue"
:placeholder="placeholder"
:format="format"
:valueFormat="format"
:allowClear="allowClear"
:disabled="disabled"
:showTime="format === 'YYYY-MM-DD HH:mm:ss'"
:picker="picker"
@change="handleChange"
/>
<a-date-picker
:size="size"
v-model:value="modelValue"
:placeholder="placeholder"
:format="format"
:valueFormat="format"
:allowClear="allowClear"
:disabled="originalDisabled"
:showTime="format === 'YYYY-MM-DD HH:mm:ss'"
:picker="picker"
@change="handleChange"
/>
</template>
<script lang="ts" setup>
import dayjs from 'dayjs';
import { ref, watch, computed } from 'vue';
import dayjs, {Dayjs} from 'dayjs';
import {ref, watch, computed} from 'vue';
const props = defineProps({
const props = defineProps({
value: [dayjs, String, Object],
size: String,
placeholder: String,
format: String,
allowClear: Boolean,
disabled: Boolean,
});
const modelValue = ref<string>();
const emit = defineEmits(['update:value']);
originalDisabled: {
type: Boolean,
default: false
}
});
const modelValue = ref<Dayjs>();
const emit = defineEmits(['update:value']);
const picker = computed(() => {
const picker = computed(() => {
let time = 'date';
switch (props.format) {
case 'YYYY-MM':
time = 'month';
break;
case 'YYYY':
time = 'year';
break;
case 'YYYY-MM':
time = 'month';
break;
case 'YYYY':
time = 'year';
break;
}
return time;
});
watch(
});
watch(
() => props.value,
(val) => {
if (val && typeof val !== 'string') {
modelValue.value = val?.format(props.format);
} else {
modelValue.value = val || '';
}
modelValue.value = dayjs(val || '');
},
{
immediate: true,
immediate: true,
},
);
const handleChange = (time) => {
);
const handleChange = (time) => {
emit('update:value', time);
};
};
</script>