mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-18 08:12:33 +00:00
perf: 优化 json field m2m
This commit is contained in:
@@ -88,15 +88,15 @@ export default {
|
||||
getType() {
|
||||
const attrType = this.attr.type || 'str'
|
||||
this.$log.debug('Value field attr type: ', attrType, this.attr, this.match)
|
||||
if (attrType === 'm2m') {
|
||||
if (['m2m', 'fk', 'select'].includes(attrType)) {
|
||||
return 'select'
|
||||
} else if (attrType === 'bool') {
|
||||
return 'bool'
|
||||
} else if (attrType === 'select') {
|
||||
return 'select'
|
||||
}
|
||||
if (['in', 'ip_in'].includes(this.match)) {
|
||||
return 'array'
|
||||
} else if (this.match.startsWith('m2m')) {
|
||||
return 'select'
|
||||
} else {
|
||||
return 'string'
|
||||
}
|
||||
|
@@ -4,7 +4,8 @@ export const strMatchValues = ['exact', 'not', 'in', 'contains', 'startswith', '
|
||||
export const typeMatchMapper = {
|
||||
str: strMatchValues,
|
||||
bool: ['exact', 'not'],
|
||||
m2m: ['m2m'],
|
||||
m2m: ['m2m', 'm2m_all'],
|
||||
fk: ['m2m'],
|
||||
ip: [...strMatchValues, 'ip_in'],
|
||||
int: [...strMatchValues, 'gte', 'lte'],
|
||||
select: ['in']
|
||||
@@ -19,6 +20,7 @@ export const attrMatchOptions = [
|
||||
{ label: i18n.t('common.Endswith'), value: 'endswith' },
|
||||
{ label: i18n.t('common.Regex'), value: 'regex' },
|
||||
{ label: i18n.t('common.BelongTo'), value: 'm2m' },
|
||||
{ label: i18n.t('common.BelongAll'), value: 'm2m_all' },
|
||||
{ label: i18n.t('common.IPMatch'), value: 'ip_in' },
|
||||
{ label: i18n.t('common.GreatEqualThan'), value: 'gte' },
|
||||
{ label: i18n.t('common.LessEqualThan'), value: 'lte' }
|
||||
|
@@ -498,6 +498,7 @@
|
||||
"AddPassKey": "AddPassKey"
|
||||
},
|
||||
"common": {
|
||||
"BelongAll": "Include all",
|
||||
"WordSep": " ",
|
||||
"Enterprise": "Enterprise",
|
||||
"SyncTask": "Synchronization task",
|
||||
|
@@ -498,6 +498,7 @@
|
||||
"AddPassKey": "パスキー(通行鍵)を追加"
|
||||
},
|
||||
"common": {
|
||||
"BelongAll": "すべての",
|
||||
"Enterprise": "企業版",
|
||||
"SyncTask": "同期任務です",
|
||||
"New": "新筑",
|
||||
|
@@ -476,6 +476,7 @@
|
||||
"ReLoginErr": "登录时长已超过 5 分钟,请重新登录"
|
||||
},
|
||||
"common": {
|
||||
"BelongAll": "包含所有",
|
||||
"WordSep": "",
|
||||
"PasswordRule": "密码生成规则",
|
||||
"Length": "长度",
|
||||
|
@@ -210,7 +210,7 @@ export const assetJSONSelectMeta = (vm) => {
|
||||
{
|
||||
name: 'platform',
|
||||
label: vm.$t('assets.Platform'),
|
||||
type: 'm2m',
|
||||
type: 'fk',
|
||||
el: {
|
||||
url: '/api/v1/assets/platforms/'
|
||||
}
|
||||
@@ -249,7 +249,12 @@ export const assetJSONSelectMeta = (vm) => {
|
||||
type: 'm2m',
|
||||
el: {
|
||||
multiple: true,
|
||||
url: '/api/v1/assets/labels/'
|
||||
url: '/api/v1/assets/labels/',
|
||||
ajax: {
|
||||
transformOption: (item) => {
|
||||
return { label: `${item.name}:${item.value}`, value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user