refactor: convert displayAdd to a computed property
This commit is contained in:
parent
26977319ed
commit
f5e1c0eca6
1 changed files with 6 additions and 12 deletions
|
|
@ -93,7 +93,6 @@ const appointModal = ref<boolean>(false);
|
|||
const getNumFile = ref(0);
|
||||
const dataRes = ref<any>([]);
|
||||
const personal = ref<any>([]);
|
||||
const displayAdd = ref<boolean>(true);
|
||||
const containStatus = ref<boolean>(false);
|
||||
const modaladdlist = ref<boolean>(false);
|
||||
const selected = ref<any>([]);
|
||||
|
|
@ -101,17 +100,12 @@ const personal_selected = ref<any>([]);
|
|||
const filterlistAdd = ref<string>("");
|
||||
const paging = ref<boolean>(true);
|
||||
|
||||
// เพิ่ม watcher สำหรับ roleAdmin
|
||||
watch(
|
||||
roleAdmin,
|
||||
(newValue) => {
|
||||
const permission = checkPermission(route);
|
||||
if (!newValue && permission?.attrOwnership !== "OWNER") {
|
||||
displayAdd.value = false;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
const displayAdd = computed(() => {
|
||||
if (!storeMenu.permissions) return true;
|
||||
|
||||
const permission = checkPermission(route);
|
||||
return roleAdmin.value || permission?.attrOwnership === "OWNER";
|
||||
});
|
||||
|
||||
// เช็ตสถานะการเลือกคนไปยังหน่วยงาน
|
||||
const checkSelected = computed(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue