Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop
This commit is contained in:
commit
483fc2943a
2 changed files with 53 additions and 93 deletions
|
|
@ -1,21 +1,32 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
/** importType*/
|
||||
/**
|
||||
*importType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { FormFilter } from "@/modules/04_registryPerson/interface/request/Main";
|
||||
|
||||
/** importComponent*/
|
||||
import DialogAddData from "@/modules/04_registryPerson/components/DialogAddData.vue";
|
||||
/**
|
||||
* importComponent
|
||||
*/
|
||||
import DialogHistory from "@/modules/04_registryPerson/components/DialogHistory.vue";
|
||||
|
||||
/** importStore*/
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
|
||||
|
||||
/**
|
||||
* use
|
||||
*/
|
||||
const store = useRegistryNewDataStore();
|
||||
const router = useRouter();
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
const formFilter = defineModel<FormFilter>("formFilter", { required: true });
|
||||
const maxPage = defineModel<Number>("maxPage", { required: true });
|
||||
const empType = defineModel<string>("empType", { required: true });
|
||||
|
|
@ -24,9 +35,14 @@ const props = defineProps({
|
|||
fetchData: { type: Function },
|
||||
fetchType: { type: Function },
|
||||
total: { type: Number },
|
||||
// empType: { type: String },
|
||||
});
|
||||
|
||||
/**
|
||||
* ตัวแปร
|
||||
*/
|
||||
const modalHistory = ref<boolean>(false); //ประวัติถือครองตำแหน่ง
|
||||
|
||||
/** ข้อมูล Table*/
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -133,7 +149,6 @@ const columns = ref<QTableProps["columns"]>([
|
|||
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
// },
|
||||
]);
|
||||
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"fullName",
|
||||
|
|
@ -144,32 +159,38 @@ const visibleColumns = ref<string[]>([
|
|||
"posLevel",
|
||||
"org",
|
||||
]);
|
||||
|
||||
function updatePagePagination() {
|
||||
props.fetchData?.();
|
||||
}
|
||||
|
||||
function updatePageSizePagination(newPagination: any) {
|
||||
formFilter.value.page = 1;
|
||||
formFilter.value.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
const pagination = ref({
|
||||
page: formFilter.value.page,
|
||||
rowsPerPage: formFilter.value.pageSize,
|
||||
});
|
||||
|
||||
const modalDialogAdd = ref<boolean>(false);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
|
||||
function onClickAddData() {
|
||||
modalDialogAdd.value = !modalDialogAdd.value;
|
||||
/**
|
||||
* function เปลี่ยนหน้า Table
|
||||
*/
|
||||
function updatePagePagination() {
|
||||
props.fetchData?.();
|
||||
}
|
||||
|
||||
/**
|
||||
* function เปลี่ยนแถวต่อหน้า
|
||||
* @param newPagination ข้อมูล Pagination
|
||||
*/
|
||||
function updatePageSizePagination(newPagination: any) {
|
||||
formFilter.value.page = 1;
|
||||
formFilter.value.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* function เปิด popup ประวัติถือครองตำแหน่ง
|
||||
*/
|
||||
function onClickHistory() {
|
||||
modalHistory.value = !modalHistory.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* function rediract หน้ารายละเอียด
|
||||
* @param id รายการ
|
||||
*/
|
||||
function onClickViewDetail(id: string) {
|
||||
if (empType.value === "officer") {
|
||||
router.push(`/registry-person/${id}`);
|
||||
|
|
@ -197,7 +218,7 @@ watch(
|
|||
<div class="col-12 row q-pb-sm q-col-gutter-sm items-center">
|
||||
<div class="row q-gutter-sm">
|
||||
<q-btn
|
||||
v-if="empType === 'officer'"
|
||||
v-if="empType === 'officer' && checkPermission($route)?.attrIsUpdate"
|
||||
color="primary"
|
||||
label="รายการคำร้องขอแก้ไข"
|
||||
@click="redirectToPagePetition()"
|
||||
|
|
@ -398,72 +419,6 @@ watch(
|
|||
}}
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<!-- <q-list dense class="q-py-sm"> -->
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>ตำแหน่งเลขที่</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">{{
|
||||
props.row.posNo ? props.row.posNo : "-"
|
||||
}}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>{{
|
||||
empType === "officer" ? `ตำแหน่งในสายงาน` : `ตำแหน่ง`
|
||||
}}</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">
|
||||
{{
|
||||
props.row.position ? props.row.position : "-"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>
|
||||
{{
|
||||
empType === "officer" ? "ตำแหน่งประเภท" : "กลุ่มงาน"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">
|
||||
{{
|
||||
props.row.posType ? props.row.posType : "-"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>
|
||||
{{
|
||||
empType === "officer" ? "ระดับ" : "ระดับชั้นงาน"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">
|
||||
{{
|
||||
props.row.posLevel
|
||||
? props.row.posTypeShortName
|
||||
? `${props.row.posTypeShortName} ${props.row.posLevel}`
|
||||
: props.row.posLevel
|
||||
: "-"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
<!-- </q-list> -->
|
||||
</q-card>
|
||||
</q-card-section>
|
||||
<q-separator inset />
|
||||
|
|
@ -513,12 +468,12 @@ watch(
|
|||
</template>
|
||||
</d-table>
|
||||
|
||||
<DialogAddData
|
||||
<!-- <DialogAddData
|
||||
v-model:modal="modalDialogAdd"
|
||||
:fetchData="props.fetchData"
|
||||
:fetchType="props.fetchType"
|
||||
:empType="empType"
|
||||
/>
|
||||
/> -->
|
||||
|
||||
<DialogHistory v-model:modal="modalHistory" />
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -7,11 +7,16 @@ import type { RoleData } from "@/interface/main";
|
|||
const storeMenu = useMenuDataStore();
|
||||
|
||||
export function checkPermission(route: any): RoleData | null {
|
||||
console.log("storeMenu.permissions", storeMenu.permissions);
|
||||
|
||||
|
||||
if (storeMenu.permissions && route.meta.Key) {
|
||||
const role =
|
||||
storeMenu.permissions.roles.find((item) =>
|
||||
item.authSysId.includes(route.meta.Key)
|
||||
storeMenu.permissions.roles.find(
|
||||
(item) => item.authSysId === route.meta.Key
|
||||
) ?? null;
|
||||
|
||||
|
||||
return role;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue