บรรจุ แต่งตั้ง ย้าย โอน => ปรับ code และ load
This commit is contained in:
parent
9f4aeec575
commit
34dc306288
30 changed files with 1154 additions and 1429 deletions
|
|
@ -1,22 +1,28 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, computed, watchEffect } from "vue";
|
||||
import { ref, computed, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { officerType } from "@/modules/05_placement/interface/response/officer";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const $q = useQuasar();
|
||||
const selected = ref<officerType[]>([]);
|
||||
const transferStore = useTransferDataStore();
|
||||
/**
|
||||
* impportType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { officerType } from "@/modules/05_placement/interface/response/officer";
|
||||
|
||||
const { statusText } = transferStore;
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store";
|
||||
|
||||
const $q = useQuasar();
|
||||
const { statusText } = useTransferDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
|
|
@ -28,6 +34,22 @@ const {
|
|||
date2Thai,
|
||||
} = mixin;
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
const props = defineProps({
|
||||
Modal: Boolean,
|
||||
closeModal: Function,
|
||||
getData: Function,
|
||||
rows2: Array,
|
||||
filterKeyword2: String,
|
||||
});
|
||||
const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
|
||||
|
||||
/**
|
||||
* table
|
||||
*/
|
||||
const selected = ref<officerType[]>([]);
|
||||
const columns2 = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -132,65 +154,70 @@ const visibleColumns2 = ref<string[]>([
|
|||
"status",
|
||||
]);
|
||||
|
||||
const props = defineProps({
|
||||
Modal: Boolean,
|
||||
closeModal: Function,
|
||||
getData: Function,
|
||||
rows2: Array,
|
||||
filterKeyword2: String,
|
||||
});
|
||||
|
||||
/**
|
||||
* chech การเลือกรายชื่อส่งตัวกลับ
|
||||
*/
|
||||
const checkSelected = computed(() => {
|
||||
if (selected.value.length === 0) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
//popup ยืนยันส่งัว
|
||||
const saveOrder = () => {
|
||||
/**
|
||||
* ยืนยันการส่งออกคำสั่งส่งตัวกลับ
|
||||
*/
|
||||
function saveOrder() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => Ordersave(),
|
||||
async () => {
|
||||
const id = selected.value.map((item) => item.id);
|
||||
const body = {
|
||||
id,
|
||||
};
|
||||
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.repatriationMainReport(), body)
|
||||
.then(async () => {
|
||||
await props.getData?.();
|
||||
await success($q, "ส่งไปออกคำสั่งส่งตัวกลับสำเร็จ");
|
||||
props.closeModal?.();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันส่งไปออกคำสั่ง",
|
||||
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
|
||||
);
|
||||
};
|
||||
//ส่งไปออกคำสั่ง
|
||||
const Ordersave = async () => {
|
||||
const id = selected.value.map((item) => item.id);
|
||||
const body = {
|
||||
id,
|
||||
};
|
||||
}
|
||||
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.repatriationMainReport(), body)
|
||||
.then((res: any) => {
|
||||
success($q, "ส่งไปออกคำสั่งส่งตัวกลับสำเร็จ");
|
||||
props.closeModal?.();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
props.getData?.();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
|
||||
const updateInput = (value: any) => {
|
||||
/**
|
||||
* อัปเดทค่า filter
|
||||
* @param value คำค้นหา
|
||||
*/
|
||||
function updateInput(value: string | number | null) {
|
||||
emit("update:filterKeyword2", value);
|
||||
};
|
||||
//รีเซ็ตค่าในช่องค้นหา
|
||||
const Reset = () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* รีเซ็ตค่าในช่องค้นหา
|
||||
*/
|
||||
function Reset() {
|
||||
emit("update:filterKeyword2", "");
|
||||
};
|
||||
watchEffect(() => {
|
||||
if (props.Modal === true) {
|
||||
selected.value = [];
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.Modal,
|
||||
() => {
|
||||
if (props.Modal === true) {
|
||||
selected.value = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<q-dialog v-model="props.Modal">
|
||||
|
|
|
|||
|
|
@ -1,29 +1,30 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { officerType } from "@/modules/05_placement/interface/response/officer";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import Dialogbody from "@/modules/05_placement/components/Repatriate/Dialogbody.vue";
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import Dialogbody from "@/modules/05_placement/components/Repatriate/Dialogbody.vue"; //popup ส่งไปออกคำสั่งส่งตัวกลับ
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store";
|
||||
|
||||
const { statusText } = useTransferDataStore();
|
||||
const $q = useQuasar();
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterKeyword2 = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
const router = useRouter();
|
||||
const rows = ref<officerType[]>([]);
|
||||
const rows2 = ref<officerType[]>([]);
|
||||
const modal = ref<boolean>(false);
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const transferStore = useTransferDataStore();
|
||||
const { statusText } = transferStore;
|
||||
const {
|
||||
date2Thai,
|
||||
messageError,
|
||||
|
|
@ -32,8 +33,17 @@ const {
|
|||
success,
|
||||
dialogRemove,
|
||||
findPosMasterNoOld,
|
||||
} = mixin;
|
||||
} = useCounterMixin();
|
||||
|
||||
/**
|
||||
* Table
|
||||
*/
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterKeyword2 = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
const router = useRouter();
|
||||
const rows = ref<officerType[]>([]);
|
||||
const rows2 = ref<officerType[]>([]);
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -139,28 +149,59 @@ const visibleColumns = ref<string[]>([
|
|||
"status",
|
||||
]);
|
||||
|
||||
// รีเซ้ตค่าในช่อง ฟิลเตอร์
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterKeyword2.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
const modal = ref<boolean>(false); // ส่งไปออกคำสั่งส่งตัวกลับ
|
||||
|
||||
//เปิดรายละเอียด
|
||||
const openDetail = (id: string) => {
|
||||
/**
|
||||
* rediarect ไปหน้ารายละเอียด
|
||||
*/
|
||||
function openDetail(id: string) {
|
||||
router.push(`/placement/repatriate/detail/${id}`);
|
||||
};
|
||||
// เปิด modal
|
||||
const openModal = () => (modal.value = true);
|
||||
// ปิด modal
|
||||
const closeModal = () => {
|
||||
modal.value = false;
|
||||
filterKeyword2.value = "";
|
||||
};
|
||||
}
|
||||
|
||||
// เปิด modal และกรอก status
|
||||
const openModalOrder = () => {
|
||||
openModal();
|
||||
/**
|
||||
* fetch รายการส่งตัวกลับ
|
||||
*/
|
||||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.repatriationMain())
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
rows.value = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* ยืนยันการลบรายการ
|
||||
*/
|
||||
function clickDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
.delete(config.API.repatriationMainDelete(id))
|
||||
.then(async () => {
|
||||
await getData();
|
||||
await success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* เปิด popup ส่งไปออกคำสั่งส่งตัวกลับ
|
||||
*/
|
||||
function openModalOrder() {
|
||||
// filter หา status
|
||||
const row = rows.value.filter(
|
||||
(item: officerType) =>
|
||||
(item.status == "WAITTING" ||
|
||||
|
|
@ -177,43 +218,25 @@ const openModalOrder = () => {
|
|||
);
|
||||
|
||||
rows2.value = row;
|
||||
};
|
||||
modal.value = true;
|
||||
}
|
||||
|
||||
// ดึงข้อมูลจาก API
|
||||
const getData = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.repatriationMain())
|
||||
.then((res: any) => {
|
||||
const data = res.data.result;
|
||||
rows.value = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// เปิดpop up ยืนยันลบข้อมูล
|
||||
const clickDelete = async (name: string, id: string) => {
|
||||
dialogRemove($q, async () => await deleteData(id), `ลบข้อมูลของ ${name}`);
|
||||
};
|
||||
/**
|
||||
* ปิด popup ส่งไปออกคำสั่งส่งตัวกลับ
|
||||
*/
|
||||
function closeModal() {
|
||||
modal.value = false;
|
||||
filterKeyword2.value = "";
|
||||
}
|
||||
|
||||
// ลบข้อมูล
|
||||
const deleteData = async (id: string) => {
|
||||
await http
|
||||
.delete(config.API.repatriationMainDelete(id))
|
||||
.then((res) => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await getData();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* รีเซ้ตค่าในช่อง ฟิลเตอร์
|
||||
*/
|
||||
function resetFilter() {
|
||||
filterKeyword.value = "";
|
||||
filterKeyword2.value = "";
|
||||
filterRef.value.focus();
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getData();
|
||||
|
|
@ -317,9 +340,7 @@ onMounted(async () => {
|
|||
round
|
||||
dense
|
||||
color="red"
|
||||
@click.stop.prevent="
|
||||
clickDelete(props.row.fullname, props.row.id)
|
||||
"
|
||||
@click.stop.prevent="clickDelete(props.row.id)"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import CardProfile from "@/components/CardProfile.vue";
|
|||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const mixin = useCounterMixin();
|
||||
const edit = ref<boolean>(false);
|
||||
const dataId = route.params.id as string;
|
||||
const {
|
||||
|
|
@ -30,12 +29,10 @@ const {
|
|||
success,
|
||||
dialogConfirm,
|
||||
findOrgName,
|
||||
} = mixin;
|
||||
} = useCounterMixin();
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
|
||||
const dataProfile = ref<DataProfile>();
|
||||
|
||||
const fullname = ref<string>("");
|
||||
|
||||
/** form แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
|
||||
|
|
@ -50,8 +47,10 @@ const dateRepatriation = ref<Date | null>(null);
|
|||
const reason = ref<string>("");
|
||||
const status = ref<string>("");
|
||||
|
||||
/** fetch ข้อมูลรายละเอียด*/
|
||||
const getData = () => {
|
||||
/**
|
||||
* fetch ข้อมูลรายละเอียด*
|
||||
*/
|
||||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.repatriationDetail(dataId))
|
||||
|
|
@ -79,9 +78,12 @@ const getData = () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
/**
|
||||
* ยืนยีนการบันทึกข้อมูลการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ
|
||||
*/
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
|
|
@ -99,10 +101,10 @@ const onSubmit = () => {
|
|||
showLoader();
|
||||
http
|
||||
.put(config.API.repatriationMainEdit(dataId), body)
|
||||
.then(() => {
|
||||
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
|
||||
.then(async () => {
|
||||
await getData();
|
||||
await success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
|
||||
edit.value = false;
|
||||
getData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -114,14 +116,20 @@ const onSubmit = () => {
|
|||
"ต้องการแก้ไขข้อมูลหรือไม่?",
|
||||
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
const cancelBtn = () => {
|
||||
/**
|
||||
* ยกเลิกการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ
|
||||
*/
|
||||
function cancelBtn() {
|
||||
edit.value = !edit;
|
||||
getData();
|
||||
myForm.value?.resetValidation();
|
||||
};
|
||||
getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* class Input
|
||||
*/
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
|
|
@ -146,7 +154,7 @@ onMounted(() => {
|
|||
class="q-mr-sm"
|
||||
@click="router.push(`/placement/repatriate`)"
|
||||
/>
|
||||
รายละเอียดการส่งตัวกลับ {{ fullname }}
|
||||
รายละเอียดการส่งตัวกลับ{{ fullname }}
|
||||
</div>
|
||||
|
||||
<CardProfile :data="dataProfile as DataProfile" />
|
||||
|
|
@ -283,7 +291,7 @@ onMounted(() => {
|
|||
hide-bottom-space
|
||||
:borderless="!edit"
|
||||
:label="`${'เงินเดือน'}`"
|
||||
class="inputgreen"
|
||||
:class="getClass(edit)"
|
||||
:rules="[(val:number) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
|
||||
lazy-rules
|
||||
mask="###,###,###,###"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue