comment code retirement
This commit is contained in:
parent
45fc4848ac
commit
45ef9649e1
15 changed files with 295 additions and 64 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue