แก้ไขเตรียมบรรจุ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-07-28 17:05:09 +07:00
parent 6e8103c2aa
commit b6553b5fb1
4 changed files with 90 additions and 28 deletions

View file

@ -95,6 +95,8 @@ const fetchplacementPosition = async () => {
await http
.get(config.API.placementPosition())
.then((res: any) => {
console.log("1221111111");
placementPosition.value = res.data.result;
})
.catch((e: any) => {
@ -277,7 +279,7 @@ const positionLevelOptions = ref<Object[]>([
]);
const selectedPosition = async (data: any) => {
console.log("selecteds", data);
// console.log("selecteds", data);
if (data.name == null && selected.value != data.keyId) {
// console.log("selecteds", data);
@ -361,7 +363,7 @@ const selectedPosition = async (data: any) => {
dataForm.positionPathSideId = "";
dataForm.positionTypeId = "";
}
console.log("dataForm", dataForm);
// console.log("dataForm", dataForm);
};
const checkPosition = (val: string) => {
@ -374,6 +376,7 @@ const expanded = ref<string[]>([]);
watch(props, () => {
expanded.value = [];
const dataPersonal = props.personal;
fetchplacementPosition();
if (dataPersonal) {
dataPersonal.map((data: any) => {
personal.value = data;
@ -382,15 +385,19 @@ watch(props, () => {
}
// console.log("draft===>", personal.value.draft);
if (personal.value && personal.value.draft === false) {
if (
personal.value &&
personal.value.draft === false &&
personal.value.positionNumber !== null
) {
// const findData = dataRespone.value.find(findByPerson);
let findData: any = null;
dataRespone.value.map((x: any) => {
findData = findByPerson(x);
console.log(findData);
// console.log(findData);
if (findData != null) {
console.log("findData===>", findData);
// console.log("findData===>", findData);
selectedPosition(findData);
for (let i = 3; i <= findData.keyId.length; i += 2) {
expanded.value.push(findData.keyId.slice(0, i));
@ -423,6 +430,34 @@ function findByPerson(element: any): any {
}
return null;
}
const clearPosition = () => {
console.log(personal.value);
$q.dialog({
title: "ยืนยันการคืนตำแหน่ง",
message: "ต้องการยืนยันการคืนตำแหน่งนี้ใช่หรือไม่ ?",
cancel: {
flat: true,
const: "negative",
},
persistent: true,
})
.onOk(async () => {
showLoader();
await http
.post(config.API.clearPosition(personal.value.personalId), {})
.then((res: Object) => success($q, "คืนตำแหน่งสำเร็จ"))
.catch((e: Object) => {
console.log(e);
})
.finally(async () => {
hideLoader();
await closeAndClear();
});
})
.onCancel(() => {})
.onDismiss(() => {});
};
</script>
<template>
@ -707,6 +742,20 @@ function findByPerson(element: any): any {
map-options
/>
</div>
<div
class="col-xs-12 col-sm-12 col-md-12 q-pa-lg"
v-if="personal.positionNumber"
>
<div class="row">
<div class="col-md-4 offset-md-4">
<q-btn
color="grey"
label="คืนตำแหน่ง"
@click="clearPosition"
></q-btn>
</div>
</div>
</div>
<!-- <div class="col-sx-12 col-sm-12 col-md-12">
<q-separator inset size="2px" class="q-my-md" />
</div> -->