refactor: handle name file

This commit is contained in:
Thanaphon Frappet 2024-11-12 16:03:59 +07:00
parent 1b3cd2ff49
commit ed4725aef9

View file

@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
import TableComponents from 'src/components/TableComponents.vue';
import ShowAttachent from 'src/components/ShowAttachent.vue';
import DialogForm from 'components/DialogForm.vue';
import { dateFormat } from 'src/utils/datetime';
const isEdit = ref(false);
const allMeta = ref<Record<string, string>>();
@ -104,6 +105,9 @@ async function change(e: Event) {
const _file = _element?.files?.[0];
if (_file) {
const newFileName = `${selectedMenu.value?.group}-${dateFormat(new Date().toISOString())}`;
const renamedFile = new File([_file], newFileName, { type: _file.type });
if (!obj.value[currentIndex.value] && selectedMenu.value) {
currentIndex.value = obj.value.length;
obj.value = [