NEZ-674 fix:修改 group不显示的问题 以及 回显params错误的问题

This commit is contained in:
zhangyu
2021-05-26 15:40:42 +08:00
parent b31090db5d
commit 8f6dbb720e

View File

@@ -20,7 +20,7 @@
<el-input placeholder="" show-word-limit v-model="editAssetMeta.metaKey" size="small" id="editAssetMeta-box-input-key"></el-input> <el-input placeholder="" show-word-limit v-model="editAssetMeta.metaKey" size="small" id="editAssetMeta-box-input-key"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label='$t("config.assetLabel.group")' prop="groupId"> <el-form-item :label='$t("config.assetLabel.group")' prop="groupId">
<el-select v-model="editAssetMeta.group.name" size="small" class="right-box__select" popper-class="right-box-select-dropdown prevent-clickoutside" :popper-append-to-body="false"> <el-select v-model="editAssetMeta.groupId" size="small" class="right-box__select" popper-class="right-box-select-dropdown prevent-clickoutside" :popper-append-to-body="false">
<el-option v-for="(item, index) in groupData" :key="index" :value="item.id" :label="item.name"></el-option> <el-option v-for="(item, index) in groupData" :key="index" :value="item.id" :label="item.name"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -234,11 +234,13 @@ export default {
handler (n) { handler (n) {
this.editAssetMeta = { this.editAssetMeta = {
...n, ...n,
groupId: n.groupId ? Number(n.groupId) : '',
search: `${n.search}`, search: `${n.search}`,
display: `${n.display}`, display: `${n.display}`,
param: n.param && typeof n.param === 'string' ? JSON.parse(n.param) : {}, param: n.param && ((typeof n.param) === 'string') ? JSON.parse(n.param) : {},
type: n.type.toUpperCase() type: n.type.toUpperCase()
} }
this.selectType(this.editAssetMeta.type, true)
} }
}, },
'editAssetMeta.search': { 'editAssetMeta.search': {
@@ -293,7 +295,7 @@ export default {
this.$refs.editAssetMetaForm.validate((valid) => { this.$refs.editAssetMetaForm.validate((valid) => {
if (valid) { if (valid) {
const param = { ...this.editAssetMeta } const param = { ...this.editAssetMeta }
if (param.type === 'radio' || param.type === 'checkbox' || param.type === 'select') { if (param.type === 'RADIO' || param.type === 'CHECKBOX' || param.type === 'SELECT') {
for (let i = 0; i < param.param.items.length; i++) { for (let i = 0; i < param.param.items.length; i++) {
if (!param.param.items[i].name) { if (!param.param.items[i].name) {
this.$refs['metaNameOption' + i][0].focus() this.$refs['metaNameOption' + i][0].focus()
@@ -303,7 +305,7 @@ export default {
} }
} }
} }
if (param.type !== 'radio' && param.type !== 'checkbox' && param.type !== 'select' && param.type !== 'datetime') { if (param.type !== 'RADIO' && param.type !== 'CHECKBOX' && param.type !== 'SELECT' && param.type !== 'DATETIME') {
delete param.param delete param.param
} else { } else {
param.param = JSON.stringify(param.param) param.param = JSON.stringify(param.param)
@@ -402,8 +404,6 @@ export default {
} }
}, },
inputChange (index, val) { inputChange (index, val) {
// console.log(val)
// this.editAssetMeta.param.items[index] = val
this.$forceUpdate() this.$forceUpdate()
}, },
radioChange (i) { radioChange (i) {