fix: 自定义字段多选框报错

This commit is contained in:
chenjianxing 2021-04-27 14:10:49 +08:00 committed by jianxing
parent 0371dcbab5
commit ec70c13154
3 changed files with 9 additions and 12 deletions

View File

@ -124,6 +124,9 @@ export default {
item.fieldId = item.id;
item.id = null;
item.options = JSON.parse(item.options);
if (item.type === 'checkbox') {
item.defaultValue = [];
}
});
this.tableData.push(...data);
});

View File

@ -1,5 +1,5 @@
<template>
<span v-if="isActive">
<span>
<el-select v-if="data.type === 'select' || data.type === 'multipleSelect'"
:disabled="disabled"
:multiple="data.type === 'multipleSelect'"
@ -104,7 +104,6 @@ export default {
data() {
return {
memberOptions: [],
isActive: false
};
},
mounted() {
@ -113,16 +112,6 @@ export default {
this.memberOptions = response.data;
});
}
if (this.data.type === 'checkbox' || this.data.type === 'multipleSelect'
|| this.data.type === 'multipleMember') {
this.data[this.prop] = [];
} else if (this.data.type === 'float' || this.data.type === 'int') {
this.data[this.prop] = null;
} else {
this.data[this.prop] = "";
}
this.isActive = true;
},
methods: {
getTranslateOption(item) {

View File

@ -184,6 +184,8 @@ export default {
}
if (item.defaultValue) {
item.defaultValue = JSON.parse(item.defaultValue);
} else if (item.type === 'checkbox') {
item.defaultValue = [];
}
this.templateContainIds.add(item.fieldId);
});
@ -206,6 +208,9 @@ export default {
item.fieldId = item.id;
item.id = null;
item.options = JSON.parse(item.options);
if (item.type === 'checkbox') {
item.defaultValue = [];
}
});
this.relateFields.push(...data);
});