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

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

@ -53,7 +53,9 @@ const myForm = ref<QForm>();
//option //option
const typeOrderOption = ref<DataOption1[]>([]); const typeOrderOption = ref<DataOption1[]>([]);
const byOrderOption = ref<DataOption1[]>([]); const byOrderOption = ref<DataOption1[]>([]);
const byOrderOptionUse = ref<DataOption1[]>([]);
const CommandOption = ref<DataOption1[]>([]); const CommandOption = ref<DataOption1[]>([]);
const CommandOptionUse = ref<DataOption1[]>([]);
//Main //Main
const typeOrder = ref<any>(); const typeOrder = ref<any>();
@ -739,6 +741,7 @@ const columnsModal = ref<QTableProps["columns"]>([
const rowsModal = ref<ResponseOrganiz[]>([]); const rowsModal = ref<ResponseOrganiz[]>([]);
const clickAction = ref<string>(""); const clickAction = ref<string>("");
const filterModal = ref<string>(""); const filterModal = ref<string>("");
const optionCPM = ref<DataOption1[]>([]);
// tree // tree
const nodeTree = async () => { const nodeTree = async () => {
showLoader(); showLoader();
@ -812,11 +815,31 @@ const clickSavelist = () => {
}; };
const filterSelector = (val: any, update: Function, fullname: any) => { const filterSelector = (val: any, update: Function, fullname: any) => {
update(() => { if (fullname == "typeOrderOption") {
typeOrderOption.value = typeOrderFilter.value.filter( update(() => {
(v: any) => v.fullname.toLowerCase().indexOf(val.toLowerCase()) > -1 typeOrderOption.value = typeOrderFilter.value.filter(
); (v: any) => v.fullname.toLowerCase().indexOf(val.toLowerCase()) > -1
}); );
});
} else if (fullname == "byOrder") {
update(() => {
byOrderOptionUse.value = byOrderOption.value.filter(
(v: any) => v.name.toLowerCase().indexOf(val.toLowerCase()) > -1
);
});
} else if (fullname == "nameCommand") {
update(() => {
CommandOptionUse.value = CommandOption.value.filter(
(v: any) => v.name.toLowerCase().indexOf(val.toLowerCase()) > -1
);
});
} else if (fullname == "C-PM") {
update(() => {
optionCPM.value = DataStore.complaintOption.filter(
(v: any) => v.name.toLowerCase().indexOf(val.toLowerCase()) > -1
);
});
}
}; };
/** /**
@ -855,7 +878,14 @@ const getClass = (val: boolean) => {
@filter="(inputValue:any, @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'typeOrderOption' doneFn:Function) => filterSelector(inputValue, doneFn,'typeOrderOption'
) " ) "
/> ><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template></q-select
>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<q-input <q-input
@ -951,7 +981,7 @@ const getClass = (val: boolean) => {
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<selector <q-select
:class="getClass(true)" :class="getClass(true)"
outlined outlined
dense dense
@ -962,12 +992,23 @@ const getClass = (val: boolean) => {
:label="`${'คำสั่งโดย'}`" :label="`${'คำสั่งโดย'}`"
map-options map-options
option-label="name" option-label="name"
:options="byOrderOption" :options="byOrderOptionUse"
option-value="id" option-value="id"
use-input use-input
input-debounce="0" input-debounce="0"
@update:model-value="(nameCommand = ''), (positionCommand = '')" @update:model-value="(nameCommand = ''), (positionCommand = '')"
/> @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'byOrder'
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div> </div>
<div <div
class="col-xs-12 col-md-6" class="col-xs-12 col-md-6"
@ -983,11 +1024,21 @@ const getClass = (val: boolean) => {
:label="`${'ผู้มีอำนาจลงนาม'}`" :label="`${'ผู้มีอำนาจลงนาม'}`"
map-options map-options
option-label="name" option-label="name"
:options="CommandOption" :options="CommandOptionUse"
option-value="id" option-value="id"
use-input use-input
input-debounce="0" input-debounce="0"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'nameCommand'
) "
> >
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
<template v-if="CommandOption.length === 0" v-slot:no-option> <template v-if="CommandOption.length === 0" v-slot:no-option>
<q-item> <q-item>
<q-item-section class="text-primary"> <q-item-section class="text-primary">
@ -2030,11 +2081,22 @@ const getClass = (val: boolean) => {
:label="`${'เรื่องร้องเรียน'}`" :label="`${'เรื่องร้องเรียน'}`"
map-options map-options
option-label="name" option-label="name"
:options="DataStore.complaintOption" :options="optionCPM"
option-value="id" option-value="id"
use-input use-input
input-debounce="0" input-debounce="0"
/> @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'C-PM'
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</selector>
</div> </div>
</div> </div>
@ -2248,11 +2310,22 @@ const getClass = (val: boolean) => {
:label="`${'เรื่องร้องเรียน'}`" :label="`${'เรื่องร้องเรียน'}`"
map-options map-options
option-label="name" option-label="name"
:options="DataStore.complaintOption" :options="optionCPM"
option-value="id" option-value="id"
use-input use-input
input-debounce="0" input-debounce="0"
/> @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'C-PM'
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</selector>
</div> </div>
<div class="col-xs-12 col-md-6"></div> <div class="col-xs-12 col-md-6"></div>

View file

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

View file

@ -157,6 +157,12 @@ const dateEndInputStyle = computed(() => {
return isInNext7Days ? "input-alert" : ""; return isInNext7Days ? "input-alert" : "";
} }
}); });
const option = ref<any[]>(mainStore.statusResultOptions);
const optionOrganization = ref<any[]>(organizationOption.value);
const optionFaultLevel = ref<any[]>(investigateDis.optionsfaultLevel);
const optionCauseText = ref<any[]>(investigateDis.causeTextOptions);
/** เปิด dialog */ /** เปิด dialog */
function popup() { function popup() {
modal.value = true; modal.value = true;
@ -679,13 +685,12 @@ function deletePerson(id: string) {
} }
const option = ref<any[]>(mainStore.statusResultOptions);
/** /**
* function นหาขอมลใน option * function นหาขอมลใน option
* @param val คำคนหา * @param val คำคนหา
* @param update function * @param update function
*/ */
function filterOptionFn(val: string, update: Function) { function filterOptionFn(val: string, update: Function) {
update(() => { update(() => {
option.value = mainStore.statusResultOptions.filter( option.value = mainStore.statusResultOptions.filter(
(e: any) => e.name.search(val) !== -1 (e: any) => e.name.search(val) !== -1
@ -693,6 +698,48 @@ const option = ref<any[]>(mainStore.statusResultOptions);
}); });
} }
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFnOrganization(val: string, update: Function) {
update(() => {
optionOrganization.value = organizationOption.value.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFnFaultLevel(val: string, update: Function) {
update(() => {
optionFaultLevel.value = investigateDis.optionsfaultLevel.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFnCauseText(val: string, update: Function) {
update(() => {
optionCauseText.value = investigateDis.causeTextOptions.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
/** Hook */ /** Hook */
onMounted(async () => { onMounted(async () => {
mainStore.rowsAdd = []; mainStore.rowsAdd = [];
@ -772,10 +819,19 @@ onMounted(async () => {
option-value="id" option-value="id"
map-options map-options
v-model="organization" v-model="organization"
:options="organizationOption" :options="optionOrganization"
label="หน่วยงานที่ถูกร้องเรียน" label="หน่วยงานที่ถูกร้องเรียน"
@update:model-value="changeFormData()" @update:model-value="changeFormData()"
/> use-input
@filter="filterOptionFnOrganization"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template></q-select
>
</div> </div>
<div <div
class="col-xs-12 col-sm-4" class="col-xs-12 col-sm-4"
@ -1565,13 +1621,21 @@ onMounted(async () => {
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
:options="investigateDis.optionsfaultLevel" :options="optionFaultLevel"
label="ระดับโทษความผิด" label="ระดับโทษความผิด"
group-label="group" group-label="group"
group-values="options" group-values="options"
clearable clearable
@update:model-value="changeFormData()" @update:model-value="changeFormData()"
> use-input
@filter="filterOptionFnFaultLevel"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select> </q-select>
</div> </div>
<div <div
@ -1721,13 +1785,14 @@ onMounted(async () => {
dense dense
ref="disciplinaryCauseTextRef" ref="disciplinaryCauseTextRef"
v-model="formData.disciplinaryCauseText" v-model="formData.disciplinaryCauseText"
:options="investigateDis.causeTextOptions" :options="optionCauseText"
label="ร้ายแรง/ไม่ร้ายแรง" label="ร้ายแรง/ไม่ร้ายแรง"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
use-input use-input
@filter="filterOptionFnCauseText"
clearable clearable
@update:model-value="changeFormData()" @update:model-value="changeFormData()"
><template v-slot:no-option> ><template v-slot:no-option>

View file

@ -91,6 +91,9 @@ const objectAppeal: MyObjectAppealRef = {
caseNumberRef: caseNumberRef, caseNumberRef: caseNumberRef,
}; };
const option = ref<any[]>(dataStore.typeOptions);
const optionStatus = ref<any[]>(dataStore.statusOptionsEdit);
/** หัวข้อที่เเสดงในตารางผู้ถูกร้องเรียน */ /** หัวข้อที่เเสดงในตารางผู้ถูกร้องเรียน */
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"no", "no",
@ -329,6 +332,32 @@ function onSubmit() {
}); });
} }
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFn(val: string, update: Function) {
update(() => {
option.value = dataStore.typeOptions.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFnStatus(val: string, update: Function) {
update(() => {
optionStatus.value = dataStore.statusOptionsEdit.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
onMounted(() => { onMounted(() => {
dataStore.columns = columns.value; dataStore.columns = columns.value;
dataStore.visibleColumns = visibleColumns.value; dataStore.visibleColumns = visibleColumns.value;
@ -360,10 +389,19 @@ onMounted(() => {
lazy-rules lazy-rules
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="dataStore.typeOptions" :options="option"
:rules="[(val) => !!val || `${'กรุณาเลือกประเภท'}`]" :rules="[(val) => !!val || `${'กรุณาเลือกประเภท'}`]"
hide-bottom-space hide-bottom-space
/> 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>
<div class="col-3" v-if="isReadonly"> <div class="col-3" v-if="isReadonly">
<q-select <q-select
@ -381,8 +419,17 @@ onMounted(() => {
hide-bottom-space hide-bottom-space
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="dataStore.statusOptionsEdit" :options="optionStatus"
/> use-input
@filter="filterOptionFnStatus"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template></q-select
>
</div> </div>
<div class="col-2 self-center" v-if="isReadonly"> <div class="col-2 self-center" v-if="isReadonly">
<q-btn <q-btn

View file

@ -316,7 +316,7 @@ function filterSelector(val: any, update: Function, refData: string) {
<template v-if="fiscalyear !== 0" v-slot:append> <template v-if="fiscalyear !== 0" v-slot:append>
<q-icon <q-icon
name="cancel" name="cancel"
@click.stop.prevent="(fiscalyear = 0), searchFilterTable()" @click.stop.prevent="(fiscalyearOP = fiscalyearFilter1)(fiscalyear = 0), searchFilterTable()"
class="cursor-pointer" class="cursor-pointer"
/> />
</template> </template>
@ -410,7 +410,7 @@ function filterSelector(val: any, update: Function, refData: string) {
<q-icon <q-icon
name="cancel" name="cancel"
@click.stop.prevent=" @click.stop.prevent="
(OrderType = ''), searchFilterTable() (OrderTypeOption = OrderTypeFilter1),(OrderType = ''), searchFilterTable()
" "
class="cursor-pointer" class="cursor-pointer"
/> />
@ -450,7 +450,7 @@ function filterSelector(val: any, update: Function, refData: string) {
<q-icon <q-icon
name="cancel" name="cancel"
@click.stop.prevent=" @click.stop.prevent="
(OrderStatus = 'ทั้งหมด'), searchFilterTable() (OrderStatusOption = OrderStatusFilter1),(OrderStatus = 'ทั้งหมด'), searchFilterTable()
" "
class="cursor-pointer" class="cursor-pointer"
/> />

View file

@ -221,7 +221,7 @@ export const useInvestigateFactStore = defineStore(
update(() => { update(() => {
const needle = val.toLowerCase(); const needle = val.toLowerCase();
if (type === "filtercomplainantType") { if (type === "filterrespondentType") {
respondentTypeOps.value = mainStore.complainantoptionsMain.filter( respondentTypeOps.value = mainStore.complainantoptionsMain.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1 (v: any) => v.name.toLowerCase().indexOf(needle) > -1
); );