บรรจุ แต่งตั้ง ย้าย โอน => ปรับ 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,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>