เพิ่ม เเสดงข้อมูลก่อนเเก้
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">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from "vue";
|
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>();
|
const channelRef = ref<any>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,7 +25,7 @@ const props = defineProps({
|
||||||
* เมื่อมีข้อมูล
|
* เมื่อมีข้อมูล
|
||||||
* เก็บข้อมูลลง formData
|
* เก็บข้อมูลลง formData
|
||||||
*/
|
*/
|
||||||
watch(props.data, async () => {});
|
|
||||||
|
|
||||||
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
|
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
|
||||||
function save() {
|
function save() {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { useQuasar } from "quasar";
|
||||||
import { useDisciplineChannelDataStore } from "@/modules/11_discipline/store/ChannelStore";
|
import { useDisciplineChannelDataStore } from "@/modules/11_discipline/store/ChannelStore";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
import type { typeItem } from "@/modules/11_discipline/interface/response/channel";
|
||||||
|
|
||||||
const dataStore = useDisciplineChannelDataStore();
|
const dataStore = useDisciplineChannelDataStore();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
|
|
@ -39,6 +40,7 @@ const pagination = ref({
|
||||||
* clickไปหน้าเพิ่มchanel
|
* clickไปหน้าเพิ่มchanel
|
||||||
*/
|
*/
|
||||||
const clickAdd = () => {
|
const clickAdd = () => {
|
||||||
|
dataStore.getType('')
|
||||||
router.push(`/discipline/channel/add`);
|
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(() => {
|
onMounted(() => {
|
||||||
getComplaintChanal();
|
getComplaintChanal();
|
||||||
|
|
@ -173,7 +183,7 @@ onMounted(() => {
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
@click="$router.push(`/discipline/channel/${props.row.id}`)"
|
@click="editPage(props.row)"
|
||||||
>
|
>
|
||||||
<div v-if="col.name === 'no'">
|
<div v-if="col.name === 'no'">
|
||||||
{{ props.rowIndex + 1 }}
|
{{ props.rowIndex + 1 }}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,8 @@ interface ChannelRows {
|
||||||
subject: string;
|
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",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const type = ref<string>('')
|
||||||
// ข้อมูลในตาราง
|
// ข้อมูลในตาราง
|
||||||
|
function getType(data:string){
|
||||||
|
type.value = ''
|
||||||
|
type.value = data
|
||||||
|
}
|
||||||
const rows = ref<ChannelRows[]>([]);
|
const rows = ref<ChannelRows[]>([]);
|
||||||
function fetchData(data: ChannelRows[]) {
|
function fetchData(data: ChannelRows[]) {
|
||||||
rows.value = data;
|
rows.value = data;
|
||||||
|
|
@ -49,6 +53,8 @@ export const useDisciplineChannelDataStore = defineStore(
|
||||||
columns,
|
columns,
|
||||||
rows,
|
rows,
|
||||||
fetchData,
|
fetchData,
|
||||||
|
type,
|
||||||
|
getType
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue