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