Refactoring code module 04_registryPerson

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-18 17:24:21 +07:00
parent 1164d79122
commit eeb92dfb5d
46 changed files with 1935 additions and 2230 deletions

View file

@ -1,14 +1,16 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import axios from "axios";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import axios from "axios";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { ArrayFileList } from "@/modules/04_registryPerson/interface/index/document";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
@ -21,12 +23,15 @@ const {
dialogRemove,
} = mixin;
const documentFile = ref<any>(null);
const fileList = ref<ArrayFileList[]>([]);
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const documentFile = ref<any>(null);
const fileList = ref<ArrayFileList[]>([]); //
/**
* งกนดงขอมลรายการเอกสารหลกฐาน
*/
async function getData() {
showLoader();
await http
@ -45,31 +50,8 @@ async function getData() {
}
/**
* งกนสำหรบอพโหลดไฟลเอกสารหลกฐาน
* งกนสาง Path ำหรบอพโหลดไฟลเอกสารหลกฐาน
*/
async function uploadFileDoc(uploadUrl: string, file: any) {
const Data = new FormData();
Data.append("file", documentFile.value);
showLoader();
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(async () => {
await getData();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
documentFile.value = null;
});
}
function clickUpload(file: any) {
const fileName = { fileName: file.name };
dialogConfirm(
@ -109,6 +91,32 @@ function clickUpload(file: any) {
);
}
/**
* งกนสำหรบอพโหลดไฟลเอกสารหลกฐาน
*/
async function uploadFileDoc(uploadUrl: string, file: any) {
const Data = new FormData();
Data.append("file", documentFile.value);
showLoader();
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(async () => {
await getData();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
documentFile.value = null;
});
}
/**
* ดาวนโหลดลงกไฟล
* @param fileName file name