Merge branch 'develop' into dev
* develop: fix(roles): Order attrPrivilegeOp PARENT fix: dataTreeFormatted
This commit is contained in:
commit
85d156407b
5 changed files with 31 additions and 29 deletions
|
|
@ -75,6 +75,7 @@ interface DataTree {
|
|||
responsibility: string;
|
||||
isDeputy: boolean;
|
||||
labelName: string;
|
||||
children?: DataTree[];
|
||||
}
|
||||
|
||||
interface DataProfile {
|
||||
|
|
|
|||
|
|
@ -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="ไม่พบข้อมูลที่ค้นหา"
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue