บรรจุ แต่งตั้ง ย้าย โอน => ปรับ code และ load
This commit is contained in:
parent
9f4aeec575
commit
34dc306288
30 changed files with 1154 additions and 1429 deletions
|
|
@ -153,7 +153,6 @@ const refreshData = async () => {
|
|||
};
|
||||
|
||||
const getNewData = async () => {
|
||||
// await props.fetch();
|
||||
await fetchProvince();
|
||||
};
|
||||
|
||||
|
|
@ -194,17 +193,15 @@ const editData = async () => {
|
|||
config.API.placementAddressId(route.params.personalId.toString()),
|
||||
body
|
||||
)
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Address");
|
||||
success($q, "แก้ไขข้อมูลสำเร็จ");
|
||||
edit.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
edit.value = false;
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Address");
|
||||
// await fetchProvince();
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -341,16 +341,15 @@ const saveData = async () => {
|
|||
expireDate: new Date(expireDate.value),
|
||||
certificateType: certificateType.value,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
.then(async () => {
|
||||
await props.fetch("Certificate");
|
||||
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
rows.value = props.data;
|
||||
modal.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await props.fetch("Certificate");
|
||||
rows.value = props.data;
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -368,16 +367,15 @@ const editData = async () => {
|
|||
expireDate: new Date(expireDate.value),
|
||||
certificateType: certificateType.value,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
.then(async () => {
|
||||
await props.fetch("Certificate");
|
||||
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
rows.value = props.data;
|
||||
modal.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await props.fetch("Certificate");
|
||||
rows.value = props.data;
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -394,16 +392,15 @@ const clickDelete = async () => {
|
|||
id.value
|
||||
)
|
||||
)
|
||||
.then((res) => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
.then(async () => {
|
||||
await props.fetch("Certificate");
|
||||
await success($q, "ลบข้อมูลสำเร็จ");
|
||||
rows.value = props.data;
|
||||
modal.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await props.fetch("Certificate");
|
||||
rows.value = props.data;
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -169,12 +169,13 @@ const changeBtn = async () => {
|
|||
};
|
||||
|
||||
/** ฟังชั่นใหม่ */
|
||||
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);
|
||||
|
|
@ -197,10 +198,14 @@ async function clickUpload(file: any) {
|
|||
res.data[key]?.fileName !== ""
|
||||
);
|
||||
foundKey &&
|
||||
uploadFileDoc(res.data[foundKey]?.uploadUrl, documentFile.value);
|
||||
(await uploadFileDoc(
|
||||
res.data[foundKey]?.uploadUrl,
|
||||
documentFile.value
|
||||
));
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันการอัปโหลดไฟล์",
|
||||
|
|
@ -211,26 +216,26 @@ async function clickUpload(file: any) {
|
|||
/**
|
||||
* ฟังก์ชั่นสำหรับอัพโหลดไฟล์เอกสารหลักฐาน
|
||||
*/
|
||||
async function uploadFileDoc(uploadUrl: string, file: any) {
|
||||
function uploadFileDoc(uploadUrl: string, file: any) {
|
||||
const Data = new FormData();
|
||||
Data.append("file", documentFile.value);
|
||||
showLoader();
|
||||
await axios
|
||||
axios
|
||||
.put(uploadUrl, file, {
|
||||
headers: {
|
||||
"Content-Type": file.type,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||
getData();
|
||||
.then(async () => {
|
||||
await getData();
|
||||
await success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||
documentFile.value = null;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
documentFile.value = null;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +261,7 @@ function downloadFile(fileName: string) {
|
|||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
|
@ -277,17 +282,14 @@ function deleteFile(fileName: string) {
|
|||
fileName
|
||||
)
|
||||
)
|
||||
.then((res) => {
|
||||
setTimeout(() => {
|
||||
getData();
|
||||
success($q, `ลบไฟล์สำเร็จ`);
|
||||
hideLoader();
|
||||
}, 1000);
|
||||
.then(async () => {
|
||||
setTimeout(async () => {
|
||||
await getData();
|
||||
await success($q, `ลบไฟล์สำเร็จ`);
|
||||
}, 1500);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -56,21 +56,19 @@ const onEdit = ref<boolean>(false);
|
|||
const myform = ref<QForm | null>(null);
|
||||
const familyData = ref<Family>(props.data);
|
||||
|
||||
|
||||
|
||||
function checkEdit() {
|
||||
onEdit.value = true;
|
||||
}
|
||||
|
||||
function filterSelector(val: any, update: Function, refData: string){
|
||||
function filterSelector(val: any, update: Function, refData: string) {
|
||||
update(() => {
|
||||
props.Ops[`${refData}`] = props.OpsFilter[`${refData}`].filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
async function refreshData(){
|
||||
async function refreshData() {
|
||||
if (myform.value != null) {
|
||||
myform.value.reset();
|
||||
}
|
||||
|
|
@ -89,31 +87,11 @@ async function refreshData(){
|
|||
} else {
|
||||
edit.value = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function editData(){
|
||||
async function editData() {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
// const body: ResponseObject = {
|
||||
// couple: familyData.value.couple == "1",
|
||||
// couplePrefixId: familyData.value.marryPrefixId,
|
||||
// coupleFirstName: familyData.value.marryFirstName,
|
||||
// coupleLastName: familyData.value.marryLastName,
|
||||
// coupleLastNameOld: familyData.value.lastnameCOld,
|
||||
// coupleCareer: familyData.value.marryOccupation,
|
||||
// fatherPrefixId: familyData.value.fatherPrefixId,
|
||||
// fatherFirstName: familyData.value.fatherFirstName,
|
||||
// fatherLastName: familyData.value.fatherLastName,
|
||||
// fatherCareer: familyData.value.fatherOccupation,
|
||||
// motherPrefixId: familyData.value.motherPrefixId,
|
||||
// motherFirstName: familyData.value.motherFirstName,
|
||||
// motherLastName: familyData.value.motherLastName,
|
||||
// motherCareer: familyData.value.motherOccupation,
|
||||
// // childrens: familyData.value.childrens,
|
||||
// createdFullName: "-",
|
||||
// createdAt: new Date(),
|
||||
// };
|
||||
|
||||
const body = {
|
||||
couple: familyData.value.couple == "1",
|
||||
couplePrefix: familyData.value.marryPrefixId,
|
||||
|
|
@ -135,31 +113,30 @@ async function editData(){
|
|||
config.API.placementFamilyId(route.params.personalId.toString()),
|
||||
body
|
||||
)
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
.then(async () => {
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Family");
|
||||
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
edit.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
edit.value = false;
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Family");
|
||||
});
|
||||
})
|
||||
.finally(async () => {});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
async function saveData(){
|
||||
async function saveData() {
|
||||
await myform.value?.validate().then(async (success: boolean) => {
|
||||
if (success) {
|
||||
await editData();
|
||||
} else {
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function selectRadio(e: boolean, i: any){
|
||||
function selectRadio(e: boolean, i: any) {
|
||||
onEdit.value = true;
|
||||
if (e) {
|
||||
familyData.value.marryPrefixId = "";
|
||||
|
|
@ -168,9 +145,9 @@ function selectRadio(e: boolean, i: any){
|
|||
// familyData.value.lastnameCOld = "";
|
||||
familyData.value.marryOccupation = "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function changeBtn(){
|
||||
async function changeBtn() {
|
||||
if (edit.value == true) {
|
||||
if (props.statusEdit === true) {
|
||||
props.notiNoEdit();
|
||||
|
|
@ -180,14 +157,14 @@ async function changeBtn(){
|
|||
} else {
|
||||
emit("update:statusEdit", false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getClass(val: boolean){
|
||||
function getClass(val: boolean) {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
emit("update:statusEdit", false);
|
||||
|
|
|
|||
|
|
@ -206,31 +206,20 @@ const editData = async () => {
|
|||
config.API.placementInformationId(route.params.personalId.toString()),
|
||||
body
|
||||
)
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
.then(async () => {
|
||||
edit.value = false;
|
||||
emit("update:statusEdit", false);
|
||||
await props.fetch("Information");
|
||||
await changeBirth(informaData.value.dateOfBirth ?? new Date());
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const saveData = async () => {
|
||||
if (myform.value != null) {
|
||||
await myform.value.validate().then(async (success: boolean) => {
|
||||
if (success) {
|
||||
await editData();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const changeBtn = async () => {
|
||||
if (edit.value == true) {
|
||||
if (props.statusEdit === true) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue