แก้ไข กรณี แก้ไข + ยกเลิก

ค่าที่เราแก้ไขต้องกลับมาเหมือนก่อนที่เราจะแก้
This commit is contained in:
AnandaTon 2023-09-26 13:14:57 +07:00
parent 45632a9bff
commit f73184531e
4 changed files with 25 additions and 5 deletions

View file

@ -105,6 +105,11 @@ const getData = async () => {
});
};
const clickCancel = async () => {
await getData();
edit.value = false;
};
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
@ -265,7 +270,7 @@ const getClass = (val: boolean) => {
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="edit = !edit"
@click="clickCancel"
/>
</div>
</div>

View file

@ -68,7 +68,7 @@ const getData = async () => {
showLoader();
await http
.get(config.API.outByid(dataId))
.then((res: any) => {
.then((res) => {
const data = res.data.result;
responseData.value.personId = data.profileId;
responseData.value.createdAt = data.createdAt;
@ -106,6 +106,11 @@ const getData = async () => {
});
};
const clickCancel = async () => {
await getData();
edit.value = false;
};
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
@ -267,7 +272,7 @@ const getClass = (val: boolean) => {
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="edit = !edit"
@click="clickCancel"
/>
</div>
</div>

View file

@ -108,6 +108,11 @@ const getData = async () => {
});
};
const clickCancel = async () => {
await getData();
edit.value = false;
};
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
@ -267,7 +272,7 @@ const getClass = (val: boolean) => {
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="edit = !edit"
@click="clickCancel"
/>
</div>
</div>

View file

@ -258,6 +258,11 @@ const redirectToRegistry = (id: string) => {
router.push(`/registry/${id}`);
};
const clickCancel = async () => {
await fetchData(id.value);
edit.value = false;
};
const conditionSave = () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
@ -665,7 +670,7 @@ const statusOrder = (val: boolean) => {
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="edit = !edit"
@click="clickCancel"
/>
</div>
</div>