เพิ่ม filter typeOrder

This commit is contained in:
AnandaTon 2023-09-27 13:20:08 +07:00
parent 04ce570654
commit c22e028890

View file

@ -112,6 +112,10 @@ const conclusionFireNo = ref<string>("");
const conclusionFireDate = ref<Date>(new Date());
const conclusionFireResolution = ref<string>("");
const typeOrderFilter = ref<any>({
typeOrderOption: [],
});
onMounted(async () => {
if (orderId) {
fecthTypeOption("hasData");
@ -149,6 +153,13 @@ const fecthTypeOption = async (actions: string) => {
commandCode: e.commandCode,
fullname: e.commandCode + " " + e.name,
}));
typeOrderFilter.value = res.data.result.map((e: OrederResult) => ({
id: e.id,
name: e.name,
category: e.category,
commandCode: e.commandCode,
fullname: e.commandCode + " " + e.name,
}));
})
.catch((e) => {
messageError($q, e);
@ -598,6 +609,14 @@ const clickSavelist = () => {
} else dialogMessageNotify($q, "โปรดเลือกรายชื่อ");
};
const filterSelector = (val: any, update: Function, fullname: any) => {
update(() => {
typeOrderOption.value = typeOrderFilter.value.filter(
(v: any) => v.fullname.toLowerCase().indexOf(val.toLowerCase()) > -1
);
});
};
/**
* class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ
* @param val อม input สำหรบแกไขหรอไม
@ -631,6 +650,9 @@ const getClass = (val: boolean) => {
use-input
input-debounce="0"
@update:model-value="selectCMP(typeOrder)"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'typeOrderOption'
) "
/>
</div>
<div class="col-xs-12 col-md-6">
@ -819,6 +841,8 @@ const getClass = (val: boolean) => {
hide-bottom-space
/>
</div>
{{ typeOrder }}
{{ typeOrder.commandCode }}
<div class="col-12 q-mb-md" v-if="typeOrder.commandCode">
<q-separator />
</div>