@ebiz/designer-components 0.1.58 → 0.1.60
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.
- package/dist/designer-components.css +1 -1
- package/dist/index.mjs +10493 -10452
- package/package.json +1 -1
- package/src/components/EbizDiv.vue +4 -4
- package/src/components/EbizTreeMergeTable.vue +102 -22
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ const props = defineProps({
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const isShow = computed(() => {
|
|
12
|
-
if(
|
|
12
|
+
if (!props.permissionKey) {
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
const developMode = localStorage.getItem('ebiz-develop-mode')
|
|
@@ -20,7 +20,7 @@ const isShow = computed(() => {
|
|
|
20
20
|
try {
|
|
21
21
|
const permissionKeysStr = localStorage.getItem('permissionKeys') || '[]';
|
|
22
22
|
const permissionKeys = JSON.parse(permissionKeysStr);
|
|
23
|
-
const hasPermission = permissionKeys.includes(props.
|
|
23
|
+
const hasPermission = permissionKeys.includes(props.permissionKey);
|
|
24
24
|
return hasPermission;
|
|
25
25
|
} catch (error) {
|
|
26
26
|
return false;
|
|
@@ -28,7 +28,7 @@ const isShow = computed(() => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
const checkPermission = () => {
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
watch(() => props.key, checkPermission, { immediate: true });
|
|
@@ -38,4 +38,4 @@ watch(() => props.key, checkPermission, { immediate: true });
|
|
|
38
38
|
<div v-if="isShow">
|
|
39
39
|
<slot name="default"></slot>
|
|
40
40
|
</div>
|
|
41
|
-
</template>
|
|
41
|
+
</template>
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
<template #module="{ row }">
|
|
62
62
|
<div class="cell-with-checkbox">
|
|
63
63
|
<t-checkbox v-model="row.moduleChecked" @change="(checked) => handleModuleCheck(row, checked)"></t-checkbox>
|
|
64
|
-
<
|
|
64
|
+
<div class="cell-content">
|
|
65
|
+
<div class="cell-text">{{ row.module }}</div>
|
|
66
|
+
<div class="cell-id" v-if="row.moduleKey">{{ row.moduleKey }}</div>
|
|
67
|
+
</div>
|
|
65
68
|
</div>
|
|
66
69
|
</template>
|
|
67
70
|
|
|
@@ -70,7 +73,10 @@
|
|
|
70
73
|
<div class="cell-with-checkbox">
|
|
71
74
|
<t-checkbox v-model="row.subModule1Checked"
|
|
72
75
|
@change="(checked) => handleSubModule1Check(row, checked)"></t-checkbox>
|
|
73
|
-
<
|
|
76
|
+
<div class="cell-content">
|
|
77
|
+
<div class="cell-text">{{ row.subModule1 || row.module }}</div>
|
|
78
|
+
<div class="cell-id" v-if="row.subModule1Key">{{ row.subModule1Key }}</div>
|
|
79
|
+
</div>
|
|
74
80
|
</div>
|
|
75
81
|
</template>
|
|
76
82
|
|
|
@@ -79,7 +85,10 @@
|
|
|
79
85
|
<div class="cell-with-checkbox" v-if="row.subModule2">
|
|
80
86
|
<t-checkbox v-model="row.subModule2Checked"
|
|
81
87
|
@change="(checked) => handleSubModule2Check(row, checked)"></t-checkbox>
|
|
82
|
-
<
|
|
88
|
+
<div class="cell-content">
|
|
89
|
+
<div class="cell-text">{{ row.subModule2 }}</div>
|
|
90
|
+
<div class="cell-id" v-if="row.subModule2Key">{{ row.subModule2Key }}</div>
|
|
91
|
+
</div>
|
|
83
92
|
</div>
|
|
84
93
|
<div v-else class="cell-with-checkbox">
|
|
85
94
|
<span class="cell-text empty-cell">-</span>
|
|
@@ -92,7 +101,10 @@
|
|
|
92
101
|
<div v-for="(func, idx) in row.functions" :key="func.id || idx" class="function-item">
|
|
93
102
|
<t-checkbox v-model="func.checked"
|
|
94
103
|
@change="(checked) => handleFunctionCheck(row, func, checked)"></t-checkbox>
|
|
95
|
-
<
|
|
104
|
+
<div class="cell-content">
|
|
105
|
+
<div class="cell-text">{{ func.name }}</div>
|
|
106
|
+
<div class="cell-id" v-if="func.funcKey">{{ func.funcKey }}</div>
|
|
107
|
+
</div>
|
|
96
108
|
</div>
|
|
97
109
|
</div>
|
|
98
110
|
</template>
|
|
@@ -413,10 +425,13 @@ const processTreeData = (treeData) => {
|
|
|
413
425
|
id: `${moduleItem.id}_all`,
|
|
414
426
|
module: moduleItem.name,
|
|
415
427
|
moduleId: moduleItem.id,
|
|
428
|
+
moduleKey: moduleItem.funcKey,
|
|
416
429
|
subModule1: null,
|
|
417
430
|
subModule1Id: null,
|
|
431
|
+
subModule1Key: null,
|
|
418
432
|
subModule2: null,
|
|
419
433
|
subModule2Id: null,
|
|
434
|
+
subModule2Key: null,
|
|
420
435
|
functions: [{ id: null, name: '全部', checked: false }]
|
|
421
436
|
})
|
|
422
437
|
return
|
|
@@ -428,10 +443,13 @@ const processTreeData = (treeData) => {
|
|
|
428
443
|
id: `${moduleItem.id}_${subModule1Item.id}_all`,
|
|
429
444
|
module: moduleItem.name,
|
|
430
445
|
moduleId: moduleItem.id,
|
|
446
|
+
moduleKey: moduleItem.funcKey,
|
|
431
447
|
subModule1: subModule1Item.name,
|
|
432
448
|
subModule1Id: subModule1Item.id,
|
|
449
|
+
subModule1Key: subModule1Item.funcKey,
|
|
433
450
|
subModule2: null,
|
|
434
451
|
subModule2Id: null,
|
|
452
|
+
subModule2Key: null,
|
|
435
453
|
functions: [{ id: null, name: '全部', checked: false }]
|
|
436
454
|
})
|
|
437
455
|
} else {
|
|
@@ -444,6 +462,7 @@ const processTreeData = (treeData) => {
|
|
|
444
462
|
const func = {
|
|
445
463
|
id: functionItem.id,
|
|
446
464
|
name: functionItem.name,
|
|
465
|
+
funcKey: functionItem.funcKey,
|
|
447
466
|
checked: false
|
|
448
467
|
}
|
|
449
468
|
functions.push(func)
|
|
@@ -453,6 +472,7 @@ const processTreeData = (treeData) => {
|
|
|
453
472
|
functions.push({
|
|
454
473
|
id: childFunc.id,
|
|
455
474
|
name: childFunc.name,
|
|
475
|
+
funcKey: childFunc.funcKey,
|
|
456
476
|
checked: false
|
|
457
477
|
})
|
|
458
478
|
})
|
|
@@ -465,10 +485,13 @@ const processTreeData = (treeData) => {
|
|
|
465
485
|
id: `${moduleItem.id}_${subModule1Item.id}_${subModule2Item.id}`,
|
|
466
486
|
module: moduleItem.name,
|
|
467
487
|
moduleId: moduleItem.id,
|
|
488
|
+
moduleKey: moduleItem.funcKey,
|
|
468
489
|
subModule1: subModule1Item.name,
|
|
469
490
|
subModule1Id: subModule1Item.id,
|
|
491
|
+
subModule1Key: subModule1Item.funcKey,
|
|
470
492
|
subModule2: subModule2Item.name,
|
|
471
493
|
subModule2Id: subModule2Item.id,
|
|
494
|
+
subModule2Key: subModule2Item.funcKey,
|
|
472
495
|
functions
|
|
473
496
|
})
|
|
474
497
|
})
|
|
@@ -620,9 +643,9 @@ const handleSubModule2Check = (row, checked) => {
|
|
|
620
643
|
// 勾选功能时,自动判断父级
|
|
621
644
|
const handleFunctionCheck = (row, func, checked) => {
|
|
622
645
|
func.checked = checked
|
|
623
|
-
//
|
|
624
|
-
const
|
|
625
|
-
row.subModule2Checked =
|
|
646
|
+
// 判断本组是否有功能被选中
|
|
647
|
+
const hasChecked = row.functions.some((f) => f.checked)
|
|
648
|
+
row.subModule2Checked = hasChecked
|
|
626
649
|
// 向上联动
|
|
627
650
|
updateSubModule1Checked(row.moduleId, row.subModule1Id)
|
|
628
651
|
}
|
|
@@ -631,9 +654,9 @@ const handleFunctionCheck = (row, func, checked) => {
|
|
|
631
654
|
const updateSubModule1Checked = (moduleId, subModule1Id) => {
|
|
632
655
|
// 找到所有同模块+同子模块1的行
|
|
633
656
|
const group = data.value.filter((item) => item.moduleId === moduleId && item.subModule1Id === subModule1Id)
|
|
634
|
-
const
|
|
657
|
+
const hasChecked = group.some((item) => item.subModule2Checked)
|
|
635
658
|
group.forEach((item) => {
|
|
636
|
-
item.subModule1Checked =
|
|
659
|
+
item.subModule1Checked = hasChecked
|
|
637
660
|
})
|
|
638
661
|
// 向上联动模块
|
|
639
662
|
updateModuleChecked(moduleId)
|
|
@@ -642,9 +665,9 @@ const updateSubModule1Checked = (moduleId, subModule1Id) => {
|
|
|
642
665
|
// 更新模块的勾选状态
|
|
643
666
|
const updateModuleChecked = (moduleId) => {
|
|
644
667
|
const group = data.value.filter((item) => item.moduleId === moduleId)
|
|
645
|
-
const
|
|
668
|
+
const hasChecked = group.some((item) => item.subModule1Checked)
|
|
646
669
|
group.forEach((item) => {
|
|
647
|
-
item.moduleChecked =
|
|
670
|
+
item.moduleChecked = hasChecked
|
|
648
671
|
})
|
|
649
672
|
}
|
|
650
673
|
|
|
@@ -979,6 +1002,29 @@ const onOrgSearch = () => {
|
|
|
979
1002
|
}
|
|
980
1003
|
onOrgSearch()
|
|
981
1004
|
|
|
1005
|
+
// 获取所有父级权限ID的辅助函数
|
|
1006
|
+
const getParentPermissionIds = (functionIds, row) => {
|
|
1007
|
+
const parentIds = new Set()
|
|
1008
|
+
|
|
1009
|
+
// 添加模块ID(如果存在)
|
|
1010
|
+
if (row.moduleId) {
|
|
1011
|
+
parentIds.add(row.moduleId)
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// 添加子模块1 ID(如果存在)
|
|
1015
|
+
if (row.subModule1Id) {
|
|
1016
|
+
parentIds.add(row.subModule1Id)
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// 添加子模块2 ID(如果存在)
|
|
1020
|
+
if (row.subModule2Id) {
|
|
1021
|
+
parentIds.add(row.subModule2Id)
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// 将Set转换为数组并去重
|
|
1025
|
+
return Array.from(parentIds)
|
|
1026
|
+
}
|
|
1027
|
+
|
|
982
1028
|
// 计算选中的数据权限结构
|
|
983
1029
|
const computedSelectedData = computed(() => {
|
|
984
1030
|
// 全局数据权限
|
|
@@ -993,8 +1039,14 @@ const computedSelectedData = computed(() => {
|
|
|
993
1039
|
.map((f) => f.id)
|
|
994
1040
|
.filter(Boolean)
|
|
995
1041
|
if (checkedFunctionIds.length > 0) {
|
|
1042
|
+
// 获取父级权限ID
|
|
1043
|
+
const parentIds = getParentPermissionIds(checkedFunctionIds, row)
|
|
1044
|
+
|
|
1045
|
+
// 合并功能ID和父级权限ID,去重
|
|
1046
|
+
const allFunctionIds = [...new Set([...checkedFunctionIds, ...parentIds])]
|
|
1047
|
+
|
|
996
1048
|
functionList.push({
|
|
997
|
-
functionIds:
|
|
1049
|
+
functionIds: allFunctionIds,
|
|
998
1050
|
dataScope: row.dataPermission || undefined,
|
|
999
1051
|
deptIds:
|
|
1000
1052
|
row.dataPermission === 6 && row.selectedOrgs && row.selectedOrgs.length > 0
|
|
@@ -1066,8 +1118,8 @@ const findOrgInTree = (tree, id) => {
|
|
|
1066
1118
|
|
|
1067
1119
|
// 添加用于更新父级勾选状态的辅助函数
|
|
1068
1120
|
const updateParentCheckStatus = (row) => {
|
|
1069
|
-
//
|
|
1070
|
-
const
|
|
1121
|
+
// 判断当前行的功能是否有被勾选
|
|
1122
|
+
const hasFunctionsChecked = row.functions.some(func => func.checked);
|
|
1071
1123
|
|
|
1072
1124
|
// 更新子模块2的勾选状态
|
|
1073
1125
|
if (row.subModule2) {
|
|
@@ -1078,14 +1130,14 @@ const updateParentCheckStatus = (row) => {
|
|
|
1078
1130
|
item.subModule2Id === row.subModule2Id
|
|
1079
1131
|
);
|
|
1080
1132
|
|
|
1081
|
-
//
|
|
1082
|
-
const
|
|
1083
|
-
item.functions.
|
|
1133
|
+
// 判断同组的所有行是否有功能被勾选
|
|
1134
|
+
const hasRowsChecked = sameGroup.some(item =>
|
|
1135
|
+
item.functions.some(func => func.checked)
|
|
1084
1136
|
);
|
|
1085
1137
|
|
|
1086
1138
|
// 更新子模块2的勾选状态
|
|
1087
1139
|
sameGroup.forEach(item => {
|
|
1088
|
-
item.subModule2Checked =
|
|
1140
|
+
item.subModule2Checked = hasRowsChecked;
|
|
1089
1141
|
});
|
|
1090
1142
|
}
|
|
1091
1143
|
|
|
@@ -1097,10 +1149,24 @@ const updateParentCheckStatus = (row) => {
|
|
|
1097
1149
|
<style lang="less" scoped>
|
|
1098
1150
|
.cell-with-checkbox {
|
|
1099
1151
|
display: flex;
|
|
1100
|
-
align-items:
|
|
1152
|
+
align-items: flex-start;
|
|
1101
1153
|
|
|
1102
|
-
.cell-
|
|
1154
|
+
.cell-content {
|
|
1103
1155
|
margin-left: 8px;
|
|
1156
|
+
display: flex;
|
|
1157
|
+
flex-direction: column;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
.cell-text {
|
|
1161
|
+
line-height: 1.4;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
.cell-id {
|
|
1165
|
+
margin-top: 2px;
|
|
1166
|
+
color: #999;
|
|
1167
|
+
font-size: 12px;
|
|
1168
|
+
font-family: monospace;
|
|
1169
|
+
line-height: 1.2;
|
|
1104
1170
|
}
|
|
1105
1171
|
|
|
1106
1172
|
.empty-cell {
|
|
@@ -1116,11 +1182,25 @@ const updateParentCheckStatus = (row) => {
|
|
|
1116
1182
|
|
|
1117
1183
|
.function-item {
|
|
1118
1184
|
display: flex;
|
|
1119
|
-
align-items:
|
|
1185
|
+
align-items: flex-start;
|
|
1120
1186
|
margin-right: 12px;
|
|
1121
1187
|
|
|
1122
|
-
.cell-
|
|
1188
|
+
.cell-content {
|
|
1123
1189
|
margin-left: 8px;
|
|
1190
|
+
display: flex;
|
|
1191
|
+
flex-direction: column;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
.cell-text {
|
|
1195
|
+
line-height: 1.4;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
.cell-id {
|
|
1199
|
+
margin-top: 2px;
|
|
1200
|
+
color: #999;
|
|
1201
|
+
font-size: 12px;
|
|
1202
|
+
font-family: monospace;
|
|
1203
|
+
line-height: 1.2;
|
|
1124
1204
|
}
|
|
1125
1205
|
}
|
|
1126
1206
|
}
|