diff --git a/src/api/05_placement/api.placement.ts b/src/api/05_placement/api.placement.ts index fc7757095..4c1b74def 100644 --- a/src/api/05_placement/api.placement.ts +++ b/src/api/05_placement/api.placement.ts @@ -47,5 +47,5 @@ export default { // position placementPosition: () => `${placement}/position/use`, // putPositiom - putPosition: (id: string) => `${placement}/position/${id}`, + putPosition: (id:any) => `${placement}/position/${id}`, }; diff --git a/src/modules/05_placement/components/PersonalList/OrgTree.vue b/src/modules/05_placement/components/PersonalList/OrgTree.vue index 141f3cc5a..5d2f99365 100644 --- a/src/modules/05_placement/components/PersonalList/OrgTree.vue +++ b/src/modules/05_placement/components/PersonalList/OrgTree.vue @@ -123,8 +123,9 @@ const myFilterMethod = (node: any, filter: string) => { const filt = filter; return ( - ((node.name && node.name == null) || !node.name) && - ((node.organizationName && node.organizationName.indexOf(filt) > -1) || + // ((node.name && node.name == null) || !node.name) && + (node.name && node.name.indexOf(filt) > -1) || + (node.organizationName && node.organizationName.indexOf(filt) > -1) || (node.positionNum && node.positionNum.indexOf(filt) > -1) || (node.positionName && node.positionName.indexOf(filt) > -1) || (node.governmentCode && @@ -139,7 +140,7 @@ const myFilterMethod = (node: any, filter: string) => { (node.executivePosition && node.executivePosition.indexOf(filt) > -1) || (node.executivePositionSide && node.executivePositionSide.indexOf(filt) > -1) || - (node.positionLevel && node.positionLevel.indexOf(filt) > -1)) + (node.positionLevel && node.positionLevel.indexOf(filt) > -1) ); }; @@ -354,6 +355,7 @@ const selectedPosition = async (data: any) => { dataForm.positionTypeId = ""; } }; + const checkPosition = (val: string) => { const num = placementPosition.value.findIndex((e: string) => e === val); return num; @@ -368,179 +370,191 @@ watch(props, () => { }); console.log("personal", personal.value); } - if (personal.value.draft === false) { - const findData = dataRespone.value.find(findByPerson); - console.log(findData); - loadTreeData(); - selectedPosition(findData.children.children.children) + + // console.log("draft===>", personal.value.draft); + + if (personal.value.draft === true) { + // const findData = dataRespone.value.find(findByPerson); + let findData: any = null; + dataRespone.value.map((x: any) => { + findData = findByPerson(x); + if (findData != null) { + console.log("findData===>", findData); + selectedPosition(findData) + } + }) + // loadTreeData(); + // selectedPosition(findData.children.children.children) } }); -const findByPerson = (obj: any) => { - if ( - obj.positionLineId === personal.value.positionLineId && - obj.positionTypeId === personal.value.positionTypeId && - obj.positionNumId === personal.value.posNoId + +function findByPerson(element: any) { + // console.log("searchTree element===>", element) + if (element.positionNumId && element.positionLineId === personal.value.positionLineId && + element.positionTypeId === personal.value.positionTypeId && + element.positionNumId === personal.value.posNoId ) { - return true; + return element; + } else if (element.children) { + var i; + var result = null; + for (i = 0; result == null && i < element.children.length; i++) { + result = findByPerson(element.children[i]); + } + return result; } - if (obj.children && obj.children.length > 0) { - obj.children = obj.children.find(findByPerson); - return obj.children; - } - return false; -}; + return null; +} + + + + + +
diff --git a/src/modules/05_placement/components/PersonalList/Table.vue b/src/modules/05_placement/components/PersonalList/Table.vue index 38bc57323..d85c9247e 100644 --- a/src/modules/05_placement/components/PersonalList/Table.vue +++ b/src/modules/05_placement/components/PersonalList/Table.vue @@ -63,6 +63,16 @@ const visibleColumns = ref([ "draft", "positionCandidate", ]); +const visibleColumnslist = ref([ + "fullName", + "examNumber", + "idCard", + "positionNumber", + "organizationName", + "draft", + "bmaOfficer", + "positionCandidate", +]); const columns = ref([ { @@ -185,9 +195,9 @@ const convertContainStatus = (val: string) => { }; const convertDraft = (val: boolean) => { switch (val) { - case false: - return "รอส่งตัว"; case true: + return "รอส่งตัว"; + case false: return "ส่งตัวแล้ว"; default: return "-"; @@ -273,7 +283,7 @@ const saveDeferment = async () => { console.log("ยืนยันการขอผ่อนผัน"); await http .post(config.API.deferment(), formData) - .then((res) => { + .then(() => { success($q, "บันทึกสำเร็จ"); }) .catch((e) => { @@ -473,6 +483,8 @@ watch(containStatus, () => { const modaladdlist = ref(false); const selected = ref([]); const personal_selected = ref([]); +const filterlistAdd = ref(""); +const paging = ref(true); const savelist = () => { selected.value.map((e: any) => { personal_selected.value.push(e.personalId); @@ -486,21 +498,21 @@ const savelist = () => { flat: true, const: "negative", }, - }) - .onOk(async () => { - showLoader(); - await http.put(config.API.putPosition(examId), personal_selected.value); - }) - .then(() => { - success($q, "บันทึกสำเร็จ"); - }) - .catch(() => { - console.log(e); - }) - .finally(async () => { - await getTable(); - hideLoader(); - }); + }).onOk(async () => { + showLoader(); + await http + .put(config.API.putPosition(examId), personal_selected.value) + .then(() => { + success($q, "บันทึกสำเร็จ"); + }) + .catch((e: any) => { + console.log(e); + }) + .finally(async () => { + await getTable(); + hideLoader(); + }); + }); } }; const handleModalAddListUpdate = (val: boolean) => { @@ -512,6 +524,16 @@ const checkSelected = computed(() => { return true; } }); +const pagination = ref({ + sortBy: "fullname", + descending: true, + page: 1, + rowsPerPage: 10, +}); +const paginationLabel = (start: number, end: number, total: number) => { + if (paging.value == true) return " " + start + "-" + end + " ใน " + total; + else return start + "-" + end + " ใน " + total; +}; +