comment code retirement
This commit is contained in:
parent
45fc4848ac
commit
45ef9649e1
15 changed files with 295 additions and 64 deletions
|
|
@ -6,20 +6,22 @@ import DialogFooter from "@/modules/05_placement/components/PersonalList/DialogF
|
|||
import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRetirementDataStore } from "@/modules/06_retirement/store";
|
||||
|
||||
import CurrencyInput from "@/components/CurruncyInput.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import keycloak from "@/plugins/keycloak";
|
||||
import type { TypeFile, rowFile } from "@/modules/06_retirement/interface/response/Main";
|
||||
import type {
|
||||
TypeFile,
|
||||
rowFile,
|
||||
} from "@/modules/06_retirement/interface/response/Main";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
/** Use */
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const mixin = useCounterMixin();
|
||||
const RetirementData = useRetirementDataStore();
|
||||
|
||||
const {
|
||||
messageError,
|
||||
date2Thai,
|
||||
|
|
@ -31,6 +33,7 @@ const {
|
|||
} = mixin;
|
||||
const { statusText } = RetirementData;
|
||||
|
||||
/** ตัวแปร */
|
||||
const roleUser = ref<string>("");
|
||||
const id = ref<string>(route.params.id.toString());
|
||||
const myForm = ref<QForm | null>(null);
|
||||
|
|
@ -58,7 +61,6 @@ const dataDetail = ref<any>({
|
|||
statustext: "",
|
||||
fullname: "",
|
||||
});
|
||||
|
||||
const organizationPositionOld = ref<string>("");
|
||||
const positionTypeOld = ref<string>("");
|
||||
const positionLevelOld = ref<string>("");
|
||||
|
|
@ -70,12 +72,12 @@ const reason = ref<string>("");
|
|||
const location = ref<string>("");
|
||||
const status = ref<string>("");
|
||||
const remarkHorizontal = ref<string>("");
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const actionPass = ref<boolean>(false);
|
||||
const reasonReign = ref<string>("");
|
||||
const dateBreak = ref<Date | null>(null);
|
||||
|
||||
/** คอลัมน์ */
|
||||
const rows = ref<TypeFile[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -107,9 +109,11 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
|
||||
/**เปิด-ปิด modal */
|
||||
const closeModal = () => (modal.value = false);
|
||||
const openModal = () => (modal.value = true);
|
||||
|
||||
/** Hook */
|
||||
onMounted(async () => {
|
||||
fetchData(id.value);
|
||||
if (keycloak.tokenParsed !== undefined) {
|
||||
|
|
@ -139,6 +143,9 @@ const diffDate = () => {
|
|||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* นำข้อมูลมาจาก API
|
||||
*/
|
||||
const fetchData = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -187,13 +194,14 @@ const fetchData = async (id: string) => {
|
|||
// document.body.removeChild(link);
|
||||
// };
|
||||
|
||||
/**Pop up */
|
||||
const popUp = (action: "pass" | "passNot") => {
|
||||
reasonReign.value = "";
|
||||
dateBreak.value = null;
|
||||
actionPass.value = action === "pass";
|
||||
openModal();
|
||||
};
|
||||
|
||||
//เงื่อนไขpop up
|
||||
const conditionPopup = () => {
|
||||
if (myFormConfirm.value !== null) {
|
||||
myFormConfirm.value.validate().then(async (check) => {
|
||||
|
|
@ -208,6 +216,7 @@ const conditionPopup = () => {
|
|||
}
|
||||
};
|
||||
|
||||
//pop up ยืนยันการอนุมัติ
|
||||
const confirmpopUp = async () => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -233,6 +242,7 @@ const confirmpopUp = async () => {
|
|||
);
|
||||
};
|
||||
|
||||
//pop up การยับยั้งสำเร็จ
|
||||
const rejectpopUp = async () => {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -258,15 +268,26 @@ const rejectpopUp = async () => {
|
|||
"ต้องการยืนยันการยับยั้งนี้หรือไม่ ?"
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* ไปยังข้อมูล
|
||||
* @param id ไอดีข้อมูล
|
||||
*/
|
||||
const redirectToRegistry = (id: string) => {
|
||||
router.push(`/registry/${id}`);
|
||||
};
|
||||
|
||||
/**
|
||||
* กดยกเลิก
|
||||
*/
|
||||
const clickCancel = async () => {
|
||||
await fetchData(id.value);
|
||||
edit.value = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Functionบันทึก
|
||||
*/
|
||||
const conditionSave = () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then((success) => {
|
||||
|
|
@ -285,7 +306,7 @@ const conditionSave = () => {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
//Save จาก Api
|
||||
const saveData = async () => {
|
||||
const formData = new FormData();
|
||||
const send = date.value !== null ? new Date(date.value).toUTCString() : "";
|
||||
|
|
@ -317,12 +338,18 @@ const saveData = async () => {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Function เพิ่ม Class เวลา Edit
|
||||
* @param val เมื่อเป็นEdit จะเปลี่ยน Class
|
||||
*/
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
};
|
||||
|
||||
/** แปลง StatusOrder */
|
||||
const statusOrder = (val: boolean) => {
|
||||
switch (val) {
|
||||
case true:
|
||||
|
|
@ -335,12 +362,12 @@ const statusOrder = (val: boolean) => {
|
|||
// เอกสารดาวน์โหลด
|
||||
const rowsFileDownload = ref<rowFile[]>([
|
||||
{
|
||||
fileName:
|
||||
"แบบฟอร์มหนังสือขอลาออกจากราชการ",
|
||||
fileName: "แบบฟอร์มหนังสือขอลาออกจากราชการ",
|
||||
pathName: "",
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
||||
// ดาว์นโหลดไฟล์
|
||||
const fileDownload = async (type: string, fileName: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -358,6 +385,7 @@ const fileDownload = async (type: string, fileName: string) => {
|
|||
});
|
||||
};
|
||||
|
||||
// ดาว์นโหลดไฟล์
|
||||
const downloadFile = (response: any, filename: string) => {
|
||||
const link = document.createElement("a");
|
||||
var fileName = filename;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue