yuang-framework-ui-common 1.0.64 → 1.0.66

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.
@@ -0,0 +1,61 @@
1
+ import { http } from '../../../lib/config/httpConfig';
2
+ import { application } from '../../../lib/config/applicationConfig';
3
+
4
+ import { getShortUuid } from '../../../lib/utils/uuidUtils';
5
+
6
+ const initFrameworkGroup = ({ frameworkGroupCode }) => {
7
+ return new Promise((resolve) => {
8
+ // prettier-ignore
9
+ http.post(`${application.gatewayServerBaseUrl}/uims-api/core/framework-group/selectPage`, { code: frameworkGroupCode }).then((res) => {
10
+ if (res.data.data.records.length == 0) {
11
+ const formData = {
12
+ id: '',
13
+ name: '全部分组',
14
+ code: frameworkGroupCode,
15
+ parentId: ''
16
+ };
17
+ http
18
+ .post('/uims-api/core/framework-group/insertInfo', formData)
19
+ .then((res) => {
20
+ formData.id = res.data.data.id;
21
+ resolve(formData);
22
+ })
23
+ .catch(() => {
24
+ //
25
+ });
26
+ } else {
27
+ resolve(res.data.data.records[0]);
28
+ }
29
+ }).catch(() => {
30
+ //
31
+ });
32
+ });
33
+ };
34
+
35
+ const saveFrameworkGroup = ({ isAddForm, editForm }) => {
36
+ return new Promise((resolve, reject) => {
37
+ editForm.code = editForm.code || getShortUuid();
38
+ // prettier-ignore
39
+ http.post(`/uims-api/core/framework-group/${isAddForm ? 'insertInfo' : 'updateInfo'}`, editForm).then((res) => {
40
+ if (!editForm.id) {
41
+ editForm.id = res.data.data.id;
42
+ }
43
+ resolve({ group: editForm });
44
+ }).catch(() => {
45
+ reject();
46
+ });
47
+ });
48
+ };
49
+ const deleteFrameworkGroup = ({ editForm }) => {
50
+ return new Promise((resolve, reject) => {
51
+ // prettier-ignore
52
+ http.get(`/uims-api/core/framework-group/deleteInfo`, { params: { id: editForm.id } }).then((res) => {
53
+ res;
54
+ resolve({ group: editForm });
55
+ }).catch(() => {
56
+ reject();
57
+ });
58
+ });
59
+ };
60
+
61
+ export { initFrameworkGroup, saveFrameworkGroup, deleteFrameworkGroup };
@@ -0,0 +1,21 @@
1
+ import { getShortUuid } from '../../../lib/utils/uuidUtils';
2
+
3
+ /**
4
+ * 初始化treeId,解决有些组件没办法直接给tree赋id属性,比如:el-treeselect,
5
+ * 前提条件是当前页面其他全部的tree都设置了id,如果treeId 不存在,则默认设置第一个tree的id为随机id
6
+ */
7
+ const initTreeId = () => {
8
+ let treeId = '';
9
+ const nodeList = document.querySelectorAll(`.el-tree`) as any;
10
+ for (let i = 0; i < nodeList.length; i++) {
11
+ if (nodeList[i].getAttribute('id')) {
12
+ continue;
13
+ }
14
+ treeId = `tree-${getShortUuid()}`;
15
+ nodeList[i].setAttribute('id', treeId);
16
+ break;
17
+ }
18
+ return treeId;
19
+ };
20
+
21
+ export { initTreeId };
File without changes
@@ -0,0 +1,36 @@
1
+ // import { http } from 'yuang-framework-ui-common/lib/config/httpConfig';
2
+ //
3
+ // import { toTree } from 'yuang-framework-ui-pc/es';
4
+ //
5
+ // /**
6
+ // * 查询Uims应用树数据,先查询所有满足条件的数据,再转树结构
7
+ // */
8
+ // const queryUimsApplicationTreeData = ({ applicationName }) => {
9
+ // return new Promise((resolve, reject) => {
10
+ // const data = { parentId: '0', name: applicationName };
11
+ // // prettier-ignore
12
+ // http.post('/uims-api/admin/uims-application/selectPage', data).then(res=>{
13
+ // const listData = [
14
+ // {
15
+ // id: '0',
16
+ // name: '全部应用',
17
+ // isHasChildren: true,
18
+ // isLeaf: false,
19
+ // levelNum: 0,
20
+ // parentId: ''
21
+ // },
22
+ // ...res.data.data.records
23
+ // ];
24
+ // const treeData = toTree({
25
+ // data: listData,
26
+ // idField: 'id',
27
+ // parentIdField: 'parentId'
28
+ // });
29
+ // resolve({ treeData });
30
+ // }).catch(() => {
31
+ // reject();
32
+ // });
33
+ // });
34
+ // };
35
+ //
36
+ // export { queryUimsApplicationTreeData };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ import { nextTick } from 'vue';
2
+ import { http } from 'yuang-framework-ui-common/lib/config/httpConfig';
3
+
4
+ /**
5
+ * 处理机构树默认展开节点,由于树组件的默认展开节点是异步的,所以需要手动处理默认展开节点
6
+ */
7
+ const handleOrganizationTreeDefaultExpandNode = 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/admin/uims-organization/selectAncestorList', { id: id, isReverseAncestorList: true });
13
+ const ancestorList = res.data.data;
14
+ expandNodeImpl({ ancestorList, index: 0, treeId });
15
+ };
16
+
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 { handleOrganizationTreeDefaultExpandNode };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-common",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {