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

View file

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

View file

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

View file

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