บรรจุ แต่งตั้ง ย้าย โอน => ปรับ code และ load

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-19 16:14:43 +07:00
parent 9f4aeec575
commit 34dc306288
30 changed files with 1154 additions and 1429 deletions

View file

@ -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">

View file

@ -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>

View file

@ -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="###,###,###,###"