Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-02-19 13:23:59 +07:00
commit 2cb4a22b3f
7 changed files with 50 additions and 8 deletions

View file

@ -34,6 +34,7 @@ const props = defineProps({
rowId: { type: String, default: "" },
fetchDataTable: Function,
getSummary: Function,
shortName: {type: String, required: true}
});
const modalAdd = ref<boolean>(false);
@ -105,7 +106,7 @@ const positionExecutiveFieldRef = ref<Object | null>(null);
const positionAreaRef = ref<Object | null>(null);
const formData = reactive<FormDataPosition>({
shortName: "สกจ.",
shortName: props.shortName,
prefixNo: "",
positionNo: "",
suffixNo: "",

View file

@ -10,6 +10,8 @@ import type { HistoryPos } from "@/modules/02_organizationalNew/interface/respon
import Header from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
const store = useOrganizational();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
const $q = useQuasar();
const modal = defineModel<boolean>("modal", { required: true });
@ -140,7 +142,15 @@ watch(
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 == 1 ? "1 (แบบร่าง)":props.rowIndex + 1 == 2 ? "2 (ปัจจุบัน)":props.rowIndex + 1 }}
{{
store.typeOrganizational === "current"
? props.rowIndex + 1
: props.rowIndex + 1 == 1
? "1 (แบบร่าง)"
: props.rowIndex + 1 == 2
? "2 (ปัจจุบัน)"
: props.rowIndex + 1
}}
</div>
<div v-else>

View file

@ -124,6 +124,8 @@ watch(
() => modal.value,
() => {
reqMaster.value.page = 1;
filterTree.value = "";
title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`;
if (modal.value && props.type === "SINGER") {
const data = rows.value.filter((e: PosMaster2) => e.id === props.rowId);
@ -137,7 +139,7 @@ watch(
);
</script>
<template>
<q-dialog v-model="modal" full-width persistent>
<q-dialog v-model="modal" full-width full-height persistent>
<q-card>
<HeaderDialog :tittle="title" :close="() => (modal = false)" />
<q-separator />
@ -222,7 +224,7 @@ watch(
<q-card
bordered
class="col-12 col-sm-4 scroll q-pa-sm"
style="max-height: 70vh"
style="height: 750px"
>
<q-toolbar style="padding: 0">
<q-toolbar-title class="text-subtitle2 text-bold"

View file

@ -102,7 +102,7 @@ function onSubmit() {
store.draftId = res.data.result.id;
store.statusView = "list";
success($q, "บันทึกข้อมูลสำเร็จ");
// props.fetchActive?.();
props.fetchActive?.();
})
.catch((err) => {
messageError($q, err);

View file

@ -34,6 +34,7 @@ const {
/** props*/
const nodeTEST = defineModel<OrgTree[]>("nodeTree", { default: [] });
const nodeId = defineModel<string>("nodeId", { required: true });
const shortName = defineModel<string>("shortName", { required: true });
const props = defineProps({
fetchDataTree: {
type: Function,
@ -102,6 +103,8 @@ const orgId = ref<string>("");
* @param data อม Tree
*/
function updateSelected(data: DataTree) {
shortName.value = data.orgTreeShortName;
if (!store.treeId || store.treeId != data.orgTreeId) {
store.treeId = data.orgTreeId;
store.level = data.orgLevel;

View file

@ -43,6 +43,7 @@ const treeId = defineModel<string>("treeId", { required: true });
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
const totalPage = defineModel<number>("totalPage", { required: true });
const posMaster = defineModel<PosMaster2[]>("posMaster", { required: true });
// const shortName = defineModel<string>("shortName", { required: true });
const props = defineProps({
filterKeyword: { type: Function, require: true, default: () => {} },
fetchDataTable: {
@ -50,6 +51,7 @@ const props = defineProps({
require: true,
default: () => {},
},
shortName: { type: String, required: true },
fetchDataTree: {
type: Function,
require: true,
@ -757,6 +759,7 @@ async function onClickDownloadReport(val: string, name: string) {
<!-- ตรากำล -->
<DialogFormPosotion
:modal="dialogPosition"
:shortName="shortName"
:close="onClickPosition"
:orgLevel="orgLevel"
:treeId="treeId"
@ -830,5 +833,4 @@ async function onClickDownloadReport(val: string, name: string) {
padding: 0px;
}
}
</style>

View file

@ -50,6 +50,7 @@ const reqMaster = reactive<FilterMaster>({
const totalPage = ref<number>(1);
const action1 = ref<boolean>(false);
const posMaster = ref<PosMaster2[]>([]);
const shortName = ref<string>("");
/**
* function fetch อมลของ Tree
@ -81,7 +82,8 @@ async function fetchDataTree(id: string) {
* @param level levelTree
*/
async function fetchDataTable(id: string, level: number, action: boolean) {
mainTree.value = nodeTree.value?.find((e) => e.orgTreeId === id);
searchAndReplaceOrgName(nodeTree.value, id);
orgLevel.value = level;
reqMaster.id = id;
reqMaster.type = level;
@ -137,7 +139,6 @@ function getSummary() {
})
.then(async (res: any) => {
const data = await res.data.result;
store.getSumPosition({
totalPosition: data.totalPosition,
totalPositionCurrentUse: data.totalPositionCurrentUse,
@ -160,6 +161,20 @@ async function filterKeyword() {
fetchDataTable(reqMaster.id, reqMaster.type, false);
}
function searchAndReplaceOrgName(data: any, targetId: string) {
for (const child of data) {
if (child.orgTreeId === targetId) {
mainTree.value = child;
return true; // Found the targetId in this level
}
if (child.children && searchAndReplaceOrgName(child.children, targetId)) {
return true; // Found the targetId in the nested children
}
}
return false; // Not found in this branch
}
/**lifecycle Hook*/
onMounted(async () => {
const id =
@ -209,6 +224,13 @@ watch(
}
}
);
watch(
() => store.draftId,
() => {
store.draftId && fetchDataTree(store.draftId?.toString());
}
);
</script>
<template>
@ -218,6 +240,7 @@ watch(
<div class="col-12 row no-wrap bg-grey-1">
<TreeMain
v-model:nodeTree="nodeTree"
v-model:shortName="shortName"
v-model:nodeId="nodeId"
:fetchDataTree="fetchDataTree"
:fetchDataTable="fetchDataTable"
@ -295,6 +318,7 @@ watch(
v-model:reqMaster="reqMaster"
v-model:totalPage="totalPage"
v-model:posMaster="posMaster"
:shortName="shortName"
:mainTree="mainTree"
:fetchDataTable="fetchDataTable"
:filterKeyword="filterKeyword"