fix:assetmeta option不能删除的问题 以及option可以为空的问题

This commit is contained in:
zhangyu
2021-03-25 16:10:35 +08:00
parent d6b5a58d4b
commit aefafab313
5 changed files with 38 additions and 28 deletions

View File

@@ -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') {