Skip to content

Commit

Permalink
[Feature]: 设置-组织管理-人员 左侧的组织树应该显示标记为隐藏的组, 显示为灰色
Browse files Browse the repository at this point in the history
  • Loading branch information
tujiajun committed Jul 23, 2024
1 parent 125f83d commit a55542b
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"adaptor": "const records = payload.data.options;\nconst treeRecords = [];\nconst getChildren = (currentRecord, records, childrenIds) => {\n if (currentRecord.children && typeof currentRecord.children[0] === \"object\") {\n // 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children\n return currentRecord.children;\n }\n if (!childrenIds) {\n return;\n }\n const children = _.filter(records, (record) => {\n return _.includes(childrenIds, record.value)\n });\n _.each(children, (item) => {\n if (item.children) {\n item.children = getChildren(item, records, item.children)\n }\n })\n return children;\n}\n\nconst getRoot = (records) => {\n for (var i = 0; i < records.length; i++) {\n records[i].noParent = 0;\n if (!!records[i].parent) {\n biaozhi = 1\n for (var j = 0; j < records.length; j++) {\n if (records[i].parent == records[j].value)\n biaozhi = 0;\n }\n if (biaozhi == 1) records[i].noParent = 1;\n } else records[i].noParent = 1;\n }\n}\ngetRoot(records);\n\n_.each(records, (record) => {\n if (record.noParent == 1) {\n treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));\n }\n});\n\npayload.data.options = treeRecords;\nreturn payload;",
"requestAdaptor": "\n ",
"data": {
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
"query": "{options:organizations(sort:\"sort_no desc\"){value:_id label:name,parent,children,is_hidden:hidden}}"
},
"messages": {},
"cache": 300000
Expand All @@ -54,7 +54,7 @@
]
}
},
"label": "",
"menuTpl": "<div class='${is_hidden?'text-gray-300':''} font-bold'>${label}</div>",
"name": "organizations",
"multiple": false,
"joinValues": false,
Expand All @@ -74,13 +74,9 @@
"placeholder": "请搜索部门"
},
"unfoldedLevel": 2,
"inputClassName": "",
"labelClassName": "",
"staticClassName": "",
"originPosition": "left-top",
"virtualThreshold": 10000,
"style": {
"min-height": "500px",
"max-height": "100%",
"background-color": "white"
}
Expand Down

0 comments on commit a55542b

Please sign in to comment.