filter ==> ข้อมูลเครื่องราชอิสริยาภรณ์
This commit is contained in:
parent
b4c9762a2a
commit
6b980a118b
3 changed files with 23 additions and 19 deletions
|
|
@ -179,7 +179,6 @@ async function fetchData(id: string) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ยืนยันการบันทึกข้อมูลเครื่องราชอิสริยาภรณ์
|
* ยืนยันการบันทึกข้อมูลเครื่องราชอิสริยาภรณ์
|
||||||
*
|
|
||||||
* dialogStatus.value เป็น "create" จะเพิ่มข้อมูล ถ้าไม่จะเป็นการแก้ไขข้อมูล
|
* dialogStatus.value เป็น "create" จะเพิ่มข้อมูล ถ้าไม่จะเป็นการแก้ไขข้อมูล
|
||||||
*/
|
*/
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
|
|
@ -219,7 +218,6 @@ async function onSubmit() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ปืด popup เพิ่ม,แก้ไข ข้อมูล
|
* ปืด popup เพิ่ม,แก้ไข ข้อมูล
|
||||||
*
|
|
||||||
* และ กำหนดฟอร์ม เพิ่มข้อมูล,แก้ไขข้อมูลเป็น defult
|
* และ กำหนดฟอร์ม เพิ่มข้อมูล,แก้ไขข้อมูลเป็น defult
|
||||||
*/
|
*/
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
|
|
@ -232,7 +230,6 @@ function closeDialog() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hook จำทำเมื่อมีการเรียกใช้ components
|
* hook จำทำเมื่อมีการเรียกใช้ components
|
||||||
*
|
|
||||||
* ทำการดึงรายการข้อมูลเครื่องราชอิสริยาภรณ์ตามลำดับชั้นเครื่องราชอิสริยาภรณ์
|
* ทำการดึงรายการข้อมูลเครื่องราชอิสริยาภรณ์ตามลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
@ -294,12 +291,13 @@ onMounted(async () => {
|
||||||
<q-input
|
<q-input
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
clearable
|
|
||||||
v-model="filterKeyword"
|
v-model="filterKeyword"
|
||||||
placeholder="ค้นหา"
|
placeholder="ค้นหา"
|
||||||
@clear="filterKeyword = ''"
|
@keydown.enter.pervent="
|
||||||
|
store.onSearchData(filterKeyword, columns)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-slot:append v-if="filterKeyword === ''">
|
<template v-slot:append>
|
||||||
<q-icon name="search" />
|
<q-icon name="search" />
|
||||||
</template>
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
@ -325,7 +323,6 @@ onMounted(async () => {
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="store.row"
|
:rows="store.row"
|
||||||
:filter="filterKeyword"
|
|
||||||
row-key="name"
|
row-key="name"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,11 @@ import type {
|
||||||
} from "../interface/response/insignia/Insignia";
|
} from "../interface/response/insignia/Insignia";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
const { date2Thai } = useCounterMixin();
|
const { date2Thai, onSearchDataTable } = useCounterMixin();
|
||||||
|
|
||||||
export const useInsigniaDataStore = defineStore("insigniaData", () => {
|
export const useInsigniaDataStore = defineStore("insigniaData", () => {
|
||||||
const row = ref<DataRow[]>([]);
|
const row = ref<DataRow[]>([]);
|
||||||
|
const rowMain = ref<DataRow[]>([]);
|
||||||
|
|
||||||
async function fetchData(data: DataResponse[], insigniaType?: string) {
|
async function fetchData(data: DataResponse[], insigniaType?: string) {
|
||||||
const list = data.map((e) => ({
|
const list = data.map((e) => ({
|
||||||
|
|
@ -20,12 +21,18 @@ export const useInsigniaDataStore = defineStore("insigniaData", () => {
|
||||||
? date2Thai(e.lastUpdatedAt, false, true)
|
? date2Thai(e.lastUpdatedAt, false, true)
|
||||||
: "-",
|
: "-",
|
||||||
}));
|
}));
|
||||||
list;
|
|
||||||
row.value = list;
|
row.value = list;
|
||||||
|
rowMain.value = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSearchData(keyword: string, columns: any = []) {
|
||||||
|
row.value = onSearchDataTable(keyword, rowMain.value, columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fetchData,
|
fetchData,
|
||||||
row,
|
row,
|
||||||
|
onSearchData,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,14 @@ import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const store = useInsigniaDataStore();
|
const store = useInsigniaDataStore();
|
||||||
const { dialogConfirm, success, messageError, showLoader, hideLoader } =
|
const {
|
||||||
useCounterMixin();
|
dialogConfirm,
|
||||||
|
success,
|
||||||
|
messageError,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
onSearchDataTable,
|
||||||
|
} = useCounterMixin();
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
|
|
@ -93,7 +99,6 @@ const editId = ref<string>(""); // id รายการที่จะแก้
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ดึงข้อมูลเครื่องราชอิสริยาภรณ์
|
* ดึงข้อมูลเครื่องราชอิสริยาภรณ์
|
||||||
*
|
|
||||||
* และบันทึกใน store.fetchData
|
* และบันทึกใน store.fetchData
|
||||||
*/
|
*/
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
|
|
@ -113,7 +118,6 @@ async function fetchData() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ยืนยันการบันทึกข้อมูลเครื่องราชอิสริยาภรณ์
|
* ยืนยันการบันทึกข้อมูลเครื่องราชอิสริยาภรณ์
|
||||||
*
|
|
||||||
* dialogStatus.value เป็น "create" จะเพิ่มข้อมูล ถ้าไม่จะเป็นการแก้ไขข้อมูล
|
* dialogStatus.value เป็น "create" จะเพิ่มข้อมูล ถ้าไม่จะเป็นการแก้ไขข้อมูล
|
||||||
*/
|
*/
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
|
|
@ -147,7 +151,6 @@ function onSubmit() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ปืด popup เพิ่ม,แก้ไข ข้อมูล
|
* ปืด popup เพิ่ม,แก้ไข ข้อมูล
|
||||||
*
|
|
||||||
* และ กำหนดลำดับชั้นเครื่องราช เป็นค่าว่าง สถานะการใช้งาน เป็น false
|
* และ กำหนดลำดับชั้นเครื่องราช เป็นค่าว่าง สถานะการใช้งาน เป็น false
|
||||||
*/
|
*/
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
|
|
@ -166,7 +169,6 @@ function onclickDetail(id: string) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hook จำทำเมื่อมีการเรียกใช้ components
|
* hook จำทำเมื่อมีการเรียกใช้ components
|
||||||
*
|
|
||||||
* ทำการดึงข้อมูลเครื่องราชอิสริยาภรณ์
|
* ทำการดึงข้อมูลเครื่องราชอิสริยาภรณ์
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
@ -200,12 +202,11 @@ onMounted(async () => {
|
||||||
<q-input
|
<q-input
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
clearable
|
|
||||||
v-model="filterKeyword"
|
v-model="filterKeyword"
|
||||||
placeholder="ค้นหา"
|
placeholder="ค้นหา"
|
||||||
@clear="filterKeyword = ''"
|
@keydown.enter.pervent="store.onSearchData(filterKeyword, columns)"
|
||||||
>
|
>
|
||||||
<template v-slot:append v-if="filterKeyword === ''">
|
<template v-slot:append>
|
||||||
<q-icon name="search" />
|
<q-icon name="search" />
|
||||||
</template>
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
@ -230,7 +231,6 @@ onMounted(async () => {
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="store.row"
|
:rows="store.row"
|
||||||
:filter="filterKeyword"
|
|
||||||
row-key="name"
|
row-key="name"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue