Refactoring code module 01_masterdata

This commit is contained in:
STW_TTTY\stwtt 2024-09-12 15:42:47 +07:00
parent 82f5380f3e
commit 71be6d095f
22 changed files with 272 additions and 209 deletions

View file

@ -2,6 +2,7 @@
import { ref, reactive, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -34,6 +35,7 @@ const formData = reactive({
],
});
/** ดึงข้อมูลรายละเอียด */
function fetchDetail() {
showLoader();
http
@ -53,6 +55,7 @@ function fetchDetail() {
});
}
/** เพิ่ม ระดับ สมรรถนะ */
function onClickAddLevels() {
const levelName = formData.levels.length + 1;
const data = {
@ -67,6 +70,7 @@ function onClickAddLevels() {
levelName <= 6 && formData.levels.push(data);
}
/** บันทึกข้อมูล */
function onSubmit() {
dialogConfirm($q, async () => {
const formBody = {
@ -95,9 +99,12 @@ function onSubmit() {
});
}
/** ลบ ระดับ สมรรถนะ*/
function onDeleteLevels(index: number) {
formData.levels.splice(index, 1);
}
/** ทำงานเมื่อ โหลด component */
onMounted(() => {
if (competencyId.value) {
fetchDetail();