ทะเบียนประวัติ => เอกสารหลักฐานและอื่นๆ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-16 17:58:33 +07:00
parent 4c534ebd94
commit ad53e6bd54
2 changed files with 26 additions and 57 deletions

View file

@ -23,7 +23,6 @@ const {
hideLoader,
success,
messageError,
dialogRemove,
dialogConfirm,
pathRegistryEmp,
} = mixin;
@ -43,21 +42,6 @@ const mode = ref<string>("table");
const filterKeyword = ref<string>("");
const rows = ref<RowList[]>([]);
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
keyword: "",
type: "",
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: false,
isProbation: false,
});
/** modal */
const modal = ref<boolean>(false);
const edit = ref<boolean>(false);
@ -66,13 +50,6 @@ const modalHistory = ref<boolean>(false);
const date = ref<Date | null>(null);
const detail = ref<string>();
const dateRef = ref<object | null>(null);
const detailRef = ref<object | null>(null);
const objectRef: MyObjectRef = {
date: dateRef,
detail: detailRef,
};
const visibleColumns = ref<String[]>(["date", "detail"]);
const columns = ref<QTableProps["columns"]>([
{
@ -134,7 +111,7 @@ function closeDialog() {
function validateForm() {
dialogConfirm(
$q,
async () => {
() => {
if (edit.value) {
editData();
} else {
@ -149,18 +126,18 @@ function validateForm() {
/**
* นทกเพมขอม
*/
async function saveData() {
function saveData() {
showLoader();
await http
http
.post(config.API.profileNewOther(empType.value), {
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
date: date.value,
detail: detail.value,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
getData();
.then(async () => {
await getData();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((e) => {
@ -174,16 +151,16 @@ async function saveData() {
/**
* นทกแกไขขอม
*/
async function editData() {
function editData() {
showLoader();
await http
http
.patch(config.API.profileNewOtherById(id.value, empType.value), {
date: date.value,
detail: detail.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
getData();
.then(async () => {
await getData();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((e) => {
@ -194,9 +171,12 @@ async function editData() {
});
}
async function getData() {
/**
* fetch รายการขอมลอนๆ
*/
function getData() {
showLoader();
await http
http
.get(config.API.profileNewOtherByProfileId(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
@ -467,15 +447,7 @@ onMounted(() => {
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
dense
unelevated
label="บันทึก"
id="onSubmit"
type="submit"
color="public"
class="q-px-md"
>
<q-btn label="บันทึก" id="onSubmit" type="submit" color="public">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>

View file

@ -57,9 +57,9 @@ async function uploadFileDoc(uploadUrl: string, file: any) {
"Content-Type": file.type,
},
})
.then((res) => {
.then(async () => {
await getData();
success($q, "อัปโหลดไฟล์สำเร็จ");
getData();
})
.catch((e) => {
messageError($q, e);
@ -70,12 +70,12 @@ async function uploadFileDoc(uploadUrl: string, file: any) {
});
}
async function clickUpload(file: any) {
function clickUpload(file: any) {
const fileName = { fileName: file.name };
dialogConfirm(
$q,
async () => {
showLoader();
const selectedFile = file;
const formdata = new FormData();
formdata.append("file", selectedFile);
@ -152,17 +152,14 @@ function deleteFile(fileName: string) {
fileName
)
)
.then((res) => {
success($q, `ลบไฟล์สำเร็จ`);
setTimeout(() => {
getData();
hideLoader();
}, 1000);
.then(async () => {
await setTimeout(async () => {
await getData();
await success($q, `ลบไฟล์สำเร็จ`);
}, 1500);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});