fix:assetmeta option不能删除的问题 以及option可以为空的问题
This commit is contained in:
@@ -468,13 +468,13 @@ export const tableSet = {
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'id': break
|
||||
case 'startAt': {
|
||||
if (from === 'alertSilence') {
|
||||
return false
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'id':
|
||||
case 'alertRule':
|
||||
case 'severity':
|
||||
case 'endAt':
|
||||
|
||||
@@ -933,7 +933,8 @@ const cn = {
|
||||
},
|
||||
assetMeta: {
|
||||
example: '示例',
|
||||
assetMeta: '资产标签',
|
||||
assetMeta: '资产元数据',
|
||||
all: '全部',
|
||||
addGroup: '创建分组',
|
||||
editGroup: '编辑分组',
|
||||
addMeta: '创建Meta',
|
||||
@@ -970,7 +971,8 @@ const cn = {
|
||||
interval: '区间',
|
||||
decimals: '精度',
|
||||
moreOptionsError: '选项最多20条',
|
||||
onlyOptionError: '至少需要一个选项'
|
||||
onlyOptionError: '至少需要一个选项',
|
||||
metaOptionNull: '请填写选项信息'
|
||||
},
|
||||
exprTemp: {
|
||||
exprTemp: 'expression模板',
|
||||
|
||||
@@ -937,6 +937,7 @@ const en = {
|
||||
assetMeta: {
|
||||
example: 'Example',
|
||||
assetMeta: 'Asset meta',
|
||||
all: 'All',
|
||||
addGroup: 'Create group',
|
||||
editGroup: 'Edit group',
|
||||
addMeta: 'Create meta',
|
||||
@@ -973,7 +974,8 @@ const en = {
|
||||
interval: 'Interval',
|
||||
decimals: 'Decimals',
|
||||
moreOptionsError: 'There are up to 20 options',
|
||||
onlyOptionError: 'You need at least one option'
|
||||
onlyOptionError: 'You need at least one option',
|
||||
metaOptionNull: 'Please input option'
|
||||
},
|
||||
exprTemp: {
|
||||
exprTemp: 'Expression template',
|
||||
|
||||
@@ -269,6 +269,17 @@ export default {
|
||||
this.$refs.editAssetMetaForm.validate((valid) => {
|
||||
if (valid) {
|
||||
const param = { ...this.editAssetMeta }
|
||||
if (param.type === 'radio' || param.type === 'checkbox' || param.type === 'select') {
|
||||
for (let i = 0; i < param.param.items.length; i++) {
|
||||
if (!param.param.items[i].name) {
|
||||
console.log(this.$refs['metaNameOption' + i])
|
||||
this.$refs['metaNameOption' + i][0].focus()
|
||||
this.$message.error(this.$t('config.assetMeta.metaOptionNull'))
|
||||
this.prevent_opt.save = false
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (param.type !== 'radio' && param.type !== 'checkbox' && param.type !== 'select' && param.type !== 'datetime') {
|
||||
delete param.param
|
||||
} else {
|
||||
@@ -403,6 +414,7 @@ export default {
|
||||
return
|
||||
}
|
||||
this.editAssetMeta.param.items.splice(index, 1)
|
||||
this.$forceUpdate()
|
||||
},
|
||||
copyParam (index) {
|
||||
if (this.editAssetMeta.type !== 'checkbox') {
|
||||
|
||||
@@ -207,14 +207,14 @@ export default {
|
||||
prop: 'id',
|
||||
show: true,
|
||||
width: 80
|
||||
}, {
|
||||
label: this.$t('config.assetMeta.key'),
|
||||
prop: 'metaKey',
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('config.assetMeta.name'),
|
||||
prop: 'name',
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('config.assetMeta.key'),
|
||||
prop: 'metaKey',
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('config.assetMeta.group'),
|
||||
prop: 'group',
|
||||
@@ -243,7 +243,7 @@ export default {
|
||||
}
|
||||
],
|
||||
groupData: [{
|
||||
name: 'All',
|
||||
name: this.$t('config.assetMeta.all'),
|
||||
id: -1,
|
||||
children: []
|
||||
}],
|
||||
@@ -280,25 +280,19 @@ export default {
|
||||
searchMsg: { // 给搜索框子组件传递的信息
|
||||
zheze_none: true,
|
||||
searchLabelList: [
|
||||
// {
|
||||
// id: 11,
|
||||
// name: 'Id',
|
||||
// type: 'input',
|
||||
// label: 'id',
|
||||
// disabled: false
|
||||
// }, {
|
||||
// id: 12,
|
||||
// name: this.$t('config.assetMeta.name'),
|
||||
// type: 'input',
|
||||
// label: 'name',
|
||||
// disabled: false
|
||||
// }, {
|
||||
// id: 13,
|
||||
// name: this.$t('config.assetMeta.gname'),
|
||||
// type: 'selectTemp',
|
||||
// label: 'gname',
|
||||
// disabled: false
|
||||
// }
|
||||
{
|
||||
id: 11,
|
||||
name: 'Id',
|
||||
type: 'input',
|
||||
label: 'id',
|
||||
disabled: false
|
||||
}, {
|
||||
id: 12,
|
||||
name: this.$t('config.assetMeta.name'),
|
||||
type: 'input',
|
||||
label: 'name',
|
||||
disabled: false
|
||||
}
|
||||
]
|
||||
},
|
||||
searchLabel: {}, // 搜索参数
|
||||
|
||||
Reference in New Issue
Block a user