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

This commit is contained in:
setthawutttty 2024-12-04 13:47:44 +07:00
parent 7ab17d378f
commit 992541eded
20 changed files with 674 additions and 488 deletions

View file

@ -18,7 +18,7 @@ const $q = useQuasar();
const storeCommand = useCommandMainStore();
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const { dialogConfirm, date2Thai } = useCounterMixin();
const { dialogConfirm, date2Thai, onSearchDataTable } = useCounterMixin();
/**
* props
@ -29,8 +29,6 @@ const props = defineProps({
resetFilter: Function,
fecthlistOthet: Function,
optionsType: Array,
rows2: Array as PropType<listMain[]>,
filterKeyword2: String,
type: String,
});
const emit = defineEmits([
@ -39,8 +37,12 @@ const emit = defineEmits([
"update:selected",
]);
const filterKeyword2 = defineModel<string>("filterKeyword2", {
required: true,
});
const rows = defineModel<listMain[]>("rows", { required: true });
const rowsData = defineModel<listMain[]>("rowsData", { required: true });
//Table
const rows = ref<listMain[]>([]); //
const selected = ref<listMain[]>([]); //
const dataMapToSend = computed(() => {
return selected.value.map((i: any) => ({
@ -174,6 +176,14 @@ function filterSelector(val: string, update: Function) {
});
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword2.value,
rowsData.value,
columns2.value ? columns2.value : []
);
}
/**
* เม props.modal เป tru
* กำหนดให selected เปนคาวาง
@ -182,7 +192,7 @@ watch(
() => props.Modal,
async () => {
if (props.Modal === true) {
rows.value = props.rows2 ? props.rows2 : [];
rows.value = rowsData.value ? rowsData.value : [];
selected.value = [];
commandType.value = "";
const data = await storeCommand.getCommandTypes();
@ -239,9 +249,9 @@ watch(
outlined
dense
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
v-model="filterKeyword2"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -266,8 +276,7 @@ watch(
<div class="col-12">
<d-table
:columns="columns2"
:rows="props.rows2"
:filter="filterKeyword2"
:rows="rows"
row-key="profileId"
flat
:visible-columns="visibleColumns2"