filter ตำแหน่งว่าง
This commit is contained in:
parent
5bfdd3cc2a
commit
6fab70b99b
2 changed files with 37 additions and 4 deletions
|
|
@ -40,6 +40,7 @@ const config = ref<any>({
|
||||||
API_URI_PROFILE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`,
|
API_URI_PROFILE_SERVICE: `${window.location.protocol}//${window.location.host}/api/v1`,
|
||||||
API_CANDIDATE_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
|
API_CANDIDATE_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
|
||||||
API_REPORT_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
|
API_REPORT_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
|
||||||
|
API_PLACEMENT_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
|
||||||
API_URI_ORG_TREE:
|
API_URI_ORG_TREE:
|
||||||
"https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230707_115124.json",
|
"https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230707_115124.json",
|
||||||
MEET_URI: "meet.frappet.com",
|
MEET_URI: "meet.frappet.com",
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ const noData = ref<string>("ไม่พบข้อมูลผังโคร
|
||||||
const checkValidate = ref<boolean>(false);
|
const checkValidate = ref<boolean>(false);
|
||||||
const myFormPosition = ref<any>();
|
const myFormPosition = ref<any>();
|
||||||
const selected = ref<string>("");
|
const selected = ref<string>("");
|
||||||
|
const selectedFile = ref<string>("");
|
||||||
|
|
||||||
// Set form field
|
// Set form field
|
||||||
let dataForm = reactive({
|
let dataForm = reactive({
|
||||||
|
|
@ -33,18 +34,37 @@ let dataForm = reactive({
|
||||||
positionSalaryAmount: null,
|
positionSalaryAmount: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
loadTreeData();
|
await fetchPublishFile();
|
||||||
fetchplacementPosition();
|
await loadTreeData();
|
||||||
|
await fetchplacementPosition();
|
||||||
});
|
});
|
||||||
|
const fetchPublishFile = async () => {
|
||||||
|
await http
|
||||||
|
.get(config.API.getPublishFileHistory)
|
||||||
|
.then((res) => {
|
||||||
|
let data = res.data.result;
|
||||||
|
selectedFile.value = data[0].fileName;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// โหลดข้อมูลโครงสร้างจาก json
|
// โหลดข้อมูลโครงสร้างจาก json
|
||||||
const treeData = ref<Array<any>>([]);
|
const treeData = ref<Array<any>>([]);
|
||||||
const loadTreeData = async () => {
|
const loadTreeData = async () => {
|
||||||
await http
|
await http
|
||||||
.get(config.API.orgTree)
|
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
treeData.value = res.data;
|
treeData.value = res.data;
|
||||||
|
|
||||||
|
// Filter objects with "name" null
|
||||||
|
const filteredData = res.data.filter(filterByPersonIdNull);
|
||||||
|
treeData.value = filteredData;
|
||||||
})
|
})
|
||||||
.catch((e: any) => {
|
.catch((e: any) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -53,6 +73,18 @@ const loadTreeData = async () => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function filterByPersonIdNull(obj: any) {
|
||||||
|
if (obj.name === null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj.children && obj.children.length > 0) {
|
||||||
|
obj.children = obj.children.filter(filterByPersonIdNull);
|
||||||
|
return obj.children.length > 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// โหลด position
|
// โหลด position
|
||||||
const placementPosition = ref<any>([]);
|
const placementPosition = ref<any>([]);
|
||||||
const fetchplacementPosition = async () => {
|
const fetchplacementPosition = async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue