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