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,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"
/>