diff --git a/src/modules/02_organization/components/DialogMovePos.vue b/src/modules/02_organization/components/DialogMovePos.vue index 170cbbd73..f00a64f46 100644 --- a/src/modules/02_organization/components/DialogMovePos.vue +++ b/src/modules/02_organization/components/DialogMovePos.vue @@ -119,7 +119,11 @@ function onClickMovePos() { await http .post(config.API.orgPosMove, body) .then(async () => { - await props.fetchDataTree?.(store.draftId); + await props.fetchDataTree?.( + store.typeOrganizational === "draft" + ? store.draftId + : store.activeId + ); await success($q, "ย้ายตำแหน่งสำเร็จ"); modal.value = false; }) diff --git a/src/modules/02_organization/components/DialogSortPosition.vue b/src/modules/02_organization/components/DialogSortPosition.vue index 93012b93f..04b11b0b9 100644 --- a/src/modules/02_organization/components/DialogSortPosition.vue +++ b/src/modules/02_organization/components/DialogSortPosition.vue @@ -89,7 +89,8 @@ function getData() { page: 1, pageSize: props.totalData, keyword: "", - revisionId: store.draftId, + revisionId: + store.typeOrganizational === "draft" ? store.draftId : store.activeId, }) .then((res) => { const dataList = res.data.result.data; @@ -99,7 +100,15 @@ function getData() { item.posMasterNoPrefix ? item.posMasterNoPrefix : "" }${item.posMasterNo ? item.posMasterNo : ""}${ item.posMasterNoSuffix ? item.posMasterNoSuffix : "" - } ${item.fullNameNextHolder ? item.fullNameNextHolder : ""}`, + } ${ + store.typeOrganizational === "draft" + ? item.fullNameNextHolder + ? item.fullNameNextHolder + : "ว่าง" + : item.fullNameCurrentHolder + ? item.fullNameCurrentHolder + : "ว่าง" + }`, posMasterNoPrefix: item.posMasterNoPrefix, posMasterNo: item.posMasterNo, posMasterNoSuffix: item.posMasterNoSuffix, diff --git a/src/modules/02_organization/components/DialogSuccession.vue b/src/modules/02_organization/components/DialogSuccession.vue index 3b410777d..065c4e9b3 100644 --- a/src/modules/02_organization/components/DialogSuccession.vue +++ b/src/modules/02_organization/components/DialogSuccession.vue @@ -52,7 +52,10 @@ const levelTree = ref(0); */ async function fetchTree() { showLoader(); - const id: string = store.activeId ? store.activeId?.toString() : ""; + const id: string = + (store.typeOrganizational === "draft" + ? store.activeId + : store.historyDnaOrgId) ?? ""; await http .get(config.API.orgByid(id)) .then((res) => { @@ -116,7 +119,10 @@ const reqMaster = reactive({ page: 1, pageSize: 10, keyword: "", - revisionId: store.activeId, + revisionId: + store.typeOrganizational === "draft" + ? store.activeId + : store.historyDnaOrgId, }); const totalRow = ref(0); const selectedPos = ref([]); @@ -178,7 +184,12 @@ function onClickConfirm() { $q, async () => { const body: Inherit = { + draftRevisionId: + store.typeOrganizational === "draft" + ? store.draftId + : store.activeId, draftPositionId: props.rowId, + publishRevisionId: reqMaster.revisionId, publishPositionId: selectedPos.value[0].id, }; showLoader(); @@ -238,7 +249,9 @@ watch([() => reqMaster.page, () => reqMaster.pageSize], async () => {
([ @@ -563,7 +569,13 @@ watch(
-
+
@@ -762,8 +783,7 @@ watch(
- ดูรายละเอียด
- + --> diff --git a/src/modules/02_organization/components/TreeMain.vue b/src/modules/02_organization/components/TreeMain.vue index 89759632c..0fd3e4a38 100644 --- a/src/modules/02_organization/components/TreeMain.vue +++ b/src/modules/02_organization/components/TreeMain.vue @@ -387,8 +387,7 @@ watch(
{ const activeId = ref(); // id โครงสร้างปัจจุบัน const draftId = ref(); // id แบบร่างโครงสร้าง const historyId = ref(); // id ประวัติโครงสร้าง + const historyDnaOrgId = ref(); // id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง const isPublic = ref(false); // การเผยแพร่ const treeId = ref(); // id โหนด const level = ref(); // ระดับโหนด const orgPublishDate = ref(null); // วันเผยแพร่ - const isLosck = ref(false); + const isLock = ref(false); const sumPosition = reactive({ total: 0, use: 0, @@ -217,9 +218,10 @@ export const useOrganizational = defineStore("organizationalStore", () => { isOfficer, isStaff, rootId, - isLosck, + isLock, remark, convertStatus, fetchDataTree, + historyDnaOrgId, }; }); diff --git a/src/modules/02_organization/views/main.vue b/src/modules/02_organization/views/main.vue index 90dd087e9..b7459c161 100644 --- a/src/modules/02_organization/views/main.vue +++ b/src/modules/02_organization/views/main.vue @@ -61,7 +61,7 @@ async function fetchOrganizationActive() { if (data.draftId) { await fetchCheckIslock(data.draftId); } else { - store.isLosck = false; + store.isLock = false; } if (data.activeName === null && data.draftName === null) { @@ -101,6 +101,9 @@ async function fetchHistory() { ? date2Thai(e.orgRevisionCreatedAt) : "", })); + + // id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง + store.historyDnaOrgId = itemHistory.value[0].id; }) .catch((err) => { messageError($q, err); @@ -151,7 +154,7 @@ async function fetchCheckIslock(id: string) { .get(config.API.orgIsLock + `/${id}`) .then((res) => { const data = res.data.result; - store.isLosck = data; + store.isLock = data; }) .catch((e) => { messageError($q, e); @@ -178,9 +181,9 @@ watch( * ดึงข้อมูลโครงสร้างและรายการประวัติโครงสร้าง */ onMounted(async () => { - const type = localStorage.getItem('org_type') ?? "current"; + const type = localStorage.getItem("org_type") ?? "current"; store.typeOrganizational = type; - localStorage.removeItem('org_type'); + localStorage.removeItem("org_type"); await Promise.all([fetchOrganizationActive(), fetchHistory()]); }); @@ -331,7 +334,7 @@ onMounted(async () => { { showLoader(); + formData.conditionReason = + formData.isCondition === false ? "" : formData.conditionReason; // ถ้าไม่เลือกติดเงื่อนไขให้หมายเหตุเป็นค่าว่าง await http .put( config.API.positionCondition + `/${props?.dataCondition?.id}`,