รายการโครงการ => ปรับ interface
This commit is contained in:
parent
854ee54396
commit
1757de73ff
4 changed files with 141 additions and 290 deletions
|
|
@ -17,7 +17,10 @@ import type {
|
|||
FormQueryListProject,
|
||||
FormProject,
|
||||
} from "@/modules/15_development/interface/request/Main";
|
||||
import type { ResListProject } from "@/modules/15_development/interface/response/Main";
|
||||
import type {
|
||||
ResListProject,
|
||||
DataTree,
|
||||
} from "@/modules/15_development/interface/response/Main";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
|
@ -28,9 +31,8 @@ const router = useRouter();
|
|||
const { showLoader, hideLoader, messageError, dialogMessageNotify } =
|
||||
useCounterMixin();
|
||||
|
||||
const ticked = ref<any>([]);
|
||||
const node = ref<any>([]);
|
||||
const expanded = ref<any>([]);
|
||||
const expanded = ref<string[]>([]);
|
||||
const filter = ref<string>("");
|
||||
const filterMain = ref<string>("");
|
||||
const splitterModel = ref<number>(60);
|
||||
|
|
@ -77,6 +79,14 @@ const statusOpt = ref<DataOption[]>([
|
|||
{ id: "ONGOING", name: "กำลังดำเนินการ" },
|
||||
{ id: "FINISH", name: "เสร็จสิ้นโครงการ" },
|
||||
]);
|
||||
|
||||
const formProject = reactive<FormProject>({
|
||||
year: null,
|
||||
projectName: "",
|
||||
node: null,
|
||||
nodeId: null,
|
||||
orgRevisionId: null,
|
||||
});
|
||||
/** formQuery*/
|
||||
const formQuery = reactive<FormQueryListProject>({
|
||||
year: new Date().getFullYear(),
|
||||
|
|
@ -88,7 +98,6 @@ const formQuery = reactive<FormQueryListProject>({
|
|||
node: null,
|
||||
nodeId: null,
|
||||
});
|
||||
|
||||
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
||||
|
||||
/** funciton fetch รายการโครงการ*/
|
||||
|
|
@ -121,31 +130,18 @@ function onClickAddOrView(status: boolean = false, id: string = "") {
|
|||
status ? router.push(`/development/${id}`) : router.push("/development/add");
|
||||
}
|
||||
|
||||
/** function เปิด Dialog เพิ่มโครงการ/หลักสูตรการฝึกอบรม*/
|
||||
function onAdd() {
|
||||
modal.value = true;
|
||||
}
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
() => {
|
||||
fetchListProject();
|
||||
}
|
||||
);
|
||||
|
||||
/** function fetchข้อมูลหน้าแรกใหม่*/
|
||||
function fetchListProjectNew() {
|
||||
formQuery.page = 1;
|
||||
fetchListProject();
|
||||
}
|
||||
|
||||
/** function Download รายการโครงการ*/
|
||||
function onDownload() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -165,6 +161,7 @@ function onDownload() {
|
|||
});
|
||||
}
|
||||
|
||||
/** function ปิด Dialog เพิ่มโครงการ/หลักสูตรการฝึกอบรม*/
|
||||
function closeDialog() {
|
||||
modal.value = false;
|
||||
year.value = 0;
|
||||
|
|
@ -172,14 +169,6 @@ function closeDialog() {
|
|||
projectName.value = "";
|
||||
}
|
||||
|
||||
const formProject = reactive<FormProject>({
|
||||
year: null,
|
||||
projectName: "",
|
||||
node: null,
|
||||
nodeId: null,
|
||||
orgRevisionId: null,
|
||||
});
|
||||
|
||||
/** dialog submit */
|
||||
function onSubmit() {
|
||||
if (formProject.nodeId) {
|
||||
|
|
@ -198,6 +187,7 @@ function onSubmit() {
|
|||
}
|
||||
}
|
||||
|
||||
/** function fetch หา Id หน่วยงานที่ Active*/
|
||||
function fetchActive() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -212,7 +202,11 @@ function fetchActive() {
|
|||
});
|
||||
}
|
||||
|
||||
async function fetchTree(id: string) {
|
||||
/**
|
||||
* function fetch โครงสร้างปจุบัน
|
||||
* @param id โครงสร้างปจุบัน
|
||||
*/
|
||||
function fetchTree(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.orgByid(id.toString()))
|
||||
|
|
@ -228,13 +222,15 @@ async function fetchTree(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
function updateSelected(data: any) {
|
||||
/** function เลือกหน่วยงานที่รับผิดชอบ*/
|
||||
function updateSelected(data: DataTree) {
|
||||
formProject.node = data.orgLevel;
|
||||
formProject.nodeId = data.orgTreeId;
|
||||
formProject.orgRevisionId = data.orgRevisionId;
|
||||
}
|
||||
|
||||
function updateSelectedTreeMain(data: any) {
|
||||
/** function เลือกหน่วยงานที่จะค้นหาโครงการ */
|
||||
function updateSelectedTreeMain(data: DataTree) {
|
||||
if (formQuery.node === data.orgLevel && formQuery.nodeId === data.orgTreeId) {
|
||||
formQuery.node = null;
|
||||
formQuery.nodeId = null;
|
||||
|
|
@ -242,10 +238,26 @@ function updateSelectedTreeMain(data: any) {
|
|||
formQuery.node = data.orgLevel;
|
||||
formQuery.nodeId = data.orgTreeId;
|
||||
}
|
||||
|
||||
fetchListProjectNew();
|
||||
fetchListProjectNew(); // fetch โครงการ
|
||||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/** callbackFunction ทำเมื่อมีการอัปเดท pageSize*/
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
() => {
|
||||
fetchListProject();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
fetchActive();
|
||||
fetchListProject();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue