@ebiz/designer-components 0.0.19-beta.10 → 0.0.19-beta.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebiz/designer-components",
3
- "version": "0.0.19-beta.10",
3
+ "version": "0.0.19-beta.12",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -207,8 +207,8 @@
207
207
  </div>
208
208
  </div>
209
209
  <div class="org-tree-container">
210
- <t-tree :data="filteredOrgTreeData" :keys="orgTreeKeys" activable hover expandAll line expand-on-click-node
211
- :expanded="expandedKeys" :active="activeKey" @active="handleOrgNodeActive"
210
+ <t-tree :data="filteredOrgTreeData" :keys="orgTreeKeys" activable hover expandAll line
211
+ expand-on-click-node :expanded="expandedKeys" :active="activeKey" @active="handleOrgNodeActive"
212
212
  @expand="handleOrgNodeExpand">
213
213
  <template #operations="{ node }">
214
214
  <t-checkbox :checked="isOrgNodeSelected(node.data.id)"
@@ -359,41 +359,42 @@ dataService.fetch({}, {}, apis.tree).then((res) => {
359
359
  row.functionChecked = false
360
360
  })
361
361
  data.value = processedData;
362
- dataService.fetch({}, {}, apis.getConfig.replace('{roleId}', props.id)).then((res) => {
363
- res.forEach(item => {
364
- // 获取functionId
365
- const functionId = item.functionId;
366
- // 在data.value中查找对应功能所在的行
367
- data.value.forEach(row => {
368
- // 检查functions数组中是否有匹配的功能
369
- const matchedFunction = row.functions.find(func => func.id === functionId);
370
- if (matchedFunction) {
371
- // 设置功能勾选状态为true
372
- matchedFunction.checked = true;
373
-
374
- // 保存数据权限配置(如果有)
375
- if (item.dataScope) {
376
- row.dataPermission = item.dataScope;
377
- // 如果是自定义数据权限,则设置已选组织
378
- if (item.dataScope === 6 && item.deptIds && item.deptIds.length > 0) {
379
- row.selectedOrgs = item.deptIds.map(id => {
380
- const org = findOrgInTree(orgTreeData.value, id);
381
- return {
382
- id: id,
383
- name: org ? org.name : `组织${id}`
384
- };
385
- });
386
- }
362
+ })
363
+ function getRoleConfig() {
364
+ dataService.fetch({}, {}, apis.getConfig.replace('{roleId}', roleId.value || props.id)).then((res) => {
365
+ res.forEach(item => {
366
+ // 获取functionId
367
+ const functionId = item.functionId;
368
+ // 在data.value中查找对应功能所在的行
369
+ data.value.forEach(row => {
370
+ // 检查functions数组中是否有匹配的功能
371
+ const matchedFunction = row.functions.find(func => func.id === functionId);
372
+ if (matchedFunction) {
373
+ // 设置功能勾选状态为true
374
+ matchedFunction.checked = true;
375
+
376
+ // 保存数据权限配置(如果有)
377
+ if (item.dataScope) {
378
+ row.dataPermission = item.dataScope;
379
+ // 如果是自定义数据权限,则设置已选组织
380
+ if (item.dataScope === 6 && item.deptIds && item.deptIds.length > 0) {
381
+ row.selectedOrgs = item.deptIds.map(id => {
382
+ const org = findOrgInTree(orgTreeData.value, id);
383
+ return {
384
+ id: id,
385
+ name: org ? org.name : `组织${id}`
386
+ };
387
+ });
387
388
  }
388
-
389
- // 更新父级勾选状态(模块、子模块)
390
- updateParentCheckStatus(row);
391
389
  }
392
- });
390
+
391
+ // 更新父级勾选状态(模块、子模块)
392
+ updateParentCheckStatus(row);
393
+ }
393
394
  });
395
+ });
394
396
  })
395
- })
396
-
397
+ }
397
398
  /**
398
399
  * 处理树形数据,生成四级结构(模块、子模块1、子模块2、功能列表)
399
400
  * @param {Array} treeData 原始树形数据
@@ -929,26 +930,30 @@ const onOrgSearch = () => {
929
930
  )
930
931
  .then(async (res) => {
931
932
  orgTreeData.value = res;
932
- if(props.type === 'post'){
933
- roleId.value = await dataService.fetch({}, {}, apis.getRole.replace('{positionId}', props.id)).then((res) => {
934
- roleId.value = res?.id
935
- })
936
- }else{
937
- roleId.value = props.id;
933
+ if (props.type === 'post') {
934
+ roleId.value = (await dataService.fetch({}, {}, apis.getRole.replace('{positionId}', props.id))).id
935
+ } else {
936
+ roleId.value = props.id;
937
+ }
938
+ if (!roleId.value) return;
939
+ let timer = setInterval(() => {
940
+ if (data.value.length > 0) {
941
+ clearInterval(timer)
942
+ getRoleConfig()
938
943
  }
939
- if(!roleId.value)return;
940
- dataService.fetch({}, {}, apis.gerRoleInfo.replace('{id}', props.id)).then(res => {
941
- globalPermission.value = res.dataScope;
942
- // 使用递归查找函数获取完整组织信息
943
- globalSelectedOrgs.value = [...res.deptIds].map(id => {
944
- const org = findOrgInTree(orgTreeData.value, id);
945
- return {
946
- id: id,
947
- name: org ? org.name : `组织${id}` // 如果找不到组织,提供一个默认名称
948
- };
949
- });
950
- // 查询角色信息
951
- })
944
+ }, 500);
945
+ dataService.fetch({}, {}, apis.gerRoleInfo.replace('{id}', roleId.value)).then(res => {
946
+ globalPermission.value = res.dataScope;
947
+ // 使用递归查找函数获取完整组织信息
948
+ globalSelectedOrgs.value = [...res.deptIds].map(id => {
949
+ const org = findOrgInTree(orgTreeData.value, id);
950
+ return {
951
+ id: id,
952
+ name: org ? org.name : `组织${id}` // 如果找不到组织,提供一个默认名称
953
+ };
954
+ });
955
+ // 查询角色信息
956
+ })
952
957
  })
953
958
  }
954
959
  onOrgSearch()
@@ -983,7 +988,7 @@ const computedSelectedData = computed(() => {
983
988
  }
984
989
  if (roleId.value) {
985
990
  role.id = roleId.value
986
- }else{
991
+ } else {
987
992
  role.positionId = props.id
988
993
  }
989
994
  return {
@@ -1006,7 +1011,7 @@ function handleSaveRolePermission() {
1006
1011
  {},
1007
1012
  apis.saveRole
1008
1013
  ).then(res => {
1009
- if(!res){
1014
+ if (!res) {
1010
1015
  Message.error('保存失败')
1011
1016
  return
1012
1017
  }
@@ -1022,11 +1027,11 @@ defineExpose({
1022
1027
  // 先添加一个从树形结构中递归查找组织的辅助函数
1023
1028
  const findOrgInTree = (tree, id) => {
1024
1029
  if (!tree || !Array.isArray(tree)) return null;
1025
-
1030
+
1026
1031
  // 先在当前层级查找
1027
1032
  const found = tree.find(item => item.id === id);
1028
1033
  if (found) return found;
1029
-
1034
+
1030
1035
  // 如果当前层级没找到,递归查找子节点
1031
1036
  for (const node of tree) {
1032
1037
  if (node.childs && node.childs.length > 0) {
@@ -1034,7 +1039,7 @@ const findOrgInTree = (tree, id) => {
1034
1039
  if (foundInChild) return foundInChild;
1035
1040
  }
1036
1041
  }
1037
-
1042
+
1038
1043
  return null; // 未找到
1039
1044
  };
1040
1045
 
@@ -1042,27 +1047,27 @@ const findOrgInTree = (tree, id) => {
1042
1047
  const updateParentCheckStatus = (row) => {
1043
1048
  // 判断当前行的功能是否全部勾选
1044
1049
  const allFunctionsChecked = row.functions.every(func => func.checked);
1045
-
1050
+
1046
1051
  // 更新子模块2的勾选状态
1047
1052
  if (row.subModule2) {
1048
1053
  // 寻找同组的所有行
1049
- const sameGroup = data.value.filter(item =>
1050
- item.moduleId === row.moduleId &&
1051
- item.subModule1Id === row.subModule1Id &&
1054
+ const sameGroup = data.value.filter(item =>
1055
+ item.moduleId === row.moduleId &&
1056
+ item.subModule1Id === row.subModule1Id &&
1052
1057
  item.subModule2Id === row.subModule2Id
1053
1058
  );
1054
-
1059
+
1055
1060
  // 判断同组的所有行是否全部勾选了功能
1056
- const allRowsChecked = sameGroup.every(item =>
1061
+ const allRowsChecked = sameGroup.every(item =>
1057
1062
  item.functions.every(func => func.checked)
1058
1063
  );
1059
-
1064
+
1060
1065
  // 更新子模块2的勾选状态
1061
1066
  sameGroup.forEach(item => {
1062
1067
  item.subModule2Checked = allRowsChecked;
1063
1068
  });
1064
1069
  }
1065
-
1070
+
1066
1071
  // 更新子模块1的勾选状态
1067
1072
  updateSubModule1Checked(row.moduleId, row.subModule1Id);
1068
1073
  }
@@ -1218,6 +1223,7 @@ const updateParentCheckStatus = (row) => {
1218
1223
  transition: all 0.2s ease;
1219
1224
  border-radius: 4px;
1220
1225
  cursor: pointer;
1226
+
1221
1227
  &:hover {
1222
1228
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
1223
1229
  transform: translateY(-1px);
@@ -1285,6 +1291,7 @@ const updateParentCheckStatus = (row) => {
1285
1291
  border-radius: 6px;
1286
1292
  overflow: hidden;
1287
1293
  background-color: #fff;
1294
+
1288
1295
  .panel-header {
1289
1296
  background-color: #f5f5f5;
1290
1297
  padding: 12px 16px;
@@ -1383,4 +1390,4 @@ const updateParentCheckStatus = (row) => {
1383
1390
  color: #999;
1384
1391
  font-size: 14px;
1385
1392
  }
1386
- </style>
1393
+ </style>
@@ -154,7 +154,7 @@ const fetchApiData = async () => {
154
154
  '/appdata/execute/plugin?key=organizational_structure'
155
155
  )
156
156
  employeeData.value = (await dataService.fetch(
157
- {keyWord:activeTab.value === 'employee' ? searchText.value : ''},
157
+ {postEnable:true, keyWord:activeTab.value === 'employee' ? searchText.value : ''},
158
158
  {},
159
159
  "/appdata/execute/plugin?key=all_active_employesse"
160
160
  )).map(i=>({
@@ -1,36 +0,0 @@
1
- <template>
2
- <div>
3
- <EbizTreeMergeTable :type="type" :id="id" @success="handleSuccess"/>
4
- </div>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: 'EbizTreeMergeTableConfig'
10
- }
11
- </script>
12
-
13
- <script setup>
14
- import { defineProps, defineEmits } from 'vue'
15
- import EbizTreeMergeTable from './EbizTreeMergeTable.vue'
16
-
17
- const props = defineProps({
18
- type: {
19
- type: String,
20
- default: 'role' // role,post 角色,岗位
21
- },
22
- id: {
23
- type: String,
24
- default: ''
25
- }
26
- })
27
-
28
- const emits = defineEmits(['success'])
29
-
30
- const handleSuccess = () => {
31
- emits('success')
32
- }
33
- </script>
34
-
35
- <style scoped>
36
- </style>