UI วินัย

This commit is contained in:
setthawutttty 2025-04-21 13:49:16 +07:00
parent c9f625e8d8
commit 818b167b8d
6 changed files with 778 additions and 12 deletions

View file

@ -78,9 +78,9 @@ function getHistory(id: string) {
}
watch(
() => props.personId,
() => props.modal,
() => {
if (props.personId) {
if (props.modal) {
getHistory(props.personId);
}
}

View file

@ -13,14 +13,16 @@ import type {
FormData,
FormRef,
DataOption,
FaultTypeOption,
} from "@/modules/11_discipline/interface/request/Result";
import DialogHistory from "@/modules/11_discipline/components/4_Result/DialogHistory.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
import DialogHeader from "@/components/DialogHeader.vue";
const mainStore = useDisciplineMainStore();
const isEmpType = ref<string>('')
const isEmpType = ref<string>("");
const dataStore = useDisciplineResultStore();
const mixin = useCounterMixin();
const {
@ -31,6 +33,7 @@ const {
showLoader,
dialogRemove,
downloadRenameFileByLink,
dialogMessageNotify,
} = mixin;
const route = useRoute();
@ -55,6 +58,28 @@ const organizationOption = ref<DataOption[]>([]);
const detailRef = ref<Object | null>(null);
const modalHistory = ref<boolean>(false);
const personalId = ref<string>("");
const nameFault = ref<string>("");
const modalFault = ref<boolean>(false);
const remark = ref<string>("");
const checkValue = ref<FaultTypeOption[]>(
JSON.parse(JSON.stringify(mainStore.checkValueFaultT))
);
const offense = ref<string>("");
const offenseOp = ref<DataOption[]>([
{
id: "มาตรา 82",
name: "มาตรา 82",
},
{
id: "มาตรา 83",
name: "มาตรา 83",
},
{
id: "มาตรา 85",
name: "มาตรา 85",
},
]);
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
@ -228,16 +253,41 @@ function closeDetail() {
}
/** เปิดรายละเอียด */
function onclickViewinfo(id: string,type:string) {
function onclickViewinfo(id: string, type: string) {
modalPersonal.value = true;
personId.value = id;
isEmpType.value = type
isEmpType.value = type;
}
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
function onFault(data: any) {
nameFault.value = data.name;
modalFault.value = true;
personalId.value = data.personId;
}
function close() {
modalFault.value = false;
personalId.value = "";
remark.value = "";
checkValue.value = JSON.parse(JSON.stringify(mainStore.checkValueFaultT));
}
function onFaultSubmit() {
if (checkValue.value.some((item) => item.value)) {
dialogConfirm($q, () => {
console.log("onFaultSubmit wait API");
close();
props.fetchData();
});
} else {
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 มาตรา");
}
}
/**
* เชคขอมลจาก props
* เมอมอม
@ -391,13 +441,28 @@ watch(
<template v-slot:body="props">
<q-tr :props="props">
<td>
<q-btn
dense
flat
round
color="edit"
icon="edit"
@click="onFault(props.row)"
>
<q-tooltip>ระบฐานความผ</q-tooltip>
</q-btn>
<q-btn
dense
flat
round
color="info"
icon="mdi-eye"
@click="onclickViewinfo(props.row.personId,props.row.profileType)"
@click="
onclickViewinfo(
props.row.personId,
props.row.profileType
)
"
>
<q-tooltip>อมลในทะเบยนประว</q-tooltip>
</q-btn>
@ -428,7 +493,11 @@ watch(
{{ props.row.organization }}
</div>
<div v-else-if="col.name === 'salary'">
{{ props.row.salary?props.row.salary.toLocaleString():'0' }}
{{
props.row.salary
? props.row.salary.toLocaleString()
: "0"
}}
</div>
<div v-else-if="col.name === 'profileType'">
{{
@ -438,7 +507,7 @@ watch(
}}
</div>
<div v-else>
{{ col.value ?? '-'}}
{{ col.value ?? "-" }}
</div>
</q-td>
</q-tr>
@ -647,6 +716,93 @@ watch(
</q-form>
</div>
<q-dialog v-model="modalFault" persistent>
<q-card class="col-12" style="width: 40vw">
<q-form greedy @submit.prevent @validation-success="onFaultSubmit">
<DialogHeader
:tittle="`ระบุฐานความผิดของ ${nameFault}`"
:close="close"
/>
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="row q-col-gutter-sm">
<div class="col-12">
<q-card
bordered
flat
style="max-height: 500px; overflow-y: scroll"
class="q-pa-sm"
>
<div
v-for="(items, index) in checkValue"
:class="`full-width `"
:key="items.id"
>
<div
:class="`row border_bottom q-py-xs ${
items.id == 1 || items.id == 25
? 'bg-grey-3'
: items.id == 2 || items.id == 14 || items.id == 26
? 'bg-grey-2'
: ''
}`"
:style="index == 0 ? 'border-top: 1px solid #d8d8d8;' : ''"
>
<div class="col-1 text-center">
<q-checkbox
v-if="
items.id !== 2 && items.id !== 14 && items.id !== 26
"
v-model="items.value"
dense
:true-value="true"
:false-value="false"
/>
</div>
<div
:class="items.subId == 0 ? `col-11` : `col-11 q-pl-lg`"
>
{{ items.title }}
</div>
</div>
</div>
<!-- <div class="row">
<div class="col-1">
<q-checkbox
v-model="checkValue"
dense
:true-value="true"
:false-value="false"
/>
</div>
<div class="col-11"></div>
</div> -->
</q-card>
</div>
<div class="col-12">
<q-input
label="หมายเหตุ"
v-model="remark"
outlined
dense
type="textarea"
>
</q-input>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
@ -660,3 +816,12 @@ watch(
:person-id="personalId"
/>
</template>
<style scoped>
.border_bottom {
border-bottom: 1px solid #d8d8d8;
border-radius: 0;
border-left: 1px solid #d8d8d8;
border-right: 1px solid #d8d8d8;
}
</style>