fix: CRUD 新增配置问题

Change-Id: I40bd523767025f0e5910ca26c685e80f77dcf2ef
This commit is contained in:
allenve 2022-07-27 17:06:12 +08:00
parent df49046f73
commit 2f2f57eed9

View File

@ -392,7 +392,10 @@ export class CRUDPlugin extends BasePlugin {
valueSchema.bulkActions = [];
/** 统一api格式 */
valueSchema.api = typeof valueSchema.api === 'string' ? valueSchema.api : normalizeApi(valueSchema.api);
valueSchema.api =
typeof valueSchema.api === 'string'
? valueSchema.api
: normalizeApi(valueSchema.api);
hasFeatures &&
features.forEach((item: string) => {
if (itemBtns.includes(item)) {
@ -418,7 +421,7 @@ export class CRUDPlugin extends BasePlugin {
);
} else if (item === 'delete') {
schema = cloneDeep(this.btnSchemas.delete);
schema.api = valueSchema.api?.method.match(/^(post|delete)$/i)
schema.api = valueSchema.api?.method?.match(/^(post|delete)$/i)
? valueSchema.api
: {...valueSchema.api, method: 'post'};
}
@ -446,7 +449,7 @@ export class CRUDPlugin extends BasePlugin {
const createSchemaBase = this.btnSchemas.create;
createSchemaBase.dialog.body = {
type: 'form',
api: valueSchema.api?.method.match(/^(post|put)$/i)
api: valueSchema.api?.method?.match(/^(post|put)$/i)
? valueSchema.api
: {...valueSchema.api, method: 'post'},
body: valueSchema.columns.map((column: ColumnItem) => {