@ebiz/designer-components 0.0.20 → 0.0.22

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.20",
3
+ "version": "0.0.22",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <t-loading :delay="delay" :duration="duration" :indicator="indicator" :inherit-color="inheritColor" :layout="layout"
3
+ :loading="loading" :loading-props="loadingProps" :pause="pause" :reverse="reverse" :show-overlay="showOverlay"
4
+ :size="size" :text="text" :theme="theme">
5
+ <!-- 默认插槽 -->
6
+ <slot></slot>
7
+
8
+ <!-- 文本内容插槽 -->
9
+ <template v-if="$slots.text" #text>
10
+ <slot name="text"></slot>
11
+ </template>
12
+
13
+ <!-- 加载指示器插槽 -->
14
+ <template v-if="$slots.indicator" #indicator>
15
+ <slot name="indicator"></slot>
16
+ </template>
17
+
18
+ <!-- 加载内容插槽 -->
19
+ <template v-if="$slots.content" #content>
20
+ <slot name="content"></slot>
21
+ </template>
22
+ </t-loading>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: "EbizTdesignLoading"
28
+ }
29
+ </script>
30
+
31
+ <script setup>
32
+ import { defineProps } from 'vue';
33
+ import { Loading as TLoading } from 'tdesign-vue-next';
34
+
35
+ const props = defineProps({
36
+ // 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒
37
+ delay: {
38
+ type: Number,
39
+ default: 0
40
+ },
41
+ // 加载动画执行完成一次的时间,单位:毫秒
42
+ duration: {
43
+ type: Number,
44
+ default: 800
45
+ },
46
+ // 加载指示符,值为 true 显示默认指示符,值为 false 则不显示,也可以自定义指示符
47
+ indicator: {
48
+ type: [Boolean, Function],
49
+ default: true
50
+ },
51
+ // 是否继承父元素颜色
52
+ inheritColor: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ // 对齐方式
57
+ layout: {
58
+ type: String,
59
+ default: 'horizontal',
60
+ validator: (val) => ['horizontal', 'vertical'].includes(val)
61
+ },
62
+ // 是否处于加载状态
63
+ loading: {
64
+ type: Boolean,
65
+ default: true
66
+ },
67
+ // 透传加载组件全部属性
68
+ loadingProps: {
69
+ type: Object,
70
+ default: () => ({})
71
+ },
72
+ // 是否暂停动画
73
+ pause: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ // 加载动画是否反向
78
+ reverse: {
79
+ type: Boolean,
80
+ default: false
81
+ },
82
+ // 是否需要遮罩层
83
+ showOverlay: {
84
+ type: Boolean,
85
+ default: true
86
+ },
87
+ // 尺寸,示例:small/medium/large/12px/56px
88
+ size: {
89
+ type: String,
90
+ default: 'medium'
91
+ },
92
+ // 加载提示文案
93
+ text: {
94
+ type: String,
95
+ default: ''
96
+ },
97
+ // 加载组件类型
98
+ theme: {
99
+ type: String,
100
+ default: 'circular',
101
+ validator: (val) => ['circular', 'spinner', 'dots', 'bar'].includes(val)
102
+ }
103
+ });
104
+ </script>
105
+
106
+ <style lang="less" scoped>
107
+ /* 自定义样式 */
108
+ </style>
@@ -161,7 +161,7 @@
161
161
  <div class="org-selected-container">
162
162
  <div v-if="tempGlobalSelectedOrgs.length === 0" class="no-selected-tip">请从左侧选择组织</div>
163
163
  <div v-else class="selected-orgs-tags">
164
- <t-tag v-for="org in tempGlobalSelectedOrgs" :key="org.id" closable @close="removeGlobalOrg(org.id)"
164
+ <t-tag v-for="org in tempGlobalSelectedOrgs" :key="org.id" closable @close="removeGlobalSelectedOrg(org.id)"
165
165
  theme="primary" variant="light" class="org-tag">
166
166
  {{ org.name }}
167
167
  </t-tag>
@@ -310,7 +310,8 @@ import {
310
310
  Input as TInput,
311
311
  Tree as TTree,
312
312
  Tag as TTag,
313
- Icon as TIcon
313
+ Icon as TIcon,
314
+ Message
314
315
  } from 'tdesign-vue-next'
315
316
 
316
317
  const apis = {
@@ -372,10 +373,12 @@ function getRoleConfig() {
372
373
  if (matchedFunction) {
373
374
  // 设置功能勾选状态为true
374
375
  matchedFunction.checked = true;
375
-
376
+
376
377
  // 保存数据权限配置(如果有)
377
378
  if (item.dataScope) {
378
379
  row.dataPermission = item.dataScope;
380
+ // 标记为自定义配置
381
+ row.hasCustomConfig = true;
379
382
  // 如果是自定义数据权限,则设置已选组织
380
383
  if (item.dataScope === 6 && item.deptIds && item.deptIds.length > 0) {
381
384
  row.selectedOrgs = item.deptIds.map(id => {
@@ -387,7 +390,7 @@ function getRoleConfig() {
387
390
  });
388
391
  }
389
392
  }
390
-
393
+
391
394
  // 更新父级勾选状态(模块、子模块)
392
395
  updateParentCheckStatus(row);
393
396
  }
@@ -761,16 +764,17 @@ const handleOrgNodeExpand = (value) => {
761
764
  // 打开数据权限配置弹窗
762
765
  const openPermissionDialog = (row) => {
763
766
  currentRow.value = row
764
- // 只做展示,不写入行权限
765
- if (row.dataPermission) {
766
- selectedPermission.value = row.dataPermission
767
+ // 检查是否已有自定义配置
768
+ if (row.hasCustomConfig) {
769
+ // 已有自定义配置,使用自身配置
770
+ selectedPermission.value = row.dataPermission || 1
767
771
  if (row.dataPermission === 6 && row.selectedOrgs) {
768
772
  selectedOrgs.value = [...row.selectedOrgs]
769
773
  } else {
770
774
  selectedOrgs.value = []
771
775
  }
772
776
  } else {
773
- // 没有配置则展示全局,但不写入行
777
+ // 没有自定义配置,继承全局配置
774
778
  selectedPermission.value = globalPermission.value
775
779
  if (globalPermission.value === 6) {
776
780
  selectedOrgs.value = [...globalSelectedOrgs.value]
@@ -818,15 +822,19 @@ const handleGlobalOrgNodeSelect = (node, checked) => {
818
822
  }
819
823
  } else {
820
824
  // 从已选中中移除
821
- removeGlobalOrg(node.id)
825
+ removeGlobalSelectedOrg(node.id)
822
826
  }
823
827
  }
824
828
 
825
829
  // 移除选中的全局组织(对话框中使用)
826
830
  const removeGlobalSelectedOrg = (id) => {
827
- const index = tempGlobalSelectedOrgs.value.findIndex((org) => org.id === id)
831
+ console.log('移除临时全局组织', id);
832
+ const index = tempGlobalSelectedOrgs.value.findIndex((org) => org.id === id);
828
833
  if (index !== -1) {
829
- tempGlobalSelectedOrgs.value.splice(index, 1)
834
+ tempGlobalSelectedOrgs.value.splice(index, 1);
835
+ console.log('移除成功,剩余组织数量:', tempGlobalSelectedOrgs.value.length);
836
+ } else {
837
+ console.log('未找到对应组织');
830
838
  }
831
839
  }
832
840
 
@@ -864,7 +872,7 @@ const handleGlobalOrgConfirm = () => {
864
872
  // 保存选择结果
865
873
  globalSelectedOrgs.value = [...tempGlobalSelectedOrgs.value]
866
874
 
867
- // 应用到所有选择了自定义数据的行
875
+ // 应用到未配置自定义数据权限的行
868
876
  applyGlobalOrgsToCustomRows()
869
877
 
870
878
  globalOrgDialogVisible.value = false
@@ -875,11 +883,21 @@ const handleGlobalOrgCancel = () => {
875
883
  globalOrgDialogVisible.value = false
876
884
  }
877
885
 
878
- // 将全局组织应用到所有自定义数据权限的行
886
+ // 将全局组织应用到未配置自定义数据权限的行
879
887
  const applyGlobalOrgsToCustomRows = () => {
888
+ // 遍历每一行数据
880
889
  data.value.forEach((row) => {
881
- if (row.dataPermission === 6) {
882
- row.selectedOrgs = [...globalSelectedOrgs.value]
890
+ // 只对没有自定义配置的行应用全局设置
891
+ if (!row.hasCustomConfig) {
892
+ // 应用全局权限设置
893
+ row.dataPermission = globalPermission.value
894
+
895
+ // 如果全局设置是自定义数据权限,则应用全局选择的组织
896
+ if (globalPermission.value === 6) {
897
+ row.selectedOrgs = [...globalSelectedOrgs.value]
898
+ } else {
899
+ row.selectedOrgs = []
900
+ }
883
901
  }
884
902
  })
885
903
  }
@@ -887,6 +905,8 @@ const applyGlobalOrgsToCustomRows = () => {
887
905
  // 确认权限配置(修改处理全局配置的情况)
888
906
  const handlePermissionConfirm = () => {
889
907
  if (currentRow.value) {
908
+ // 标记该行已有自定义配置
909
+ currentRow.value.hasCustomConfig = true;
890
910
  currentRow.value.dataPermission = selectedPermission.value
891
911
  if (selectedPermission.value === 6) {
892
912
  currentRow.value.selectedOrgs = [...selectedOrgs.value]
@@ -899,6 +919,7 @@ const handlePermissionConfirm = () => {
899
919
 
900
920
  // 取消权限配置(修改处理全局配置的情况)
901
921
  const handlePermissionCancel = () => {
922
+ // 只关闭弹窗,不做其他操作
902
923
  permissionDialogVisible.value = false
903
924
  }
904
925
 
package/src/index.js CHANGED
@@ -57,6 +57,7 @@ import EbizTreeSelector from './components/EbizTreeSelector.vue';
57
57
  import EbizTimePicker from './components/EbizTimePicker.vue';
58
58
  import EbizPopconfirm from './components/EbizPopconfirm.vue';
59
59
  import EbizTreeMergeTable from './components/EbizTreeMergeTable.vue';
60
+ import EbizTdesignLoading from './components/EbizTdesignLoading.vue';
60
61
  import EbizAutoForm from './components/EbizAutoForm.vue';
61
62
  import { MessagePlugin as EbizMessage } from 'tdesign-vue-next';
62
63
 
@@ -77,6 +78,7 @@ import "./assets/styles/charts/main.less";
77
78
  // 时间轴组件
78
79
  import EbizTimeline from "./components/TdesignTimeline.vue";
79
80
  import {TimelineItem as EbizTimelineItem} from 'tdesign-vue-next';
81
+ import { LoadingPlugin as EbizLoading } from 'tdesign-vue-next';
80
82
 
81
83
  // 导出组件
82
84
  export {
@@ -184,5 +186,7 @@ export {
184
186
  // 新增 EbizDescriptions 和 EbizDescriptionsItem
185
187
  EbizDescriptions,
186
188
  EbizDescriptionsItem,
187
- TDescriptionsItem
189
+ TDescriptionsItem,
190
+ EbizTdesignLoading,
191
+ EbizLoading
188
192
  };