Merge branch 'develop' into dev
Some checks failed
Build & Deploy on Dev / build (push) Failing after 2m49s

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-12-22 14:30:17 +07:00
commit 99f4cb6db6
4 changed files with 72 additions and 15 deletions

View file

@ -4,6 +4,9 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useCommandMainStore } from "@/modules/18_command/store/Main";
import { useDisciplineSuspendStore } from "@/modules/11_discipline/store/SuspendStore";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type { dataType } from "@/modules/11_discipline/interface/response/suspend";
@ -15,8 +18,9 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom
/** use */
const $q = useQuasar();
const storeCommand = useCommandMainStore();
const mixin = useCounterMixin();
const { dialogConfirm, onSearchDataTable } = mixin;
const storeSuspend = useDisciplineSuspendStore();
const { onSearchDataTable, showLoader, hideLoader, messageError, date2Thai } =
useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true });
const modalCommand = ref<boolean>(false); // popup
@ -47,6 +51,7 @@ const filterKeyword = ref<string>("");
const props = defineProps<{
rows: dataType[];
fetchData: Function;
employeeClass: string;
}>();
/** คอลัมน์ */
@ -128,6 +133,62 @@ const visibleColumns = ref<string[]>([
"status",
]);
async function fetchListData() {
showLoader();
const paramsNew = {
keyword: filterKeyword.value.trim(),
profileType: props.employeeClass,
status: "PENDING",
};
await http
.get(config.API.suspendMain, { params: paramsNew })
.then(async (res) => {
const result = await res.data.result.data;
const mapData = result.map((item: dataType) => {
return {
id: item.id,
profileId: item.profileId,
citizenId: item.citizenId,
name: `${item.prefix}${item.firstName} ${item.lastName}`,
prefix: item.prefix,
firstName: item.firstName,
profileType: item.profileType,
lastName: item.lastName,
organization: item.organization,
position: item.position,
posNo: item.posNo,
positionType: item.positionType,
positionLevel: item.positionLevel,
salary: item.salary,
status: storeSuspend.statusTothai(item.status),
statusEn: item.status,
descriptionSuspend: item.descriptionSuspend,
dateTotal:
item.startDateSuspend && item.endDateSuspend
? `${date2Thai(item.startDateSuspend)} - ${date2Thai(
item.endDateSuspend
)}`
: "-",
startDateSuspend: item.startDateSuspend,
endDateSuspend: item.endDateSuspend,
title: item.title,
offenseDetails: item.offenseDetails,
disciplinaryFaultLevel: item.disciplinaryFaultLevel,
disciplinaryCaseFault: item.disciplinaryCaseFault,
};
});
rows.value = mapData;
rowsMain.value = mapData;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function closeModal() {
modal.value = false;
commandType.value = "";
@ -149,15 +210,8 @@ function filterSelector(val: string, update: Function) {
/** ฟังก์ชั่นยืนยันและส่งคนไปสร้างคำสั่ง */
function saveOrder() {
// dialogConfirm(
// $q,
// async () => {
modalCommand.value = true;
modal.value = false;
// },
// "",
// "?"
// );
}
function serchDataTable() {
@ -185,8 +239,7 @@ watch(
() => modal.value,
async () => {
if (modal.value === true) {
rows.value = props.rows ? props.rows : [];
rowsMain.value = props.rows ? props.rows : [];
await fetchListData();
selected.value = [];
const data = await storeCommand.getCommandTypes();
listCommand.value = data.filter(
@ -274,7 +327,7 @@ watch(
keep-color
color="primary"
dense
:disable="commandType"
:disable="commandType ? false : true"
v-model="scope.selected"
/>
</template>
@ -285,7 +338,7 @@ watch(
keep-color
color="primary"
dense
:disable="commandType"
:disable="commandType ? false : true"
v-model="props.selected"
/>
</q-td>

View file

@ -31,9 +31,9 @@ const { messageError, showLoader, hideLoader, date2Thai, convertDateToAPI } =
const { pagination, params, onRequest } = usePagination("", getList);
const date = ref<any>(null);
const employeeClass = ref<string>("");
const employeeClass = ref<string>("OFFICER");
const employeeClassOption = ref<DataOption[]>([
{ id: "", name: "ทั้งหมด" },
// { id: "", name: "" },
{ id: "OFFICER", name: "ข้าราชการ กทม. สามัญ" },
{ id: "EMPLOYEE", name: "ลูกจ้างประจำ กทม." },
]);
@ -451,6 +451,7 @@ onMounted(async () => {
v-model:modal="modal"
:rows="rows2"
:fetch-data="getList"
:employeeClass="employeeClass"
/>
</template>
<style scoped lang="scss"></style>

View file

@ -45,6 +45,8 @@ interface dataType {
offenseDetails: string;
disciplinaryFaultLevel: string;
disciplinaryCaseFault: string;
profileId?: string;
profileType: string;
}
interface DataDetail {

View file

@ -99,6 +99,7 @@ export const useDisciplineSuspendStore = defineStore(
visibleColumns,
getData,
offenseDetailsOps,
statusTothai,
};
}
);