diff --git a/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue b/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue
index 1a1e2b83c..8d736d6aa 100644
--- a/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue
+++ b/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue
@@ -1,5 +1,5 @@
-
+
@@ -192,6 +211,7 @@ watchEffect(() => {
dense
:model-value="filterKeyword2"
@update:model-value="updateInput"
+ @keydown.enter="onSearch"
placeholder="ค้นหา"
>
@@ -217,8 +237,7 @@ watchEffect(() => {
-import { ref, watchEffect, computed } from "vue";
+import { ref, watch, computed } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@@ -30,7 +30,7 @@ const dataMapToSend = computed(() => {
}));
});
const mixin = useCounterMixin();
-const { dialogConfirm, date2Thai } = mixin;
+const { dialogConfirm, date2Thai, onSearchDataTable } = mixin;
/** props*/
const props = defineProps({
@@ -43,6 +43,8 @@ const props = defineProps({
});
//Table
+const rowsData = ref([]);
+const rowsDataMain = ref([]);
const columns = ref([
{
name: "no",
@@ -60,7 +62,10 @@ const columns = ref([
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
- field: (row) => `${row.prefix}${row.firstName} ${row.lastName}`,
+ field: "fullname",
+ format(val, row) {
+ return `${row.prefix}${row.firstName} ${row.lastName}`;
+ },
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@@ -129,7 +134,10 @@ const columns = ref([
align: "left",
label: "สถานะ",
sortable: true,
- field: (row) => statusText(row.status),
+ field: "status",
+ format(val, row) {
+ return statusText(row.status);
+ },
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@@ -166,15 +174,31 @@ function updateInput(value: any) {
emit("update:filterKeyword2", value);
}
-watchEffect(() => {
- if (props.modal === true) {
- selected.value = [];
+async function onSearch() {
+ rowsData.value = onSearchDataTable(
+ props.filterKeyword2 ? props.filterKeyword2 : "",
+ rowsDataMain.value,
+ columns.value ? columns.value : []
+ );
+}
+
+watch(
+ () => props.modal,
+ (val) => {
+ if (val) {
+ selected.value = [];
+ rowsData.value = props.rows ? props.rows : [];
+ rowsDataMain.value = props.rows ? props.rows : [];
+ } else {
+ rowsData.value = [];
+ rowsDataMain.value = [];
+ }
}
-});
+);
-
+
@@ -188,6 +212,7 @@ watchEffect(() => {
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
+ @keydown.enter="onSearch"
>
@@ -212,8 +237,7 @@ watchEffect(() => {
(false);
const selectedModal = ref([]);
const rows = ref([]);
+const rowsMain = ref([]);
const editRows = ref([]);
/** selcet OPtion */
@@ -59,7 +61,6 @@ const optionSelect = ref([
{ id: 1, name: "อีเมล" },
{ id: 2, name: "กล่องข้อความ" },
]);
-
/** คอลัมน์ที่แสดง */
const visibleColumns = ref([
"no",
@@ -158,6 +159,7 @@ async function getData() {
});
}
rows.value = list;
+ rowsMain.value = list;
})
.catch((e) => {
messageError($q, e);
@@ -189,12 +191,6 @@ async function saveData() {
});
}
-function resetFilter() {
- // reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
- filter.value = "";
- filterRef.value!.focus();
-}
-
/**
* class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ
* @param val ข้อมูล input สำหรับแก้ไขหรือไม่
@@ -257,7 +253,7 @@ async function saveDataCopyOrder() {
//อัพเดทข้อมูลหลัง Save
async function fetchSaveCopyOrder() {
let list: requestSendNoti[] = [];
- rows.value.map((r: DataCopyOrder) => {
+ rowsMain.value.map((r: DataCopyOrder) => {
list.push({
profileId: r.personalId,
isSendMail: r.mutiselect.includes(1),
@@ -285,6 +281,14 @@ function updateData(row: DataCopyOrder) {
editRows.value.push(row);
}
+async function onSearch() {
+ rows.value = onSearchDataTable(
+ filter.value,
+ rowsMain.value,
+ columns.value ? columns.value : []
+ );
+}
+
/** Hook */
onMounted(async () => {
await getData();
@@ -322,6 +326,7 @@ onMounted(async () => {
outlined
placeholder="ค้นหา"
class="q-ml-sm"
+ @keydown.enter="onSearch"
>
@@ -349,7 +354,6 @@ onMounted(async () => {
:rows="rows"
:columns="columns"
:visible-columns="visibleColumns"
- :filter="filter.trim()"
row-key="idCard"
>