fix:hideBtnAction
This commit is contained in:
parent
a760910794
commit
8b4ea6da38
12 changed files with 277 additions and 26 deletions
|
|
@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { tokenParsed } from "@/plugins/auth";
|
||||
|
||||
/** importComponents*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
|
@ -67,6 +68,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
const visibleColumns = ref<string[]>(["roleName", "roleDescription"]);
|
||||
|
||||
const selected = ref<Roles[]>([]);
|
||||
const roleUser = ref<string[]>([]);
|
||||
|
||||
function closeDialog() {
|
||||
modal.value = false;
|
||||
|
|
@ -74,10 +76,19 @@ function closeDialog() {
|
|||
keyword.value = "";
|
||||
}
|
||||
|
||||
function fetchListRoles() {
|
||||
async function fetchListRoles() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.managementAuth + `/list`)
|
||||
const isCheckRole = roleUser.value.includes("SUPER_ADMIN") ? true : false;
|
||||
|
||||
const param: { params?: { isAdminVisibled: string } } = {};
|
||||
if (!isCheckRole) {
|
||||
param.params = {
|
||||
isAdminVisibled: "true",
|
||||
};
|
||||
}
|
||||
|
||||
await http
|
||||
.get(config.API.managementAuth + `/list`, param)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
rows.value = data;
|
||||
|
|
@ -138,8 +149,12 @@ function serchDataTable() {
|
|||
|
||||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
modal.value && fetchListRoles();
|
||||
async () => {
|
||||
if (modal.value) {
|
||||
const token = await tokenParsed();
|
||||
roleUser.value = token?.role || [];
|
||||
await fetchListRoles();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDataStoreUser } from "@/modules/02_users/stores/main";
|
||||
import { usekeycloakPosition } from "@/stores/keycloakPosition";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
|
|
@ -17,6 +19,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
|||
|
||||
const $q = useQuasar();
|
||||
const store = useDataStoreUser();
|
||||
const { dataPosition } = storeToRefs(usekeycloakPosition());
|
||||
const { showLoader, hideLoader, messageError, success, dialogConfirm } =
|
||||
useCounterMixin();
|
||||
|
||||
|
|
@ -168,6 +171,18 @@ function onClose() {
|
|||
selected.value = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* ซ่อน checkbox ของผู้ใช้งานที่กำลังล็อกอินอยู่
|
||||
* @param id รหัสผู้ใช้งาน
|
||||
*/
|
||||
function hideCheckbox(id: string) {
|
||||
if (dataPosition.value?.profileId === id) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ pageSize ใน queryBody
|
||||
*
|
||||
|
|
@ -208,7 +223,7 @@ watch(
|
|||
dense
|
||||
v-model="qurey.searchKeyword"
|
||||
label="คำค้น"
|
||||
|
||||
@keydown.enter.prevent="onSearchListPerson(true)"
|
||||
>
|
||||
<!-- <template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -259,6 +274,7 @@ watch(
|
|||
<q-tr :props="props">
|
||||
<td auto-width>
|
||||
<q-checkbox
|
||||
v-if="hideCheckbox(props.row.id)"
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDataStoreUser } from "@/modules/02_users/stores/main";
|
||||
import { usekeycloakPosition } from "@/stores/keycloakPosition";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
|
|
@ -17,6 +19,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
|||
|
||||
const $q = useQuasar();
|
||||
const store = useDataStoreUser();
|
||||
const { dataPosition } = storeToRefs(usekeycloakPosition());
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
|
|
@ -184,6 +187,18 @@ function onClose() {
|
|||
isCheck.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* ซ่อน checkbox ของผู้ใช้งานที่กำลังล็อกอินอยู่
|
||||
* @param id รหัสผู้ใช้งาน
|
||||
*/
|
||||
function hideCheckbox(id: string) {
|
||||
if (dataPosition.value?.profileId === id) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ pageSize ใน queryBody
|
||||
*
|
||||
|
|
@ -237,6 +252,7 @@ watch(
|
|||
dense
|
||||
v-model="qurey.searchKeyword"
|
||||
label="คำค้น"
|
||||
@keydown.enter.prevent="onSearchListPerson(true)"
|
||||
>
|
||||
<!-- <template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -287,6 +303,7 @@ watch(
|
|||
<q-tr :props="props">
|
||||
<td auto-width>
|
||||
<q-checkbox
|
||||
v-if="hideCheckbox(props.row.id)"
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue