yuang-framework-ui-common 1.0.74 → 1.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,37 @@
1
+ import { nextTick } from 'vue';
2
+ import { http } from '../../../lib/config/httpConfig';
1
3
 
4
+ /**
5
+ * 处理分组树默认展开节点,由于树组件的默认展开节点是异步的,所以需要手动处理默认展开节点
6
+ */
7
+ const handleFrameworkGroupTreeDefaultExpandNode = async ({ id, treeId }) => {
8
+ if (document.querySelectorAll(`#${treeId}`).length == 0) {
9
+ console.error(`参数[treeId]不存在`);
10
+ return;
11
+ }
12
+ const res = await http.post('/uims-api/core/framework-group/selectAncestorList', { idForEqual: id, isReverseAncestorList: true });
13
+ const ancestorList = res.data.data;
14
+ expandNodeImpl({ ancestorList, index: 0, treeId });
15
+ };
2
16
 
3
- export { };
17
+ /** 默认展开节点实现 */
18
+ const expandNodeImpl = ({ ancestorList, index, treeId }) => {
19
+ if (index >= ancestorList.length) {
20
+ return;
21
+ }
22
+ const nodeList = document.querySelectorAll(`${!treeId ? '' : '#' + treeId}.el-tree [data-key='${ancestorList[index].id}'] .el-tree-node__expand-icon`) as any;
23
+ for (let i = 0; i < nodeList.length; i++) {
24
+ if (!nodeList[i].classList.contains('expanded')) {
25
+ nodeList[i] && nodeList[i].click();
26
+ }
27
+ }
28
+ nextTick(() => {
29
+ // 这里必须延迟一会运行,否则下级分组不会展开
30
+ setTimeout(() => {
31
+ index++;
32
+ expandNodeImpl({ ancestorList, index, treeId });
33
+ }, 200);
34
+ });
35
+ };
36
+
37
+ export { handleFrameworkGroupTreeDefaultExpandNode };
@@ -4,7 +4,7 @@ import { http } from '../../../lib/config/httpConfig';
4
4
  /**
5
5
  * 处理机构树默认展开节点,由于树组件的默认展开节点是异步的,所以需要手动处理默认展开节点
6
6
  */
7
- const handleOrganizationTreeDefaultExpandNode = async ({ id, treeId }) => {
7
+ const handleUimsOrganizationTreeDefaultExpandNode = async ({ id, treeId }) => {
8
8
  if (document.querySelectorAll(`#${treeId}`).length == 0) {
9
9
  console.error(`参数[treeId]不存在`);
10
10
  return;
@@ -34,4 +34,4 @@ const expandNodeImpl = ({ ancestorList, index, treeId }) => {
34
34
  });
35
35
  };
36
36
 
37
- export { handleOrganizationTreeDefaultExpandNode };
37
+ export { handleUimsOrganizationTreeDefaultExpandNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-common",
3
- "version": "1.0.74",
3
+ "version": "1.0.76",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {