เเก้ไข UI detailLeave

comment code retirement
This commit is contained in:
AnandaTon 2023-11-16 17:57:48 +07:00
parent b0cd3af1ad
commit ee2eba56a1
13 changed files with 470 additions and 266 deletions

View file

@ -3,20 +3,20 @@ import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import keycloak from "@/plugins/keycloak";
/**Import type */
import type { QForm } from "quasar";
import type { ResponseDataDetail } from "@/modules/06_retirement/interface/response/expulsion";
/** use */
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin();
const dataId = route.params.id.toString();
const {
date2Thai,
@ -27,6 +27,9 @@ const {
success,
} = mixin;
/**
* กำหนดคาตวแปร
*/
const myForm = ref<QForm | null>(null);
const roleAdmin = ref<boolean>(false);
const edit = ref<boolean>(false);
@ -38,7 +41,6 @@ const salary = ref<number>(0);
const organization = ref<string>("");
const date = ref<Date | null>(null);
const reason = ref<string>("");
const responseData = ref<ResponseDataDetail>({
personId: "",
avataPath: "",
@ -56,6 +58,7 @@ const responseData = ref<ResponseDataDetail>({
fullname: "",
});
/** Hook */
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
@ -63,7 +66,7 @@ onMounted(async () => {
await getData();
});
//
// API
const getData = async () => {
showLoader();
await http
@ -106,11 +109,17 @@ const getData = async () => {
});
};
/**
* งก Cancle
*/
const clickCancel = async () => {
await getData();
edit.value = false;
};
/**
* งก Save
*/
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
@ -130,6 +139,9 @@ const conditionSave = async () => {
}
};
/**
* งก Saveจาก API
*/
const saveData = async () => {
const body = {
organization: organization.value,
@ -157,6 +169,10 @@ const saveData = async () => {
});
};
/**
* Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class
*/
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,