Browse Source

修改noErrorAxios的catch处理。

main
likunming 4 months ago
parent
commit
621a00a044
  1. 18
      io.sc.platform.core.frontend/src/platform/components/grid/CellEditor.vue
  2. 14
      io.sc.platform.core.frontend/src/platform/components/grid/GridBody.vue
  3. 26
      io.sc.platform.core.frontend/src/platform/components/grid/GridEditToolbar.vue
  4. 18
      io.sc.platform.core.frontend/src/platform/components/grid/GridEditor.vue

18
io.sc.platform.core.frontend/src/platform/components/grid/CellEditor.vue

@ -5,7 +5,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, inject, computed, toRaw } from 'vue'; import { ref, reactive, inject, computed, toRaw } from 'vue';
import { t, Tools, noErrorAxios, NotifyManager } from '@/platform'; import { t, Tools, noErrorAxios, NotifyManager, ServerExceptionHandler } from '@/platform';
const dialogRef = ref(); const dialogRef = ref();
const dialogFormRef = ref(); const dialogFormRef = ref();
@ -75,21 +75,11 @@ const dialog = {
dialogRef.value.hide(); dialogRef.value.hide();
}) })
.catch((error) => { .catch((error) => {
const response = error?.response; if (error?.code === 1001) {
const status = response?.status;
const data = response?.data;
if (data?.code === 1001) {
// //
if (error.response.data.data) { dialogFormRef.value.setValidationErrors(error.data);
dialogFormRef.value.setValidationErrors(error.response.data.data);
}
} else { } else {
// ServerExceptionHandler.handle(error);
if (status === 500) {
NotifyManager.error(t(data?.errorMessageI18nKey));
} else {
NotifyManager.error(t(status));
}
} }
dialog.buttons[0].loading = false; dialog.buttons[0].loading = false;
}); });

14
io.sc.platform.core.frontend/src/platform/components/grid/GridBody.vue

@ -69,7 +69,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, inject, ref, toRaw } from 'vue'; import { computed, inject, ref, toRaw } from 'vue';
import { Tools, noErrorAxios, NotifyManager, t } from '@/platform'; import { Tools, noErrorAxios, NotifyManager, t, ServerExceptionHandler } from '@/platform';
import { dndMode, dndImage, selectMode, editStatus } from './ts/grid'; import { dndMode, dndImage, selectMode, editStatus } from './ts/grid';
import TreeGridRow from './TreeGridRow.vue'; import TreeGridRow from './TreeGridRow.vue';
import GridTd from './GridTd.vue'; import GridTd from './GridTd.vue';
@ -245,18 +245,10 @@ const updates = (data, callback) => {
} }
}) })
.catch((error) => { .catch((error) => {
const response = error?.response; if (error.code === 1001) {
const status = response?.status;
const data = response?.data;
if (data?.code === 1001) {
NotifyManager.error('服务器验证未通过'); NotifyManager.error('服务器验证未通过');
} else { } else {
// ServerExceptionHandler.handle(error);
if (status === 500) {
NotifyManager.error(t(data?.errorMessageI18nKey));
} else {
NotifyManager.error(t(status));
}
} }
}); });
}; };

26
io.sc.platform.core.frontend/src/platform/components/grid/GridEditToolbar.vue

@ -42,7 +42,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, inject, ref, toRaw } from 'vue'; import { computed, inject, ref, toRaw } from 'vue';
import { Tools, NotifyManager, noErrorAxios, t } from '@/platform'; import { Tools, NotifyManager, noErrorAxios, t, ServerExceptionHandler } from '@/platform';
import { editStatus } from './ts/grid'; import { editStatus } from './ts/grid';
const props = defineProps({ const props = defineProps({
@ -178,18 +178,10 @@ const rowSave = (args) => {
table.bodyEditStatus = 'none'; table.bodyEditStatus = 'none';
}) })
.catch((error) => { .catch((error) => {
const response = error?.response; if (error.code === 1001) {
const status = response?.status;
const data = response?.data;
if (data?.code === 1001) {
NotifyManager.error('服务器验证未通过'); NotifyManager.error('服务器验证未通过');
} else { } else {
// ServerExceptionHandler.handle(error);
if (status === 500) {
NotifyManager.error(t(data?.errorMessageI18nKey));
} else {
NotifyManager.error(t(status));
}
} }
}); });
} }
@ -301,18 +293,10 @@ const updates = (data, callback) => {
} }
}) })
.catch((error) => { .catch((error) => {
const response = error?.response; if (error.code === 1001) {
const status = response?.status;
const data = response?.data;
if (data?.code === 1001) {
NotifyManager.error('服务器验证未通过'); NotifyManager.error('服务器验证未通过');
} else { } else {
// ServerExceptionHandler.handle(error);
if (status === 500) {
NotifyManager.error(t(data?.errorMessageI18nKey));
} else {
NotifyManager.error(t(status));
}
} }
}); });
}; };

18
io.sc.platform.core.frontend/src/platform/components/grid/GridEditor.vue

@ -5,7 +5,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, inject, computed } from 'vue'; import { ref, reactive, inject, computed } from 'vue';
import { t, Tools, noErrorAxios, NotifyManager } from '@/platform'; import { t, Tools, noErrorAxios, NotifyManager, ServerExceptionHandler } from '@/platform';
const dialogRef = ref(); const dialogRef = ref();
const dialogFormRef = ref(); const dialogFormRef = ref();
@ -118,21 +118,11 @@ const save = async () => {
} }
}) })
.catch((error) => { .catch((error) => {
const response = error?.response; if (error?.code === 1001) {
const status = response?.status;
const data = response?.data;
if (data?.code === 1001) {
// //
if (error.response.data.data) { dialogFormRef.value.setValidationErrors(error.data);
dialogFormRef.value.setValidationErrors(error.response.data.data);
}
} else { } else {
// ServerExceptionHandler.handle(error);
if (status === 500) {
NotifyManager.error(t(data?.errorMessageI18nKey));
} else {
NotifyManager.error(t(status));
}
} }
dialog.dialogButtons[0].loading = false; dialog.dialogButtons[0].loading = false;
}); });

Loading…
Cancel
Save