Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m55s

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-11 15:42:30 +07:00
commit 7f96fb9443
3 changed files with 13 additions and 44 deletions

View file

@ -47,8 +47,8 @@ function onSubmit() {
formData formData
) )
.then(async () => { .then(async () => {
await props.fetchData?.();
onCloseDialog(); onCloseDialog();
await props.fetchData?.();
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
}) })
.catch((err) => { .catch((err) => {

View file

@ -7,7 +7,7 @@ export default [
component: mainView, component: mainView,
meta: { meta: {
Auth: true, Auth: true,
Key: "COMMAND", Key: "SYS_POS_CONDITION",
Role: "STAFF", Role: "STAFF",
}, },
}, },

View file

@ -1,8 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, watch } from "vue"; import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { storeToRefs } from "pinia";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import { useStructureTree } from "@/stores/structureTree";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
@ -17,12 +20,15 @@ import LoadView from "@/components/LoadView.vue";
import DialogCondition from "@/modules/19_condition/components/DialogCondition.vue"; import DialogCondition from "@/modules/19_condition/components/DialogCondition.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute();
const { showLoader, hideLoader, messageError } = useCounterMixin(); const { showLoader, hideLoader, messageError } = useCounterMixin();
const { fetchStructureTree, fetchTreeStrategy } = useStructureTree();
const { activeId } = storeToRefs(useStructureTree());
const isLoadTable = ref<boolean>(false); const isLoadTable = ref<boolean>(false);
//Tree //Tree
const activeId = ref<string>(""); // const activeId = ref<string>("");
const filter = ref<string>(""); const filter = ref<string>("");
const orgTreeId = ref<string>(""); const orgTreeId = ref<string>("");
const nodeTree = ref<OrgTree[]>([]); const nodeTree = ref<OrgTree[]>([]);
@ -193,46 +199,9 @@ const columnsExpand = ref<QTableProps["columns"]>([
}, },
]); ]);
/** /** function fetch ข้อมูลของ Tree*/
* function เรยกขอมลโครงสราง แบบป async function fetchDataTree() {
*/ nodeTree.value = await fetchStructureTree(route.meta.Key as string, true);
async function fetchOrgActive() {
showLoader();
http
.get(config.API.activeOrganization)
.then(async (res) => {
const data = res.data.result;
if (data) {
activeId.value = data.activeId;
await fetchDataTree(data.activeId);
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function fetch อมลของ Tree
* @param id id โครงสราง
*/
async function fetchDataTree(id: string) {
showLoader();
await http
.get(config.API.orgByid(id))
.then((res) => {
const data = res.data.result;
nodeTree.value = data.data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
function onSelectedOrgTree(data: OrgTree) { function onSelectedOrgTree(data: OrgTree) {
@ -302,7 +271,7 @@ watch(pageSize, () => {
}); });
onMounted(async () => { onMounted(async () => {
await fetchOrgActive(); await fetchDataTree();
}); });
</script> </script>