เพิ่ม เเสดงข้อมูลก่อนเเก้
This commit is contained in:
parent
bf3bc89636
commit
bd20219da9
4 changed files with 28 additions and 5 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,8 @@ interface ChannelRows {
|
|||
subject: string;
|
||||
}
|
||||
|
||||
export type { ChannelRows };
|
||||
interface typeItem {
|
||||
id:string
|
||||
name:string
|
||||
}
|
||||
export type { ChannelRows,typeItem };
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue