เพิ่ม เเสดงข้อมูลก่อนเเก้

This commit is contained in:
setthawutttty 2023-11-21 17:24:42 +07:00
parent bf3bc89636
commit bd20219da9
4 changed files with 28 additions and 5 deletions

View file

@ -1,6 +1,9 @@
<script setup lang="ts">
import { ref, watch } from "vue";
const channel = ref<string>("");
import { useDisciplineChannelDataStore } from "@/modules/11_discipline/store/ChannelStore";
const dataStore = useDisciplineChannelDataStore();
const channel = ref<string>(dataStore.type);
const channelRef = ref<any>();
/**
@ -22,7 +25,7 @@ const props = defineProps({
* เมอมอม
* เกบขอมลลง formData
*/
watch(props.data, async () => {});
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
function save() {

View file

@ -7,6 +7,7 @@ import { useQuasar } from "quasar";
import { useDisciplineChannelDataStore } from "@/modules/11_discipline/store/ChannelStore";
import config from "@/app.config";
import http from "@/plugins/http";
import type { typeItem } from "@/modules/11_discipline/interface/response/channel";
const dataStore = useDisciplineChannelDataStore();
const mixin = useCounterMixin();
@ -39,6 +40,7 @@ const pagination = ref({
* clickไปหนาเพมchanel
*/
const clickAdd = () => {
dataStore.getType('')
router.push(`/discipline/channel/add`);
};
@ -86,6 +88,14 @@ async function deleteData(id: string) {
});
}
/**
* ไปหน แกไข
* @param id type
*/
function editPage(data:typeItem){
dataStore.getType(data.name)
router.push(`/discipline/channel/${data.id}`)
}
/**เมื่อเริ่มโหลดหน้า เรียกใช้ฟังชั่น*/
onMounted(() => {
getComplaintChanal();
@ -173,7 +183,7 @@ onMounted(() => {
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="$router.push(`/discipline/channel/${props.row.id}`)"
@click="editPage(props.row)"
>
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}

View file

@ -2,4 +2,8 @@ interface ChannelRows {
subject: string;
}
export type { ChannelRows };
interface typeItem {
id:string
name:string
}
export type { ChannelRows,typeItem };

View file

@ -37,8 +37,12 @@ export const useDisciplineChannelDataStore = defineStore(
style: "font-size: 14px",
},
]);
const type = ref<string>('')
// ข้อมูลในตาราง
function getType(data:string){
type.value = ''
type.value = data
}
const rows = ref<ChannelRows[]>([]);
function fetchData(data: ChannelRows[]) {
rows.value = data;
@ -49,6 +53,8 @@ export const useDisciplineChannelDataStore = defineStore(
columns,
rows,
fetchData,
type,
getType
};
}
);