fixing แต่งตั้ง เลื่อน ย้าย

This commit is contained in:
Warunee Tamkoo 2024-05-15 15:39:33 +07:00
parent 7a394bce3a
commit ee9f6f594e
5 changed files with 167 additions and 125 deletions

View file

@ -3,13 +3,8 @@ import { onMounted, ref, reactive } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive"; import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive";
import type { import type { DataProfile } from "@/modules/05_placement/interface/response/AppointMent";
appointmentData,
ResponseData,
DataProfile,
} from "@/modules/05_placement/interface/response/AppointMent";
import type { QForm } from "quasar"; import type { QForm } from "quasar";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
@ -102,7 +97,7 @@ function putAppointment() {
positionTypeOld: positionTypeOld.value, positionTypeOld: positionTypeOld.value,
positionLevelOld: positionLevelOld.value, positionLevelOld: positionLevelOld.value,
positionNumberOld: posNo.value, positionNumberOld: posNo.value,
amountOld: Number(salary.value), amountOld: salary.value.toString().replace(/,/g, ""),
reason: reason.value, reason: reason.value,
positionDate: date.value, positionDate: date.value,
}; };

View file

@ -3,7 +3,7 @@ import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { UserData } from "@/modules/05_placement/interface/response/AppointMent"; import type { UserDataNew } from "@/modules/05_placement/interface/response/AppointMent";
import DialogHeader from "@/modules/05_placement/components/AppointMent/DialogHeader.vue"; import DialogHeader from "@/modules/05_placement/components/AppointMent/DialogHeader.vue";
import { useTransferDataStore } from "@/modules/05_placement/store"; import { useTransferDataStore } from "@/modules/05_placement/store";
@ -27,7 +27,7 @@ const {
const $q = useQuasar(); const $q = useQuasar();
const selected = ref<[]>([]); const selected = ref<[]>([]);
const checkSelected = computed(() => { const checkSelected = computed(() => {
if (selected.value.length === 0 || props.type === "") { if (selected.value.length === 0) {
return true; return true;
} }
}); });
@ -48,6 +48,7 @@ const visibleColumns2 = ref<string[]>([
"fullname", "fullname",
"organizationName", "organizationName",
"birthday", "birthday",
"typeCommand",
]); ]);
const columns2 = ref<QTableProps["columns"]>([ const columns2 = ref<QTableProps["columns"]>([
{ {
@ -88,6 +89,24 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{
name: "typeCommand",
align: "left",
label: "ประเภทคำสั่ง",
sortable: true,
field: "typeCommand",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val: string) => {
return val === "APPOINT"
? "แต่งตั้ง"
: val === "SLIP"
? "เลื่อน"
: val === "MOVE"
? "ย้าย"
: "-";
},
},
{ {
name: "birthday", name: "birthday",
align: "left", align: "left",
@ -110,43 +129,41 @@ const updateInput = (value: any) => {
emit("update:filterKeyword2", value); emit("update:filterKeyword2", value);
}; };
const updateInputType = (value: string) => { // const updateInputType = (value: string) => {
emit("update:type", value); // emit("update:type", value);
}; // };
// //
const Reset = () => { const Reset = () => {
emit("update:filterKeyword2", ""); emit("update:filterKeyword2", "");
}; };
// modal
const clickAddlist = () => {
dialogConfirm($q, () => createdAppoint());
};
// //
const createdAppoint = async () => { const sendToCommand = () => {
let pId: string[] = []; dialogConfirm($q, async () => {
let Type = props.type as string; let pId: string[] = [];
selected.value.forEach((e: UserData) => { let Type = props.type as string;
pId.push(e.personalId); selected.value.forEach((e: UserDataNew) => {
}); pId.push(e.id);
let data = {
id: pId,
};
showLoader();
await http
.put(config.API.apppointmentReport(Type), data)
.then((res) => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
props.fecthlistappointment?.();
selected.value = [];
props.clickClose?.();
}); });
let data = {
id: pId,
};
showLoader();
await http
.put(config.API.apppointmentReport(Type), data)
.then((res) => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
props.fecthlistappointment?.();
selected.value = [];
props.clickClose?.();
});
});
}; };
watchEffect(() => { watchEffect(() => {
@ -163,7 +180,7 @@ watchEffect(() => {
<q-card-section class="q-pt-none"> <q-card-section class="q-pt-none">
<div class="row justify-between"> <div class="row justify-between">
<div class="col-5"> <div class="col-5">
<q-toolbar style="padding: 0"> <!-- <q-toolbar style="padding: 0">
<q-select <q-select
outlined outlined
dense dense
@ -177,7 +194,7 @@ watchEffect(() => {
option-label="name" option-label="name"
option-value="id" option-value="id"
/> />
</q-toolbar> </q-toolbar> -->
</div> </div>
<div class="col-5"> <div class="col-5">
<q-toolbar style="padding: 0"> <q-toolbar style="padding: 0">
@ -316,7 +333,7 @@ watchEffect(() => {
<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="sendToCommand"
color="public" color="public"
:disable="checkSelected" :disable="checkSelected"
/> />

View file

@ -57,6 +57,7 @@ const visibleColumns = ref<string[]>([
"citizenId", "citizenId",
"fullname", "fullname",
"organizationName", "organizationName",
"typeCommand",
"dateOfBirth", "dateOfBirth",
"createdAt", "createdAt",
"status", "status",
@ -113,6 +114,24 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{
name: "typeCommand",
align: "left",
label: "ประเภทคำสั่ง",
sortable: true,
field: "typeCommand",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val: string) => {
return val === "APPOINT"
? "แต่งตั้ง"
: val === "SLIP"
? "เลื่อน"
: val === "MOVE"
? "ย้าย"
: "-";
},
},
{ {
name: "createdAt", name: "createdAt",
align: "left", align: "left",
@ -146,10 +165,10 @@ const clickClose = () => {
}; };
// modal // modal
const popup = () => { const sendToCommand = () => {
modal.value = true; modal.value = true;
filterKeyword2.value = ""; filterKeyword2.value = "";
fecthTypeOption(); // fecthTypeOption();
}; };
// API // API
@ -213,22 +232,22 @@ const fecthlistappointment = async () => {
}; };
// //
const fecthTypeOption = async () => { // const fecthTypeOption = async () => {
type.value = ""; // type.value = "";
await http // await http
.get(config.API.typeOrder()) // .get(config.API.typeOrder())
.then((res) => { // .then((res) => {
optionsType.value = res.data.result.filter( // optionsType.value = res.data.result.filter(
(e: OpType) => // (e: OpType) =>
e.commandCode === "C-PM-05" || // e.commandCode === "C-PM-05" ||
e.commandCode === "C-PM-06" || // e.commandCode === "C-PM-06" ||
e.commandCode === "C-PM-07" // e.commandCode === "C-PM-07"
); // );
}) // })
.catch((e) => { // .catch((e) => {
messageError($q, e); // messageError($q, e);
}); // });
}; // };
// //
const openModalTree = (data: any, type: string) => { const openModalTree = (data: any, type: string) => {
@ -262,12 +281,6 @@ const deleteAppoint = async (id: string) => {
}); });
}; };
// modal
const closeModalTree = async () => {
await fecthlistappointment();
modalTree.value = false;
};
// //
const nextPage = (id: string) => { const nextPage = (id: string) => {
router.push({ router.push({
@ -314,6 +327,7 @@ onMounted(() => {
fecthlistappointment(); fecthlistappointment();
}); });
</script> </script>
<template> <template>
<div class="toptitle text-dark col-12 row items-center"> <div class="toptitle text-dark col-12 row items-center">
รายการแตงต-เลอน-าย รายการแตงต-เลอน-าย
@ -324,7 +338,7 @@ onMounted(() => {
<div class="col-12"> <div class="col-12">
<div class="row col-12"> <div class="row col-12">
<q-btn <q-btn
@click="popup()" @click="sendToCommand()"
size="14px" size="14px"
flat flat
round round

View file

@ -258,7 +258,7 @@ const getData = async () => {
positionLevelOld: item.positionLevelOld, positionLevelOld: item.positionLevelOld,
positionNumberOld: item.positionNumberOld, positionNumberOld: item.positionNumberOld,
organizationPositionOld: item.organizationPositionOld, organizationPositionOld: item.organizationPositionOld,
createdAt:date2Thai(item.createdAt), createdAt: date2Thai(item.createdAt),
})); }));
}) })
.catch((e) => { .catch((e) => {
@ -516,7 +516,10 @@ const pagination = ref({
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn <q-btn
v-if="props.row.status !== 'DONE' && props.row.status !== 'REPORT'" v-if="
props.row.status !== 'DONE' &&
props.row.status !== 'REPORT'
"
icon="mdi-dots-vertical" icon="mdi-dots-vertical"
size="12px" size="12px"
color="grey-7" color="grey-7"

View file

@ -1,61 +1,61 @@
interface listAppointType { interface listAppointType {
personalId: string personalId: string;
citizenId: number citizenId: number;
fullname: string fullname: string;
organizationName: string organizationName: string;
orgName: string orgName: string;
organizationShortName: string organizationShortName: string;
positionNumber: string positionNumber: string;
positionPath: string positionPath: string;
status: string status: string;
createdAt: string createdAt: string;
birthday: string birthday: string;
educationOld: string educationOld: string;
organizationPositionOld: string organizationPositionOld: string;
positionTypeOld: string positionTypeOld: string;
positionLevelOld: string positionLevelOld: string;
positionNumberOld: string positionNumberOld: string;
salary: number salary: number;
positionDate: Date positionDate: Date;
} }
interface resData { interface resData {
id: string id: string;
citizenId: number citizenId: number;
prefix: string prefix: string;
firstname: string firstname: string;
lastname: string lastname: string;
organizationName: string organizationName: string;
organizationShortName: string organizationShortName: string;
positionNumber: string positionNumber: string;
positionPath: string positionPath: string;
status: string status: string;
createdAt: Date createdAt: Date;
dateOfBirth: Date dateOfBirth: Date;
educationOld: string educationOld: string;
organizationPositionOld: string organizationPositionOld: string;
positionTypeOld: string positionTypeOld: string;
positionLevelOld: string positionLevelOld: string;
positionNumberOld: string positionNumberOld: string;
salary: number salary: number;
positionDate: Date positionDate: Date;
} }
interface orgFilter { interface orgFilter {
orgName: string orgName: string;
status: string status: string;
educationOld: string educationOld: string;
organizationPositionOld: string organizationPositionOld: string;
positionTypeOld: string positionTypeOld: string;
positionLevelOld: string positionLevelOld: string;
positionNumberOld: string positionNumberOld: string;
salary: number salary: number;
positionDate: Date positionDate: Date;
} }
interface appointmentData { interface appointmentData {
citizenId: string citizenId: string;
prefixId?: string prefixId?: string;
firstname?: string firstname?: string;
lastname?: string lastname?: string;
} }
interface UserData { interface UserData {
@ -72,10 +72,24 @@ interface UserData {
birthday: string; birthday: string;
} }
interface UserDataNew {
id: string;
citizenId: string;
fullname: string;
organizationName: string;
orgName: string;
organizationShortName: string;
positionNumber: string;
positionPath: string;
status: string;
createdAt: string;
birthday: string;
}
interface ResponseData { interface ResponseData {
data: { data: {
result: { result: {
citizenId: string citizenId: string;
profileId: string; profileId: string;
prefix: string; prefix: string;
firstname: string; firstname: string;
@ -90,7 +104,6 @@ interface ResponseData {
reason: string; reason: string;
positionDate: Date; positionDate: Date;
avatar: string; avatar: string;
}; };
}; };
} }
@ -129,7 +142,7 @@ export type {
orgFilter, orgFilter,
appointmentData, appointmentData,
UserData, UserData,
UserDataNew,
ResponseData, ResponseData,
DataProfile DataProfile,
};
}