emit
This commit is contained in:
parent
13b5589083
commit
c76af202de
2 changed files with 19 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ import type { QTableProps } from "quasar";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogConfirm } = mixin;
|
const { dialogConfirm, dialogMessageNotify } = mixin;
|
||||||
|
|
||||||
interface typeOp {
|
interface typeOp {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -127,6 +127,9 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**ส่งค่ากลับหน้าหลัก */
|
||||||
|
const emit = defineEmits(["returnData"]);
|
||||||
|
|
||||||
/** ปิด dialog */
|
/** ปิด dialog */
|
||||||
async function close() {
|
async function close() {
|
||||||
console.log("close");
|
console.log("close");
|
||||||
|
|
@ -135,13 +138,17 @@ async function close() {
|
||||||
|
|
||||||
/** เปิด dialog ยืนยัน */
|
/** เปิด dialog ยืนยัน */
|
||||||
function savePost() {
|
function savePost() {
|
||||||
dialogConfirm($q, () => saveData());
|
if (selected.value.length != 0) {
|
||||||
|
dialogConfirm($q, () => saveData());
|
||||||
|
} else {
|
||||||
|
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 รายการ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** save data หลังจาก ยืนยัน */
|
/** save data หลังจาก ยืนยัน */
|
||||||
function saveData() {
|
function saveData() {
|
||||||
console.log("save #in component", selected.value);
|
|
||||||
props.save();
|
props.save();
|
||||||
|
emit("returnData", selected.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** input ค้นหา */
|
/** input ค้นหา */
|
||||||
|
|
|
||||||
|
|
@ -357,6 +357,14 @@ watch(props.data, async () => {
|
||||||
formData.files = props.data.files;
|
formData.files = props.data.files;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังชั่น รับค่าจาก คอมโพเเนน
|
||||||
|
* @param returnData ค่าที่ได้คืนมา
|
||||||
|
*/
|
||||||
|
function handleSave(returnData:any) {
|
||||||
|
console.log('returnData:', returnData);
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
complainstStore.columns = columns.value;
|
complainstStore.columns = columns.value;
|
||||||
complainstStore.visibleColumns = visibleColumns.value;
|
complainstStore.visibleColumns = visibleColumns.value;
|
||||||
|
|
@ -464,6 +472,7 @@ onMounted(() => {
|
||||||
btn-title="เพิ่มรายชื่อผู้ถูกสอบสวน"
|
btn-title="เพิ่มรายชื่อผู้ถูกสอบสวน"
|
||||||
:close="toggleModal"
|
:close="toggleModal"
|
||||||
:save="addPerson"
|
:save="addPerson"
|
||||||
|
@returnData="handleSave"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue