refactor: handle name file
This commit is contained in:
parent
1b3cd2ff49
commit
ed4725aef9
1 changed files with 4 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import TableComponents from 'src/components/TableComponents.vue';
|
import TableComponents from 'src/components/TableComponents.vue';
|
||||||
import ShowAttachent from 'src/components/ShowAttachent.vue';
|
import ShowAttachent from 'src/components/ShowAttachent.vue';
|
||||||
import DialogForm from 'components/DialogForm.vue';
|
import DialogForm from 'components/DialogForm.vue';
|
||||||
|
import { dateFormat } from 'src/utils/datetime';
|
||||||
|
|
||||||
const isEdit = ref(false);
|
const isEdit = ref(false);
|
||||||
const allMeta = ref<Record<string, string>>();
|
const allMeta = ref<Record<string, string>>();
|
||||||
|
|
@ -104,6 +105,9 @@ async function change(e: Event) {
|
||||||
const _file = _element?.files?.[0];
|
const _file = _element?.files?.[0];
|
||||||
|
|
||||||
if (_file) {
|
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) {
|
if (!obj.value[currentIndex.value] && selectedMenu.value) {
|
||||||
currentIndex.value = obj.value.length;
|
currentIndex.value = obj.value.length;
|
||||||
obj.value = [
|
obj.value = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue