comment code retirement

This commit is contained in:
AnandaTon 2023-11-17 14:21:53 +07:00
parent 45fc4848ac
commit 45ef9649e1
15 changed files with 295 additions and 64 deletions

View file

@ -11,11 +11,12 @@ import http from "@/plugins/http";
import config from "@/app.config";
import type { ResponseData } from "@/modules/06_retirement/interface/response/expulsion";
/** use */
const $q = useQuasar();
const router = useRouter();
const modal = ref<boolean>(false);
const mixin = useCounterMixin();
const retirementStore = useRetirementDataStore();
const {
date2Thai,
messageError,
@ -26,7 +27,7 @@ const {
} = mixin;
const { statusText } = retirementStore;
const modal = ref<boolean>(false);
/** คอลัมน์ที่แสดง */
const visibleColumns = ref<string[]>([
"no",
"fullname",
@ -46,6 +47,7 @@ const resetFilter = () => {
filterRef.value.focus();
};
/** คอลัมน์ */
const rows = ref<ResponseData[]>([]);
const rows2 = ref<ResponseData[]>([]);
const filters = ref<ResponseData[]>([]);
@ -115,10 +117,14 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/** HOOK */
onMounted(async () => {
await getData();
});
/**
* งก modal
*/
const openModalOrder = () => {
openModal();
const row = filters.value.filter(
@ -136,7 +142,12 @@ const openModalOrder = () => {
);
rows2.value = row;
};
const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false);
/**
* นำขอมลมาจาก API
*/
const getData = async () => {
showLoader();
await http
@ -179,6 +190,10 @@ const getData = async () => {
});
};
/**
* ลบขอม
* @param id ไอดอม
*/
const clickDelete = async (id: string) => {
dialogRemove(
$q,
@ -189,7 +204,7 @@ const clickDelete = async (id: string) => {
`ต้องการทำการลบข้อมูลนี้ใช่หรือไม่?`
);
};
//API
const deleteData = async (id: string) => {
await http
.delete(config.API.expulsionByid(id))
@ -205,8 +220,7 @@ const deleteData = async (id: string) => {
});
};
const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false);
/** Setting Pagination */
const pagination = ref({
sortBy: "createdAt",
descending: true,

View file

@ -4,19 +4,18 @@ 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,10 +26,10 @@ const {
dialogConfirm,
} = mixin;
/**ตัวแปร */
const myForm = ref<QForm | null>(null);
const roleAdmin = ref<boolean>(false);
const edit = ref<boolean>(false);
const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
@ -40,6 +39,7 @@ const organization = ref<string>("");
const date = ref<Date | null>(null);
const reason = ref<string>("");
/**Setค่าตัวแปร */
const responseData = ref<ResponseDataDetail>({
personId: "",
avataPath: "",
@ -57,6 +57,7 @@ const responseData = ref<ResponseDataDetail>({
fullname: "",
});
/**Hook */
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
@ -64,6 +65,9 @@ onMounted(async () => {
await getData();
});
/**
* นำขอมลมาจาก API
*/
const getData = async () => {
showLoader();
await http
@ -108,11 +112,15 @@ const getData = async () => {
});
};
/**ฟังก์ชั่นcancel */
const clickCancel = async () => {
await getData();
edit.value = false;
};
/**
* Functionบนท
*/
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
@ -129,7 +137,7 @@ const conditionSave = async () => {
});
}
};
//Save Api
const saveData = async () => {
const body = {
organization: organization.value,
@ -157,6 +165,10 @@ const saveData = async () => {
});
};
/**
* Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class
*/
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,