Merge branch 'develop' into dev

* develop:
  fix(roles): Order attrPrivilegeOp  PARENT
  fix: dataTreeFormatted
This commit is contained in:
Warunee Tamkoo 2026-02-20 17:26:53 +07:00
commit 85d156407b
5 changed files with 31 additions and 29 deletions

View file

@ -4,7 +4,7 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { ref, watch, reactive } from "vue";
import type { QTableProps } from "quasar";
import CardPosition from "@/modules/05_placement/components/PersonalList/CardPosition.vue";
import http from "@/plugins/http";
import config from "@/app.config";
@ -389,7 +389,7 @@ async function onClickSelectPos(id: string) {
positionId.value = id;
selectedPos.value = [];
const position: DataPositionNo = positionData.value.find(
(e: DataPositionNo) => e.id === id
(e: DataPositionNo) => e.id === id,
);
//
@ -397,7 +397,7 @@ async function onClickSelectPos(id: string) {
rowsPosition.value = position.positions;
if (seletcId.value) {
selectedPos.value = rowsPosition.value.filter(
(e) => e.id === seletcId.value
(e) => e.id === seletcId.value,
);
}
}
@ -448,7 +448,7 @@ watch(
expanded.value = [];
}
}
}
},
);
watch(
@ -457,7 +457,7 @@ watch(
if (value !== oldVal) {
getDataTable(nodeId.value, nodeLevel.value);
}
}
},
);
watch(
@ -466,7 +466,7 @@ watch(
if (value !== oldVal) {
getDataTable(nodeId.value, nodeLevel.value);
}
}
},
);
watch(
@ -475,11 +475,11 @@ watch(
if (n) {
onClickSelectPos(n);
}
}
},
);
function onSubmit() {
const dataPosMaster = posMasterMain.value?.find(
(e: any) => e.id === positionId.value
(e: any) => e.id === positionId.value,
);
console.log(dataPosMaster);
@ -650,7 +650,6 @@ function onSubmit() {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>

View file

@ -4,7 +4,6 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { ref, watch, reactive } from "vue";
import type { QTableProps } from "quasar";
import CardPosition from "@/modules/05_placement/components/PersonalList/CardPosition.vue";
import http from "@/plugins/http";
import config from "@/app.config";
@ -368,7 +367,7 @@ async function onClickSelectPos(id: string) {
positionId.value = id;
selectedPos.value = [];
const position: DataPositionNo = positionData.value.find(
(e: DataPositionNo) => e.id === id
(e: DataPositionNo) => e.id === id,
);
//
@ -376,7 +375,7 @@ async function onClickSelectPos(id: string) {
rowsPosition.value = position.positions;
if (seletcId.value) {
selectedPos.value = rowsPosition.value.filter(
(e) => e.id === seletcId.value
(e) => e.id === seletcId.value,
);
}
}
@ -427,7 +426,7 @@ watch(
expanded.value = [];
}
}
}
},
);
watch(
@ -436,7 +435,7 @@ watch(
if (value !== oldVal) {
getDataTable(nodeId.value, nodeLevel.value);
}
}
},
);
watch(
@ -445,7 +444,7 @@ watch(
if (value !== oldVal) {
getDataTable(nodeId.value, nodeLevel.value);
}
}
},
);
watch(
@ -454,11 +453,11 @@ watch(
if (n) {
onClickSelectPos(n);
}
}
},
);
function onSubmit() {
const dataPosMaster = posMasterMain.value?.find(
(e: any) => e.id === positionId.value
(e: any) => e.id === positionId.value,
);
console.log(dataPosMaster);
@ -629,7 +628,6 @@ function onSubmit() {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>

View file

@ -75,6 +75,7 @@ interface DataTree {
responsibility: string;
isDeputy: boolean;
labelName: string;
children?: DataTree[];
}
interface DataProfile {

View file

@ -97,7 +97,11 @@ async function fetchDataTree(id: string) {
.get(config.API.orgByid(id.toString()))
.then(async (res) => {
const data = await res.data.result;
nodeTree.value.push(...data);
const dataTreeFormatted = data.map((item: DataTree) => {
const { children, ...itemWithoutChildren } = item;
return itemWithoutChildren;
});
nodeTree.value.push(...dataTreeFormatted);
if (data.length === 1) {
selectedOrg(data[0].orgTreeId);
@ -309,7 +313,7 @@ onMounted(async () => {
class="q-pa-sm q-gutter-sm"
dense
:nodes="nodeTree"
node-key="labelName"
node-key="orgRootName"
label-key="labelName"
:filter="filter?.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"

View file

@ -25,14 +25,14 @@ const { dialogConfirm, messageError, showLoader, hideLoader, success } =
const roleId = ref<string>(route.params.id.toString()); // id
//
const attrPrivilegeOp = ref<DataOption[]>([
{
id: "ROOT",
name: "มีสิทธิ์เข้าถึงข้อมูลในทุกระดับ", // root
},
{
id: "PARENT",
name: "มีสิทธิ์เข้าถึงข้อมูลในทุกระดับที่อยู่ภายใต้หน่วยงานของตัวเอง ยกเว้นระดับชั้นบนสุด", // root root
},
{
id: "ROOT",
name: "มีสิทธิ์เข้าถึงข้อมูลในทุกระดับ", // root
},
{
id: "BROTHER",
name: "มีสิทธิ์เข้าถึงข้อมูลตั้งแต่ระดับชั้นที่สูงกว่าตัวเอง 1 ระดับ", // "" child 1
@ -104,7 +104,7 @@ async function fetchDataRole() {
if (item.children.length !== 0) {
item.children.forEach((q: SystemList) => {
const findChil = sysList.find(
(e: DataSystem) => e.authSysId === q.id
(e: DataSystem) => e.authSysId === q.id,
);
chil.push({
...q,
@ -119,7 +119,7 @@ async function fetchDataRole() {
});
});
const findMainRoot = sysList.find(
(e: DataSystem) => e.parentNode === item.id
(e: DataSystem) => e.parentNode === item.id,
);
const arrayChil = chil.filter((a) => a.parentId === item.id);
@ -139,7 +139,7 @@ async function fetchDataRole() {
}
} else {
const findRoot = sysList.find(
(e: DataSystem) => e.authSysId === item.id
(e: DataSystem) => e.authSysId === item.id,
);
root.push({
...item,
@ -172,7 +172,7 @@ function onSubmit() {
dialogConfirm($q, () => {
showLoader();
const filterList: any = systemLists.value.filter(
(e: any) => e.selected === true
(e: any) => e.selected === true,
);
const arrayRoleAttrs = filterList.flatMap((e: any) => {
if (e.children.length === 0) {
@ -192,7 +192,7 @@ function onSubmit() {
(e: any) =>
e.selected === true &&
e.attrOwnership !== "" &&
e.attrPrivilege !== ""
e.attrPrivilege !== "",
);
return filterListChil.map((i: any) => ({
parentNode: e.id,