diff --git a/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue b/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue index efdc1b79..f9ce6dd7 100644 --- a/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue +++ b/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue @@ -2,12 +2,9 @@ import { ref, watch } from "vue"; import { useQuasar } from "quasar"; +import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useCounterMixin } from "@/stores/mixin"; - -/** importComponents*/ -import DialogHeader from "@/components/DialogHeader.vue"; /** importType*/ import type { @@ -15,6 +12,9 @@ import type { CommandSysAssign, } from "@/modules/02_users/interface/response/Main"; +/** importComponents*/ +import DialogHeader from "@/components/DialogHeader.vue"; + /** use*/ const $q = useQuasar(); const { showLoader, hideLoader, dialogConfirm, messageError, success } = @@ -37,11 +37,12 @@ const props = defineProps({ }, }); -const posMasterId = ref(""); -const sysType = ref([]); -const isChangData = ref(false); -const sysTypeOptions = ref([]); +const posMasterId = ref(""); //id รายการตำแหน่งที่ต้องการกำหนดหน้าที่ความรับผิดชอบ +const sysType = ref([]); //รายการหน้าที่ความรับผิดชอบที่เลือก +const isChangData = ref(false); //การเปลี่ยนแปลงของข้อมูล +const sysTypeOptions = ref([]); //ข้อมูลรายการหน้าที่ความรับผิดชอบ +/** ฟังก์ชันเรียกข้อมูลรายการหน้าที่ความรับผิดชอบ*/ async function fetchCommandSysAssign() { if (sysTypeOptions.value.length === 0) { showLoader(); @@ -60,11 +61,13 @@ async function fetchCommandSysAssign() { } } +/** ฟังก์ชันปิด popup */ function closeDialog() { modal.value = false; sysType.value = []; } +/** ฟังก์ชันยืนยันการบันทึกข้อมูลกำหนดหน้าที่ความรับผิดชอบ*/ function onSubmit() { if (sysType.value.length !== 0) { dialogConfirm($q, async () => { @@ -94,12 +97,19 @@ function onSubmit() { } } +/** + * ดูการเปลี่ยนแปลงของ modal + * และเมื่อ modal เป็น true เรียก ฟังก์ชัน fetchCommandSysAssign เพื่อเรียกข้อมูลรายการหน้าที่ความรับผิดชอบ + * และเกำหนด posMasterId เป็น ID ข้อมูลที่ต้องการกำหนดหน้าที่ความรับผิดชอบ + * และเกำหนด sysType เป็น รายการหน้าที่ความรับผิดชอบที่เลือก + */ watch( () => modal.value, async () => { if (modal.value) { await fetchCommandSysAssign(); posMasterId.value = props.dataPosMaster.id; + // กำหนดรายการหน้าที่ความรับผิดชอบที่เลือก const assignId = props.dataPosMaster.posMasterAssigns.map( (r: PosMaster) => r.assignId ); diff --git a/src/modules/02_users/views/05_responsIbilities.vue b/src/modules/02_users/views/05_responsIbilities.vue index 43cc0b3b..04d3bc4c 100644 --- a/src/modules/02_users/views/05_responsIbilities.vue +++ b/src/modules/02_users/views/05_responsIbilities.vue @@ -30,7 +30,7 @@ const nodes = ref>([]); // ข้อมูลโครงส const lazy = ref(nodes); const expanded = ref([]); // แสดงข้อมูลในโหนดที่เลือก const nodeId = ref(""); // id โหนด -const isOfficer = ref(false); +const isOfficer = ref(false); //แสดง columns สกจ. /** Table*/ const columns = ref([ @@ -192,8 +192,8 @@ const reqMaster = reactive({ keyword: "", revisionId: "", }); -const maxPage = ref(0); -const totalRow = ref(0); +const maxPage = ref(0); //จำนวนหน้า +const totalRow = ref(0); //จำนวนข้อมูล const posMaster = ref([]); // ข้อมูลรายการตำแหน่ง const dataPosMaster = ref(); // ข้อมูลตำแหน่ง const pagination = ref({ @@ -201,11 +201,9 @@ const pagination = ref({ rowsPerPage: reqMaster.pageSize, }); -const modalDialog = ref(false); +const modalDialog = ref(false); // popup กำหนดหน้าที่ความรับผิดชอบ -/** - * function เรียกข้อมูลโครงสร้าง แบบปัจุบัน - */ +/** function เรียกข้อมูลโครงสร้าง แบบปัจุบัน*/ async function fetchOrganizationActive() { showLoader(); await http @@ -301,6 +299,10 @@ function updatePagination(newPagination: Pagination) { reqMaster.page = 1; } +/** + * function กำหนดหน้าที่ความรับผิดชอบ + * @param data ข้อมูลรายการที่ต้องการกำหนดหน้าที่ความรับผิดชอบ + */ function onClickAddRole(data: PosMaster) { modalDialog.value = true; dataPosMaster.value = data;