เพิ่ม router.push ไปทะเบียน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-22 17:56:24 +07:00
parent c5b95ef15b
commit bbe2dcb273
4 changed files with 44 additions and 21 deletions

View file

@ -6,6 +6,9 @@ import type { QTableProps } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store"; import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useRouter } from "vue-router";
const router = useRouter();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
@ -323,12 +326,11 @@ const addlistperson = async (id: string) => {
// }; // };
const clickmodalEdit = (props: any) => { const clickmodalEdit = (props: any) => {
insignia.value = props.insigniaSend; insignia.value = props.insigniaSend;
insigniaType.value = props.insigniaLevel; // insigniaType.value = props.insigniaLevel;
person.value = props; person.value = props;
console.log(person.value);
modalEdit.value = true; modalEdit.value = true;
fecthInsignia(); fecthInsignia();
fecthInsigniaType(); // fecthInsigniaType();
}; };
const clickSave = () => { const clickSave = () => {
dialogConfirm( dialogConfirm(
@ -343,7 +345,7 @@ const clickSave = () => {
const listEdit = async (profileId: string) => { const listEdit = async (profileId: string) => {
let data: any = { let data: any = {
insigniaId: insignia.value, insigniaId: insignia.value,
insigniaTypeId: insigniaType.value, // insigniaTypeId: insigniaType.value,
}; };
await http await http
.put(config.API.insigniaEdit(profileId), data) .put(config.API.insigniaEdit(profileId), data)
@ -428,7 +430,7 @@ const listdelete = async (profileId: string) => {
const insignia = ref<string>(""); const insignia = ref<string>("");
const insigniaOptions = ref<any>([]); const insigniaOptions = ref<any>([]);
const insigniaType = ref<string>(""); const insigniaType = ref<string>("");
const insigniaTypeOptions = ref<any>([]); // const insigniaTypeOptions = ref<any>([]);
const fecthInsignia = async () => { const fecthInsignia = async () => {
await http await http
@ -436,14 +438,20 @@ const fecthInsignia = async () => {
.then((res) => { .then((res) => {
insigniaOptions.value = res.data.result; insigniaOptions.value = res.data.result;
}) })
.catch((err) => {}); .catch((err) => {
console.log(err);
});
}; };
const fecthInsigniaType = async () => { // const fecthInsigniaType = async () => {
await http(config.API.insigniaType) // await http(config.API.insigniaType)
.then((res) => { // .then((res) => {
insigniaTypeOptions.value = res.data.result; // insigniaTypeOptions.value = res.data.result;
}) // })
.catch((err) => {}); // .catch((err) => {});
// };
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
}; };
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
@ -597,7 +605,11 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr
:props="props"
class="cursor-pointer"
@click="nextPage(props.row.profileId)"
>
<q-td key="no" :props="props"> <q-td key="no" :props="props">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</q-td> </q-td>
@ -846,7 +858,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
style="min-width: 150px" style="min-width: 150px"
/> />
</div> </div>
<div class="col"> <!-- <div class="col">
<q-select <q-select
v-model="insigniaType" v-model="insigniaType"
label="ชั้นเครื่องราชฯ" label="ชั้นเครื่องราชฯ"
@ -864,7 +876,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
:hide-dropdown-icon="false" :hide-dropdown-icon="false"
style="min-width: 150px" style="min-width: 150px"
/> />
</div> </div> -->
</div> </div>
</div> </div>
<q-separator /> <q-separator />
@ -877,7 +889,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
</q-dialog> </q-dialog>
<!-- note --> <!-- note -->
<q-dialog v-model="modalNote" persistent> <!-- <q-dialog v-model="modalNote" persistent>
<q-card style="min-width: 350px"> <q-card style="min-width: 350px">
<q-toolbar> <q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold"> <q-toolbar-title class="text-subtitle2 text-bold">
@ -924,5 +936,5 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
/> />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog> -->
</template> </template>

View file

@ -2,6 +2,9 @@
import { onMounted, ref, watch, reactive } from "vue"; import { onMounted, ref, watch, reactive } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store"; import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useRouter } from "vue-router";
const router = useRouter();
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
@ -159,6 +162,9 @@ const changtypeOc = () => {
} }
DataStore.typeOc = organization.value; DataStore.typeOc = organization.value;
}; };
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
};
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
@ -285,7 +291,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-tr <q-tr
:props="props" :props="props"
class="cursor-pointer" class="cursor-pointer"
@click="nextPage(props.row)" @click="nextPage(props.row.profileId)"
> >
<q-td key="no" :props="props"> <q-td key="no" :props="props">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}

View file

@ -3,7 +3,9 @@ import { onMounted, ref, watch, reactive } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store"; import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useRouter } from "vue-router";
const router = useRouter();
const DataStore = useInsigniaDataStore(); const DataStore = useInsigniaDataStore();
const props = defineProps({ const props = defineProps({
@ -155,6 +157,9 @@ const changtypeOc = () => {
} }
DataStore.typeOc = organization.value; DataStore.typeOc = organization.value;
}; };
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
};
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
@ -280,7 +285,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-tr <q-tr
:props="props" :props="props"
class="cursor-pointer" class="cursor-pointer"
@click="nextPage(props.row)" @click="nextPage(props.row.profileId)"
> >
<q-td key="no" :props="props"> <q-td key="no" :props="props">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}

View file

@ -1,6 +1,7 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { ref, } from "vue"; import { ref, } from "vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
date2Thai date2Thai
@ -12,7 +13,6 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
let typeOc = ref<string>("") let typeOc = ref<string>("")
let rows = ref<any>([]) let rows = ref<any>([])
const listinsignia = ref<any>([]) const listinsignia = ref<any>([])
const typeinsigniaValues: Set<number> = new Set();
const typeinsignia = ref<number | string>("all"); const typeinsignia = ref<number | string>("all");
let typeinsigniaOptions = ref<any>([{ id: "all", name: "ทั้งหมด" }]); let typeinsigniaOptions = ref<any>([{ id: "all", name: "ทั้งหมด" }]);
@ -66,6 +66,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
} }
} }
}; };
return { return {
optionsTypeOc, optionsTypeOc,
typeOc, typeOc,
@ -74,6 +75,5 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
typeinsignia, typeinsignia,
fetchData, fetchData,
searchFilterTable, searchFilterTable,
}; };
}); });