diff --git a/src/components/Dialogs/PopupPersonalNew.vue b/src/components/Dialogs/PopupPersonalNew.vue index 7032a48a7..857c993ab 100644 --- a/src/components/Dialogs/PopupPersonalNew.vue +++ b/src/components/Dialogs/PopupPersonalNew.vue @@ -155,7 +155,7 @@ async function fetchProfileGov(id: string) { } function redirecToRegistry() { - router.push(`/registry-person${empType.value}/${props.id}`); + router.push(`/registry-officer${empType.value}/${props.id}`); modal.value = false; } diff --git a/src/modules/04_registryPerson/components/DialogHistory.vue b/src/modules/04_registryPerson/components/DialogHistory.vue index 82cdf0d33..b55ac7e15 100644 --- a/src/modules/04_registryPerson/components/DialogHistory.vue +++ b/src/modules/04_registryPerson/components/DialogHistory.vue @@ -253,7 +253,9 @@ function filterFn(val: string, update: Function) { */ function clickRedirect(id: string) { const url = - employeeClass.value === "officer" ? "registry-person" : "registry-employee"; + employeeClass.value === "officer" + ? "registry-officer" + : "registry-employee"; router.push(`${url}/${id}`); } diff --git a/src/modules/04_registryPerson/components/TableView.vue b/src/modules/04_registryPerson/components/TableView.vue index df44c3ce2..847ec5db5 100644 --- a/src/modules/04_registryPerson/components/TableView.vue +++ b/src/modules/04_registryPerson/components/TableView.vue @@ -193,7 +193,7 @@ function onClickHistory() { */ function onClickViewDetail(id: string) { if (empType.value === "officer") { - router.push(`/registry-person/${id}`); + router.push(`/registry-officer/${id}`); } else { router.push(`/registry-employee/${id}`); } @@ -203,7 +203,7 @@ function onClickViewDetail(id: string) { * function redirect ไปหน้ารายการคำร้องขอแก้ไขข้อมูล */ function redirectToPagePetition() { - router.push(`/registry-person/request-edit`); + router.push(`/registry-officer/request-edit`); } watch( diff --git a/src/modules/04_registryPerson/router.ts b/src/modules/04_registryPerson/router.ts index 59fb03cd8..c8277a342 100644 --- a/src/modules/04_registryPerson/router.ts +++ b/src/modules/04_registryPerson/router.ts @@ -7,19 +7,29 @@ const requestEdit = () => export default [ { - path: "/registry-person", + path: "/registry-officer", name: "registryNew", component: listPage, meta: { Auth: true, - Key: "SYS_REGISTRY", + Key: "SYS_REGISTRY_OFFICER", Role: "STAFF", }, }, { - path: "/registry-person/:id", + path: "/registry-officer/:id", name: "registryNewByid", component: detailPage, + meta: { + Auth: true, + Key: "SYS_REGISTRY_OFFICER", + Role: "STAFF", + }, + }, + { + path: "/registry-employee", + name: "registryEmployeeList", + component: listPage, meta: { Auth: true, Key: "SYS_REGISTRY", @@ -37,12 +47,12 @@ export default [ }, }, { - path: "/registry-person/request-edit", + path: "/registry-officer/request-edit", name: "registryNewRequestEdit", component: requestEdit, meta: { Auth: true, - Key: "SYS_REGISTRY", + Key: "SYS_REGISTRY_OFFICER", Role: "STAFF", }, }, diff --git a/src/modules/04_registryPerson/views/list.vue b/src/modules/04_registryPerson/views/list.vue index d9e1ac890..4f325eb65 100644 --- a/src/modules/04_registryPerson/views/list.vue +++ b/src/modules/04_registryPerson/views/list.vue @@ -19,10 +19,12 @@ import avatar from "@/assets/avatar_user.jpg"; /** importStore*/ import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store"; import { useCounterMixin } from "@/stores/mixin"; +import { useRoute } from "vue-router"; const $q = useQuasar(); const store = useRegistryNewDataStore(); const { showLoader, hideLoader, messageError } = useCounterMixin(); +const route = useRoute(); const mode = ref<"table" | "card">("table"); @@ -72,6 +74,7 @@ function fetchType() { http .get(config.API.orgPosType) .then((res) => { + console.log("this fetchType", res.data.result); store.fetchType(res.data.result); }) .catch((err) => { @@ -86,6 +89,8 @@ function fetchOptionGroup() { http .get(config.API.orgEmployeeType) .then((res) => { + console.log("this fetchOptionGroup===>", res.data.result); + store.fetchType(res.data.result); }) .catch((err) => { @@ -206,7 +211,6 @@ function onClickShowFilter() { isShowFilter.value = !isShowFilter.value; isShowBtnFilter.value = false; if (isShowFilter.value) { - fetchType(); // fetchLevel(); fetchYearOption(); } @@ -232,14 +236,16 @@ function onclickSearch() { * function เลือกประเภทข้าราชการ * @param item ประเภทข้าราชการ */ -function selectType(item: DataOption) { - labelOption.type = item.name; - empType.value = item.id; +async function selectType() { + // labelOption.type = item.name; + empType.value = await (route.name == "registryNew" ? "officer" : "perm"); formFilter.page = 1; + console.log("empType===>", empType.value); + labelOption.posType = "ทั้งหมด"; labelOption.posLevel = "ทั้งหมด"; - if (item.id !== "officer") { + if (empType.value !== "officer") { formFilter.isShowRetire = null; formFilter.isProbation = null; fetchOptionGroup(); @@ -294,14 +300,18 @@ function clearSelect(t: string) { } onMounted(async () => { - fetchDataPerson(); + selectType(); }); +