Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-07-28 17:05:19 +07:00
commit 52bb63a285
4 changed files with 90 additions and 28 deletions

View file

@ -48,4 +48,6 @@ export default {
placementPosition: () => `${placement}/position/use`,
// putPositiom
putPosition: (id:any) => `${placement}/position/${id}`,
// clear Position
clearPosition: (personalId:string) => `${placement}/position/clear/${personalId}`
};

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> -->

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, watch, reactive, computed } from "vue";
import { ref, onMounted, watch, reactive, computed, watchEffect } from "vue";
import { useQuasar, QForm } from "quasar";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@ -209,7 +209,7 @@ const getTable = async () => {
await http
.get(config.API.personalList(examIdString))
.then(async (res: any) => {
console.log(res);
// console.log(res);
dataRes.value = res.data.result;
rowsAll.value = [];
(rowsFilter.value = []),
@ -252,7 +252,9 @@ const getTable = async () => {
? rowsAll.value
: rowsAll.value.filter((x: any) => x.statusId != "CONTAIN");
rowsFilter.value = rows.value.filter((e: any) => e.draft == "รอส่งตัว");
rowsFilter.value = rows.value.filter(
(e: any) => e.draft == "รอส่งตัว" && e.positionNumber == null
);
console.log(rowsFilter.value);
})
.catch((e) => {
@ -433,6 +435,7 @@ const openAppointModal = (pid: string) => {
const clickCloseModalTree = async () => {
await getTable();
appointModal.value = false;
props.statCard();
};
const validateData = async () => {
@ -492,6 +495,11 @@ onMounted(async () => {
}
await getTable();
});
watchEffect(() => {
if (getTable()) {
props.statCard();
}
});
const containStatus = ref<boolean>(false);
watch(containStatus, () => {
@ -532,6 +540,7 @@ const savelist = () => {
})
.finally(async () => {
await getTable();
hideLoader();
});
});

View file

@ -93,6 +93,7 @@ watch(props, () => {
}
});
const validateData = () => {
const selectedIds = personalForm.value.isProperty;
@ -105,24 +106,24 @@ const validateData = () => {
);
};
const ClickSave = () => {
const isValid = validateData();
// const ClickSave = () => {
// const isValid = validateData();
if (isValid) {
// props.close();
// props.validate();
// putpersonalForm();
modalConfirm(
$q,
"การยืนยัน",
"ยืนยันการบันทึกการคัดกรองคุณสมบัติ",
putpersonalForm
);
} else {
success($q, "กรอกให้ครบ");
console.log();
}
};
// if (isValid) {
// // props.close();
// // props.validate();
// // putpersonalForm();
// modalConfirm(
// $q,
// "",
// "",
// putpersonalForm
// );
// } else {
// success($q, "");
// console.log();
// }
// };
const fetchData = async () => {
showLoader();
await http
@ -134,7 +135,7 @@ const fetchData = async () => {
university: e.name,
degree: e.degree,
major: e.field,
graduation: e.finishDate,
graduation: date2Thai(e.finishDate),
});
});
})
@ -145,6 +146,7 @@ const fetchData = async () => {
hideLoader();
});
};
const formBmaofficer = (val: string) => {
switch (val) {
case "OFFICER":
@ -345,7 +347,7 @@ const putpersonalForm = async () => {
</q-card>
</div>
</div>
<q-separator />
<!-- <q-separator />
<div>
<DialogFooter
@click="ClickSave"
@ -353,7 +355,7 @@ const putpersonalForm = async () => {
:editvisible="save"
:validate="validateData"
/>
</div>
</div> -->
</q-form>
</q-card>
</q-dialog>