mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 10:26:45 +00:00
fix: add filter operator "is not current logged-in user"
This commit is contained in:
parent
a614bc7de8
commit
fd71d57bdf
@ -86,6 +86,14 @@ export const id = [
|
|||||||
return field.collectionName === 'users';
|
return field.collectionName === 'users';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '{{t("is not current logged-in user")}}',
|
||||||
|
value: '$isNotCurrentUser',
|
||||||
|
noValue: true,
|
||||||
|
visible(field) {
|
||||||
|
return field.collectionName === 'users';
|
||||||
|
},
|
||||||
|
},
|
||||||
{ label: '{{t("exists")}}', value: '$exists', noValue: true },
|
{ label: '{{t("exists")}}', value: '$exists', noValue: true },
|
||||||
{ label: '{{t("not exists")}}', value: '$notExists', noValue: true },
|
{ label: '{{t("not exists")}}', value: '$notExists', noValue: true },
|
||||||
];
|
];
|
||||||
|
@ -447,6 +447,7 @@ export default {
|
|||||||
'exists': '存在',
|
'exists': '存在',
|
||||||
'not exists': '不存在',
|
'not exists': '不存在',
|
||||||
'is current logged-in user': '为当前登录用户',
|
'is current logged-in user': '为当前登录用户',
|
||||||
|
'is not current logged-in user': '不为当前登录用户',
|
||||||
'=': '=',
|
'=': '=',
|
||||||
'≠': '≠',
|
'≠': '≠',
|
||||||
'>': '>',
|
'>': '>',
|
||||||
|
@ -43,6 +43,11 @@ export default class UsersPlugin extends Plugin<UserPluginConfig> {
|
|||||||
[Op.eq]: ctx?.app?.ctx?.state?.currentUser?.id || -1,
|
[Op.eq]: ctx?.app?.ctx?.state?.currentUser?.id || -1,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
$isNotCurrentUser(_, ctx) {
|
||||||
|
return {
|
||||||
|
[Op.ne]: ctx?.app?.ctx?.state?.currentUser?.id || -1,
|
||||||
|
};
|
||||||
|
},
|
||||||
$isVar(val, ctx) {
|
$isVar(val, ctx) {
|
||||||
const obj = parse({ val: `{{${val}}}` })(JSON.parse(JSON.stringify(ctx?.app?.ctx?.state)));
|
const obj = parse({ val: `{{${val}}}` })(JSON.parse(JSON.stringify(ctx?.app?.ctx?.state)));
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user