ฟิลเตอร์วินัย ออกคำสั่ง

This commit is contained in:
STW_TTTY\stwtt 2024-07-10 17:39:16 +07:00
parent 68e241693a
commit 5528e68bc1
6 changed files with 272 additions and 38 deletions

View file

@ -71,6 +71,10 @@ const investigationExtendStatus = ref<boolean>(false);
const isSave = ref<boolean>(false); //
const isReadonly = ref<boolean>(false); //
const option = ref<any[]>(investigateFactStore.organizationIdOp);
const optionStatusResult = ref<any[]>(mainStore.statusResultOptions);
const optionCauseText = ref<any[]>(mainStore.statusResultOptions);
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
data: {
@ -683,6 +687,44 @@ watch(
}
);
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFn(val: string, update: Function) {
update(() => {
option.value = investigateFactStore.organizationIdOp.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFnStatusResult(val: string, update: Function) {
update(() => {
optionStatusResult.value = mainStore.statusResultOptions.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFnCauseText(val: string, update: Function) {
update(() => {
optionCauseText.value = mainStore.causeTextOptions.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
onMounted(async () => {
mainStore.rowsAdd = [];
getActive();
@ -762,11 +804,20 @@ onMounted(async () => {
option-label="name"
option-value="id"
v-model="organization"
:options="investigateFactStore.organizationIdOp"
:options="option"
label="หน่วยงานที่ถูกร้องเรียน"
clearable
@update:model-value="changeFormData()"
/>
use-input
@filter="filterOptionFn"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template></q-select
>
</div>
<div
class="col-xs-12 col-sm-4"
@ -1346,16 +1397,14 @@ onMounted(async () => {
:readonly="isReadonly"
ref="investigationStatusResultRef"
v-model="formData.investigationStatusResult"
:options="mainStore.statusResultOptions"
:options="optionStatusResult"
label="ผลการสืบสวน"
emit-value
map-options
option-label="name"
option-value="id"
use-input
@filter="(inputValue: any,
doneFn: Function) => filterFnOptionsType(inputValue, doneFn, 'faultOp'
)"
@filter="filterOptionFnStatusResult"
@update:model-value="changeFormData()"
><template v-slot:no-option>
<q-item>
@ -1380,7 +1429,7 @@ onMounted(async () => {
dense
ref="investigationCauseTextRef"
v-model="formData.investigationCauseText"
:options="mainStore.causeTextOptions"
:options="optionCauseText"
label="ร้ายแรง/ไม่ร้ายแรง"
emit-value
map-options
@ -1388,6 +1437,7 @@ onMounted(async () => {
option-value="id"
use-input
@update:model-value="changeFormData()"
@filter="filterOptionFnCauseText"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
@ -1545,7 +1595,7 @@ onMounted(async () => {
v-if="!isReadonly && formData.id !== ''"
class="col-12 row"
>
<!-- accept=".pdf,.xlsx,.docx" -->
<!-- accept=".pdf,.xlsx,.docx" -->
<q-file
for="inputFiles"
class="col-12"
@ -1554,7 +1604,6 @@ onMounted(async () => {
v-model="formData.documentFile"
@added="uploadFile"
label="ไฟล์เอกสารหลักฐาน"
clearable
>
<template v-slot:prepend>