Compare commits

..

No commits in common. "54a8483b61c80e70d7ec8e0fb9a6e259de1aeb98" and "4a2a4eb3a38f2d3cf03c6308177527b6992d0aa9" have entirely different histories.

3 changed files with 47 additions and 66 deletions

View file

@ -1,45 +1,8 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type { NodeTree } from "../interface/response/Main";
export const usePermissionsStore = defineStore("permissions", () => {
const typeOrganizational = ref<string>("current");
const defaultOrganizationalNode = {
labelName: "หน่วยงานทั้งหมด",
orgCode: "",
orgLevel: 0,
orgName: "",
orgRevisionId: "",
orgRootName: "",
orgTreeCode: "",
orgTreeFax: "",
orgTreeId: "",
orgTreeName: "หน่วยงานทั้งหมด",
orgTreeOrder: 0,
orgTreePhoneEx: "",
orgTreePhoneIn: "",
orgTreeRank: "",
orgTreeRankSub: "",
orgTreeShortName: "",
responsibility: "",
totalPosition: 0,
totalPositionCurrentUse: 0,
totalPositionCurrentVacant: 0,
totalPositionNextUse: 0,
totalPositionNextVacant: 0,
totalRootPosition: 0,
totalRootPositionCurrentUse: 0,
totalRootPositionCurrentVacant: 0,
totalRootPositionNextUse: 0,
totalRootPositionNextVacant: 0,
children: [] as NodeTree[],
isOfficer: false,
orgRootDnaId: "",
orgChild1DnaId: "",
orgChild2DnaId: "",
orgChild3DnaId: "",
orgChild4DnaId: "",
};
const activeId = ref<string>("");
const draftId = ref<string>("");
@ -47,6 +10,5 @@ export const usePermissionsStore = defineStore("permissions", () => {
typeOrganizational,
activeId,
draftId,
defaultOrganizationalNode,
};
});

View file

@ -33,7 +33,44 @@ const { showLoader, hideLoader, messageError, success, dialogRemove } =
/** Tree*/
const filter = ref<string>(""); //
const nodes = ref<Array<NodeTree>>([store.defaultOrganizationalNode]); //
const nodes = ref<Array<NodeTree>>([
{
labelName: "หน่วยงานทั้งหมด",
orgCode: "",
orgLevel: 0,
orgName: "",
orgRevisionId: "",
orgRootName: "",
orgTreeCode: "",
orgTreeFax: "",
orgTreeId: "",
orgTreeName: "หน่วยงานทั้งหมด",
orgTreeOrder: 0,
orgTreePhoneEx: "",
orgTreePhoneIn: "",
orgTreeRank: "",
orgTreeRankSub: "",
orgTreeShortName: "",
responsibility: "",
totalPosition: 0,
totalPositionCurrentUse: 0,
totalPositionCurrentVacant: 0,
totalPositionNextUse: 0,
totalPositionNextVacant: 0,
totalRootPosition: 0,
totalRootPositionCurrentUse: 0,
totalRootPositionCurrentVacant: 0,
totalRootPositionNextUse: 0,
totalRootPositionNextVacant: 0,
children: [] as NodeTree[],
isOfficer: false,
orgRootDnaId: "",
orgChild1DnaId: "",
orgChild2DnaId: "",
orgChild3DnaId: "",
orgChild4DnaId: "",
},
]); //
const lazy = ref(nodes);
const expanded = ref<string[]>([]); //
const nodeId = ref<string>(""); // id
@ -258,8 +295,6 @@ async function fetchDataTree(id: string) {
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
if (!isSuperAdmin) {
nodes.value = [];
} else {
nodes.value = [store.defaultOrganizationalNode];
}
showLoader();
await http
@ -591,7 +626,7 @@ onMounted(async () => {
<div>
<q-checkbox
:disable="nodeId ? false : true"
:disable="nodeId"
keep-color
v-model="reqMaster.isAll"
label="แสดงตำแหน่งทั้งหมด"
@ -784,6 +819,7 @@ onMounted(async () => {
table-class="text-grey-9"
row-key="id"
dense
hide-bottom
bordered
separator="vertical"
class="custom-header-table-expand"
@ -811,15 +847,6 @@ onMounted(async () => {
<div v-if="col.name == 'no'" class="text-body2">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'positionName'">
{{ col.value ? col.value : "-" }}
<q-icon
v-if="props.row.positionIsSelected"
name="check"
color="primary"
/>
</div>
<div
v-else-if="col.name === 'posExecutiveName'"
class="text-body2"

View file

@ -309,7 +309,7 @@ async function fetchDataTree(id: string) {
async function fetchDataTable(
id: string | null,
revisionId: string,
level: number,
level: number
) {
showLoader();
posMaster.value = [];
@ -385,7 +385,7 @@ function onDelete(id: string) {
await fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type,
reqMaster.type
);
success($q, "ลบข้อมูลสำเร็จ");
})
@ -433,7 +433,7 @@ watch(
() => {
reqMaster.page = 1;
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
},
}
);
onMounted(async () => {
@ -559,7 +559,7 @@ onMounted(async () => {
<div>
<q-checkbox
keep-color
:disable="nodeId ? false : true"
:disable="nodeId"
v-model="reqMaster.isAll"
label="แสดงตำแหน่งทั้งหมด"
color="primary"
@ -580,7 +580,7 @@ onMounted(async () => {
fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type,
reqMaster.type
)
"
>
@ -681,7 +681,7 @@ onMounted(async () => {
round
@click.prevent="
onOpenModalPersonal(
props.row.profileIdCurrentHolder,
props.row.profileIdCurrentHolder
)
"
>
@ -786,14 +786,6 @@ onMounted(async () => {
<div v-if="col.name == 'no'" class="text-body2">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'positionName'">
{{ col.value ? col.value : "-" }}
<q-icon
v-if="props.row.positionIsSelected"
name="check"
color="primary"
/>
</div>
<div
v-else-if="col.name === 'posExecutiveName'"
class="text-body2"
@ -843,7 +835,7 @@ onMounted(async () => {
fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type,
reqMaster.type
)
"
></q-pagination>