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

- แก้ 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) =>
`${organizationEmployee}position/${profileId}`,
organizationEmployeeSendOrder: `${organizationEmployee}report`,
};

View file

@ -131,32 +131,8 @@ const fecthTypeOption = async () => {
});
};
const rows = 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 rows = ref<any>([]);
const rows2 = ref<any>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -714,7 +690,7 @@ const status = (val: string) => {
<q-card-actions align="right" class="bg-white text-teal">
<q-btn
label="ส่งไปรายการแต่งตั้ง-เลื่อน"
label="ส่งไปออกคำสั่ง"
@click="clickAddlist"
color="public"
:disable="checkSelected"

View file

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