Merge branch 'develop' into dev

* develop:
  fix ui noti
  fix
  refactor(notification): update icon and text display
  feat(notification): add delete notification feature
  fix
  refactor(responsibilities):  table hide-bottom
  refactor(permission): display positionIsSelected
This commit is contained in:
Warunee Tamkoo 2026-06-25 21:54:25 +07:00
commit 3e05ba5dde
4 changed files with 102 additions and 49 deletions

View file

@ -1,8 +1,45 @@
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>("");
@ -10,5 +47,6 @@ export const usePermissionsStore = defineStore("permissions", () => {
typeOrganizational,
activeId,
draftId,
defaultOrganizationalNode,
};
});

View file

@ -33,44 +33,7 @@ const { showLoader, hideLoader, messageError, success, dialogRemove } =
/** Tree*/
const filter = ref<string>(""); //
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 nodes = ref<Array<NodeTree>>([store.defaultOrganizationalNode]); //
const lazy = ref(nodes);
const expanded = ref<string[]>([]); //
const nodeId = ref<string>(""); // id
@ -295,6 +258,8 @@ async function fetchDataTree(id: string) {
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
if (!isSuperAdmin) {
nodes.value = [];
} else {
nodes.value = [store.defaultOrganizationalNode];
}
showLoader();
await http
@ -626,7 +591,7 @@ onMounted(async () => {
<div>
<q-checkbox
:disable="nodeId"
:disable="nodeId ? false : true"
keep-color
v-model="reqMaster.isAll"
label="แสดงตำแหน่งทั้งหมด"
@ -819,7 +784,6 @@ onMounted(async () => {
table-class="text-grey-9"
row-key="id"
dense
hide-bottom
bordered
separator="vertical"
class="custom-header-table-expand"
@ -847,6 +811,15 @@ 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"
:disable="nodeId ? false : true"
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,
)
"
>
@ -758,7 +758,6 @@ onMounted(async () => {
table-class="text-grey-9"
row-key="id"
dense
hide-bottom
bordered
separator="vertical"
class="custom-header-table-expand"
@ -786,6 +785,14 @@ 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"
@ -835,7 +842,7 @@ onMounted(async () => {
fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type
reqMaster.type,
)
"
></q-pagination>

View file

@ -114,7 +114,7 @@ async function getDataNotification(index: number, type: string) {
.get(config.API.msgNotificate + `?page=${index}&pageSize=${15}`)
.then((res) => {
const response = res.data.result.data;
totalInbox.value = res.data.result.total;
totalInbox.value = res.data.result.total || 0;
let list: notiType[] = [];
if (type === "DEL") {
notiList.value = [];
@ -405,6 +405,26 @@ onBeforeMount(async () => {
}
});
function handleDeleteNotification() {
dialogRemove(
$q,
async () => {
try {
showLoader();
await http.delete(config.API.msgNotificate);
await getDataNotification(1, "DEL");
success($q, "ลบข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
},
"ยืนยันการล้างการแจ้งเตือนทั้งหมด",
`ต้องการล้างการแจ้งเตือนทั้งหมด (${totalInbox.value} รายการ) ใช่หรือไม่? การกระทำนี้ไม่สามารถย้อนกลับได้`,
);
}
/**
* เมอเรมตนโปรแกรมให event resize และ function myEventHandler
* set function myEventHandler เพราะ state งไมเซ , state เซทเม หนาจอเร ขยบหนาจอ
@ -510,6 +530,21 @@ onUnmounted(() => {
<div class="text-grey-5" style="font-size: 12px">
งหมด {{ totalInbox }} อความ
</div>
<q-btn
v-if="totalInbox !== 0"
flat
dense
no-caps
size="12px"
color="red-7"
icon="mdi-trash-can-outline"
label="ล้างทั้งหมด"
class="q-ml-sm"
aria-label="ล้างการแจ้งเตือนทั้งหมด"
@click.stop.prevent="handleDeleteNotification"
>
<q-tooltip>างการแจงเตอนทงหมด</q-tooltip>
</q-btn>
</div>
<q-infinite-scroll