แก้ออกคำสั่งวินัย

This commit is contained in:
Warunee Tamkoo 2024-01-16 16:44:36 +07:00
parent 743401b19e
commit 9b0ab95165
7 changed files with 180 additions and 107 deletions

View file

@ -35,6 +35,14 @@ const columnsLeave = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{
name: "citizenId",
align: "left",
label: "เลขบัตรประชาชน",
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{ {
name: "fullName", name: "fullName",
align: "left", align: "left",
@ -44,6 +52,42 @@ const columnsLeave = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{
name: "agency",
align: "left",
label: "หน่วยงาน",
sortable: true,
field: "agency",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "org",
align: "left",
label: "ส่วนราชการ",
sortable: true,
field: "org",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "level",
align: "left",
label: "ระดับ",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{ {
name: "dateSendLeave", name: "dateSendLeave",
align: "left", align: "left",
@ -53,6 +97,15 @@ const columnsLeave = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{
name: "dateLeave",
align: "left",
label: "วันที่ลา",
sortable: true,
field: "dateLeave",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{ {
name: "status", name: "status",
align: "left", align: "left",
@ -66,8 +119,14 @@ const columnsLeave = ref<QTableProps["columns"]>([
const visibleColumnsLeave = ref<string[]>([ const visibleColumnsLeave = ref<string[]>([
"no", "no",
"leaveTypeName", "leaveTypeName",
"citizenId",
"fullName", "fullName",
"dateSendLeave", "dateSendLeave",
"dateLeave",
"agency",
"org",
"position",
"level",
"status", "status",
]); ]);

View file

@ -13,6 +13,13 @@ interface ListLeave {
fullName: string; //คำนำหน้า ชื่อ นามสกุล คนขอลา fullName: string; //คำนำหน้า ชื่อ นามสกุล คนขอลา
dateSendLeave: Date | null; //วันที่ยื่นใบลา dateSendLeave: Date | null; //วันที่ยื่นใบลา
status: string | null; //ส status: string | null; //ส
citizenId?: string;
leaveStartDate?: Date | null;
leaveEndDate?: Date | null;
agency?: string;
org?: string;
position?: string;
level?: string;
} }
interface FormData { interface FormData {
id: string; id: string;

View file

@ -45,8 +45,16 @@ export const useLeavelistDataStore = defineStore("leave", () => {
id: e.id, id: e.id,
leaveTypeName: e.leaveTypeName, leaveTypeName: e.leaveTypeName,
leaveTypeId: e.leaveTypeId, leaveTypeId: e.leaveTypeId,
citizenId: e.citizenId ?? "3120101734950",
fullName: e.fullName, fullName: e.fullName,
agency: e.agency ?? "สำนักงานการเจ้าหน้าที่",
org: e.org ?? "กองบริหารทั่วไป/ฝ่ายการเจ้าหน้าที่",
position: e.position ?? "นักทรัพยากรบุคคล",
level: e.level ?? "ชำนาญการ",
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave), dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
dateLeave:
e.dateSendLeave &&
date2Thai(e.dateSendLeave) + "-" + date2Thai(e.dateSendLeave),
status: e.status && convertSatatus(e.status), status: e.status && convertSatatus(e.status),
})); }));

View file

@ -37,7 +37,10 @@ const nextStep = async () => {
await http await http
.put(config.API.nextStep(orderId.value)) .put(config.API.nextStep(orderId.value))
.then(() => { .then(() => {
if (route.name == "disciplineOrderDatail") { if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
router.push( router.push(
`/discipline-order/detail/${orderId.value}?step=${step.value + 1}` `/discipline-order/detail/${orderId.value}?step=${step.value + 1}`
); );
@ -56,7 +59,10 @@ const previousStep = async () => {
await http await http
.put(config.API.prevStep(orderId.value)) .put(config.API.prevStep(orderId.value))
.then(() => { .then(() => {
if (route.name == "disciplineOrderDatail") { if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
router.push( router.push(
`/discipline-order/detail/${orderId.value}?step=${step.value - 1}` `/discipline-order/detail/${orderId.value}?step=${step.value - 1}`
); );
@ -101,7 +107,8 @@ onMounted(() => {
color="primary" color="primary"
class="q-mr-sm" class="q-mr-sm"
@click=" @click="
route.name == 'disciplineOrderDatail' || route.name == 'disciplineOrderAdd' route.name == 'disciplineOrderDatail' ||
route.name == 'disciplineOrderAdd'
? router.push(`/discipline-order`) ? router.push(`/discipline-order`)
: router.push(`/order`) : router.push(`/order`)
" "

View file

@ -136,13 +136,6 @@ onMounted(async () => {
} else { } else {
await fecthTypeOption("noData"); await fecthTypeOption("noData");
} }
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
await getComplaint();
}
}); });
// //
watch(byOrder, async () => { watch(byOrder, async () => {
@ -222,8 +215,12 @@ const fetchdetailOrder = async () => {
let orderIdString = orderId.toString(); let orderIdString = orderId.toString();
await http await http
.get(config.API.detailOrder(orderIdString)) .get(config.API.detailOrder(orderIdString))
.then((res) => { .then(async (res: any) => {
const data = res.data.result; const data = res.data.result;
const orderTypeCode = await data.orderTypeCode.toUpperCase();
await optionsData(orderTypeCode);
typeOrder.value = typeOrderOption.value.find( typeOrder.value = typeOrderOption.value.find(
(e) => e.id === data.orderTypeValue (e) => e.id === data.orderTypeValue
); );
@ -294,8 +291,6 @@ const fetchdetailOrder = async () => {
result.value = data.result; result.value = data.result;
refRaw.value = data.refRaw; refRaw.value = data.refRaw;
complaintId.value = data.complaintId; complaintId.value = data.complaintId;
fecthExamRoundOption(data.orderTypeCode);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -317,62 +312,71 @@ const fecthCommand = async () => {
}); });
}; };
const optionsData = async (commandCode: string) => {
const orderTypeCode = await commandCode.toUpperCase();
if (orderTypeCode === "C-PM-10") {
nodeTree();
}
nameOrder.value = DataStore.nameOrderFilter(orderTypeCode);
// 01 - 04
if (
orderTypeCode == "C-PM-01" ||
orderTypeCode == "C-PM-02" ||
orderTypeCode == "C-PM-03" ||
orderTypeCode == "C-PM-04"
) {
fecthExamRoundOption(orderTypeCode);
}
//
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
await getComplaint();
}
// console.log(DataStore.complaintLists)
DataStore.complaintOption = [];
if (orderTypeCode == "C-PM-25" || orderTypeCode == "C-PM-26") {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isDisciplinary === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (orderTypeCode == "C-PM-32") {
await DataStore.complaintLists
.filter(
(x: complaintLists) =>
x.isInvestigate === true ||
x.isDisciplinary === true ||
x.isResult === true
)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (
orderTypeCode == "C-PM-19" ||
orderTypeCode == "C-PM-20" ||
orderTypeCode == "C-PM-27" ||
orderTypeCode == "C-PM-28" ||
orderTypeCode == "C-PM-29" ||
orderTypeCode == "C-PM-30" ||
orderTypeCode == "C-PM-31"
) {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isResult === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
}
};
const selectCMP = async (selectOrder: OrederResult) => { const selectCMP = async (selectOrder: OrederResult) => {
if (selectOrder != null) { if (selectOrder != null) {
fecthExamRoundOption(selectOrder.commandCode); const orderTypeCode = await selectOrder.commandCode.toUpperCase();
if (selectOrder.commandCode === "C-PM-10") { optionsData(orderTypeCode);
nodeTree();
}
nameOrder.value = DataStore.nameOrderFilter(selectOrder.commandCode);
// 01 - 04
if (
selectOrder.commandCode == "C-PM-01" ||
selectOrder.commandCode == "C-PM-02" ||
selectOrder.commandCode == "C-PM-03" ||
selectOrder.commandCode == "C-PM-04"
) {
fecthExamRoundOption(selectOrder.commandCode);
}
//
// console.log(DataStore.complaintLists)
DataStore.complaintOption = [];
if (
selectOrder.commandCode == "C-PM-25" ||
selectOrder.commandCode == "C-PM-26"
) {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isDisciplinary === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (selectOrder.commandCode == "C-PM-32") {
await DataStore.complaintLists
.filter(
(x: complaintLists) =>
x.isInvestigate === true ||
x.isDisciplinary === true ||
x.isResult === true
)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
} else if (
selectOrder.commandCode == "C-PM-19" ||
selectOrder.commandCode == "C-PM-20" ||
selectOrder.commandCode == "C-PM-27" ||
selectOrder.commandCode == "C-PM-28" ||
selectOrder.commandCode == "C-PM-29" ||
selectOrder.commandCode == "C-PM-30" ||
selectOrder.commandCode == "C-PM-31"
) {
await DataStore.complaintLists
.filter((x: complaintLists) => x.isResult === true)
.map((val: complaintLists) => {
DataStore.complaintOption.push({ id: val.id, name: val.title });
});
}
} }
//01-04 //01-04
examRound.value = ""; examRound.value = "";
@ -635,7 +639,15 @@ const createListOrder = async (formData: Object, type: string) => {
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
localStorage.setItem("orderId", data.id); localStorage.setItem("orderId", data.id);
router.push(`/order/detail/${data.id}?step=${2}`); // Step 2
if (
route.name == "disciplineOrderDatail" ||
route.name == "disciplineOrderAdd"
) {
router.push(`/discipline-order/detail/${data.id}?step=${2}`); // Step 2
} else {
router.push(`/order/detail/${data.id}?step=${2}`); // Step 2
}
next(); next();
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
}) })

View file

@ -240,16 +240,16 @@ interface DataOptionInsigniaType {
name: string; name: string;
} }
interface OrederResult { interface OrederResult {
category: string category?: string
commandCode: string commandCode: string
createdAt: Date createdAt?: Date
createdFullName: string createdFullName?: string
createdUserId: string createdUserId?: string
id: string id?: string
lastUpdateFullName: string lastUpdateFullName?: string
lastUpdateUserId: string lastUpdateUserId?: string
lastUpdatedAt: string lastUpdatedAt?: string
name: string name?: string
} }
export type { export type {
DataOption, DataOption,

View file

@ -146,26 +146,6 @@ async function fetchOrderlist() {
}); });
} }
// redirect step
const redirectToPage = (id?: string, status?: string) => {
let step = 1;
switch (status) {
case "จัดทำร่างคำสั่ง":
step = 1;
break;
case "บัญชีแนบท้าย":
step = 2;
break;
case "เลือกผู้ได้รับสำเนาคำสั่ง":
step = 3;
break;
default:
step = 4;
break;
}
router.push(`/order/detail/${id}?step=${step}`);
};
// //
const clickAdd = () => { const clickAdd = () => {
router.push({ name: "disciplineOrderAdd" }); router.push({ name: "disciplineOrderAdd" });
@ -212,12 +192,12 @@ const addedOrderStatusValues: string[] = [];
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
function resetFilter(){ function resetFilter() {
filterKeyword.value = ""; filterKeyword.value = "";
filterRef.value.focus(); filterRef.value.focus();
}; }
async function OrderTypeFilter(){ async function OrderTypeFilter() {
await http await http
.get(config.API.typeOrder()) .get(config.API.typeOrder())
.then((res) => { .then((res) => {
@ -235,14 +215,14 @@ async function OrderTypeFilter(){
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}); });
}; }
/** ฟังชั่นฟิลเตอร์ตามค่า ประเภท สถานะ ปี */ /** ฟังชั่นฟิลเตอร์ตามค่า ประเภท สถานะ ปี */
async function searchFilterTable(){ async function searchFilterTable() {
stroe.filterListOrder(OrderType.value, OrderStatus.value, fiscalyear.value); stroe.filterListOrder(OrderType.value, OrderStatus.value, fiscalyear.value);
}; }
async function OrderStatusFilter(){ async function OrderStatusFilter() {
for (let data of stroe.mainData) { for (let data of stroe.mainData) {
const OrderStatusValue = data.orderStatusName; const OrderStatusValue = data.orderStatusName;
@ -261,7 +241,7 @@ async function OrderStatusFilter(){
addedOrderStatusValues.push(OrderStatusValue); addedOrderStatusValues.push(OrderStatusValue);
} }
} }
}; }
/** /**
* ลเตอรอมลจาก input * ลเตอรอมลจาก input
@ -269,7 +249,7 @@ async function OrderStatusFilter(){
* @param update function จาก quasar * @param update function จาก quasar
* @param refData type กำหนด ของ input นๆ * @param refData type กำหนด ของ input นๆ
*/ */
function filterSelector(val: any, update: Function, refData: string){ function filterSelector(val: any, update: Function, refData: string) {
switch (refData) { switch (refData) {
case "fiscalyearOP": case "fiscalyearOP":
update(() => { update(() => {
@ -295,7 +275,7 @@ function filterSelector(val: any, update: Function, refData: string){
default: default:
break; break;
} }
}; }
</script> </script>
<template> <template>