แก้ฟิลเตอร์ระบบ บรรจุ

This commit is contained in:
setthawutttty 2024-12-11 11:49:34 +07:00
parent a15efd7b45
commit b8f336d2ba
7 changed files with 88 additions and 23 deletions

View file

@ -15,7 +15,7 @@ import { useSelectOrgStore } from "@/modules/05_placement/stores/storeSelect";
import { useCounterMixin } from "@/stores/mixin";
/** use*/
const { date2Thai } = useCounterMixin();
const { date2Thai, onSearchDataTable } = useCounterMixin();
const store = useSelectOrgStore();
@ -40,6 +40,7 @@ const optionPosLevel = defineModel<FormPosLevel[]>("optionPosLevel", {
const bmaOfficer = defineModel<string>("bmaOfficer", { required: true });
const positionRows = ref<DataPositionNo[]>(positionData.value);
const positionRowsData = ref<DataPositionNo[]>(positionData.value);
const props = defineProps({
fetchDataTable: Function,
@ -231,10 +232,19 @@ async function onClickSelectPos(id: string) {
// }
// }
function onSearch() {
positionRows.value = onSearchDataTable(
filters.value,
positionRowsData.value,
columns.value ? columns.value : []
);
}
// filter filter
watch(positionData, (newVal, oldVal) => {
if (newVal != oldVal) {
positionRows.value = positionData.value;
positionRowsData.value = positionData.value;
}
});
@ -248,6 +258,7 @@ onMounted(async () => {
}, 1000);
} else {
positionRows.value = positionData.value;
positionRowsData.value = positionData.value;
}
});
</script>
@ -349,9 +360,15 @@ onMounted(async () => {
<div class="row q-gutter-md">
<div>
<q-input outlined dense v-model="filters" label="ค้นหา">
<q-input
outlined
dense
v-model="filters"
label="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" color="grey-5" />
<q-icon name="search" />
</template>
</q-input>
</div>
@ -377,7 +394,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="positionRows"
:filter="filters"
row-key="id"
flat
bordered

View file

@ -36,7 +36,7 @@ const {
success,
dialogConfirm,
date2Thai,
onSearchDataTable
onSearchDataTable,
} = mixin;
/** รับค่ามาจากหน้าหลัก */
@ -67,6 +67,7 @@ const rows = ref<any[]>([]);
const rowsData = ref<any[]>([]);
const rowsAwait = ref<any[]>([]);
const rowsFilter = ref<any>([]);
const rowsFilterData = ref<any>([]);
const rowsOrder = ref<any[]>([]);
const myForm = ref<any>();
const files = ref<any>(null);
@ -402,6 +403,12 @@ async function getTable() {
e.nodeName !== null &&
e.reportingDate !== null
);
rowsFilterData.value = await rows.value.filter(
(e: any) =>
e.draft == "รอส่งตัว" &&
e.nodeName !== null &&
e.reportingDate !== null
);
DataStore.checkLoad(1);
// insertAvatar(rows.value);
})
@ -838,6 +845,14 @@ function onSearch() {
);
}
function onSearchAdd() {
rowsFilter.value = onSearchDataTable(
filterlistAdd.value,
rowsFilterData.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
await getWorkFlow();
await getTable();
@ -1406,6 +1421,7 @@ onMounted(async () => {
v-model="filterlistAdd"
placeholder="ค้นหา"
style="width: 850px; max-width: auto"
@keydown.enter="onSearchAdd"
>
<template v-slot:append>
<q-icon name="search" />
@ -1422,7 +1438,6 @@ onMounted(async () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
class="gt-xs q-ml-sm"
/>
@ -1436,7 +1451,6 @@ onMounted(async () => {
dense
:rows="rowsFilter"
:columns="columns"
:filter="filterlistAdd"
row-key="name"
class="custom-header-table"
selection="multiple"