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

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

@ -52,7 +52,7 @@ const mixin = useCounterMixin();
const {
date2Thai,
success,
onSearchDataTable,
messageError,
showLoader,
hideLoader,
@ -82,6 +82,7 @@ const modalHistory = ref<boolean>(false); //modal ประวัติการ
const profileId = ref<string>("");
const rows = ref<Certificate[]>([]);
const rowsData = ref<Certificate[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.certicate.columns.length == 0
@ -333,6 +334,7 @@ const saveData = async () => {
await props.fetch("Certificate");
await success($q, "บันทึกข้อมูลสำเร็จ");
rows.value = props.data;
rowsData.value = props.data;
modal.value = false;
})
.catch((e) => {
@ -359,6 +361,7 @@ const editData = async () => {
await props.fetch("Certificate");
await success($q, "บันทึกข้อมูลสำเร็จ");
rows.value = props.data;
rowsData.value = props.data;
modal.value = false;
})
.catch((e) => {
@ -384,6 +387,7 @@ const clickDelete = async () => {
await props.fetch("Certificate");
await success($q, "ลบข้อมูลสำเร็จ");
rows.value = props.data;
rowsData.value = props.data;
modal.value = false;
})
.catch((e) => {
@ -488,6 +492,14 @@ const getClass = (val: boolean) => {
};
};
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
watch(visibleColumns, async (count: String[], prevCount: String[]) => {
changeProfileColumns("certicate", count);
});
@ -497,6 +509,7 @@ onMounted(() => {
profileId.value = route.params.personalId.toString();
}
rows.value = props.data;
rowsData.value = props.data;
});
</script>
<template>
@ -505,7 +518,7 @@ onMounted(() => {
<ProfileTable
:rows="rows"
:columns="columns"
:filter="filter"
:on-search="onSearch"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"

View file

@ -31,6 +31,7 @@ const mixin = useCounterMixin();
const {
success,
dateToISO,
onSearchDataTable,
date2Thai,
messageError,
showLoader,
@ -95,6 +96,7 @@ const editRow = ref<boolean>(false); //เช็คมีการแก้ไ
const checkValidate = ref<boolean>(false); //validate data
const rows = ref<Education[]>(props.data);
const rowsData = ref<Education[]>(props.data);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -456,6 +458,7 @@ const saveData = async () => {
.then(async () => {
await props.fetch("Education");
rows.value = props.data;
rowsData.value = props.data;
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
@ -501,6 +504,7 @@ const editData = async () => {
await props.fetch("Education");
success($q, "บันทึกข้อมูลสำเร็จ");
rows.value = props.data;
rowsData.value = props.data;
modal.value = false;
})
.catch((e) => {
@ -524,6 +528,7 @@ const clickDelete = async () => {
await success($q, "ลบข้อมูลสำเร็จ");
modal.value = false;
rows.value = props.data;
rowsData.value = props.data;
})
.catch((e) => {
messageError($q, e);
@ -669,6 +674,14 @@ const getClass = (val: boolean) => {
};
};
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
watch(startDate, (count, prevCount) => {
minDate.value = new Date(`${startDate.value}-01-01`);
});
@ -691,8 +704,8 @@ onMounted(async () => {
<q-form ref="myForm">
<ProfileTable
:rows="rows"
:on-search="onSearch"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"

View file

@ -11,9 +11,10 @@ const initialPagination = ref<Pagination>({
rowsPerPage: 0,
});
const inputfilter = defineModel<string>("inputfilter", { required: true });
const props = defineProps({
inputfilter: String,
name: String,
onSearch: Function,
icon: String,
inputvisible: Array,
editvisible: Boolean,
@ -99,22 +100,16 @@ const resetFilter = () => {
<q-input
standout
dense
:model-value="inputfilter"
v-model="inputfilter"
ref="filterRef"
@update:model-value="updateInput"
outlined
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
@keydown.enter="props.onSearch?.()"
>
<template v-slot:append>
<q-icon v-if="inputfilter == ''" name="search" />
<q-icon
v-if="inputfilter !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
<q-icon name="search" />
</template>
</q-input>
<!-- แสดงคอลมนใน table -->

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"

View file

@ -14,7 +14,7 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom
const $q = useQuasar();
const selected = ref<AppointMainRows[]>([]);
const mixin = useCounterMixin();
const { dialogConfirm } = mixin;
const { dialogConfirm, onSearchDataTable } = mixin;
const dataMapToSend = computed(() => {
return selected.value.map((i: any) => ({
@ -29,6 +29,7 @@ const dataMapToSend = computed(() => {
const filterKeyword = defineModel<string>("filterKeyword", { required: true });
const rows = defineModel<AppointMainRows[]>("rows", { required: true });
const rowsData = defineModel<AppointMainRows[]>("rowsData", { required: true });
/** props*/
const props = defineProps({
modal: Boolean,
@ -130,6 +131,14 @@ function convertText(val: string) {
}
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
watchEffect(() => {
if (props.modal === true) {
selected.value = [];
@ -153,6 +162,7 @@ watchEffect(() => {
dense
placeholder="ค้นหา"
v-model="filterKeyword"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -178,7 +188,6 @@ watchEffect(() => {
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword.trim()"
row-key="id"
:visible-columns="visibleColumns"
selection="single"

View file

@ -26,6 +26,7 @@ const router = useRouter();
const rows = ref<AppointMainRows[]>([]);
const rowsData = ref<AppointMainRows[]>([]);
const rowsOrder = ref<AppointMainRows[]>([]);
const rowsOrderData = ref<AppointMainRows[]>([]);
const filterKeyword = ref<string>("");
const filterKeywordOrder = ref<string>("");
@ -153,14 +154,17 @@ function convertText(val: string) {
function onSendOrder() {
modalOrder.value = true;
rowsOrder.value = rows.value.filter(
const listData = rows.value.filter(
(item: AppointMainRows) => item.status == "PENDING"
);
rowsOrder.value = listData;
rowsOrderData.value = listData;
}
function closeModal() {
modalOrder.value = false;
rowsOrder.value = [];
rowsOrderData.value = [];
}
function onSearch() {
@ -313,6 +317,7 @@ onMounted(async () => {
v-model:modal="modalOrder"
:close-modal="closeModal"
v-model:rows="rowsOrder"
v-model:rowsData="rowsOrderData"
v-model:filter-keyword="filterKeywordOrder"
:get-data="getData"
/>