|
@@ -500,7 +500,13 @@ function getItemClassData(nodes, prefix) {
|
|
|
optionNode.children.filter(node => !!node.data.rationID).map(node => node.data.rationID) : [];
|
|
|
classItems.push({ name: optionNode.data.name, requiredRationIDs });
|
|
|
} else {
|
|
|
- classItems.push(...getItemClassData(optionNode.children, optionNode.parent && optionNode.parent.data.required ? optionNode.data.name : ''));
|
|
|
+ const childrenClassItem = getItemClassData(optionNode.children, optionNode.parent && optionNode.parent.data.required ? optionNode.data.name : '');
|
|
|
+ //如果返回的子项为空,但是父项又勾选了必填,则要把本身存入数组
|
|
|
+ if(optionNode.parent && optionNode.parent.data.required && childrenClassItem.length === 0){
|
|
|
+ classItems.push({ name: optionNode.data.name, requiredRationIDs:[] });
|
|
|
+ }else{
|
|
|
+ classItems.push(...childrenClassItem);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
if (classItems.length) {
|
|
@@ -509,6 +515,7 @@ function getItemClassData(nodes, prefix) {
|
|
|
});
|
|
|
// 拼接上一文本
|
|
|
if (classGroups[0] && classGroups[0].length) {
|
|
|
+
|
|
|
classGroups[0] = classGroups[0].map(item => {
|
|
|
item.name = prefix ? `${prefix}@${item.name}` : item.name
|
|
|
return item;
|