fix: select 接口报错时 url 应该显示为实际请求地址 (#5033)

This commit is contained in:
吴多益 2022-08-01 19:26:06 +08:00 committed by GitHub
parent 8e5ffe7d23
commit 27891108fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -152,6 +152,18 @@ export function wrapControl<
this.handleBlur = this.handleBlur.bind(this);
if (!name) {
// 一般情况下这些表单项都是需要 name 的,提示一下
if (
typeof type === 'string' &&
(type.startsWith('input-') ||
type.endsWith('select') ||
type === 'switch' ||
type === 'textarea' ||
type === 'radios')
) {
console.warn('name is required', this.props.$schema);
}
return;
}

View File

@ -12,7 +12,7 @@ import {str2rules, validate as doValidate} from '../utils/validations';
import {Api, Payload, fetchOptions} from '../types';
import {ComboStore, IComboStore, IUniqueGroup} from './combo';
import {evalExpression} from '../utils/tpl';
import {isEffectiveApi} from '../utils/api';
import {buildApi, isEffectiveApi} from '../utils/api';
import findIndex from 'lodash/findIndex';
import {
isArrayChildrenModified,
@ -535,6 +535,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
let result: any = null;
if (!json.ok) {
const apiObject = buildApi(api, data);
setErrorFlag !== false &&
setError(
self.__('Form.loadOptionsFailed', {
@ -543,7 +544,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
);
getEnv(self).notify(
'error',
self.errors.join('') || `${api}${json.msg}`,
self.errors.join('') || `${apiObject.url}${json.msg}`,
json.msgTimeout !== undefined
? {
closeButton: true,