@ebiz/designer-components 0.1.108 → 0.1.110

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.1.108",
3
+ "version": "0.1.110",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <div class='ebiz-approval-container'>
3
+ <div class='detail-container'>
4
+ <div class="title">{{ approvalDetail.variables?.startUserName + '的' + approvalDetail.processDefinitionName }}</div>
5
+ <!-- 区块详情 -->
6
+ <div class="block-detail">
7
+ <slot name="block"></slot>
8
+ </div>
9
+ <!-- 审批区域 -->
10
+ <div class="approval-area">
11
+ <ebiz-s-approval-process ref="approvalprocessRef" :businessKey="businessKey"
12
+ :type="type"></ebiz-s-approval-process>
13
+
14
+ <ebiz-approval-form v-if="isAssignee" :taskId="currTask.id" :businessKey="businessKey"
15
+ :taskDefinitionKey="currTask.taskDefinitionKey" :approvalDetail="approvalDetail" @pass="refresh"
16
+ @reject="refresh" @refresh="refresh"></ebiz-approval-form>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script lang='ts' setup>
23
+
24
+ import { ref, onMounted } from 'vue';
25
+ import { dataService, EbizSApprovalProcess, EbizApprovalForm } from '../index'
26
+ import { MessagePlugin as message, LoadingPlugin as loading } from 'tdesign-vue-next'
27
+
28
+ const props = defineProps({
29
+ businessKey: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ type: {
34
+ type: String,
35
+ default: ''
36
+ }
37
+ })
38
+
39
+ // 审批流程组件实例
40
+ const approvalprocessRef = ref(null)
41
+
42
+ // 当前用户
43
+ const user = ref({})
44
+
45
+ // 审批详情
46
+ const approvalDetail = ref({})
47
+
48
+ // 当前任务
49
+ const currTask = ref({})
50
+
51
+ // 是否为当前任务的审批人
52
+ const isAssignee = ref(false)
53
+
54
+ // 获取审批详情
55
+ const getApprovalDetail = () => {
56
+ loading(true)
57
+ dataService.fetch(
58
+ {
59
+ businessKey: props.businessKey,
60
+ type: props.type
61
+ },
62
+ {},
63
+ '/tasks/process/detail'
64
+ ).then((res) => {
65
+ approvalDetail.value = res
66
+ if (res.activeTasks.length > 0) {
67
+ //是待处理的任务
68
+ currTask.value = res.activeTasks[0] //当前任务
69
+ isAssignee.value = currTask.value.assignee == user.value.userId
70
+
71
+ } else {
72
+ isAssignee.value = false
73
+ }
74
+ loading(false)
75
+ }).catch((err) => {
76
+ message.error(err.message)
77
+ })
78
+ }
79
+
80
+ // 初始化
81
+ const init = () => {
82
+ approvalDetail.value = {}
83
+ currTask.value = {}
84
+ isAssignee.value = false
85
+ const { businessKey, type } = props
86
+ getApprovalDetail()
87
+ user.value = JSON.parse(localStorage.getItem('user'))
88
+ approvalprocessRef.value?.requestApprovalDetail(businessKey, type)
89
+ }
90
+
91
+ // 刷新页面
92
+ const refresh = () => {
93
+ init()
94
+ }
95
+
96
+ onMounted(() => {
97
+ init()
98
+ })
99
+ </script>
100
+
101
+ <style lang='less' scoped>
102
+ .ebiz-approval-container {
103
+ display: flex;
104
+ justify-content: center;
105
+ align-items: center;
106
+ }
107
+
108
+ .title {
109
+ position: absolute;
110
+ top: 0;
111
+ left: 0;
112
+ padding: 24px 12px;
113
+ color: #000000;
114
+ font-size: 18px;
115
+ font-weight: 600;
116
+ }
117
+
118
+ .detail-container {
119
+ position: relative;
120
+ display: flex;
121
+ width: 1000px;
122
+ padding: 60px 12px;
123
+ background-color: #ffffff;
124
+ border-radius: 4px;
125
+ box-sizing: border-box;
126
+ }
127
+
128
+ .block-detail {
129
+ padding-top: 12px;
130
+ flex: 3;
131
+ }
132
+
133
+ .approval-area {
134
+ padding-left: 16px;
135
+ flex: 2;
136
+ }
137
+ </style>
@@ -1,8 +1,7 @@
1
1
  <template>
2
2
  <div class="ebiz-file-list" :class="{ 'mini-mode': size === 'mini' }">
3
3
  <div v-if="computedFiles.length === 0" class="empty-state">
4
- <t-icon name="file" size="20px" />
5
- <p>暂无文件</p>
4
+ <div>-</div>
6
5
  </div>
7
6
  <div v-else class="file-list-container" :class="{ 'mini-container': size === 'mini' }">
8
7
  <div v-for="(file, index) in computedFiles" :key="index" class="file-item"
@@ -164,8 +163,47 @@ const computedFiles = computed(() => {
164
163
  return [];
165
164
  }
166
165
 
167
- // 判断是单个URL还是逗号分隔的多个URL
168
- if (props.files.includes(',')) {
166
+ // 判断是否为JSON字符串
167
+ const trimmedFiles = props.files.trim();
168
+ if (trimmedFiles.startsWith('[') && trimmedFiles.endsWith(']')) {
169
+ try {
170
+ // 尝试解析JSON字符串
171
+ const parsedArray = JSON.parse(trimmedFiles);
172
+ if (Array.isArray(parsedArray)) {
173
+ // 解析成功,处理数组中的每个元素
174
+ fileList = parsedArray.map(item => {
175
+ if (typeof item === 'string') {
176
+ // 数组中的字符串元素,作为URL处理
177
+ return parseFileInfo(item);
178
+ } else if (item && typeof item === 'object') {
179
+ // 对象格式的文件信息
180
+ const url = item.url || item.src || item.path || '';
181
+ return {
182
+ name: item.name || extractFileName(url),
183
+ url: getFullUrl(url),
184
+ size: item.size || null,
185
+ extension: item.extension || getFileExtension(url || item.name || ''),
186
+ ...item
187
+ };
188
+ } else {
189
+ // 其他情况,返回默认对象
190
+ return {
191
+ name: '未知文件',
192
+ url: '',
193
+ extension: '',
194
+ size: null
195
+ };
196
+ }
197
+ });
198
+ } else {
199
+ // 解析出来不是数组,按普通字符串处理
200
+ fileList = [parseFileInfo(trimmedFiles)];
201
+ }
202
+ } catch (e) {
203
+ // JSON解析失败,按普通字符串处理
204
+ fileList = [parseFileInfo(trimmedFiles)];
205
+ }
206
+ } else if (props.files.includes(',')) {
169
207
  // 逗号分隔的多个URL
170
208
  const urls = props.files.split(',').map(url => url.trim()).filter(url => url);
171
209
  fileList = urls.map(url => parseFileInfo(url));
@@ -360,8 +398,6 @@ const handleImageError = () => {
360
398
  .empty-state {
361
399
  display: flex;
362
400
  flex-direction: column;
363
- align-items: center;
364
- justify-content: center;
365
401
  padding: 10px;
366
402
  color: #999;
367
403
 
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <t-qrcode :bg-color="bgColor" :border-less="borderless" :color="color" :icon="icon" :icon-size="iconSize"
4
4
  :level="level" :size="size" :type="type" :value="value" @refresh="onRefresh"
5
- @click="onClick" :class="{ 'cursor-pointer': props.dialogShow }">
5
+ @click="onClick" :class="{ 'no-padding': true, 'cursor-pointer': props.dialogShow }">
6
6
  </t-qrcode>
7
7
  <t-dialog v-model:visible="dialogVisible" :width="dialogWidth" :confirm-btn="null" :cancel-btn="null">
8
8
  <div style="display: flex; justify-content: center;">
@@ -157,9 +157,12 @@ const handleDownload = () => {
157
157
  </script>
158
158
 
159
159
 
160
- <style scoped>
160
+ <style lang="less" scoped>
161
161
  /* 自定义样式 */
162
162
  .cursor-pointer {
163
163
  cursor: pointer;
164
164
  }
165
+ .no-padding {
166
+ padding: 6px;
167
+ }
165
168
  </style>
package/src/index.js CHANGED
@@ -66,6 +66,7 @@ import EbizApproval from './components/EbizApproval.vue'
66
66
  import EbizApprovalForm from './components/EbizApprovalForm.vue'
67
67
  import EbizDiv from './components/EbizDiv.vue'
68
68
  import EbizSApprovalProcess from './components/EbizSApprovalProcess.vue'
69
+ import EbizApprovalDetail from './components/EbizApprovalDetail.vue'
69
70
 
70
71
  // import EbizDescriptions from './components/EbizDescriptions.vue';
71
72
  // import EbizDescriptionsItem from './components/EbizDescriptionsItem.vue'
@@ -313,5 +314,7 @@ export {
313
314
  // 二维码组件
314
315
  EbizQrCode,
315
316
  // 访谈组件
316
- LaunchInterview
317
+ LaunchInterview,
318
+ // 审批详情组件
319
+ EbizApprovalDetail
317
320
  }