บรรจุ แต่งตั้ง ย้าย โอน ==> ปรับ โครงสร้าง
This commit is contained in:
parent
d659b0930d
commit
d9af8f5514
5 changed files with 60 additions and 1211 deletions
|
|
@ -1,11 +1,12 @@
|
|||
<script setup lang="ts">
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { ref, watch, reactive, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { ref, watch, reactive } from "vue";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
|
|
@ -19,6 +20,7 @@ import type {
|
|||
TreeMain,
|
||||
} from "@/interface/request/orgSelect/org";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
const props = defineProps({
|
||||
dataRows: {
|
||||
type: Object,
|
||||
|
|
@ -28,6 +30,8 @@ const props = defineProps({
|
|||
});
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const storeTree = useStructureTree();
|
||||
const { fetchStructureTree } = useStructureTree();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogConfirm,
|
||||
|
|
@ -232,13 +236,10 @@ const visibleColumns = ref<string[]>([
|
|||
/** ปิด dialog */
|
||||
function close() {
|
||||
modal.value = false;
|
||||
|
||||
type.value = null;
|
||||
filter.value = "";
|
||||
isAll.value = false;
|
||||
isBlank.value = false;
|
||||
|
||||
nodes.value = [];
|
||||
expanded.value = [];
|
||||
nodeLevel.value = 0;
|
||||
nodeId.value = "";
|
||||
|
|
@ -341,44 +342,13 @@ function updateSelected(data: DataTree) {
|
|||
}
|
||||
|
||||
/** ดึงข้อมูล active */
|
||||
async function getActive() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.activeOrganization)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
|
||||
formActive.activeId = data.activeId;
|
||||
formActive.activeName = data.activeName;
|
||||
formActive.draftId = data.draftId;
|
||||
formActive.draftName = data.draftName;
|
||||
formActive.orgPublishDate = data.orgPublishDate;
|
||||
formActive.isPublic = data.isPublic;
|
||||
|
||||
getTreeData(data.activeId);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล หน่วยงาน */
|
||||
async function getTreeData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
nodes.value = data;
|
||||
filterItemsTaps(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
async function fetchTree() {
|
||||
const dataTree = await fetchStructureTree(route.meta.Key as string, true);
|
||||
if (dataTree) {
|
||||
formActive.activeId = storeTree.activeId;
|
||||
nodes.value = dataTree;
|
||||
filterItemsTaps(dataTree);
|
||||
}
|
||||
}
|
||||
|
||||
function filterItemsTaps(data: TreeMain[]) {
|
||||
|
|
@ -449,7 +419,6 @@ watch(
|
|||
() => modal.value,
|
||||
async (n) => {
|
||||
if (n == true) {
|
||||
getActive();
|
||||
fetchPositionUes();
|
||||
|
||||
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
||||
|
|
@ -542,6 +511,10 @@ function onSubmit() {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchTree();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<q-dialog v-model="modal" persistent full-width>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<script setup lang="ts">
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { ref, watch, reactive, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { ref, watch, reactive } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
OrgTree,
|
||||
DataTree,
|
||||
|
|
@ -20,6 +20,8 @@ import type {
|
|||
TreeMain,
|
||||
} from "@/interface/request/orgSelect/org";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const props = defineProps({
|
||||
dataRows: {
|
||||
type: Object,
|
||||
|
|
@ -29,6 +31,8 @@ const props = defineProps({
|
|||
});
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const storeTree = useStructureTree();
|
||||
const { fetchStructureTree } = useStructureTree();
|
||||
const {
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
|
|
@ -42,7 +46,7 @@ const route = useRoute();
|
|||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const title = defineModel<string>("title", { required: true });
|
||||
const type = defineModel<any>("type", { required: true });
|
||||
const type = defineModel<string>("type", { required: true });
|
||||
const posType = defineModel<any>("posType", { required: true });
|
||||
const posLevel = defineModel<any>("posLevel", { required: true });
|
||||
const position = defineModel<any>("position", { required: true });
|
||||
|
|
@ -217,8 +221,7 @@ function close() {
|
|||
filter.value = "";
|
||||
isAll.value = false;
|
||||
isBlank.value = false;
|
||||
type.value = null;
|
||||
nodes.value = [];
|
||||
type.value = "";
|
||||
expanded.value = [];
|
||||
nodeLevel.value = 0;
|
||||
nodeId.value = "";
|
||||
|
|
@ -321,44 +324,13 @@ function updateSelected(data: DataTree) {
|
|||
}
|
||||
|
||||
/** ดึงข้อมูล active */
|
||||
async function getActive() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.activeOrganization)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
|
||||
formActive.activeId = data.activeId;
|
||||
formActive.activeName = data.activeName;
|
||||
formActive.draftId = data.draftId;
|
||||
formActive.draftName = data.draftName;
|
||||
formActive.orgPublishDate = data.orgPublishDate;
|
||||
formActive.isPublic = data.isPublic;
|
||||
|
||||
getTreeData(data.activeId);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล หน่วยงาน */
|
||||
async function getTreeData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
nodes.value = data;
|
||||
filterItemsTaps(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
async function fetchTree() {
|
||||
const dataTree = await fetchStructureTree(route.meta.Key as string);
|
||||
if (dataTree) {
|
||||
formActive.activeId = storeTree.activeId;
|
||||
nodes.value = dataTree;
|
||||
filterItemsTaps(dataTree);
|
||||
}
|
||||
}
|
||||
|
||||
function filterItemsTaps(data: TreeMain[]) {
|
||||
|
|
@ -429,7 +401,6 @@ watch(
|
|||
() => modal.value,
|
||||
async (n) => {
|
||||
if (n == true) {
|
||||
getActive();
|
||||
fetchPositionUes();
|
||||
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
||||
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
|
||||
|
|
@ -487,8 +458,6 @@ function onSubmit() {
|
|||
const dataPosMaster = posMasterMain.value?.find(
|
||||
(e: any) => e.id === positionId.value
|
||||
);
|
||||
|
||||
console.log(dataPosMaster);
|
||||
if (selectedPos.value.length === 0) {
|
||||
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
|
||||
} else {
|
||||
|
|
@ -514,6 +483,10 @@ function onSubmit() {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchTree();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<q-dialog v-model="modal" persistent full-width>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useSelectOrgStore } from "@/modules/05_placement/stores/storeSelect";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
|
||||
/** importType*/
|
||||
import type {
|
||||
|
|
@ -17,15 +22,10 @@ import type { DataPositionNo } from "@/modules/05_placement/interface/index/Sele
|
|||
import Header from "@/components/DialogHeader.vue";
|
||||
import CardPosition from "@/modules/05_placement/components/PersonalList/CardPosition.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useSelectOrgStore } from "@/modules/05_placement/stores/storeSelect";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
/** use*/
|
||||
const $q = useQuasar();
|
||||
const storeTree = useStructureTree();
|
||||
const { fetchStructureTree } = useStructureTree();
|
||||
const store = useSelectOrgStore();
|
||||
const {
|
||||
success,
|
||||
|
|
@ -73,45 +73,13 @@ const posMasterMain = ref<any[]>([]);
|
|||
const orgRevisionId = ref<string>("");
|
||||
|
||||
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
|
||||
async function fetchOrganizationActive() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.activeOrganization)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
if (data) {
|
||||
orgRevisionId.value = data.activeId;
|
||||
fetchDataTree(data.activeId);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลของ Tree
|
||||
* @param id id โครงสร้าง
|
||||
*/
|
||||
async function fetchDataTree(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
if (data) {
|
||||
nodes.value = data;
|
||||
filterItemsTaps(data);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 1000);
|
||||
});
|
||||
async function fetchStructure() {
|
||||
const dataTree = await fetchStructureTree(route.meta.Key as string);
|
||||
if (dataTree) {
|
||||
orgRevisionId.value = storeTree.activeId;
|
||||
nodes.value = dataTree;
|
||||
filterItemsTaps(dataTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -291,7 +259,6 @@ watch(
|
|||
() => modal.value,
|
||||
async () => {
|
||||
if (modal.value) {
|
||||
await fetchOrganizationActive();
|
||||
await fetchPositionUes();
|
||||
|
||||
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
|
||||
|
|
@ -327,20 +294,6 @@ function filterItemsTaps(data: TreeMain[]) {
|
|||
return orgTreeIds;
|
||||
}
|
||||
|
||||
function filterNodeFn(data: any, id: string) {
|
||||
for (const child of data) {
|
||||
if (child.orgTreeId === id) {
|
||||
return child;
|
||||
} else if (child.children) {
|
||||
const result: any = filterNodeFn(child.children, id);
|
||||
if (result !== null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => isAll.value,
|
||||
(value, oldVal) => {
|
||||
|
|
@ -358,6 +311,10 @@ watch(
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
fetchStructure();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import config from "@/app.config";
|
|||
import { useRouter } from "vue-router";
|
||||
|
||||
import DialogHeader from "@/modules/05_placement/components/Receive/DialogHeader.vue";
|
||||
// import DialogOrgTree from "@/modules/05_placement/components/Receive/receiveModal.vue";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
|
|
@ -189,7 +188,7 @@ const SaveData = async () => {
|
|||
const fecthlistRecevice = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.receiveData()+`?keyword=`)
|
||||
.get(config.API.receiveData() + `?keyword=`)
|
||||
.then((res: any) => {
|
||||
const response = res.data.result;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue