fix(sort-field): the value of the scopeKey attribute is null

This commit is contained in:
chenos 2022-02-11 14:50:53 +08:00
parent 16d07e9b4a
commit 695b953a8f
2 changed files with 5 additions and 3 deletions

View File

@ -21,7 +21,10 @@ export class SortField extends Field {
const where = {}; const where = {};
if (scopeKey) { if (scopeKey) {
where[scopeKey] = instance.get(scopeKey); const value = instance.get(scopeKey);
if (value !== undefined && value !== null) {
where[scopeKey] = value;
}
} }
await sortFieldMutex.runExclusive(async () => { await sortFieldMutex.runExclusive(async () => {

View File

@ -6,9 +6,8 @@ export default {
model: 'FieldModel', model: 'FieldModel',
timestamps: false, timestamps: false,
sortable: { sortable: {
type: 'sort',
name: 'sort', name: 'sort',
scope: ['parentKey'], scopeKey: 'parentKey',
}, },
fields: [ fields: [
{ {