diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index b0c28c673..d4af7e15d 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -29,6 +29,7 @@ export default { orgPosMove: `${orgPos}/move`, organizationShortName: `${organization}/sort`, organizationPublishGet: `${organization}/get/publish`, + orgPosDNA: `${orgPos}/dna`, //สืบทอดตำแหน่ง orgPosExecutiveById: (id: string) => `${orgPos}/executive/${id}`, orgPosHistory: (id: string) => `${orgPos}/history/${id}`, diff --git a/src/modules/02_organizationalNew/components/DialogFormPosition.vue b/src/modules/02_organizationalNew/components/DialogFormPosition.vue index 08dbc21eb..301a281c7 100644 --- a/src/modules/02_organizationalNew/components/DialogFormPosition.vue +++ b/src/modules/02_organizationalNew/components/DialogFormPosition.vue @@ -736,17 +736,6 @@ async function emitSearch(keyword: string, typeSelect: string) { }} - - - - เลือกสืบทอดตำแหน่ง - diff --git a/src/modules/02_organizationalNew/components/DialogInherit.vue b/src/modules/02_organizationalNew/components/DialogInherit.vue new file mode 100644 index 000000000..1caa06bd4 --- /dev/null +++ b/src/modules/02_organizationalNew/components/DialogInherit.vue @@ -0,0 +1,410 @@ + + + + + diff --git a/src/modules/02_organizationalNew/components/DialogMovePos.vue b/src/modules/02_organizationalNew/components/DialogMovePos.vue index d09b60813..4fb410553 100644 --- a/src/modules/02_organizationalNew/components/DialogMovePos.vue +++ b/src/modules/02_organizationalNew/components/DialogMovePos.vue @@ -9,7 +9,10 @@ import type { OrgTree, PosMaster2, } from "@/modules/02_organizationalNew/interface/response/organizational"; -import type { MovePos } from "@/modules/02_organizationalNew/interface/request/organizational"; +import type { + MovePos, + FilterMaster, +} from "@/modules/02_organizationalNew/interface/request/organizational"; import type { DataTree } from "@/modules/02_organizationalNew/interface/index/organizational"; import HeaderDialog from "@/components/DialogHeader.vue"; @@ -29,6 +32,8 @@ const { } = useCounterMixin(); const modal = defineModel("modal", { required: true }); +const reqMaster = defineModel("reqMaster", { required: true }); +const totalPage = defineModel("totalPage", { required: true }); const nodeTree = defineModel("nodeTree", { required: true }); const columns = defineModel("columns", {}); const rows = defineModel("rows", { required: true }); @@ -111,9 +116,60 @@ function onClickMovePos() { } } +/** + * function fetch ข้อรายการตำแหน่ง + * @param id idTree + * @param level levelTree + */ +async function fetchDataTable(id: string, level: number, action: boolean) { + // orgLevel.value = level; + // reqMaster.id = id; + // reqMaster.type = level; + // action1.value = action; + // if (action) { + // setTimeout(() => { + // action1.value = false; + // }, 1000); + // reqMaster.isAll = false; + // reqMaster.page = 1; + // reqMaster.pageSize = 10; + // reqMaster.keyword = ""; + // } + // if (action === true) { + // isLoad.value = true; + // } + // await http + // .post(config.API.orgPosMasterList, reqMaster) + // .then((res) => { + // posMaster.value = []; + // const dataMain: PosMaster[] = []; + // totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize); + // res.data.result.data.forEach((e: PosMaster) => { + // const p = e.positions; + // if (p.length !== 0) { + // const a = p.find((el: Position) => el.positionIsSelected === true); + // const { id, ...rest } = a ? a : p[0]; + // const test = { ...e, ...rest }; + // dataMain.push(test); + // } + // }); + // posMaster.value = store.fetchPosMaster(dataMain); + // }) + // .catch((err) => { + // messageError($q, err); + // posMaster.value = []; + // }) + // .finally(() => { + // setTimeout(() => { + // isLoad.value = false; + // }, 500); + // }); +} + watch( () => modal.value, () => { + reqMaster.value.page = 1; if (modal.value && props.type === "SINGER") { const data = rows.value.filter((e: PosMaster2) => e.id === props.rowId); selectedFilter.value = data; @@ -181,7 +237,11 @@ watch( :props="props" >
- {{ props.rowIndex + 1 }} + {{ + (reqMaster.page - 1) * Number(reqMaster.pageSize) + + props.rowIndex + + 1 + }}
@@ -190,6 +250,17 @@ watch( + diff --git a/src/modules/02_organizationalNew/components/listView.vue b/src/modules/02_organizationalNew/components/listView.vue index 1c551d81f..2ff6a8217 100644 --- a/src/modules/02_organizationalNew/components/listView.vue +++ b/src/modules/02_organizationalNew/components/listView.vue @@ -159,11 +159,20 @@ watch( ); /** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/ +watch([() => reqMaster.page, () => reqMaster.pageSize], () => { + action1.value === false && + fetchDataTable(reqMaster.id, reqMaster.type, false); +}); + +/** callblck function ทำการ fetch ข้อมูล Table เมื่อแสดงตำแหน่งทั้งหมด*/ watch( - [() => reqMaster.page, () => reqMaster.pageSize, () => reqMaster.isAll], + () => reqMaster.isAll, () => { - action1.value === false && + if (reqMaster.page !== 1) { + reqMaster.page = 1; + } else { fetchDataTable(reqMaster.id, reqMaster.type, false); + } } ); diff --git a/src/modules/02_organizationalNew/components/tableTree.vue b/src/modules/02_organizationalNew/components/tableTree.vue index a07497da4..4df6c0097 100644 --- a/src/modules/02_organizationalNew/components/tableTree.vue +++ b/src/modules/02_organizationalNew/components/tableTree.vue @@ -22,6 +22,8 @@ import DialogSort from "@/modules/02_organizationalNew/components/DialogSortPosi import DialogMovePos from "@/modules/02_organizationalNew/components/DialogMovePos.vue"; import DialogHistoryPos from "@/modules/02_organizationalNew/components/DialogHistoryPos.vue"; import DialogSelectPerson from "@/modules/02_organizationalNew/components/DialogSelectPerson.vue"; +import DialogInherit from "@/modules/02_organizationalNew/components/DialogInherit.vue"; + /** importStore*/ import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; import { useCounterMixin } from "@/stores/mixin"; @@ -78,6 +80,12 @@ const listMenu = ref([ type: "MOVE", color: "positive", }, + { + label: "สืบทอดตำแหน่ง", + icon: "mdi-account-multiple-outline", + type: "INHERIT", + color: "deep-orange", + }, { label: "ประวัติตำแหน่ง", icon: "history", @@ -356,6 +364,12 @@ function removePerson(id: string) { ); } +const modalDialogInherit = ref(false); +function onClickInherit(id: string) { + modalDialogInherit.value = !modalDialogInherit.value; + rowId.value = id; +} + /** ดึงข้อมูลสถิติจำนวนด้านบน*/ function getSummary() { showLoader(); @@ -655,6 +669,8 @@ async function genReportDoc(data: any) { ? onClickMovePos(props.row.id, 'SINGER') : item.type === 'HISTORY' ? onClickHistoryPos(props.row.id) + : item.type === 'INHERIT' + ? onClickInherit(props.row.id) : null " > @@ -790,6 +806,8 @@ async function genReportDoc(data: any) { v-model:nodeTree="nodeTree" v-model:columns="columns as QTableProps[]" v-model:rows="posMaster" + v-model:totalPage="totalPage" + v-model:reqMaster="reqMaster" :fetchDataTree="props.fetchDataTree" :type="typeMove" :rowId="rowId" @@ -798,12 +816,16 @@ async function genReportDoc(data: any) { + + + +