From e7568373c8d8001dd90102eb4ad5aab014d9fc67 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 7 Oct 2024 18:03:50 +0700 Subject: [PATCH] =?UTF-8?q?API=20=E0=B8=A1=E0=B8=AD=E0=B8=9A=E0=B8=AB?= =?UTF-8?q?=E0=B8=A1=E0=B8=B2=E0=B8=A2=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2?= =?UTF-8?q?=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B8=84=E0=B8=A7=E0=B8=B2=E0=B8=A1?= =?UTF-8?q?=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=9C=E0=B8=B4=E0=B8=94=E0=B8=8A?= =?UTF-8?q?=E0=B8=AD=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/02_organizational/api.organization.ts | 6 +- .../DialogResponsibilities.vue | 119 ++++++++++-------- .../02_users/interface/response/Main.ts | 25 +++- .../02_users/views/05_responsIbilities.vue | 63 ++++++---- 4 files changed, 135 insertions(+), 78 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 23270711..d7549cc4 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -93,6 +93,10 @@ export default { orgProfileListKeycloak: () => `${orgProfile}/search-personal-no-keycloak`, /** กำหนดสิทธิ์จัดการโครงสร้าง */ - permissionOrg: `${organization}/permission-org`, + permissionOrg: `${organization}/permission-org`, permissionOrgProfile: `${organization}/permission-org/profile`, // คนที่มีสิทธิ์จัดการโครงสร้าง + + /** หมอบหมาย*/ + commandSysAssign: `${organization}/commandSys/assign`, + posAssign: `${organization}/pos/assign`, }; diff --git a/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue b/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue index 27996f71..efdc1b79 100644 --- a/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue +++ b/src/modules/02_users/components/05_responsIbilities/DialogResponsibilities.vue @@ -10,24 +10,18 @@ import { useCounterMixin } from "@/stores/mixin"; import DialogHeader from "@/components/DialogHeader.vue"; /** importType*/ -import type { QTableProps } from "quasar"; -import type { FilterReqMaster } from "@/modules/02_users/interface/request/Main"; -import type { Roles } from "@/modules/02_users/interface/response/Main"; +import type { + PosMaster, + CommandSysAssign, +} from "@/modules/02_users/interface/response/Main"; /** use*/ const $q = useQuasar(); -const { - showLoader, - hideLoader, - dialogConfirm, - messageError, - success, - dialogMessageNotify, -} = useCounterMixin(); +const { showLoader, hideLoader, dialogConfirm, messageError, success } = + useCounterMixin(); /** props*/ const modal = defineModel("modal", { required: true }); - const props = defineProps({ fetchDataTable: { type: Function, @@ -37,40 +31,34 @@ const props = defineProps({ type: Object, required: true, }, + reqMaster: { + type: Object, + required: true, + }, }); -const sysType = ref(["SALARY_EMP"]); +const posMasterId = ref(""); +const sysType = ref([]); const isChangData = ref(false); -const sysTypeOptions = ref([ - { - code: "SALARY", - name: "ระบบเงินเดือน", - modules: [ - { - code: "SALARY_EMP", - name: "เงินเดือนข้าราชการ", - }, - { - code: "SALARY_TEMP", - name: "เงินเดือนลูกจ้างประจำ", - }, - ], - }, - { - code: "PLACEMENT", - name: "ระบบบรรจุ", - modules: [ - { - code: "PLACEMENT_NEW", - name: "เงินเดือนข้าราชการ", - }, - { - code: "TRANSFER", - name: "ขอโอน", - }, - ], - }, -]); +const sysTypeOptions = ref([]); + +async function fetchCommandSysAssign() { + if (sysTypeOptions.value.length === 0) { + showLoader(); + await http + .get(config.API.commandSysAssign) + .then(async (res) => { + const data = await res.data.result; + sysTypeOptions.value = data; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + } +} function closeDialog() { modal.value = false; @@ -79,14 +67,45 @@ function closeDialog() { function onSubmit() { if (sysType.value.length !== 0) { - dialogConfirm($q, () => {}); + dialogConfirm($q, async () => { + const body = { + posMasterId: posMasterId.value, + assignIds: sysType.value, + }; + showLoader(); + await http + .post(config.API.posAssign, body) + .then(async () => { + await props.fetchDataTable( + props.reqMaster.id, + props.reqMaster.revisionId, + props.reqMaster.type + ); + success($q, "บันทึกข้อมูลสำเร็จ"); + closeDialog(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + }); } } watch( () => modal.value, - () => { - modal.value; + async () => { + if (modal.value) { + await fetchCommandSysAssign(); + posMasterId.value = props.dataPosMaster.id; + const assignId = props.dataPosMaster.posMasterAssigns.map( + (r: PosMaster) => r.assignId + ); + sysType.value = assignId; + isChangData.value = false; + } } ); @@ -105,22 +124,22 @@ watch( >
- {{ item.name }} + {{ item.sysName }}
- + diff --git a/src/modules/02_users/interface/response/Main.ts b/src/modules/02_users/interface/response/Main.ts index 10fe4a78..f4bd6e3e 100644 --- a/src/modules/02_users/interface/response/Main.ts +++ b/src/modules/02_users/interface/response/Main.ts @@ -48,6 +48,7 @@ interface NodeTree { totalRootPositionNextUse: number; totalRootPositionNextVacant: number; children: NodeTree; + isOfficer: boolean; } interface PosMaster { @@ -81,6 +82,7 @@ interface PosMaster { profilePostype: null | string; reason: null | string; positions: Position[]; + assignId: string[]; } interface Position { @@ -135,4 +137,25 @@ interface Profile { salary: number; } -export type { Users, Roles, NodeTree, PosMaster, Position, SysList, Profile }; +interface CommandSysAssign { + assgins: DataAssgins[]; + id: "REGISTRY"; + sysName: "ทะเบียนประวัติ"; +} + +interface DataAssgins { + description: "เงินเดือนข้าราชการ"; + id: "00942120-9787-43a1-934a-e146e0618622"; + name: "เงินเดือนข้าราชการ"; +} + +export type { + Users, + Roles, + NodeTree, + PosMaster, + Position, + SysList, + Profile, + CommandSysAssign, +}; diff --git a/src/modules/02_users/views/05_responsIbilities.vue b/src/modules/02_users/views/05_responsIbilities.vue index cbd5eac8..43cc0b3b 100644 --- a/src/modules/02_users/views/05_responsIbilities.vue +++ b/src/modules/02_users/views/05_responsIbilities.vue @@ -30,6 +30,7 @@ const nodes = ref>([]); // ข้อมูลโครงส const lazy = ref(nodes); const expanded = ref([]); // แสดงข้อมูลในโหนดที่เลือก const nodeId = ref(""); // id โหนด +const isOfficer = ref(false); /** Table*/ const columns = ref([ @@ -97,11 +98,11 @@ const columns = ref([ style: "font-size: 14px", }, { - name: "responsibilities", - align: "left", + name: "isPosMasterAssign", + align: "center", label: "การเจ้าหน้าที่", sortable: false, - field: "responsibilities", + field: "isPosMasterAssign", headerStyle: "font-size: 14px", style: "font-size: 14px", }, @@ -287,6 +288,7 @@ async function fetchDataTable(id: string, revisionId: string, level: number) { */ function updateSelected(data: NodeTree) { nodeId.value = data.orgTreeId; + isOfficer.value = data.isOfficer; fetchDataTable(data.orgTreeId, data.orgRevisionId, data.orgLevel); } @@ -309,27 +311,24 @@ function onClickAddRole(data: PosMaster) { * @param id ตำแหน่ง */ function onDelete(id: string) { - dialogRemove($q, () => { - // showLoader(); - // http - // .post(config.API.managementPermission, { - // authRoleId: "", - // posMasterId: id, - // }) - // .then(async () => { - // await fetchDataTable( - // reqMaster.id, - // reqMaster.revisionId, - // reqMaster.type - // ); - // success($q, "ลบข้อมูลสำเร็จ"); - // }) - // .catch((err) => { - // messageError($q, err); - // }) - // .finally(() => { - // hideLoader(); - // }); + dialogRemove($q, async () => { + showLoader(); + await http + .delete(config.API.posAssign + `/${id}`) + .then(async () => { + await fetchDataTable( + reqMaster.id, + reqMaster.revisionId, + reqMaster.type + ); + success($q, "ลบข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); }); } @@ -506,7 +505,15 @@ onMounted(() => { :key="col.name" :props="props" > - {{ col.label }} + + + + + @@ -531,7 +538,10 @@ onMounted(() => { :key="col.name" :props="props" > -
+
+ +
+
{{ col.value ? col.value : "-" }}
@@ -682,6 +692,7 @@ onMounted(() => { v-model:modal="modalDialog" :dataPosMaster="dataPosMaster as PosMaster" :fetchDataTable="fetchDataTable" + :reqMaster="reqMaster" />