This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-22 16:56:40 +07:00
parent 7f3eb5225f
commit 4c35662eed
22 changed files with 632 additions and 343 deletions

View file

@ -62,7 +62,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "email",
align: "left",
label: "Email",
label: "อีเมล",
sortable: true,
field: "email",
headerStyle: "font-size: 14px",

View file

@ -6,6 +6,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
import { usePermissionsStore } from "@/modules/02_users/stores/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth";
/** importType*/
import type { QTableProps } from "quasar";
@ -69,6 +70,15 @@ const expanded = ref<string[]>([]); // แสดงข้อมูลในโ
const nodeId = ref<string>(""); // id
/** Table*/
const visibleColumns = ref<string[]>([
"no",
"posMasterNo",
"positionName",
"posTypeName",
"posLevelName",
"positionIsSelected",
"authRoleName",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -277,6 +287,11 @@ async function fetchOrganizationActive() {
* @param id id โครงสราง
*/
async function fetchDataTree(id: string) {
const tokenParsedData = await tokenParsed();
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
if (!isSuperAdmin) {
nodes.value = [];
}
showLoader();
await http
.get(config.API.orgByid(id.toString()))
@ -284,6 +299,7 @@ async function fetchDataTree(id: string) {
const data = await res.data.result;
nodes.value.push(...data);
nodes.value[0].orgRevisionId = id;
nodeId.value = nodes.value[0].orgTreeId;
await fetchDataTable(reqMaster.id, id, reqMaster.type);
})
.catch((err) => {
@ -622,6 +638,22 @@ onMounted(() => {
</template>
</q-input>
</div>
<div>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
</div>
</q-toolbar>
<d-table
@ -636,6 +668,7 @@ onMounted(() => {
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
v-model:pagination="pagination"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">

View file

@ -6,6 +6,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreUser } from "@/modules/02_users/stores/main";
import { tokenParsed } from "@/plugins/auth";
import type { QTableProps } from "quasar";
import type {
@ -59,6 +60,12 @@ const personId = ref<string>("");
* เกบขอมลโครงสรางไวใน nodeTree
*/
async function fatchOrg() {
const tokenParsedData = await tokenParsed();
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
if (!isSuperAdmin) {
nodeTree.value = [];
}
showLoader();
await http
.get(config.API.permissionOrg)
@ -127,6 +134,7 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>(["fullName", "orgNew"]);
const modalAdd = ref<boolean>(false); // modal
/**
@ -363,6 +371,23 @@ onMounted(async () => {
</div>
</div>
<div class="row col-12 q-mt-sm">
<q-space />
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
<div class="col-12 q-mt-sm">
<d-table
:columns="columns"
@ -374,6 +399,7 @@ onMounted(async () => {
dense
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">

View file

@ -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";
/** importType*/
import type { QTableProps } from "quasar";
@ -66,6 +67,15 @@ const nodeId = ref<string>(""); // id โหนด
const isOfficer = ref<boolean>(false); // columns .
/** Table*/
const visibleColumns = ref<string[]>([
"no",
"posMasterNo",
"positionName",
"posTypeName",
"posLevelName",
"positionIsSelected",
"isPosMasterAssign",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -260,6 +270,11 @@ async function fetchOrganizationActive() {
* @param id id โครงสราง
*/
async function fetchDataTree(id: string) {
const tokenParsedData = await tokenParsed();
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
if (!isSuperAdmin) {
nodes.value = [];
}
showLoader();
await http
.get(config.API.orgByid(id.toString()))
@ -267,6 +282,7 @@ async function fetchDataTree(id: string) {
const data = await res.data.result;
nodes.value.push(...data);
nodes.value[0].orgRevisionId = id;
nodeId.value = nodes.value[0].orgTreeId;
await fetchDataTable(reqMaster.id, id, reqMaster.type);
})
.catch((err) => {
@ -553,6 +569,22 @@ onMounted(() => {
</template>
</q-input>
</div>
<div>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
</div>
</q-toolbar>
<d-table
@ -567,6 +599,7 @@ onMounted(() => {
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
v-model:pagination="pagination"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
@ -744,7 +777,7 @@ onMounted(() => {
</div>
<div v-else class="text-body2">
{{ col.value }}
{{ col.value ?? "-" }}
</div>
</q-td>
</q-tr>

View file

@ -143,7 +143,7 @@ onMounted(async () => {
<q-card flast bordered class="q-pa-md">
<div class="items-center col-12 row q-col-gutter-sm q-mb-sm">
<q-btn flat round dense color="primary" icon="add" @click="openDialog">
<q-tooltip>เพ Role </q-tooltip>
<q-tooltip>เพทธ </q-tooltip>
</q-btn>
<q-space />