|
@@ -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;
|
|
@@ -594,20 +601,24 @@ async function generateClassData(libID) {
|
|
|
// 获取分类数据
|
|
|
let classNum = 1;
|
|
|
const billClassData = [];
|
|
|
- leaves.forEach(billNode => {
|
|
|
+ for(let billNode of leaves){
|
|
|
const guidanceItems = guidanceMap[billNode.data.ID];
|
|
|
if (!guidanceItems || !guidanceItems.length) {
|
|
|
- return;
|
|
|
+ continue;
|
|
|
}
|
|
|
+ if(billNode.data.code.startsWith('03')) continue;//先屏蔽掉03开头的清单
|
|
|
const guidanceTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
|
|
|
guidanceTree.loadDatas(guidanceItems);
|
|
|
+ //console.log('getItemClassData start',billNode.data.name,billNode.data.code,billNode.data.ID);
|
|
|
const itemClassData = getItemClassData(guidanceTree.roots); // 必套定额在这个方法内就获取了,避免重复执行递归方法
|
|
|
const allRationIDs = guidanceTree.items.filter(node => !!node.data.rationID).map(node => node.data.rationID);
|
|
|
// 选套定额ID
|
|
|
const optionalRationIDs = getOptionalRationIDs(itemClassData, allRationIDs);
|
|
|
+ //if(itemClassData.length > 1000) console.log('getItemClassData end',billNode.data.name,billNode.data.code,billNode.data.ID,itemClassData.length)
|
|
|
itemClassData.forEach(item => {
|
|
|
// 错套定额
|
|
|
const errorRationIDs = getErrorRationIDs(item.requiredRationIDs, optionalRationIDs, allRationIDs);
|
|
|
+ if(billNode.data.ID == '1d32fa34-0a9b-11ea-a33d-5388f9783b09') console.log(item.name)
|
|
|
billClassData.push({
|
|
|
itemCharacter: item.name,
|
|
|
class: classNum++,
|
|
@@ -620,7 +631,7 @@ async function generateClassData(libID) {
|
|
|
errorRationIDs,
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
console.log(`billClassData.length`);
|
|
|
console.log(billClassData.length);
|
|
|
// 清空旧的分类数据
|