วินัย => fix bug

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-07-04 13:44:29 +07:00
parent 7a483649d4
commit 17b801eede
15 changed files with 197 additions and 90 deletions

View file

@ -92,7 +92,7 @@ onMounted(async () => {
</div>
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-2">
<div class="col-4">
<q-select
v-model="statusFilter"
label="สถานะ"
@ -104,7 +104,15 @@ onMounted(async () => {
option-value="id"
:options="complainstStore.statusOptions"
@update:model-value="getList()"
/>
>
<template v-if="statusFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(statusFilter = 'ALL'), getList()"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<div>
<q-btn

View file

@ -109,7 +109,11 @@ const dataComplaints = reactive<FormDataComplaint>({
async function getDataComplaint() {
showLoader();
await http
.get(config.API.complaintbyId(data.idComplaint))
.get(
config.API.complaintbyId(
data.idComplaint ? data.idComplaint : store.complaintId
)
)
.then((res) => {
const dataList = res.data.result;
dataComplaints.id = dataList.id;
@ -148,6 +152,7 @@ function getData() {
const dataList = res.data.result;
data.id = dataList.id;
data.idComplaint = dataList.idComplaint;
store.complaintId = dataList.idComplaint;
data.respondentType = dataList.respondentType;
data.organizationId = dataList.organizationId;
data.organization = dataList.organization;
@ -191,15 +196,15 @@ async function onSubmit(data: any) {
showLoader();
http
.put(config.API.investigateById(id.value), data)
.then((res) => {
getData();
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async (res) => {
await getData();
await success($q, "บันทึกข้อมูลสำเร็จ");
// router.push(`/discipline/complaints`);
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
.finally(() => {
hideLoader();
});
// router.push(`/discipline/investigatefacts`);
@ -225,14 +230,15 @@ function sentConfirmNoPerson() {
.put(config.API.investigateApprove(id.value), {
persons: [],
})
.then((res) => {})
.then((res) => {
getData();
router.push(`/discipline/investigatefacts`);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
getData();
router.push(`/discipline/investigatefacts`);
});
}
@ -265,14 +271,13 @@ function confirmEndInvestigate() {
showLoader();
http
.get(config.API.investigateReject(id.value))
.then((res) => {
success($q, "ยุติเรื่องสำเร็จ");
.then(async () => {
await getData();
await success($q, "ยุติเรื่องสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await getData();
hideLoader();
});
}
@ -281,15 +286,15 @@ function confirmCancelInvestigate() {
showLoader();
http
.get(config.API.investigateResume(id.value))
.then((res) => {
getData();
.then(async () => {
await getData();
await success($q, "ยกเลิกยุติเรื่องสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
success($q, "ยกเลิกยุติเรื่องสำเร็จ");
});
}
@ -300,8 +305,7 @@ function emitPerson(data: FormData[]) {
.put(config.API.investigateApprove(id.value), {
persons: dataMapId,
})
.then((res) => {
.then(() => {
router.push(`/discipline/investigatefacts`);
})
.catch((e) => {
@ -315,6 +319,9 @@ function emitPerson(data: FormData[]) {
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(() => {
getData();
if (store.tabMenu == "complaints") {
getDataComplaint();
}
});
watch(

View file

@ -902,7 +902,7 @@ onMounted(async () => {
{{ props.row.salary.toLocaleString() }}
</div>
<div v-else>
{{ col.value }}
{{ col.value ?? "-" }}
</div>
</q-td>
<q-td auto-width>
@ -1268,7 +1268,7 @@ onMounted(async () => {
{{ props.rowIndex + 1 }}
</div>
<div v-else class="table_ellipsis2">
{{ col.value }}
{{ col.value ?? "-" }}
</div>
</q-td>
<q-td class="text-right">
@ -1545,6 +1545,7 @@ onMounted(async () => {
v-if="!isReadonly && formData.id !== ''"
class="col-12 row"
>
<!-- accept=".pdf,.xlsx,.docx" -->
<q-file
for="inputFiles"
class="col-12"
@ -1553,7 +1554,7 @@ onMounted(async () => {
v-model="formData.documentFile"
@added="uploadFile"
label="ไฟล์เอกสารหลักฐาน"
accept=".pdf,.xlsx,.docx"
clearable
>
<template v-slot:prepend>

View file

@ -124,7 +124,14 @@ onMounted(async () => {
option-value="id"
:options="dataInvestigate.statusOptions"
@update:model-value="getList()"
/>
>
<template v-if="statusFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(statusFilter = 'ALL'), getList()"
class="cursor-pointer"
/> </template
></q-select>
</div>
<q-space />

View file

@ -132,7 +132,7 @@ function filterFn() {
<template>
<div class="q-pb-sm row q-col-gutter-sm">
<div class="col-xs-12 col-sm-4 col-md-3">
<div class="col-xs-12 col-sm-4 col-md-4">
<q-select
v-model="statusFilter"
label="สถานะ"
@ -144,7 +144,15 @@ function filterFn() {
option-value="id"
:options="dataInvestigateDis.statusOptions"
@update:model-value="dataUpdate"
/>
>
<template v-if="statusFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(statusFilter = 'ALL'), dataUpdate()"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<q-space />
<!-- นหาขอความใน table -->

View file

@ -115,6 +115,7 @@ const dataComplaints = reactive<FormDataComplaint>({
/** ฟังชั่นปิด dialog */
function closeModal() {
modal.value = false;
filterKeyword.value = "";
}
/**

View file

@ -115,7 +115,7 @@ function filterFn() {
<template>
<div class="q-pb-sm row q-col-gutter-sm">
<div class="q-gutter-sm" v-if="nornmalData == true"></div>
<div class="col-xs-12 col-sm-4 col-md-3">
<div class="col-xs-12 col-sm-4 col-md-4">
<q-select
v-model="statusFilter"
label="สถานะ"
@ -127,7 +127,15 @@ function filterFn() {
option-value="id"
:options="store.statusOptions"
@update:model-value="dataUpdate"
/>
>
<template v-if="statusFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(statusFilter = 'ALL'), dataUpdate()"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<q-space />
<q-input
@ -202,10 +210,10 @@ function filterFn() {
}}
</div>
<div v-else-if="col.name === 'title'" class="table_ellipsis">
{{ props.row.title }}
{{ props.row.title ?? "-" }}
</div>
<div v-else>
{{ col.value }}
{{ col.value ?? "-" }}
</div>
</q-td>
</q-tr>

View file

@ -31,7 +31,7 @@ const rows = ref<tableType[]>([]);
const search = ref<string>("");
const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, showLoader, dialogMessageNotify, hideLoader } = mixin;
const { messageError, showLoader, hideLoader } = mixin;
/** รับ props มาจาก page หลัก */
const props = defineProps({
@ -194,7 +194,11 @@ async function getSearch() {
keyword: search.value,
};
await http
.post(config.API.orgSearchPersonal()+`?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&searchKeyword=${search.value}`, body)
.post(
config.API.orgSearchPersonal() +
`?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&searchKeyword=${search.value}`,
body
)
.then((res) => {
totalList.value = Math.ceil(
res.data.result.total / pagination.value.rowsPerPage
@ -207,7 +211,9 @@ async function getSearch() {
prefix: e.prefix,
firstName: e.firstName,
lastName: e.lastName,
name: `${e.prefix ? e.prefix :''}${e.firstName ? e.firstName :''} ${e.lastName ? e.lastName :''}`,
name: `${e.prefix ? e.prefix : ""}${e.firstName ? e.firstName : ""} ${
e.lastName ? e.lastName : ""
}`,
posNo: e.posNo ?? "-",
position: e.position ?? "-",
positionLevel: e.positionLevel ?? "-",
@ -219,18 +225,20 @@ async function getSearch() {
rows.value = list;
})
.catch((err) => {})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function returnDetail(data: any) {
function returnDetail(data: ResponsePreson) {
formData.prefix = data.prefix;
formData.firstname = data.firstName;
formData.lastname = data.lastName;
formData.position = data.position;
formData.phone = data.phone;
formData.phone = data.phone !== "-" ? data.phone.replace(/\D/g, "") : "";
formData.email = data.email;
}
@ -254,7 +262,6 @@ function updatemodalPersonal(modal: boolean) {
function updatePagination(newPagination: any) {
pagination.value.page = 1;
pagination.value.rowsPerPage = newPagination.rowsPerPage;
}
/**
@ -274,8 +281,8 @@ watch(props.data, async () => {
watch(
() => pagination.value.rowsPerPage,
async() => {
await getSearch();
async () => {
await getSearch();
}
);
</script>
@ -342,20 +349,20 @@ watch(
:rows-per-page-options="[1, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="getSearch"
></q-pagination>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="getSearch"
></q-pagination>
</template>
<template v-slot:header="props">
<q-tr :props="props">
@ -377,13 +384,13 @@ watch(
:props="props"
@click="returnDetail(props.row)"
>
<div v-if="col.name == 'no'">
{{
(pagination.page - 1) * pagination.rowsPerPage +
props.rowIndex +
1
}}
</div>
<div v-if="col.name == 'no'">
{{
(pagination.page - 1) * pagination.rowsPerPage +
props.rowIndex +
1
}}
</div>
<div v-else-if="col.name == 'info'">
<!-- <router-link
target="_blank"

View file

@ -355,7 +355,9 @@ onMounted(async () => {
dense
outlined
:model-value="
formData.year === 0 ? null : Number(formData.year) + 543
formData.year === 0
? 'ทั้งหมด'
: Number(formData.year) + 543
"
:label="`${'ปีงบประมาณ'}`"
>
@ -390,9 +392,17 @@ onMounted(async () => {
option-value="id"
:options="type"
@update:model-value="dataUpdate"
/>
>
<template v-if="formData.type !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(formData.type = 'ALL'), dataUpdate()"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<div class="col-2">
<div class="col-3">
<q-select
v-model="formData.status"
label="สถานะ"
@ -404,7 +414,15 @@ onMounted(async () => {
option-value="id"
:options="dataStore.statusOptions"
@update:model-value="dataUpdate"
/>
class="select_ellipsis2"
>
<template v-if="formData.status !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(formData.status = 'ALL'), dataUpdate()"
class="cursor-pointer"
/> </template
></q-select>
</div>
</div>
</q-card>

View file

@ -313,6 +313,13 @@ function filterSelector(val: any, update: Function, refData: string) {
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
<template v-if="fiscalyear !== 0" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(fiscalyear = 0), searchFilterTable()"
class="cursor-pointer"
/>
</template>
</q-select>
<!-- use-input -->
<div>
@ -364,7 +371,8 @@ function filterSelector(val: any, update: Function, refData: string) {
options-cover
style="min-width: 150px"
class="col-xs-12 col-sm-3 col-md-2"
/>
>
</q-select>
</div>
<div class="col-12">
<q-card bordered class="col-12 filter-card q-pa-sm">
@ -398,6 +406,15 @@ function filterSelector(val: any, update: Function, refData: string) {
</q-item-section>
</q-item>
</template>
<template v-if="OrderType !== ''" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
(OrderType = ''), searchFilterTable()
"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
@ -429,6 +446,15 @@ function filterSelector(val: any, update: Function, refData: string) {
</q-item-section>
</q-item>
</template>
<template v-if="OrderStatus !== 'ทั้งหมด'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
(OrderStatus = 'ทั้งหมด'), searchFilterTable()
"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<q-space />

View file

@ -116,6 +116,7 @@ watch([() => props.modal], () => {
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
</template>
</q-input>
@ -155,8 +156,7 @@ watch([() => props.modal], () => {
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width>
</q-th>
<q-th auto-width> </q-th>
<q-th
v-for="col in props.cols"
:key="col.name"

View file

@ -20,12 +20,12 @@ const { date2Thai } = mixin;
const organizationIdOp = ref<DataOption[]>([]);
const consideredAgencytoptions = ref<DataOption[]>([]);
/*** store ของข้อมูลสืบสวนข้อเท็จจริง */
export const useInvestigateFactStore = defineStore(
"DisciplineInvestigateFact",
() => {
const tabMenu = ref<string>("investigatefacts");
const complaintId = ref<string>("");
const rows = ref<InvestigatefactsDataRowType[]>([]);
const respondentTypeOps = ref<DataOption[]>(
mainStore.complainantoptionsMain
@ -229,7 +229,6 @@ export const useInvestigateFactStore = defineStore(
});
}
/**
* API
* @param data API
@ -238,21 +237,27 @@ export const useInvestigateFactStore = defineStore(
rows.value = await data.map((e: ListData) => {
return {
id: e.id,
title: e.title ? e.title : '-',
respondentType: e.respondentType ? mainStore.convertComplaintType(e.respondentType) : '-',
offenseDetails: e.offenseDetails ? mainStore.convertOffenseDetailst(e.offenseDetails) : '-',
investigationDetail: e.investigationDetail ? convertInvestigationDetail(e.investigationDetail) : '-',
title: e.title ? e.title : "-",
respondentType: e.respondentType
? mainStore.convertComplaintType(e.respondentType)
: "-",
offenseDetails: e.offenseDetails
? mainStore.convertOffenseDetailst(e.offenseDetails)
: "-",
investigationDetail: e.investigationDetail
? convertInvestigationDetail(e.investigationDetail)
: "-",
dateInvestigate:
e.investigationDateStart && e.investigationDateEnd
? `${date2Thai(e.investigationDateStart)} - ${date2Thai(
e.investigationDateEnd
)}`
e.investigationDateEnd
)}`
: "-",
investigationStatusResult: e.investigationStatusResult ? mainStore.convertStatusResult(
e.investigationStatusResult
) : '-',
createdAt: e.createdAt ? date2Thai(e.createdAt as Date) : '-',
status: e.status ? convertStatus(e.status) : '-',
investigationStatusResult: e.investigationStatusResult
? mainStore.convertStatusResult(e.investigationStatusResult)
: "-",
createdAt: e.createdAt ? date2Thai(e.createdAt as Date) : "-",
status: e.status ? convertStatus(e.status) : "-",
};
});
}
@ -281,6 +286,7 @@ export const useInvestigateFactStore = defineStore(
return {
tabMenu,
complaintId,
fecthList,
rows,
daysExtendOps,
@ -296,7 +302,7 @@ export const useInvestigateFactStore = defineStore(
respondentTypeOps,
organizationIdOp,
ocListFn,
statusOptions
statusOptions,
};
}
);

View file

@ -80,11 +80,11 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
style: "font-size: 14px",
},
{
name: "positionLevel",
name: "posLevelName",
align: "left",
label: "ระดับ",
sortable: true,
field: "positionLevel",
field: "posLevelName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -115,7 +115,7 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
"name",
"posNo",
"position",
"positionLevel",
"posLevelName",
"salary",
"organization",
]);