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

View file

@ -3,7 +3,7 @@ import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
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 { useTransferDataStore } from "@/modules/05_placement/store";
@ -27,7 +27,7 @@ const {
const $q = useQuasar();
const selected = ref<[]>([]);
const checkSelected = computed(() => {
if (selected.value.length === 0 || props.type === "") {
if (selected.value.length === 0) {
return true;
}
});
@ -48,6 +48,7 @@ const visibleColumns2 = ref<string[]>([
"fullname",
"organizationName",
"birthday",
"typeCommand",
]);
const columns2 = ref<QTableProps["columns"]>([
{
@ -88,6 +89,24 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
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",
align: "left",
@ -110,43 +129,41 @@ const updateInput = (value: any) => {
emit("update:filterKeyword2", value);
};
const updateInputType = (value: string) => {
emit("update:type", value);
};
// const updateInputType = (value: string) => {
// emit("update:type", value);
// };
//
const Reset = () => {
emit("update:filterKeyword2", "");
};
// modal
const clickAddlist = () => {
dialogConfirm($q, () => createdAppoint());
};
//
const createdAppoint = async () => {
let pId: string[] = [];
let Type = props.type as string;
selected.value.forEach((e: UserData) => {
pId.push(e.personalId);
});
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?.();
//
const sendToCommand = () => {
dialogConfirm($q, async () => {
let pId: string[] = [];
let Type = props.type as string;
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?.();
});
});
};
watchEffect(() => {
@ -163,7 +180,7 @@ watchEffect(() => {
<q-card-section class="q-pt-none">
<div class="row justify-between">
<div class="col-5">
<q-toolbar style="padding: 0">
<!-- <q-toolbar style="padding: 0">
<q-select
outlined
dense
@ -177,7 +194,7 @@ watchEffect(() => {
option-label="name"
option-value="id"
/>
</q-toolbar>
</q-toolbar> -->
</div>
<div class="col-5">
<q-toolbar style="padding: 0">
@ -316,7 +333,7 @@ watchEffect(() => {
<q-card-actions align="right" class="bg-white text-teal">
<q-btn
label="ส่งไปออกคำสั่ง"
@click="clickAddlist"
@click="sendToCommand"
color="public"
:disable="checkSelected"
/>

View file

@ -57,6 +57,7 @@ const visibleColumns = ref<string[]>([
"citizenId",
"fullname",
"organizationName",
"typeCommand",
"dateOfBirth",
"createdAt",
"status",
@ -113,6 +114,24 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "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",
align: "left",
@ -146,10 +165,10 @@ const clickClose = () => {
};
// modal
const popup = () => {
const sendToCommand = () => {
modal.value = true;
filterKeyword2.value = "";
fecthTypeOption();
// fecthTypeOption();
};
// API
@ -213,22 +232,22 @@ const fecthlistappointment = async () => {
};
//
const fecthTypeOption = async () => {
type.value = "";
await http
.get(config.API.typeOrder())
.then((res) => {
optionsType.value = res.data.result.filter(
(e: OpType) =>
e.commandCode === "C-PM-05" ||
e.commandCode === "C-PM-06" ||
e.commandCode === "C-PM-07"
);
})
.catch((e) => {
messageError($q, e);
});
};
// const fecthTypeOption = async () => {
// type.value = "";
// await http
// .get(config.API.typeOrder())
// .then((res) => {
// optionsType.value = res.data.result.filter(
// (e: OpType) =>
// e.commandCode === "C-PM-05" ||
// e.commandCode === "C-PM-06" ||
// e.commandCode === "C-PM-07"
// );
// })
// .catch((e) => {
// messageError($q, e);
// });
// };
//
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) => {
router.push({
@ -314,6 +327,7 @@ onMounted(() => {
fecthlistappointment();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
รายการแตงต-เลอน-าย
@ -324,7 +338,7 @@ onMounted(() => {
<div class="col-12">
<div class="row col-12">
<q-btn
@click="popup()"
@click="sendToCommand()"
size="14px"
flat
round

View file

@ -258,7 +258,7 @@ const getData = async () => {
positionLevelOld: item.positionLevelOld,
positionNumberOld: item.positionNumberOld,
organizationPositionOld: item.organizationPositionOld,
createdAt:date2Thai(item.createdAt),
createdAt: date2Thai(item.createdAt),
}));
})
.catch((e) => {
@ -516,7 +516,10 @@ const pagination = ref({
</q-td>
<q-td auto-width>
<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"
size="12px"
color="grey-7"

View file

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