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

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

@ -48,4 +48,6 @@ export default {
placementPosition: () => `${placement}/position/use`, placementPosition: () => `${placement}/position/use`,
// putPositiom // putPositiom
putPosition: (id:any) => `${placement}/position/${id}`, 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 await http
.get(config.API.placementPosition()) .get(config.API.placementPosition())
.then((res: any) => { .then((res: any) => {
console.log("1221111111");
placementPosition.value = res.data.result; placementPosition.value = res.data.result;
}) })
.catch((e: any) => { .catch((e: any) => {
@ -277,7 +279,7 @@ const positionLevelOptions = ref<Object[]>([
]); ]);
const selectedPosition = async (data: any) => { const selectedPosition = async (data: any) => {
console.log("selecteds", data); // console.log("selecteds", data);
if (data.name == null && selected.value != data.keyId) { if (data.name == null && selected.value != data.keyId) {
// console.log("selecteds", data); // console.log("selecteds", data);
@ -361,7 +363,7 @@ const selectedPosition = async (data: any) => {
dataForm.positionPathSideId = ""; dataForm.positionPathSideId = "";
dataForm.positionTypeId = ""; dataForm.positionTypeId = "";
} }
console.log("dataForm", dataForm); // console.log("dataForm", dataForm);
}; };
const checkPosition = (val: string) => { const checkPosition = (val: string) => {
@ -374,6 +376,7 @@ const expanded = ref<string[]>([]);
watch(props, () => { watch(props, () => {
expanded.value = []; expanded.value = [];
const dataPersonal = props.personal; const dataPersonal = props.personal;
fetchplacementPosition();
if (dataPersonal) { if (dataPersonal) {
dataPersonal.map((data: any) => { dataPersonal.map((data: any) => {
personal.value = data; personal.value = data;
@ -382,15 +385,19 @@ watch(props, () => {
} }
// console.log("draft===>", personal.value.draft); // 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); // const findData = dataRespone.value.find(findByPerson);
let findData: any = null; let findData: any = null;
dataRespone.value.map((x: any) => { dataRespone.value.map((x: any) => {
findData = findByPerson(x); findData = findByPerson(x);
console.log(findData); // console.log(findData);
if (findData != null) { if (findData != null) {
console.log("findData===>", findData); // console.log("findData===>", findData);
selectedPosition(findData); selectedPosition(findData);
for (let i = 3; i <= findData.keyId.length; i += 2) { for (let i = 3; i <= findData.keyId.length; i += 2) {
expanded.value.push(findData.keyId.slice(0, i)); expanded.value.push(findData.keyId.slice(0, i));
@ -423,6 +430,34 @@ function findByPerson(element: any): any {
} }
return null; 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> </script>
<template> <template>
@ -707,6 +742,20 @@ function findByPerson(element: any): any {
map-options map-options
/> />
</div> </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"> <!-- <div class="col-sx-12 col-sm-12 col-md-12">
<q-separator inset size="2px" class="q-my-md" /> <q-separator inset size="2px" class="q-my-md" />
</div> --> </div> -->

View file

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

View file

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