ปรับการ fetch ข้อมูล tree
This commit is contained in:
parent
c7ea4e0e5b
commit
dd9239ac25
7 changed files with 18 additions and 12 deletions
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -232,7 +232,6 @@ async function onClickDel(type: number, id: string, rootId: string) {
|
|||
messageError($q, err);
|
||||
})
|
||||
.finally(async () => {
|
||||
props.fetchDataTree?.();
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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>("");
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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" /> -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue