fix bug 22/4
This commit is contained in:
@@ -27,6 +27,15 @@
|
||||
:loading="loading"
|
||||
@close="stopGetPrice"
|
||||
>
|
||||
<a-alert
|
||||
v-if="submitError"
|
||||
type="error"
|
||||
:message="submitError"
|
||||
show-icon
|
||||
closable
|
||||
class="mb-3"
|
||||
@close="submitError = ''"
|
||||
/>
|
||||
<a-form :model="form" ref="formRef" autocomplete="off">
|
||||
<div class="grid md:grid-cols-1 gap-4">
|
||||
<div class="bg-gray-50 px-10 py-3 flex justify-center gap-4">
|
||||
@@ -161,6 +170,7 @@ import { initAccountingSettingsFromApi, tahesabEnabledSetting, pargarEnabledSett
|
||||
|
||||
//loading
|
||||
const loading = ref<boolean>(false)
|
||||
const submitError = ref('')
|
||||
const activeTab = ref<'reports' | 'tahesab' | 'customer-sync' | 'pargar' | 'pargar-customer-sync'>('reports')
|
||||
const tahesabEnabled = tahesabEnabledSetting
|
||||
const pargarEnabled = pargarEnabledSetting
|
||||
@@ -240,6 +250,7 @@ async function changeUser(val: Customer) {
|
||||
}
|
||||
|
||||
function stopGetPrice() {
|
||||
clearSubmitError()
|
||||
clearInterval(interval)
|
||||
console.log('stop')
|
||||
}
|
||||
@@ -374,10 +385,21 @@ async function edit(record: Customer) {
|
||||
form.value = cloneDeep(record)
|
||||
}
|
||||
|
||||
function clearSubmitError() {
|
||||
submitError.value = ''
|
||||
}
|
||||
|
||||
function getOrderSubmitError(e: unknown): string {
|
||||
const msg = (e as { response?: { data?: { message?: string } } })?.response?.data?.message
|
||||
if (typeof msg === 'string' && msg.trim()) return msg
|
||||
return 'خطا در ثبت سفارش'
|
||||
}
|
||||
|
||||
//add
|
||||
async function add() {
|
||||
loading.value = true
|
||||
editId = undefined
|
||||
clearSubmitError()
|
||||
// await store.getUsersList()
|
||||
resetData()
|
||||
addOrderVisible.value = true
|
||||
@@ -422,8 +444,7 @@ const userInfoVisible = ref<boolean>(false)
|
||||
//submit user
|
||||
async function ok() {
|
||||
formRef.value?.validateFields().then(async () => {
|
||||
// console.log('salam', form.value)
|
||||
// return
|
||||
clearSubmitError()
|
||||
loading.value = true
|
||||
try {
|
||||
form.value.amount = form.value.goldValue
|
||||
@@ -440,7 +461,7 @@ async function ok() {
|
||||
// await getManager()
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
// message.error('خطا در بارگذاری اطلاعات')
|
||||
submitError.value = getOrderSubmitError(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user