เพิ่ม dialog

This commit is contained in:
setthawutttty 2023-08-18 11:11:37 +07:00
parent 4da9bdd7f0
commit b412634096
17 changed files with 264 additions and 194 deletions

View file

@ -323,7 +323,7 @@ const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const { date2Thai, success, messageError, showLoader, hideLoader, dialogConfirm } = mixin;
const edit = ref<boolean>(false);
const addressData = ref<Address>(defaultAddress);
const myform = ref<any>();
@ -714,8 +714,10 @@ const addData = async () => {
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => {
dialogConfirm($q,() => Datasave())
}
const Datasave = async () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
if (props.statusAdd) {

View file

@ -213,7 +213,6 @@
:cancel="clickCancel"
:edit="clickEdit"
:save="clickSave"
:validate="validateData"
:clickNext="clickNext"
:clickPrevious="clickPrevious"
:clickDelete="clickDelete"
@ -292,7 +291,7 @@ const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader ,dialogConfirm} =
mixin;
const route = useRoute();
const id = ref<string>("");
@ -583,8 +582,11 @@ const clickAdd = async () => {
/**
* กดบนทกใน dialog
*/
const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
const clickSave = () => {
dialogConfirm($q,() => SaveData())
}
const SaveData = async () => {
await myForm.value?.validate().then(async (result: boolean) => {
if (result) {
if (modalEdit.value) {
await editData();
@ -803,14 +805,14 @@ const clickHistory = async (row: RequestItemsObject) => {
/**
* validate input ใน dialog
*/
const validateData = async () => {
checkValidate.value = true;
await myForm.value.validate().then((result: boolean) => {
if (result == false) {
checkValidate.value = false;
}
});
};
// const validateData = async () => {
// checkValidate.value = true;
// await myForm.value.validate().then((result: boolean) => {
// if (result == false) {
// checkValidate.value = false;
// }
// });
// };
/**
* class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ

View file

@ -1126,7 +1126,7 @@ const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const { date2Thai, success, messageError, showLoader, hideLoader ,dialogConfirm} = mixin;
const edit = ref<boolean>(false);
const fix = ref<boolean>(true);
const myform = ref<QForm | null>(null);
@ -1456,8 +1456,10 @@ const addData = async () => {
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => {
const saveData = () =>{
dialogConfirm($q,() => Datasave())
}
const Datasave = async () => {
await myform.value?.validate().then(async (success: boolean) => {
if (success) {
if (props.statusAdd) {

View file

@ -458,6 +458,7 @@ const {
dialogMessage,
showLoader,
hideLoader,
dialogConfirm
} = mixin;
const profileStore = useProfileDataStore();
@ -1103,7 +1104,10 @@ const addData = async () => {
// });
};
const saveData = async () => {
const saveData = async () =>{
dialogConfirm($q,()=>Datasave())
}
const Datasave = async () => {
if (myform.value != null) {
await myform.value.validate().then(async (success: boolean) => {
if (success) {