ปรับการ fetch ข้อมูล tree

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-02-01 09:27:56 +07:00
parent c7ea4e0e5b
commit dd9239ac25
7 changed files with 18 additions and 12 deletions

View file

@ -141,14 +141,14 @@ function onSubmit() {
if (actionType.value === "ADD") {
await http
.post(config.API.createOrgLevel(type.toLocaleLowerCase()), body)
.then((res) => {
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.fetchDataTree();
props.fetchDataTree(store.draftId);
closeClear();
hideLoader();
});

View file

@ -324,10 +324,8 @@ function validateFormPositionEdit() {
/** ฟังชั่น บันทึก */
function onSubmit() {
console.log(props.orgLevel);
dialogConfirm($q, async () => {
const positionsData = rows.value.map((e) => ({
const positionsData = rows.value.map((e: any) => ({
posDictName: e.positionName, // ()
posDictField: e.positionField, //
posTypeId: e.posTypeId, //*
@ -471,7 +469,7 @@ watch(
);
function addPosition(data: RowDetailPositions) {
const isIdExist = rows.value.some((item) => item.id === data.id);
const isIdExist = rows.value.some((item: any) => item.id === data.id);
if (!isIdExist) {
rows.value = [data, ...rows.value];
@ -521,7 +519,12 @@ async function clearFormPositionSelect() {
<template>
<q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 96vw">
<DialogHeader :tittle="props.actionType === 'ADD' ? 'เพิ่มอัตรากำลัง':'แก้ไขอัตรากำลัง'" :close="props.close" />
<DialogHeader
:tittle="
props.actionType === 'ADD' ? 'เพิ่มอัตรากำลัง' : 'แก้ไขอัตรากำลัง'
"
:close="props.close"
/>
<q-separator />
<q-card-section class="q-pa-sm">

View file

@ -47,7 +47,7 @@ async function fetchDataTree(id: string) {
// console.log(nodeTree.value);
}
async function fetchDataTable(id: string, level: namber) {
async function fetchDataTable(id: string, level: number) {
orgLevel.value = level;
// isLoad.value = true;
// await http

View file

@ -232,7 +232,6 @@ async function onClickDel(type: number, id: string, rootId: string) {
messageError($q, err);
})
.finally(async () => {
props.fetchDataTree?.();
hideLoader();
});
});

View file

@ -13,8 +13,8 @@ import DialogPositionDetail from "@/modules/02_organizationalNew/components/Posi
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
const showAllData = ref<boolean>(false);
const orgLevel = defineModel<number>("orgLevel", { require: true });
const treeId = defineModel<string>("treeId", { require: true });
const orgLevel = defineModel<number>("orgLevel", {});
const treeId = defineModel<string>("treeId", {});
const stroe = useOrganizational();
const filter = ref<string>("");
const actionType = ref<string>("");

View file

@ -103,6 +103,7 @@ interface FormPositionSelectRef {
}
interface RowDetailPositions {
id: string;
positionId: string;
positionName: string;
positionField: string;
@ -111,6 +112,9 @@ interface RowDetailPositions {
positionExecutive: string;
positionExecutiveField: string;
positionArea: string;
posTypeId: string;
posLevelId: string;
posExecutiveId: string;
}
export type {

View file

@ -296,7 +296,7 @@ onMounted(async () => {
<DialogDateTime :modal="modalDateTime" :close="onClickDateTime" />
<!-- ประวโครงสราง -->
<DialogHistory :modal="modalHistory" :close="onClickHistory" />
<!-- <DialogHistory :modal="modalHistory" :close="onClickHistory" /> -->
<!-- รายละเอยดโครงสราง -->
<!-- <DialogStructureDetail v-model:structure-detail="modalStructureDetail" /> -->