@ebiz/designer-components 0.0.51 → 0.0.52

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.51",
3
+ "version": "0.0.52",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -122,6 +122,13 @@ const fetchHistory = () => {
122
122
  }, {}, '/tasks/process/detail').then(res=>{
123
123
  selectedApprover.value = res?.variables?.form?.approverList ?? [];
124
124
  selectedCC.value = res?.variables?.form?.ccList ?? [];
125
+ if(!selectedApprover.value.length){
126
+ dataService.fetch({
127
+ apiKey: "test_app_11111"
128
+ }, {},"/appdata/process?key=test_app_11111").then(res=>{
129
+ selectedApprover.value = res?.data?.at(0)?.approve_list || [];
130
+ })
131
+ }
125
132
  })
126
133
  }
127
134
 
@@ -184,6 +191,11 @@ const fetchEmployeeList = async () => {
184
191
  '/process/userList'
185
192
  )
186
193
  employeeList.value = response || [];
194
+ dataService.fetch({
195
+ apiKey: "test_app_11111"
196
+ }, {},"/appdata/execute/plugin?key=test_app_11111").then(res=>{
197
+ console.log(res,190)
198
+ })
187
199
  if(props.id) {
188
200
  fetchHistory();
189
201
  }
@@ -236,13 +248,11 @@ const handleAddCC = () => {
236
248
  showCCSelector.value = true
237
249
  }
238
250
 
239
- // 初始化时获取员工列表
240
- fetchEmployeeList()
241
251
 
242
252
  // 监听查询条件变化
243
253
  watch([() => props.type, () => props.value, () => props.showRootOrg, () => props.childDeptEnable], () => {
244
254
  fetchEmployeeList()
245
- })
255
+ }, { immediate: true })
246
256
  </script>
247
257
 
248
258
  <style lang="less" scoped>
@@ -0,0 +1,33 @@
1
+ <script setup>
2
+ import { ref, watch } from 'vue';
3
+
4
+ const props = defineProps({
5
+ key: {
6
+ type: String,
7
+ required: true,
8
+ default: ''
9
+ }
10
+ });
11
+
12
+ const isShow = ref(true);
13
+
14
+ const checkPermission = () => {
15
+ try {
16
+ const permissionKeysStr = localStorage.getItem('permissionKeys') || '[]';
17
+ const permissionKeys = JSON.parse(permissionKeysStr);
18
+ const hasPermission = permissionKeys.includes(props.key);
19
+ isShow.value = hasPermission;
20
+ } catch (error) {
21
+ console.error('解析权限数据失败:', error);
22
+ isShow.value = false;
23
+ }
24
+ };
25
+
26
+ watch(() => props.key, checkPermission, { immediate: true });
27
+ </script>
28
+
29
+ <template>
30
+ <div v-if="isShow">
31
+ <slot></slot>
32
+ </div>
33
+ </template>
@@ -18,7 +18,7 @@
18
18
 
19
19
  <!-- 选择弹窗 -->
20
20
  <t-dialog v-model:visible="dialogVisible" header="选择人员" :width="800" footer :close-btn="true"
21
- :close-on-esc-keydown="true" :close-on-overlay-click="true">
21
+ :close-on-esc-keydown="true" :close-on-overlay-click="true" destroyOnClose>
22
22
 
23
23
  <!-- 选项卡 -->
24
24
  <t-tabs v-model="activeTab" class="selector-tabs">
package/src/index.js CHANGED
@@ -63,6 +63,7 @@ import EbizDepartmentSelector from './components/EbizDepartmentSelector.vue';
63
63
  import EbizTdesignButtonDialog from './components/EbizTdesignButtonDialog.vue';
64
64
  import { MessagePlugin as EbizMessage } from 'tdesign-vue-next';
65
65
  import EbizApproval from './components/EbizApproval.vue';
66
+ import EbizDiv from './components/EbizDiv.vue';
66
67
 
67
68
  // import EbizDescriptions from './components/EbizDescriptions.vue';
68
69
  // import EbizDescriptionsItem from './components/EbizDescriptionsItem.vue'
@@ -90,6 +91,7 @@ import EbizSForm from './components/senior/EbizSForm/index.vue';
90
91
  import EbizSFormItem from './components/senior/EbizSForm/item.vue';
91
92
  import EbizSDialog from "./components/senior/EbizSDialog/index.vue";
92
93
 
94
+
93
95
  // 导出组件
94
96
  export {
95
97
  MyComponent,
@@ -211,5 +213,6 @@ export {
211
213
  EbizSFormItem,
212
214
  EbizSDialog,
213
215
  // 新增 EbizApproval 组件
214
- EbizApproval
216
+ EbizApproval,
217
+ EbizDiv
215
218
  };
@@ -358,6 +358,12 @@ const routes = [
358
358
  name:"EbizVxeTable",
359
359
  component:()=>import('../views/VxeTableDemo.vue'),
360
360
  meta:{title:"EbizVxeTable组件示例"}
361
+ },
362
+ {
363
+ path: '/permission-box',
364
+ name: 'PermissionBox',
365
+ component: () => import('../views/PermissionBoxDemo.vue'),
366
+ meta: { title: 'Ebiz权限盒子组件示例' }
361
367
  }
362
368
  ]
363
369
 
@@ -22,6 +22,11 @@
22
22
  <div class="component-title">树形合并表格</div>
23
23
  <div class="component-desc">支持树形展示和单元格合并的表格组件</div>
24
24
  </router-link>
25
+
26
+ <router-link to="/permission-box" class="component-item">
27
+ <div class="component-title">权限盒子组件示例</div>
28
+ <div class="component-desc">用于展示权限控制的组件示例</div>
29
+ </router-link>
25
30
  </div>
26
31
  </div>
27
32
  </template>
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <div class="permission-box-demo">
3
+ <h2>权限盒子组件演示</h2>
4
+
5
+ <div class="demo-section">
6
+ <h3>基础用法</h3>
7
+ <div class="demo-block">
8
+ <EbizDiv key="admin">
9
+ <div class="demo-content">
10
+ 这是只有管理员可见的内容
11
+ </div>
12
+ </EbizDiv>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="demo-section">
17
+ <h3>权限控制演示</h3>
18
+ <div class="demo-block">
19
+ <t-space direction="vertical">
20
+ <t-button @click="setPermission(['admin'])">设置管理员权限</t-button>
21
+ <t-button @click="setPermission(['user'])">设置普通用户权限</t-button>
22
+ <t-button @click="setPermission([])">清除所有权限</t-button>
23
+ </t-space>
24
+
25
+ <div class="permission-examples">
26
+ <EbizDiv key="admin">
27
+ <t-alert theme="success" message="管理员可见内容" />
28
+ </EbizDiv>
29
+
30
+ <EbizDiv key="user">
31
+ <t-alert theme="info" message="普通用户可见内容" />
32
+ </EbizDiv>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <script setup>
40
+ import { EbizDiv } from '../index.js';
41
+ import { Button as TButton, Space as TSpace, Alert as TAlert } from 'tdesign-vue-next';
42
+
43
+ const setPermission = (permissions) => {
44
+ localStorage.setItem('permissionKeys', JSON.stringify(permissions));
45
+ // 刷新页面以重新加载权限
46
+ window.location.reload();
47
+ };
48
+ </script>
49
+
50
+ <style scoped>
51
+ .permission-box-demo {
52
+ padding: 20px;
53
+ }
54
+
55
+ .demo-section {
56
+ margin-bottom: 30px;
57
+ }
58
+
59
+ h2 {
60
+ margin-bottom: 20px;
61
+ }
62
+
63
+ h3 {
64
+ margin-bottom: 15px;
65
+ }
66
+
67
+ .demo-block {
68
+ padding: 20px;
69
+ border: 1px solid #eee;
70
+ border-radius: 4px;
71
+ }
72
+
73
+ .demo-content {
74
+ padding: 16px;
75
+ background-color: #f5f5f5;
76
+ border-radius: 4px;
77
+ }
78
+
79
+ .permission-examples {
80
+ margin-top: 20px;
81
+ }
82
+
83
+ .permission-examples > * {
84
+ margin-bottom: 10px;
85
+ }
86
+ </style>