fix รายงานโครงสร้างและกรอบอัตรากำลัง
This commit is contained in:
parent
938b1f8e98
commit
584c5d6756
4 changed files with 73 additions and 476 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, watch } from "vue";
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -8,13 +8,7 @@ import { useOrganizational } from "@/modules/02_organization/store/organizationa
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** importType*/
|
||||
import type {
|
||||
OrgTree,
|
||||
PosMaster,
|
||||
Position,
|
||||
PosMaster2,
|
||||
} from "@/modules/02_organization/interface/response/organizational";
|
||||
import type { FilterMaster } from "@/modules/02_organization/interface/request/organizational";
|
||||
import type { OrgTree } from "@/modules/02_organization/interface/response/organizational";
|
||||
|
||||
/** importComponents*/
|
||||
import TreeMain from "@/modules/21_report/components/01_org/TreeMain.vue";
|
||||
|
|
@ -32,35 +26,15 @@ const count = defineModel<number>("count", { required: true });
|
|||
|
||||
const nodeTree = ref<OrgTree[]>(); // ข้อมูล Tree
|
||||
const nodeId = ref<string>(""); // id ของ Tree
|
||||
const orgRootId = ref<string>("");
|
||||
const orgLevel = ref<number>(0); // levelTree
|
||||
const orgRootId = ref<string>(""); // id ของ Root
|
||||
const isLoad = ref<boolean>(false); // loadTable
|
||||
const isLoadTree = ref<boolean>(false); // loadTable
|
||||
const mainTree = ref<OrgTree>();
|
||||
|
||||
const selected = ref<string>("");
|
||||
|
||||
const reqMaster = reactive<FilterMaster>({
|
||||
id: "",
|
||||
type: 0,
|
||||
isAll: false,
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
keyword: "",
|
||||
revisionId: "",
|
||||
});
|
||||
const totalPage = ref<number>(1);
|
||||
const totalData = ref<number>(1);
|
||||
const action1 = ref<boolean>(false);
|
||||
const posMaster = ref<PosMaster2[]>([]);
|
||||
const shortName = ref<string>("");
|
||||
const selected = ref<string>(""); // selected node
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลของ Tree
|
||||
* @param id id โครงสร้าง
|
||||
*/
|
||||
async function fetchDataTree(id: string) {
|
||||
isLoadTree.value = false;
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgByid(id))
|
||||
|
|
@ -80,120 +54,6 @@ async function fetchDataTree(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อรายการตำแหน่ง
|
||||
* @param id idTree
|
||||
* @param level levelTree
|
||||
*/
|
||||
async function fetchDataTable(id: string, level: number, action: boolean) {
|
||||
searchAndReplaceOrgName(nodeTree.value, id);
|
||||
orgLevel.value = level;
|
||||
reqMaster.id = id;
|
||||
reqMaster.type = level;
|
||||
action1.value = action;
|
||||
if (action) {
|
||||
setTimeout(() => {
|
||||
action1.value = false;
|
||||
}, 1000);
|
||||
reqMaster.isAll = false;
|
||||
reqMaster.page = 1;
|
||||
reqMaster.pageSize = 10;
|
||||
reqMaster.keyword = "";
|
||||
reqMaster.revisionId =
|
||||
store.typeOrganizational == "draft"
|
||||
? store.draftId
|
||||
: store.typeOrganizational == "current"
|
||||
? store.activeId
|
||||
: store.historyId;
|
||||
isLoad.value = true;
|
||||
}
|
||||
posMaster.value = [];
|
||||
|
||||
await http
|
||||
.post(config.API.orgPosMasterList, {
|
||||
...reqMaster,
|
||||
keyword: reqMaster.keyword.trim(),
|
||||
})
|
||||
.then(async (res) => {
|
||||
const dataMain: PosMaster[] = [];
|
||||
totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
|
||||
totalData.value = res.data.result.total;
|
||||
res.data.result.data.forEach((e: PosMaster) => {
|
||||
const p = e.positions;
|
||||
if (p.length !== 0) {
|
||||
const a = p.find((el: Position) => el.positionIsSelected === true);
|
||||
const { id, ...rest } = a ? a : p[0];
|
||||
const test = {
|
||||
...e,
|
||||
...rest,
|
||||
};
|
||||
dataMain.push(test);
|
||||
}
|
||||
});
|
||||
posMaster.value = store.fetchPosMaster(dataMain);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
posMaster.value = [];
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
isLoad.value = false;
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลสถิติจำนวนด้านบน*/
|
||||
// function getSummary() {
|
||||
// http
|
||||
// .post(config.API.orgSummary, {
|
||||
// id: reqMaster.id, //*Id node
|
||||
// type: reqMaster.type, //*ประเภทnode
|
||||
// isNode: reqMaster.isAll, //*นับทั้ง node ไหม
|
||||
// })
|
||||
// .then(async (res: any) => {
|
||||
// const data = await res.data.result;
|
||||
// store.getSumPosition({
|
||||
// totalPosition: data.totalPosition,
|
||||
// totalPositionCurrentUse: data.totalPositionCurrentUse,
|
||||
// totalPositionCurrentVacant: data.totalPositionCurrentVacant,
|
||||
// totalPositionNextUse: data.totalPositionNextUse,
|
||||
// totalPositionNextVacant: data.totalPositionNextVacant,
|
||||
// totalRootPosition: data.totalPosition,
|
||||
// totalRootPositionCurrentUse: data.totalPositionCurrentUse,
|
||||
// totalRootPositionCurrentVacant: data.totalPositionCurrentVacant,
|
||||
// totalRootPositionNextUse: data.totalPositionNextUse,
|
||||
// totalRootPositionNextVacant: data.totalPositionNextVacant,
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
/** funcion ค้นหาข้อมูลใน Table*/
|
||||
async function filterKeyword() {
|
||||
reqMaster.page = 1;
|
||||
action1.value === false &&
|
||||
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* ค้นหาโครงสร้างในข้อมูลแบบลำดับชั้นเพื่อหาที่ตรงกับ orgTreeId
|
||||
* @param data ข้อมูลโครงสร้าง
|
||||
* @param targetId id ของโครงสร้างที่ต้องการค้นหา
|
||||
*/
|
||||
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
|
||||
}
|
||||
|
||||
/** callback function ทำงาน ทำการ fetch ข้อมูล Tree เมื่อมีการเลือกประวัติโครงสร้าง*/
|
||||
watch(
|
||||
() => count.value,
|
||||
|
|
@ -202,7 +62,7 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
/** callblck function ทำการ fetch ข้อมูล Tree เมื่อมีการเปลี่ยนโครงสร้าง*/
|
||||
/** callback function ทำการ fetch ข้อมูล Tree เมื่อมีการเปลี่ยนโครงสร้าง*/
|
||||
watch(
|
||||
() => store.typeOrganizational,
|
||||
() => {
|
||||
|
|
@ -215,44 +75,22 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า */
|
||||
watch([() => reqMaster.page, () => reqMaster.pageSize], () => {
|
||||
action1.value === false &&
|
||||
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
||||
});
|
||||
|
||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อแสดงตำแหน่งทั้งหมด*/
|
||||
// watch(
|
||||
// () => reqMaster.isAll,
|
||||
// () => {
|
||||
// getSummary();
|
||||
// if (reqMaster.page !== 1) {
|
||||
// reqMaster.page = 1;
|
||||
// } else {
|
||||
// fetchDataTable(reqMaster.id, reqMaster.type, false);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
/** callback function ทำการ fetch ข้อมูล Tree เมื่อมีการเปลี่ยนแปลง activeId */
|
||||
watch(
|
||||
() => store.draftId,
|
||||
() => store.activeId,
|
||||
() => {
|
||||
store.draftId && fetchDataTree(store.draftId?.toString());
|
||||
store.activeId && fetchDataTree(store.activeId?.toString());
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* lifecycle Hook ทำเมือ่ Components ถูกเรียกใช้งาน
|
||||
*
|
||||
* ุ และดึงช้อมูลโครงสร้างตาม ID ของประเภทโครงสร้าง ปัจจุบัน,แบบร่าง
|
||||
*/
|
||||
onMounted(async () => {
|
||||
const id =
|
||||
store.typeOrganizational === "current"
|
||||
? store.activeId
|
||||
: store.typeOrganizational === "draft"
|
||||
? store.draftId
|
||||
: historyId.value;
|
||||
store.typeOrganizational === "current" ? store.activeId : historyId.value;
|
||||
|
||||
id && (await fetchDataTree(id));
|
||||
});
|
||||
</script>
|
||||
|
|
@ -264,11 +102,8 @@ onMounted(async () => {
|
|||
<div class="col-12 row no-wrap bg-grey-1">
|
||||
<TreeMain
|
||||
v-model:node-tree="nodeTree"
|
||||
v-model:short-name="shortName"
|
||||
v-model:node-id="nodeId"
|
||||
v-model:org-root-id="orgRootId"
|
||||
:fetch-data-table="fetchDataTable"
|
||||
:fetch-data-tree="fetchDataTree"
|
||||
/>
|
||||
|
||||
<div class="col-12 row">
|
||||
|
|
@ -294,36 +129,18 @@ onMounted(async () => {
|
|||
<q-space />
|
||||
<q-badge
|
||||
color="secondary"
|
||||
:label="
|
||||
reqMaster.isAll
|
||||
? store.sumPosition.total
|
||||
: store.sumPosition.totalRoot
|
||||
"
|
||||
:label="store.sumPosition.totalRoot"
|
||||
/>
|
||||
</div>
|
||||
<div class="row col q-pa-sm item">
|
||||
<div class="ellipsis">ตำแหน่งที่มีคนครอง</div>
|
||||
<q-space />
|
||||
<q-badge
|
||||
color="primary"
|
||||
:label="
|
||||
reqMaster.isAll
|
||||
? store.sumPosition.use
|
||||
: store.sumPosition.useRoot
|
||||
"
|
||||
/>
|
||||
<q-badge color="primary" :label="store.sumPosition.useRoot" />
|
||||
</div>
|
||||
<div class="row col q-pa-sm item">
|
||||
<div class="ellipsis">ตำแหน่งว่าง</div>
|
||||
<q-space />
|
||||
<q-badge
|
||||
color="red"
|
||||
:label="
|
||||
reqMaster.isAll
|
||||
? store.sumPosition.vacant
|
||||
: store.sumPosition.vacantRoot
|
||||
"
|
||||
/>
|
||||
<q-badge color="red" :label="store.sumPosition.vacantRoot" />
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
|
|
@ -331,19 +148,7 @@ onMounted(async () => {
|
|||
<div class="q-pa-sm">
|
||||
<TreeTable
|
||||
v-if="nodeId !== ''"
|
||||
v-model:node-tree="nodeTree"
|
||||
v-model:org-level="orgLevel"
|
||||
v-model:tree-id="nodeId"
|
||||
v-model:pos-master="posMaster"
|
||||
v-model:req-master="reqMaster"
|
||||
v-model:total-page="totalPage"
|
||||
v-model:org-root-id="orgRootId"
|
||||
v-model:total-data="totalData"
|
||||
:short-name="shortName"
|
||||
:main-tree="mainTree"
|
||||
:fetch-data-table="fetchDataTable"
|
||||
:filter-keyword="filterKeyword"
|
||||
:fetch-data-tree="fetchDataTree"
|
||||
/>
|
||||
</div>
|
||||
</q-card>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import axios from "axios";
|
||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||
|
|
@ -11,11 +11,8 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||
|
||||
import type { DataDocument } from "@/modules/02_organization/interface/index/Main";
|
||||
import type { FilterMaster } from "@/modules/02_organization/interface/request/organizational";
|
||||
import type { PosMaster2 } from "@/modules/02_organization/interface/response/organizational";
|
||||
|
||||
/** importComponents*/
|
||||
|
||||
import LoadView from "@/components/LoadView.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
|
|
@ -27,36 +24,14 @@ const page = ref<number>(1);
|
|||
const pdfSrc = ref<any>();
|
||||
const splitterModel = ref(14);
|
||||
|
||||
/** prosp*/
|
||||
/** props */
|
||||
const isLoadPDF = ref<boolean>(false);
|
||||
const detailReport = ref<any>();
|
||||
|
||||
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
||||
const posMaster = defineModel<PosMaster2[]>("posMaster", { required: true });
|
||||
const orgRootId = defineModel<string>("orgRootId", { required: true });
|
||||
const props = defineProps({
|
||||
filterKeyword: { type: Function, require: true, default: () => {} },
|
||||
fetchDataTable: {
|
||||
type: Function,
|
||||
require: true,
|
||||
default: () => {},
|
||||
},
|
||||
shortName: { type: String, required: true },
|
||||
fetchDataTree: {
|
||||
type: Function,
|
||||
require: true,
|
||||
default: () => {},
|
||||
},
|
||||
mainTree: {
|
||||
type: Object,
|
||||
require: true,
|
||||
},
|
||||
});
|
||||
|
||||
const title = ref<string>("");
|
||||
|
||||
/** ListMenu Table*/
|
||||
|
||||
const baseDocument = ref<DataDocument[]>([
|
||||
{
|
||||
name: "บัญชี 2",
|
||||
|
|
@ -69,10 +44,9 @@ const baseDocument = ref<DataDocument[]>([
|
|||
},
|
||||
]);
|
||||
|
||||
const modalDialogMMove = ref<boolean>(false);
|
||||
|
||||
/**
|
||||
* function DownloadReport
|
||||
* ฟังก์ชัน DownloadReport
|
||||
* @param list รายงานที่ต้องการดาวน์โหลด
|
||||
*/
|
||||
async function getReport(list: string) {
|
||||
const listFind = baseDocument.value.find(
|
||||
|
|
@ -101,7 +75,7 @@ async function getReport(list: string) {
|
|||
}
|
||||
|
||||
/**
|
||||
* function เรียกไฟล์ PDF
|
||||
* ฟังก์ชันเรียกไฟล์ PDF
|
||||
* @param data ข้อมูลบัญชีวันลา
|
||||
*/
|
||||
async function fetchDocumentTemplate(data: any) {
|
||||
|
|
@ -141,17 +115,6 @@ function backPage() {
|
|||
page.value--;
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => modalDialogMMove.value,
|
||||
() => {
|
||||
if (!modalDialogMMove.value) {
|
||||
if (posMaster.value.length === 0) {
|
||||
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
/** use*/
|
||||
const $q = useQuasar();
|
||||
const store = useOrganizational();
|
||||
const { showLoader } = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||
|
||||
/** props*/
|
||||
const nodeTEST = defineModel<OrgTree[]>("nodeTree", { default: [] });
|
||||
|
|
@ -27,17 +27,6 @@ const nodeId = defineModel<string>("nodeId", { required: true });
|
|||
const orgRootId = defineModel<string | undefined>("orgRootId", {
|
||||
required: true,
|
||||
});
|
||||
const shortName = defineModel<string>("shortName", { required: true });
|
||||
const props = defineProps({
|
||||
fetchDataTree: {
|
||||
type: Function,
|
||||
require: true,
|
||||
},
|
||||
fetchDataTable: {
|
||||
type: Function,
|
||||
require: true,
|
||||
},
|
||||
});
|
||||
|
||||
const filter = ref<string>("");
|
||||
const nodes = ref<Array<OrgTree>>([]);
|
||||
|
|
@ -51,50 +40,31 @@ const orgLevel = ref<number>(0);
|
|||
* funtion เลือกข้อมูล Tree
|
||||
* @param data ข่อมูล Tree
|
||||
*/
|
||||
function updateSelected(data: DataTree) {
|
||||
orgRootId.value = data?.orgLevel === 0 ? data?.orgTreeId : data?.orgRootId;
|
||||
store.rootId = (
|
||||
data.orgLevel === 0 ? data.orgTreeId : data.orgRootId
|
||||
) as string;
|
||||
shortName.value = data.orgTreeShortName;
|
||||
async function updateSelected(data: DataTree) {
|
||||
showLoader();
|
||||
try {
|
||||
orgRootId.value = data?.orgLevel === 0 ? data?.orgTreeId : data?.orgRootId;
|
||||
store.rootId = (
|
||||
data.orgLevel === 0 ? data.orgTreeId : data.orgRootId
|
||||
) as string;
|
||||
|
||||
if (!store.treeId || store.treeId != data.orgTreeId) {
|
||||
store.treeId = data.orgTreeId;
|
||||
store.level = data.orgLevel;
|
||||
if (!store.treeId || store.treeId != data.orgTreeId) {
|
||||
store.treeId = data.orgTreeId;
|
||||
store.level = data.orgLevel;
|
||||
|
||||
nodeId.value = data.orgTreeId ? data.orgTreeId : "111";
|
||||
nodeId.value = data.orgTreeId ? data.orgTreeId : "";
|
||||
|
||||
data.orgTreeId &&
|
||||
props.fetchDataTable?.(data.orgTreeId, data.orgLevel, true);
|
||||
/** ดึงข้อมูลสถิติจำนวนด้านบน*/
|
||||
http
|
||||
.post(config.API.orgSummary, {
|
||||
id: data.orgTreeId, //*Id node
|
||||
type: data.orgLevel, //*ประเภทnode
|
||||
isNode: true, //*นับทั้ง node ไหม
|
||||
})
|
||||
.then(async (res: any) => {
|
||||
const data = await res.data.result;
|
||||
if (data) {
|
||||
store.getSumPosition({
|
||||
totalPosition: data.totalPosition,
|
||||
totalPositionCurrentUse: data.totalPositionCurrentUse,
|
||||
totalPositionCurrentVacant: data.totalPositionCurrentVacant,
|
||||
totalPositionNextUse: data.totalPositionNextUse,
|
||||
totalPositionNextVacant: data.totalPositionNextVacant,
|
||||
totalRootPosition: data.totalPosition,
|
||||
totalRootPositionCurrentUse: data.totalPositionCurrentUse,
|
||||
totalRootPositionCurrentVacant: data.totalPositionCurrentVacant,
|
||||
totalRootPositionNextUse: data.totalPositionNextUse,
|
||||
totalRootPositionNextVacant: data.totalPositionNextVacant,
|
||||
});
|
||||
}
|
||||
});
|
||||
/** ดึงข้อมูลสถิติจำนวนด้านบน*/
|
||||
await fetchSummary(data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error showing loader:", error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
}
|
||||
|
||||
const treeId = ref<string>("");
|
||||
|
||||
const dialogDetail = ref<boolean>(false);
|
||||
/**
|
||||
* funtion ดูรายละเอียดโครงสร้าง
|
||||
|
|
@ -108,6 +78,39 @@ function onClickDetail(id: string, level: number) {
|
|||
orgLevel.value = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันดึงข้อมูลสถิติ
|
||||
* @param data ขอมูลโครงสร้าง
|
||||
*/
|
||||
async function fetchSummary(data: DataTree) {
|
||||
await http
|
||||
.post(config.API.orgSummary, {
|
||||
id: data.orgTreeId, //*Id node
|
||||
type: data.orgLevel, //*ประเภทnode
|
||||
isNode: true, //*นับทั้ง node ไหม
|
||||
})
|
||||
.then(async (res: any) => {
|
||||
const data = await res.data.result;
|
||||
if (data) {
|
||||
store.getSumPosition({
|
||||
totalPosition: data.totalPosition,
|
||||
totalPositionCurrentUse: data.totalPositionCurrentUse,
|
||||
totalPositionCurrentVacant: data.totalPositionCurrentVacant,
|
||||
totalPositionNextUse: data.totalPositionNextUse,
|
||||
totalPositionNextVacant: data.totalPositionNextVacant,
|
||||
totalRootPosition: data.totalPosition,
|
||||
totalRootPositionCurrentUse: data.totalPositionCurrentUse,
|
||||
totalRootPositionCurrentVacant: data.totalPositionCurrentVacant,
|
||||
totalRootPositionNextUse: data.totalPositionNextUse,
|
||||
totalRootPositionNextVacant: data.totalPositionNextVacant,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => nodeTEST.value,
|
||||
() => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -16,31 +16,19 @@ import type { OrgRevision } from "@/modules/02_organization/interface/response/o
|
|||
import TreeView from "@/modules/21_report/components/01_org/Main.vue";
|
||||
import StructureView from "@/modules/02_organization/components/StructureMain.vue";
|
||||
import StructureOrgMain from "@/modules/02_organization/components/StructureOrgMain.vue";
|
||||
// import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/** use*/
|
||||
const $q = useQuasar();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
||||
const store = useOrganizational();
|
||||
|
||||
/** ตัวแปร*/
|
||||
const modalNewStructure = ref<boolean>(false); // เพิ่มโครงสร้าง
|
||||
const modalDateTime = ref<boolean>(false); // ตั้งเวลาเผยแพร่
|
||||
const isStatusData = ref<boolean>(false); // แสดงตั้งเวลาเผยแพร่
|
||||
const typeStructure = ref<string>(""); // ประเภทการเพิ่มโครงสร้าง
|
||||
/** ประวัติโครงสร้าง*/
|
||||
const itemHistory = ref<DataOrgRevision[]>([]); // List ประวัติโครงสร้าง
|
||||
const historyId = ref<string>(""); // ID ประวัติโครงสร้าง
|
||||
const labelHistory = ref<string>("ประวัติโครงสร้าง"); // ชื่อประวัติโครงสร้าง
|
||||
const count = ref<number>(0);
|
||||
|
||||
// const modalCommand = ref<boolean>(false); //ส่งไปออกคำสั่ง
|
||||
// const modalRemark = ref<boolean>(false); // หมายเหตุ
|
||||
|
||||
/**
|
||||
* function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง
|
||||
* เก็บข่อมูลใน store
|
||||
*/
|
||||
/** ฟังก์ชันเรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
|
||||
async function fetchOrganizationActive() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -49,25 +37,6 @@ async function fetchOrganizationActive() {
|
|||
const data = await res.data.result;
|
||||
if (data) {
|
||||
await store.fetchDataActive(data);
|
||||
// ต้องมี id ของแบบร่างถึงจะเช็ค isLock
|
||||
if (data.draftId) {
|
||||
await fetchCheckIslock(data.draftId);
|
||||
} else {
|
||||
store.isLosck = false;
|
||||
}
|
||||
|
||||
if (data.activeName === null && data.draftName === null) {
|
||||
isStatusData.value = false;
|
||||
} else {
|
||||
isStatusData.value = true;
|
||||
if (isStatusData.value) {
|
||||
if (data.activeName === null) {
|
||||
store.typeOrganizational = "draft";
|
||||
} else if (data.draftName === null) {
|
||||
store.typeOrganizational = "current";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -76,7 +45,7 @@ async function fetchOrganizationActive() {
|
|||
});
|
||||
}
|
||||
|
||||
/** function เรียกข้อมูรายการลประวัติโครงสร้าง*/
|
||||
/** ฟังก์ชันเรียกข้อมูลรายการประวัติโครงสร้าง*/
|
||||
async function fetchHistory() {
|
||||
await http
|
||||
.get(config.API.organizationHistoryNew)
|
||||
|
|
@ -99,20 +68,6 @@ async function fetchHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
// /**
|
||||
// * function openPopup เพิ่มโครงสร้าง
|
||||
// * @param type ประเภทการเพิ่มโครงาสร้าง
|
||||
// */
|
||||
// function ocClickAddStructure(type: string) {
|
||||
// modalNewStructure.value = !modalNewStructure.value;
|
||||
// typeStructure.value = type;
|
||||
// }
|
||||
|
||||
// /** function openPopup ตั้งเวลาเผยแพร่ */
|
||||
// function onClickDateTime() {
|
||||
// modalDateTime.value = !modalDateTime.value;
|
||||
// }
|
||||
|
||||
/**
|
||||
* function เปิดประวัติโครงสร้าง
|
||||
* @param id id โครงสร้าง
|
||||
|
|
@ -125,46 +80,6 @@ function onClickHistory(id: string, name: string) {
|
|||
count.value++;
|
||||
}
|
||||
|
||||
// async function workflowSystem() {
|
||||
// http
|
||||
// .get(config.API.workflowKeycloakSystem("SYS_ORG"))
|
||||
// .then((res) => {
|
||||
// const data = res.data.result;
|
||||
// store.isOfficer = data.isOfficer;
|
||||
// store.isStaff = data.isStaff;
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// });
|
||||
// }
|
||||
|
||||
async function fetchCheckIslock(id: string) {
|
||||
http
|
||||
.get(config.API.orgIsLock + `/${id}`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
store.isLosck = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
// watch(
|
||||
// () => store.typeOrganizational,
|
||||
// () => {
|
||||
// if (
|
||||
// store.typeOrganizational === "draft" &&
|
||||
// store.isOfficer === null &&
|
||||
// store.isStaff === null
|
||||
// ) {
|
||||
// workflowSystem();
|
||||
// } else if (store.typeOrganizational === "draft") {
|
||||
// store.rootId = "";
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
/**
|
||||
* lifecycleHook ทำงานเมื่อมีการเรียกใช้ Components
|
||||
* ดึงข้อมูลโครงสร้างและรายการประวัติโครงสร้าง
|
||||
|
|
@ -180,71 +95,9 @@ onMounted(async () => {
|
|||
รายงานโครงสร้างและกรอบอัตรากำลัง
|
||||
</div>
|
||||
<q-space />
|
||||
|
||||
<!-- <div
|
||||
class="toptitle row items-center"
|
||||
v-if="store.typeOrganizational === 'draft'"
|
||||
>
|
||||
<div
|
||||
v-if="store.isPublic && store.orgPublishDate"
|
||||
class="q-pr-md text-caption"
|
||||
>
|
||||
วันที่เผยแพร่ :
|
||||
<strong>{{ date2Thai(store.orgPublishDate) }}</strong>
|
||||
</div>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrOwnership == 'OWNER'"
|
||||
dense
|
||||
class="q-px-md"
|
||||
color="indigo-9"
|
||||
icon="alarm"
|
||||
label="ตั้งเวลาเผยแพร่"
|
||||
@click="onClickDateTime"
|
||||
>
|
||||
</q-btn>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<q-card flat bordered>
|
||||
<!-- <div class="q-pa-xl" v-if="!isStatusData">
|
||||
<q-card
|
||||
flat
|
||||
bordered
|
||||
style="
|
||||
height: 70vh;
|
||||
border: 1px solid rgb(210, 210, 210);
|
||||
border-radius: 5px;
|
||||
"
|
||||
>
|
||||
<div
|
||||
class="text-center row"
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
"
|
||||
>
|
||||
<div>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsCreate"
|
||||
flat
|
||||
style="background-color: #d8f5f2"
|
||||
round
|
||||
color="primary"
|
||||
size="lg"
|
||||
icon="add"
|
||||
@click="ocClickAddStructure('NEW')"
|
||||
>
|
||||
<q-tooltip>เพิ่มโครงสร้าง </q-tooltip>
|
||||
</q-btn>
|
||||
<div class="q-mt-sm">เพิ่มโครงสร้าง</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
|
||||
<div v-else> -->
|
||||
<q-card class="my-card">
|
||||
<q-card-section class="q-pa-sm">
|
||||
<q-toolbar class="q-gutter-md items-center" style="padding: 0px">
|
||||
|
|
@ -294,17 +147,6 @@ onMounted(async () => {
|
|||
</q-btn-dropdown>
|
||||
</q-btn-group>
|
||||
|
||||
<!-- <q-btn
|
||||
v-if="store.remark"
|
||||
flat
|
||||
round
|
||||
color="info"
|
||||
icon="info"
|
||||
@click="modalRemark = true"
|
||||
>
|
||||
<q-tooltip>หมายเหตุ</q-tooltip>
|
||||
</q-btn> -->
|
||||
|
||||
<q-space />
|
||||
<q-btn
|
||||
flat
|
||||
|
|
@ -352,23 +194,7 @@ onMounted(async () => {
|
|||
</q-tab-panels>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
<!-- </div> -->
|
||||
</q-card>
|
||||
|
||||
<!-- <q-dialog v-model="modalRemark">
|
||||
<q-card style="width: 300px">
|
||||
<DialogHeader tittle="หมายเหตุ" :close="() => (modalRemark = false)" />
|
||||
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{{ store.remark }}
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog> -->
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue