- ส่งไปออกคำสั่งของรายชื่อลูกจ้างชั่วคราว

- แก้ label
This commit is contained in:
Warunee Tamkoo 2023-08-19 21:56:00 +07:00
parent b2a7e7dee5
commit 0f96b24df2
3 changed files with 106 additions and 155 deletions

View file

@ -89,4 +89,6 @@ export default {
organizationEmployeePositionId: (profileId: string) => organizationEmployeePositionId: (profileId: string) =>
`${organizationEmployee}position/${profileId}`, `${organizationEmployee}position/${profileId}`,
organizationEmployeeSendOrder: `${organizationEmployee}report`,
}; };

View file

@ -131,32 +131,8 @@ const fecthTypeOption = async () => {
}); });
}; };
const rows = ref<any>([ const rows = ref<any>([]);
// { const rows2 = ref<any>([]);
// personalId: "08db721d-add6-47b0-8a13-5f45d106e8d1",
// citizenId: "1234444332222",
// fullname: " ",
// organizationName: "",
// orgName: "",
// organizationShortName: ".",
// positionNumber: ". 1",
// positionPath: "",
// birthday: dateText(new Date("1989-09-03")),
// },
]);
const rows2 = ref<any>([
// {
// personalId: "08db721d-add6-47b0-8a13-5f45d106e8d1",
// citizenId: "1234444332222",
// fullname: " ",
// organizationName: "",
// orgName: "",
// organizationShortName: ".",
// positionNumber: ". 1",
// positionPath: "",
// birthday: dateText(new Date("1989-09-03")),
// },
]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -714,7 +690,7 @@ const status = (val: string) => {
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right" class="bg-white text-teal">
<q-btn <q-btn
label="ส่งไปรายการแต่งตั้ง-เลื่อน" label="ส่งไปออกคำสั่ง"
@click="clickAddlist" @click="clickAddlist"
color="public" color="public"
:disable="checkSelected" :disable="checkSelected"

View file

@ -278,7 +278,7 @@
</q-card-section> </q-card-section>
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right" class="bg-white text-teal">
<q-btn label="บันทึก" @click="checkSaveOrder" color="public" /> <q-btn label="ส่งไปออกคำสั่ง" @click="checkSaveOrder" color="public" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
@ -1110,26 +1110,35 @@ const saveData = async () => {
} }
}; };
const checkSaveOrder = () => { const checkSaveOrder = () => {
dialogConfirm($q, async () => await SaveOrder()) dialogConfirm($q, () => SaveOrder())
} }
const SaveOrder = async () => { const SaveOrder = async () => {
if (selectedToOrder.value.length == 0) { //
dialogMessageNotify( let pId: string[] = [];
$q, selectedToOrder.value.forEach((e: any) => {
"ไม่สามารถบันทึกข้อมูลได้ กรุณาเลือกตำแหน่ง", pId.push(e.id);
// "", });
// "warning", let data = {
// undefined, id: pId,
// "orange", };
// undefined, console.log(data);
// undefined, showLoader();
// true await http
); .post(config.API.organizationEmployeeSendOrder, data)
return; .then((res: any) => {
} else { // console.log(res);
// success($q, "บันทึกสำเร็จ");
await sendToOrder(); })
} .catch((e: any) => {
// console.log(e);
messageError($q, e);
})
.finally(async () => {
hideLoader();
modaladdOrder.value = false;
await showEmployeeTemp();
selectedToOrder.value = [];
});
}; };
const savePosition = async () => { const savePosition = async () => {
@ -1151,26 +1160,6 @@ const savePosition = async () => {
}); });
}; };
const sendToOrder = async () => {
modaladdOrder.value = false;
// showLoader();
// const data = {
// organizationEmployeeId: selectedPosition.value[0].id,
// };
// await http
// .put(config.API.organizationEmployeePositionId(id.value), data)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// await nodeTree();
// modalOpenClose();
// });
};
const modalOpenClose = () => { const modalOpenClose = () => {
modal.value = !modal.value; modal.value = !modal.value;
if (!modal.value) { if (!modal.value) {
@ -1190,31 +1179,12 @@ const resetFilter = () => {
filterRef.value!.focus(); filterRef.value!.focus();
}; };
const getClass = (val: boolean) => { // const getClass = (val: boolean) => {
return { // return {
"full-width inputgreen cursor-pointer": val, // "full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val, // "full-width cursor-pointer": !val,
}; // };
}; // };
const clickClose = async () => {
// if (editRow.value == true) {
// dialogMessage(
// $q,
// "",
// "?",
// "mdi-help-circle-outline",
// "",
// "orange",
// () => (modal.value = false),
// undefined
// );
// } else {
modal.value = false;
// next.value = false;
// previous.value = false;
// }
};
const clickAdd = () => { const clickAdd = () => {
// modal.value = true; // modal.value = true;
@ -1271,11 +1241,13 @@ const nodeTree = async () => {
.finally(async () => { .finally(async () => {
hideLoader(); hideLoader();
await showEmployeeTemp(); await showEmployeeTemp();
await showEmployeeTempOrder(); // await showEmployeeTempOrder();
}); });
}; };
const showEmployeeTemp = async () => { const showEmployeeTemp = async () => {
showLoader();
let cirteria = []; let cirteria = [];
cirteria.push({ cirteria.push({
@ -1288,8 +1260,7 @@ const showEmployeeTemp = async () => {
criteriaValue: "false", criteriaValue: "false",
}); });
if (selected.value == null || selected.value == "") return; if (selected.value == null) return;
showLoader();
await http await http
.post(config.API.searchProfileTemp("all"), { .post(config.API.searchProfileTemp("all"), {
criterias: cirteria, criterias: cirteria,
@ -1329,6 +1300,8 @@ const showEmployeeTemp = async () => {
draftPositionEmployee: e.draftPositionEmployee, draftPositionEmployee: e.draftPositionEmployee,
draftOrganizationOrganization: e.draftOrganizationOrganization, draftOrganizationOrganization: e.draftOrganizationOrganization,
}); });
rowsOrder.value = rows.value.filter((e: any) => e.draftPositionEmployee !== null);
}); });
}) })
.catch((e) => { .catch((e) => {
@ -1339,70 +1312,70 @@ const showEmployeeTemp = async () => {
}); });
}; };
const showEmployeeTempOrder = async () => { // const showEmployeeTempOrder = async () => {
let cirteria = []; // let cirteria = [];
cirteria.push({ // cirteria.push({
criteriaType: "employee_class", // criteriaType: "employee_class",
criteriaValue: "temp", // criteriaValue: "temp",
}); // });
cirteria.push({ // cirteria.push({
criteriaType: "is_retire", // criteriaType: "is_retire",
criteriaValue: "false", // criteriaValue: "false",
}); // });
if (selected.value == null || selected.value == "") return; // if (selected.value == null || selected.value == "") return;
showLoader(); // showLoader();
await http // await http
.post(config.API.searchProfileTemp("all"), { // .post(config.API.searchProfileTemp("all"), {
criterias: cirteria, // criterias: cirteria,
}) // })
.then((res) => { // .then((res) => {
let data = res.data.result; // let data = res.data.result;
rowsOrder.value = []; // rowsOrder.value = [];
data.map((e: ResponseEmployeeTemp) => { // data.map((e: ResponseEmployeeTemp) => {
rowsOrder.value.push({ // rowsOrder.value.push({
id: e.id, // id: e.id,
fullname: e.fullname, // fullname: e.fullname,
fullnameOld: e.fullnameOld, // fullnameOld: e.fullnameOld,
position: e.position, // position: e.position,
positionPathSide: e.positionPathSide, // positionPathSide: e.positionPathSide,
positionLine: e.positionLine, // positionLine: e.positionLine,
govAge: e.govAge, // govAge: e.govAge,
positionEmployeePosition: e.positionEmployeePosition, // positionEmployeePosition: e.positionEmployeePosition,
positionEmployeePositionSide: e.positionEmployeePositionSide, // positionEmployeePositionSide: e.positionEmployeePositionSide,
positionEmployeeGroup: e.positionEmployeeGroup, // positionEmployeeGroup: e.positionEmployeeGroup,
oc: e.oc, // oc: e.oc,
age: e.age, // age: e.age,
amount: e.amount == null ? "" : e.amount.toLocaleString(), // amount: e.amount == null ? "" : e.amount.toLocaleString(),
refSalary: e.refSalary, // refSalary: e.refSalary,
dateAppoint: // dateAppoint:
e.dateAppoint == null ? null : date2Thai(new Date(e.dateAppoint)), // e.dateAppoint == null ? null : date2Thai(new Date(e.dateAppoint)),
dateStart: // dateStart:
e.dateStart == null ? null : date2Thai(new Date(e.dateStart)), // e.dateStart == null ? null : date2Thai(new Date(e.dateStart)),
createdAt: // createdAt:
e.createdAt == null ? null : date2Thai(new Date(e.createdAt)), // e.createdAt == null ? null : date2Thai(new Date(e.createdAt)),
isLeave: e.isLeave == false ? "ครอง" : `${typeRetire(e.leaveReason)}`, // isLeave: e.isLeave == false ? "" : `${typeRetire(e.leaveReason)}`,
leaveDateOrder: // leaveDateOrder:
e.leaveDateOrder == null // e.leaveDateOrder == null
? null // ? null
: date2Thai(new Date(e.leaveDateOrder)), // : date2Thai(new Date(e.leaveDateOrder)),
newAgency: "", // newAgency: "",
currentAgency: "", // currentAgency: "",
draftPositionEmployee: e.draftPositionEmployee, // draftPositionEmployee: e.draftPositionEmployee,
draftOrganizationOrganization: e.draftOrganizationOrganization, // draftOrganizationOrganization: e.draftOrganizationOrganization,
}); // });
}); // });
}) // })
.catch((e) => { // .catch((e) => {
messageError($q, e); // messageError($q, e);
}) // })
.finally(() => { // .finally(() => {
hideLoader(); // hideLoader();
// console.log(rowsOrder); // // console.log(rowsOrder);
}); // });
}; // };
const onSelected = async (id: string) => { const onSelected = async (id: string) => {
// await fetchPositionNumber(id); // await fetchPositionNumber(id);