fixing bug placement, registry remove employee temp & remove api get tree form json file

This commit is contained in:
Warunee Tamkoo 2024-06-05 11:21:58 +07:00
parent 955c2d402f
commit fde7bd6f11
7 changed files with 186 additions and 191 deletions

View file

@ -48,43 +48,43 @@ let dataForm = reactive({
});
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// 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();
});
};
// 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
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
function filterByPersonIdNull(obj: any) {
if (obj.name === null && obj.isCondition != true) {
return true;
@ -171,8 +171,8 @@ const saveAppoint = async () => {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
hideLoader();
});

View file

@ -47,42 +47,41 @@ let dataForm = reactive({
positionTypeId: "",
});
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();
});
};
// 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
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
function filterByPersonIdNull(obj: any) {
if (obj.name === null && obj.isCondition != true) {
@ -177,8 +176,8 @@ const saveAppoint = async () => {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
hideLoader();
});
@ -393,8 +392,8 @@ function findByPerson(element: any): any {
}
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
// await fetchplacementPosition();
});
</script>

View file

@ -61,41 +61,41 @@ let dataForm = reactive({
});
/** ฟังชั่น get file*/
async function fetchPublishFile() {
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();
});
}
// async function fetchPublishFile() {
// 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 */
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
/**
* งกนกรองขอมลท personId เป null
@ -202,8 +202,8 @@ async function saveAppoint() {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
hideLoader();
});
@ -419,8 +419,8 @@ watch(props, () => {
});
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
await fetchplacementPosition();
});
</script>

View file

@ -239,9 +239,9 @@ function convertContainStatus(val: string, type: string = "") {
case "UN-CONTAIN":
return "ยังไม่บรรจุ";
case "PREPARE-CONTAIN":
return "เตรียม" + (type != "" ? type : "บรรจุ");
return "เตรียม" + (!type ? type : "บรรจุ");
case "CONTAIN":
return (type != "" ? type : "บรรจุ") + "แล้ว";
return (!type ? type : "บรรจุ") + "แล้ว";
case "DISCLAIM":
return "สละสิทธิ์";
default:
@ -358,16 +358,15 @@ async function getTable() {
});
//
rows.value = roleAdmin.value
rows.value = await (roleAdmin.value
? rowsAll.value
: rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN");
: rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN"));
//
rowsFilter.value = rows.value.filter(
(e: any) => e.draft == "รอส่งตัว" && e.statusNameCheck == "เตรียมบรรจุ"
rowsFilter.value = await rows.value.filter(
(e: any) => e.draft == "รอส่งตัว"
);
console.log(rows.value);
insertAvatar(rowsAll.value);
insertAvatar(rows.value);
})
.catch((e) => {
messageError($q, e);
@ -389,13 +388,13 @@ function insertAvatar(items: any) {
)
)
.then((img) => {
rowsAll.value[index] = {
rows.value[index] = {
...x,
avatar: img.data.downloadUrl,
};
})
.catch(() => {
rowsAll.value[index] = {
rows.value[index] = {
...x,
avatar: avatar,
};
@ -829,7 +828,7 @@ onMounted(async () => {
</q-td>
<q-td auto-width>
<q-btn
v-if="roleAdmin && props.row.statusId !== 'CONTAIN'"
v-if="props.row.statusId !== 'CONTAIN'"
icon="mdi-dots-vertical"
size="12px"
color="grey-7"
@ -841,9 +840,9 @@ onMounted(async () => {
<q-list dense style="min-width: 100px">
<q-item
v-if="
(roleAdmin && props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup
@ -872,11 +871,10 @@ onMounted(async () => {
</q-item>
<q-item
v-if="
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup
@ -904,11 +902,10 @@ onMounted(async () => {
<q-item
v-if="
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup
@ -932,11 +929,10 @@ onMounted(async () => {
<q-item
v-if="
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.draft !== 'ส่งตัวแล้ว' &&
props.row.statusId !== 'DISCLAIM'
"
clickable
v-close-popup

View file

@ -118,40 +118,40 @@ let dataForm = reactive({
positionTypeId: "",
});
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();
});
};
// 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
const loadTreeData = async () => {
expanded.value = [];
await http
.get(`${config.s3ClusterUrl}${selectedFile.value}`)
.then((res: any) => {
treeData.value = res.data;
dataRespone.value = res.data;
// Filter objects with "name" null
const filteredData = res.data.filter(filterByPersonIdNull);
treeData.value = filteredData;
})
.catch((e: any) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
// const loadTreeData = async () => {
// expanded.value = [];
// await http
// .get(`${config.s3ClusterUrl}${selectedFile.value}`)
// .then((res: any) => {
// treeData.value = res.data;
// dataRespone.value = res.data;
// // Filter objects with "name" null
// const filteredData = res.data.filter(filterByPersonIdNull);
// treeData.value = filteredData;
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// };
function filterByPersonIdNull(obj: any) {
if (obj.name === null && obj.isCondition != true) {
@ -234,8 +234,8 @@ const saveAppoint = async () => {
})
.finally(async () => {
await closeAndClear();
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
// await fetchplacementPosition();
hideLoader();
});
@ -634,8 +634,8 @@ watch(
);
onMounted(async () => {
await fetchPublishFile();
await loadTreeData();
// await fetchPublishFile();
// await loadTreeData();
// await fetchplacementPosition();
});
</script>

View file

@ -43,24 +43,24 @@ let dataForm = reactive({
});
onMounted(async () => {
await fetchPublishFile();
// await fetchPublishFile();
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();
});
};
// 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
const treeData = ref<Array<any>>([]);
@ -192,7 +192,7 @@ const saveAppoint = async () => {
.finally(async () => {
await closeAndClear();
// await resetFilter();
await fetchPublishFile();
// await fetchPublishFile();
await loadTreeData();
await fetchplacementPosition();
hideLoader();