refactor: warningClose
This commit is contained in:
parent
e9c15d4555
commit
792d62b0ea
2 changed files with 11 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
||||||
import { dialogCheckData } from 'stores/utils';
|
import { dialogCheckData, dialogWarningClose } from 'stores/utils';
|
||||||
import { ProductTree, quotationProductTree } from './utils';
|
import { ProductTree, quotationProductTree } from './utils';
|
||||||
|
|
||||||
// NOTE: Import stores
|
// NOTE: Import stores
|
||||||
|
|
@ -82,7 +82,7 @@ const employeeFormStore = useEmployeeForm();
|
||||||
const customerStore = useCustomerStore();
|
const customerStore = useCustomerStore();
|
||||||
const quotationForm = useQuotationForm();
|
const quotationForm = useQuotationForm();
|
||||||
const optionStore = useOptionStore();
|
const optionStore = useOptionStore();
|
||||||
const { locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const ocrStore = useOcrStore();
|
const ocrStore = useOcrStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
|
@ -216,7 +216,13 @@ function closeTab() {
|
||||||
if (quotationFormState.value.mode === 'edit') {
|
if (quotationFormState.value.mode === 'edit') {
|
||||||
quotationForm.resetForm();
|
quotationForm.resetForm();
|
||||||
} else {
|
} else {
|
||||||
window.close();
|
dialogWarningClose(t, {
|
||||||
|
message: t('dialog.message.close'),
|
||||||
|
action: () => {
|
||||||
|
window.close();
|
||||||
|
},
|
||||||
|
cancel: () => {},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ export function dialogCheckData(opts: {
|
||||||
export function dialogWarningClose(
|
export function dialogWarningClose(
|
||||||
t: ComposerTranslation,
|
t: ComposerTranslation,
|
||||||
opts: {
|
opts: {
|
||||||
|
message?: string;
|
||||||
action?: (...args: unknown[]) => unknown;
|
action?: (...args: unknown[]) => unknown;
|
||||||
cancel?: (...args: unknown[]) => unknown;
|
cancel?: (...args: unknown[]) => unknown;
|
||||||
},
|
},
|
||||||
|
|
@ -53,7 +54,7 @@ export function dialogWarningClose(
|
||||||
icon: 'mdi-alert',
|
icon: 'mdi-alert',
|
||||||
title: t('form.warning.title'),
|
title: t('form.warning.title'),
|
||||||
actionText: t('dialog.action.ok'),
|
actionText: t('dialog.action.ok'),
|
||||||
message: t('dialog.message.warningClose'),
|
message: opts.message || t('dialog.message.warningClose'),
|
||||||
action: async () => {
|
action: async () => {
|
||||||
if (opts.action) opts.action();
|
if (opts.action) opts.action();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue