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

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

View file

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

View file

@ -91,6 +91,9 @@ const objectAppeal: MyObjectAppealRef = {
caseNumberRef: caseNumberRef,
};
const option = ref<any[]>(dataStore.typeOptions);
const optionStatus = ref<any[]>(dataStore.statusOptionsEdit);
/** หัวข้อที่เเสดงในตารางผู้ถูกร้องเรียน */
const visibleColumns = ref<string[]>([
"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(() => {
dataStore.columns = columns.value;
dataStore.visibleColumns = visibleColumns.value;
@ -360,10 +389,19 @@ onMounted(() => {
lazy-rules
option-label="name"
option-value="id"
:options="dataStore.typeOptions"
:options="option"
:rules="[(val) => !!val || `${'กรุณาเลือกประเภท'}`]"
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 class="col-3" v-if="isReadonly">
<q-select
@ -381,8 +419,17 @@ onMounted(() => {
hide-bottom-space
option-label="name"
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 class="col-2 self-center" v-if="isReadonly">
<q-btn

View file

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

View file

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