fix(01): upload image

This commit is contained in:
puriphatt 2024-08-28 16:33:51 +07:00
parent bda2f0164d
commit 59436725f7
3 changed files with 21 additions and 38 deletions

View file

@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref, onMounted, watch, computed } from 'vue';
import useUtilsStore, { baseUrl, dialog } from 'stores/utils';
import useUtilsStore, { dialog } from 'stores/utils';
import { calculateAge } from 'src/utils/datetime';
import { useQuasar, type QTableProps } from 'quasar';
import { storeToRefs } from 'pinia';
@ -166,7 +166,6 @@ const fieldSelected = ref<
]);
const refImageUpload = ref<InstanceType<typeof ImageUploadDialog>>();
const fieldDisplay = ref();
const hideStat = ref(false);
const userCode = ref<string>();
const currentUser = ref<User>();
@ -187,9 +186,7 @@ const hqId = ref<string>();
const brId = ref<string>();
const formDialogRef = ref();
const userStats = ref<BranchUserStats[]>();
const sortedUserStats = computed(() => {
return userStats.value?.slice().sort((a, b) => b.count - a.count);
});
const typeStats = ref<UserTypeStats>();
const agencyFile = ref<File[]>([]);
const agencyFileList = ref<{ name: string; url: string }[]>([]);
@ -290,25 +287,10 @@ const columns = [
},
] satisfies QTableProps['columns'];
// reader.addEventListener('load', () => {
// if (typeof reader.result === 'string') {
// urlProfile.value = reader.result;
// }
// if (infoDrawerEdit.value) infoPersonCard.value[0].img = urlProfile.value;
// });
watch(profileFileImg, () => {
if (profileFileImg.value) reader.readAsDataURL(profileFileImg.value);
});
const selectorList = computed(() => [
{ label: 'USER', count: typeStats.value?.USER || 0 },
{ label: 'MESSENGER', count: typeStats.value?.MESSENGER || 0 },
{ label: 'DELEGATE', count: typeStats.value?.DELEGATE || 0 },
{ label: 'AGENCY', count: typeStats.value?.AGENCY || 0 },
]);
async function openDialog(
action?: 'FORM' | 'INFO',
id?: string,