ปรับวินัย

This commit is contained in:
setthawutttty 2024-01-17 17:30:51 +07:00
parent f67c32209e
commit cd307bc0a8
5 changed files with 272 additions and 59 deletions

View file

@ -152,6 +152,7 @@ function validateForm() {
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
@ -160,6 +161,7 @@ function validateForm() {
onSubmit();
} else {
console.log("ไม่ผ่าน ");
console.log(formData)
}
}
@ -346,7 +348,7 @@ function onclickViewinfo(id: string) {
/**
* modal
* @param modal false
* @param modal false
*/
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
@ -598,7 +600,7 @@ onMounted(() => {
:readonly="isReadonly"
hide-bottom-space
v-model="formData.title"
:rules="[(val) => !!val || 'กรุณาการข้อมูล']"
:rules="[(val) => !!val || 'กรุณากรอกเรื่องร้องเรียน']"
lazy-rules
label="เรื่องร้องเรียน"
type="textarea"
@ -689,6 +691,7 @@ onMounted(() => {
option-value="id"
option-label="name"
emit-value
clearable
hide-bottom-space
map-options
@update:model-value="
@ -740,6 +743,13 @@ onMounted(() => {
>
</q-icon>
</template>
<template v-if="formData.dateConsideration && !isReadonly" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="formData.dateConsideration = null"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -761,6 +771,7 @@ onMounted(() => {
emit-value
hide-bottom-space
map-options
clearable
@update:model-value="changeFormData()"
/>
</div>
@ -807,6 +818,14 @@ onMounted(() => {
>
</q-icon>
</template>
<template v-if="formData.dateNotification && !isReadonly" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="formData.dateNotification = null"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -827,6 +846,7 @@ onMounted(() => {
option-label="name"
hide-bottom-space
emit-value
clearable
map-options
@update:model-value="changeFormData()"
/>

View file

@ -163,8 +163,8 @@ const calendarModalclose = () => (calendarModal.value = !calendarModal.value);
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
function validateForm() {
countNum.value = 1
onSubmit();
countNum.value = 1;
onSubmit();
}
/**
@ -173,6 +173,7 @@ function validateForm() {
* หากยกเลกจะกลบไปหนาฟอร
*/
function onSubmit() {
console.log(formData);
dialogConfirm(
$q,
async () => {
@ -212,7 +213,7 @@ async function calEndDate(val: string) {
changeFormData();
const date = await new Date(props.data.investigationDateEnd);
formData.investigationDateEnd = await new Date(
date.setDate(date.getDate() + (Number(val)))
date.setDate(date.getDate() + Number(val))
);
}
@ -293,7 +294,6 @@ watch(props.data, async () => {
} else if (countNum.value === 2) {
formData.disciplineInvestigateRelevantDocs =
props.data.disciplineInvestigateRelevantDocs;
} else if (countNum.value === 3) {
formData.disciplineInvestigateDocs = props.data.disciplineInvestigateDocs;
}
@ -330,7 +330,7 @@ function uploadFile() {
.put(config.API.investigateUploadFile(formData.id), Data)
.then((res) => {
success($q, "อัปโหลดไฟล์สำเร็จ");
countNum.value = 3
countNum.value = 3;
props.getData();
// router.push(`/discipline/complaints`);
})
@ -382,9 +382,7 @@ function confirmDeleteRelevant(id: string) {
.catch((e) => {
messageError($q, e);
})
.finally(() => {
});
.finally(() => {});
}
/**
@ -410,9 +408,7 @@ function confirmDelete(id: string) {
.catch((e) => {
messageError($q, e);
})
.finally(() => {
});
.finally(() => {});
}
async function addPerson(data: any) {
await mainStore.fetchData(data);
@ -585,7 +581,6 @@ async function saveDuty(id: string, duty: string, resolution: string) {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
@ -599,6 +594,38 @@ function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
watch(
() => formData.investigationDetail,
(newValue, oldValue) => {
if (newValue !== "OTHER") {
formData.investigationDetailOther = "";
}
}
);
watch(
() => formData.respondentType,
() => {
if (formData.respondentType !== "ORGANIZATION") {
formData.organizationId = "";
}
}
);
watch(
() => formData.investigationStatusResult,
() => {
if (formData.investigationStatusResult !== "HAVE_CAUSE") {
formData.investigationCauseText = "";
}
}
);
function calculateMinDate() {
const startDate = new Date(formData.investigationDateStart as Date);
startDate.setDate(startDate.getDate() + 1);
return startDate;
}
onMounted(async () => {
mainStore.rowsAdd = [];
getOc();
@ -676,6 +703,7 @@ onMounted(async () => {
v-model="formData.organizationId"
:options="investigateFactStore.organizationIdOp"
label="เลือกสำนักงาน"
clearable
@update:model-value="changeFormData()"
/>
</div>
@ -754,15 +782,15 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<td>
<q-btn
dense
flat
round
color="info"
icon="info"
@click="onclickViewinfo(props.row.personId)"
>
<q-tooltip>อมลในทะเบยนประว</q-tooltip>
</q-btn>
dense
flat
round
color="info"
icon="info"
@click="onclickViewinfo(props.row.personId)"
>
<q-tooltip>อมลในทะเบยนประว</q-tooltip>
</q-btn>
</td>
<q-td
v-for="col in props.cols"
@ -820,6 +848,7 @@ onMounted(async () => {
label="ลักษณะการสืบสวน"
emit-value
map-options
clearable
option-label="name"
option-value="id"
use-input
@ -990,6 +1019,20 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="formData.investigationDateStart && isReadonly === false && formData.investigationExtendHistory.length === 0"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
(formData.investigationDateStart =
null),
(formData.investigationDateEnd = null)
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -1012,6 +1055,7 @@ onMounted(async () => {
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
:min-date="calculateMinDate()"
>
<template #year="{ year }">{{
year + 543
@ -1048,6 +1092,18 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="formData.investigationDateEnd && isReadonly === false && formData.investigationExtendHistory.length === 0"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
formData.investigationDateEnd = null
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -1221,6 +1277,7 @@ onMounted(async () => {
:options="mainStore.statusResultOptions"
label="ผลการสืบสวน"
emit-value
map-options
option-label="name"
option-value="id"
@ -1248,6 +1305,7 @@ onMounted(async () => {
:readonly="isReadonly"
for="#fault"
outlined
clearable
dense
ref="investigationCauseTextRef"
v-model="formData.investigationCauseText"
@ -1553,7 +1611,6 @@ onMounted(async () => {
:id="personId"
@update:modal="updatemodalPersonal"
/>
</template>
<style scope>

View file

@ -608,6 +608,29 @@ function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
watch(
() => formData.disciplinaryStatusResult,
() => {
if (formData.disciplinaryStatusResult !== "HAVE_CAUSE") {
formData.disciplinaryCauseText = "";
}
}
);
watch(
() => formData.disciplinaryFaultLevel,
() => {
if (formData.disciplinaryFaultLevel !== "อื่นๆ") {
formData.disciplinaryFaultLevelOther = "";
}
}
);
function calculateMinDate() {
const startDate = new Date(formData.disciplinaryDateStart as Date);
startDate.setDate(startDate.getDate() + 1);
return startDate;
}
/** Hook */
onMounted(async () => {
mainStore.rowsAdd = [];
@ -864,6 +887,21 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="
formData.disciplinaryDateInvestigation &&
isReadonly === false
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
formData.disciplinaryDateInvestigation = null
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -910,6 +948,21 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="
formData.disciplinaryDateAllegation &&
isReadonly === false
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
formData.disciplinaryDateAllegation = null
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -993,6 +1046,18 @@ onMounted(async () => {
</q-item-section>
</q-item>
</template>
<template
v-if="formData.daysExtend === 0"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
formData.daysExtend = 0
"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
@ -1048,6 +1113,26 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="
formData.disciplinaryDateStart &&
isReadonly === false &&
formData.disciplinaryExtendHistory
.length === 0
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
(formData.disciplinaryDateStart =
null),
(formData.disciplinaryDateEnd =
null)
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -1067,6 +1152,7 @@ onMounted(async () => {
:enableTimePicker="false"
week-start="0"
@update:model-value="changeFormData()"
:min-date="calculateMinDate()"
>
<template #year="{ year }">{{
year + 543
@ -1105,6 +1191,23 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="
formData.disciplinaryDateEnd &&
isReadonly === false &&
formData.disciplinaryExtendHistory
.length === 0
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
formData.disciplinaryDateEnd = null
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -1183,6 +1286,21 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="
formData.disciplinaryDateEvident &&
isReadonly === false
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
formData.disciplinaryDateEvident = null
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -1230,6 +1348,21 @@ onMounted(async () => {
>
</q-icon>
</template>
<template
v-if="
formData.disciplinaryDateResult &&
isReadonly === false
"
v-slot:append
>
<q-icon
name="cancel"
@click.stop.prevent="
formData.disciplinaryDateResult = null
"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>
@ -1378,6 +1511,7 @@ onMounted(async () => {
label="ระดับโทษความผิด"
group-label="group"
group-values="options"
clearable
@update:model-value="changeFormData()"
>
</q-select>
@ -1538,6 +1672,7 @@ onMounted(async () => {
option-label="name"
option-value="id"
use-input
clearable
@update:model-value="changeFormData()"
><template v-slot:no-option>
<q-item>

View file

@ -116,7 +116,7 @@ function validateForm() {
}
}
if (hasError.every((result) => result === true)) {
countNum.value = 1
countNum.value = 1;
onSubmit();
}
}
@ -140,9 +140,7 @@ function onSubmit() {
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
});
.finally(async () => {});
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -161,21 +159,21 @@ watch(
() => props.data,
async () => {
if (countNum.value === 1) {
respondentType.value = props.data.respondentType;
formData.oc = props.data.resultOc;
formData.disciplineType = props.data.resultDisciplineType;
formData.titleType = props.data.resultTitleType;
formData.disciplineDisciplinary_DocResults =
props.data.disciplineDisciplinary_DocResults;
formData.year = props.data.resultYear ?? 0;
mainStore.rowsAdd = props.data.persons;
await fetchDatadetail();
await fetchOrganization();
}else if(countNum.value === 2){
formData.disciplineDisciplinary_DocResults =
props.data.disciplineDisciplinary_DocResults;
respondentType.value = props.data.respondentType;
formData.oc = props.data.resultOc;
formData.disciplineType = props.data.resultDisciplineType;
formData.titleType = props.data.resultTitleType;
formData.disciplineDisciplinary_DocResults =
props.data.disciplineDisciplinary_DocResults;
formData.year = props.data.resultYear ?? 0;
mainStore.rowsAdd = props.data.persons;
await fetchDatadetail();
await fetchOrganization();
} else if (countNum.value === 2) {
formData.disciplineDisciplinary_DocResults =
props.data.disciplineDisciplinary_DocResults;
}
}
}
);
function inputEdit(val: boolean) {
@ -203,7 +201,7 @@ function uploadFile() {
.put(config.API.upLoadFileResult(id.value), Data)
.then((res) => {
success($q, "อัปโหลดไฟล์สำเร็จ");
countNum.value = 2
countNum.value = 2;
props.fetchData();
// router.push(`/discipline/complaints`);
})
@ -261,7 +259,6 @@ function onclickViewinfo(id: string) {
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
</script>
<template>
<div class="row q-col-gutter-sm">
@ -369,22 +366,21 @@ function updatemodalPersonal(modal: boolean) {
col.label
}}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<td>
<q-btn
dense
flat
round
color="info"
icon="info"
@click="onclickViewinfo(props.row.personId)"
>
<q-tooltip>อมลในทะเบยนประว</q-tooltip>
</q-btn>
dense
flat
round
color="info"
icon="info"
@click="onclickViewinfo(props.row.personId)"
>
<q-tooltip>อมลในทะเบยนประว</q-tooltip>
</q-btn>
</td>
<q-td
v-for="col in props.cols"
@ -402,11 +398,9 @@ function updatemodalPersonal(modal: boolean) {
>
{{ props.row.organization }}
</div>
<div
v-else-if="col.name === 'salary'"
>
<div v-else-if="col.name === 'salary'">
{{ props.row.salary.toLocaleString() }}
</div>
</div>
<div v-else>
{{ col.value }}
</div>
@ -494,6 +488,13 @@ function updatemodalPersonal(modal: boolean) {
>
</q-icon>
</template>
<template v-if="formData.year" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="formData.year = 0"
class="cursor-pointer"
/>
</template>
</q-input>
</template>
</datepicker>

View file

@ -359,7 +359,7 @@ function filterSelector(val: any, update: Function, refData: string) {
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
:options="stroe.columns"
option-value="name"
options-cover
style="min-width: 150px"