วินัย => แสดงรายการทั้งหมด , ตัวชี้วัดตามแผน => ปรับ tree

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-26 14:23:14 +07:00
parent f7d8256682
commit 7cce2fd1fb
13 changed files with 157 additions and 115 deletions

View file

@ -17,22 +17,17 @@ const router = useRouter();
const heightSize = ref<string>("224");
const filter = ref<string>("");
const node = ref<any>([]);
const expanded = ref<any>([]);
const ticked = ref<any>([]);
const expanded = ref<string[]>([]);
const orgName = ref<string>("");
const nodeId = ref<string>("");
const notFound = ref<string>("ไม่พบข้อมูลที่ค้นหา");
const noData = ref<string>("ไม่มีข้อมูล");
const id = ref<string>(route.params.id ? route.params.id.toLocaleString() : "");
const {
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
date2Thai,
calculateDurationYmd,
dialogConfirm,
dialogMessageNotify,
} = useCounterMixin();
const title = ref<string>(route.params.id ? "แก้ไข" : "เพิ่ม");
@ -149,15 +144,20 @@ function onSubmit() {
if (form.nodeId == null) {
dialogMessageNotify($q, "กรุณาเลือกหน่วยงาน/ส่วนราชการ");
} else {
showLoader();
http[id.value ? "put" : "post"](url, body)
.then((res) => {
success($q, "บันทึกสำเร็จ");
id.value ? getDetail() : router.push(`/KPI-indicator-role`);
})
.finally(() => {
hideLoader();
});
dialogConfirm($q, () => {
showLoader();
http[id.value ? "put" : "post"](url, body)
.then(() => {
success($q, "บันทึกสำเร็จ");
id.value ? getDetail() : router.push(`/KPI-indicator-role`);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
}
@ -189,6 +189,14 @@ function getDetail() {
form.node = data.node;
form.nodeId = data.nodeId;
form.orgRevisionId = data.orgRevisionId;
const arrayExpanded = [
data.root,
data.child1,
data.child2,
data.child3,
data.child4,
];
expanded.value = arrayExpanded.filter((e) => e !== null).slice(0, -1);
})
.catch((e) => {
messageError($q, e);
@ -228,11 +236,6 @@ async function fetchTree(id: string) {
});
}
function updateTicked(val: any) {
ticked.value = [];
ticked.value.push(val[val.length - 1]);
}
function updateSelected(data: any) {
nodeId.value = data.orgTreeId;
orgName.value = data.orgTreeName;
@ -482,7 +485,7 @@ onMounted(() => {
<q-tree
dense
:nodes="node"
node-key="orgTreeName"
node-key="orgTreeId"
label-key="orgTreeName"
v-model:expanded="expanded"
:filter="filter"