@ebiz/designer-components 0.1.122 → 0.1.124
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 +9556 -9545
- package/package.json +1 -1
- package/src/components/EbizApprovalForm.vue +41 -14
- package/src/components/EbizApprovalV2.vue +714 -0
- package/src/components/EbizDormDashboard.vue +4 -4
- package/src/components/EbizParkingDashboard.vue +10 -3
- package/src/components/LaunchInterview.vue +2 -1
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ebiz-approval">
|
|
3
|
+
<t-card>
|
|
4
|
+
<!-- 审批流程节点列表 -->
|
|
5
|
+
<div class="approval-section">
|
|
6
|
+
<slot name="title">
|
|
7
|
+
<div class="approval-title">审批流程</div>
|
|
8
|
+
</slot>
|
|
9
|
+
|
|
10
|
+
<!-- 节点列表 -->
|
|
11
|
+
<div v-if="nodeConfigs.length > 0" class="node-list">
|
|
12
|
+
<div v-for="(node, index) in nodeConfigs" :key="node.nodeId" class="node-item">
|
|
13
|
+
<!-- 节点信息 -->
|
|
14
|
+
<div class="node-header">
|
|
15
|
+
<t-icon name="user" class="node-icon" />
|
|
16
|
+
<span class="node-name">{{ node.nodeName }}</span>
|
|
17
|
+
<span class="node-type-badge" :class="{ 'parallel': isParallelNode(node) }">
|
|
18
|
+
{{ node.nodeTypeDesc || node.multiInstanceTypeDesc }}
|
|
19
|
+
</span>
|
|
20
|
+
<span class="required" v-if="required">*</span>
|
|
21
|
+
<div class="node-desc" v-if="node.description">{{ node.description }}</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<!-- 节点审批人 -->
|
|
25
|
+
<div class="node-approvers">
|
|
26
|
+
<!-- 会签节点:支持添加/删除 -->
|
|
27
|
+
<template v-if="needManualConfig(node)">
|
|
28
|
+
<div class="approver-row">
|
|
29
|
+
<template v-for="(approver, approverIndex) in getNodeApprovers(node.nodeId)" :key="approver.id">
|
|
30
|
+
<div class="approver-item">
|
|
31
|
+
<t-avatar :image="approver.avatar" size="small">
|
|
32
|
+
{{ getAvatarText(approver.name) }}
|
|
33
|
+
</t-avatar>
|
|
34
|
+
<div class="user-info" :class="{ 'no-delete': required && getNodeApprovers(node.nodeId).length <= 1 }">
|
|
35
|
+
<span class="approver-name">{{ approver.no }} - {{ approver.name }}</span>
|
|
36
|
+
<t-icon name="close" size="16px" @click="removeNodeApprover(node.nodeId, approver.id)" />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<t-icon v-if="approverIndex < getNodeApprovers(node.nodeId).length - 1" name="chevron-right" class="arrow-icon" />
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<!-- 添加审批人按钮 -->
|
|
43
|
+
<t-button
|
|
44
|
+
theme="default"
|
|
45
|
+
variant="text"
|
|
46
|
+
@click="handleAddNodeApprover(node.nodeId)"
|
|
47
|
+
>
|
|
48
|
+
<template #icon>
|
|
49
|
+
<t-icon name="add" />
|
|
50
|
+
</template>
|
|
51
|
+
添加审批人
|
|
52
|
+
</t-button>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<!-- 非会签节点:只读显示 -->
|
|
57
|
+
<template v-else>
|
|
58
|
+
<div class="readonly-approvers">
|
|
59
|
+
<template v-if="getNodeApprovers(node.nodeId).length > 0">
|
|
60
|
+
<div class="approver-row">
|
|
61
|
+
<template v-for="(approver, approverIndex) in getNodeApprovers(node.nodeId)" :key="approver.id">
|
|
62
|
+
<div class="approver-item readonly">
|
|
63
|
+
<t-avatar :image="approver.avatar" size="small">
|
|
64
|
+
{{ getAvatarText(approver.name) }}
|
|
65
|
+
</t-avatar>
|
|
66
|
+
<div class="user-info">
|
|
67
|
+
<span class="approver-name">{{ approver.no }} - {{ approver.name }}</span>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<t-icon v-if="approverIndex < getNodeApprovers(node.nodeId).length - 1" name="chevron-right" class="arrow-icon" />
|
|
71
|
+
</template>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
<div v-else class="no-approvers">
|
|
75
|
+
<t-icon name="user" size="16px" />
|
|
76
|
+
<span>系统自动分配审批人</span>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<!-- 节点分隔线 -->
|
|
83
|
+
<!-- <div v-if="index < nodeConfigs.length - 1" class="node-divider">
|
|
84
|
+
</div> -->
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<!-- 无配置提示 -->
|
|
89
|
+
<div v-else class="no-config">
|
|
90
|
+
<t-icon name="info-circle" size="20px" />
|
|
91
|
+
<span>暂无流程配置信息</span>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<!-- 抄送人部分 -->
|
|
96
|
+
<div v-if="showCC" class="cc-section">
|
|
97
|
+
<div class="section-header">
|
|
98
|
+
<t-icon name="user-add" class="section-icon" />
|
|
99
|
+
<span class="section-title">抄送人</span>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="cc-list">
|
|
102
|
+
<div class="cc-row">
|
|
103
|
+
<template v-for="(cc, index) in ccEmployees" :key="index">
|
|
104
|
+
<div class="cc-item">
|
|
105
|
+
<t-avatar :image="cc.avatar" size="small">
|
|
106
|
+
{{ getAvatarText(cc.name) }}
|
|
107
|
+
</t-avatar>
|
|
108
|
+
<div class="user-info">
|
|
109
|
+
<span class="cc-name">{{ cc.name }}</span>
|
|
110
|
+
<t-icon name="close" size="16px" @click="removeEmployee(cc.id)" v-if="canEdit" />
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</template>
|
|
114
|
+
<t-button
|
|
115
|
+
theme="default"
|
|
116
|
+
variant="text"
|
|
117
|
+
@click="handleAddCC"
|
|
118
|
+
v-if="canEdit"
|
|
119
|
+
>
|
|
120
|
+
<template #icon>
|
|
121
|
+
<t-icon name="add" />
|
|
122
|
+
</template>
|
|
123
|
+
添加抄送人
|
|
124
|
+
</t-button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</t-card>
|
|
129
|
+
|
|
130
|
+
<!-- 审批人选择弹窗 -->
|
|
131
|
+
<ebiz-employee-selector v-if="showApproverSelector" :showDefault="false" v-model:visible="showApproverSelector"
|
|
132
|
+
@change="handleApproverSelect" :single="true" />
|
|
133
|
+
<ebiz-employee-selector v-if="showCCSelector" :showDefault="false" v-model:visible="showCCSelector"
|
|
134
|
+
@change="handleCCSelect" />
|
|
135
|
+
</div>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<script setup lang="ts">
|
|
139
|
+
import { ref, watch, computed, onMounted } from 'vue'
|
|
140
|
+
import { Icon as TIcon, Avatar as TAvatar, Card as TCard, Button as TButton } from 'tdesign-vue-next'
|
|
141
|
+
import EbizEmployeeSelector from './EbizEmployeeSelector.vue'
|
|
142
|
+
import dataService from '../apiService/simpleDataService'
|
|
143
|
+
|
|
144
|
+
interface Employee {
|
|
145
|
+
id: string | number
|
|
146
|
+
name: string
|
|
147
|
+
no: string
|
|
148
|
+
avatar?: string
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 节点配置接口
|
|
152
|
+
interface ProcessNodeConfig {
|
|
153
|
+
nodeId: string
|
|
154
|
+
nodeName: string
|
|
155
|
+
nodeType: string
|
|
156
|
+
nodeTypeDesc: string
|
|
157
|
+
multiInstanceType: string
|
|
158
|
+
multiInstanceTypeDesc: string
|
|
159
|
+
isMultiInstance: boolean
|
|
160
|
+
needManualConfig: boolean
|
|
161
|
+
ruleType: string
|
|
162
|
+
ruleTypeDesc: string
|
|
163
|
+
deptIds: number[]
|
|
164
|
+
roleIds: number[]
|
|
165
|
+
userIds: number[]
|
|
166
|
+
defaultApprovers: ApproverConfig[]
|
|
167
|
+
extensionProperties: Record<string, any>
|
|
168
|
+
description: string
|
|
169
|
+
priority: number
|
|
170
|
+
formKey: string
|
|
171
|
+
dueDate: string
|
|
172
|
+
collection: string
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
interface ApproverConfig {
|
|
176
|
+
userId: number | null
|
|
177
|
+
userName: string | null
|
|
178
|
+
userAccount: string | null
|
|
179
|
+
deptId: number | null
|
|
180
|
+
deptName: string | null
|
|
181
|
+
roleIds: number[] | null
|
|
182
|
+
roleNames: string[] | null
|
|
183
|
+
isDefault: boolean | null
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface NodeApproverData {
|
|
187
|
+
nodeId: string
|
|
188
|
+
approvers: Employee[]
|
|
189
|
+
selectedIds: (string | number)[]
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
interface Props {
|
|
193
|
+
approverList: (string | number)[]
|
|
194
|
+
ccList: (string | number)[]
|
|
195
|
+
workFlowKey: string
|
|
196
|
+
id: number
|
|
197
|
+
required: boolean
|
|
198
|
+
type?: 'organization' | 'role' | 'all'
|
|
199
|
+
value?: string
|
|
200
|
+
showRootOrg?: boolean
|
|
201
|
+
childDeptEnable?: boolean
|
|
202
|
+
showCC?: boolean
|
|
203
|
+
canEdit?: boolean,
|
|
204
|
+
data?: Record<string, any> // 数据对象,用于存储ccList、approverList和节点审批人数据
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
208
|
+
approverList: () => [],
|
|
209
|
+
ccList: () => [],
|
|
210
|
+
workFlowKey: '',
|
|
211
|
+
id: 0,
|
|
212
|
+
required: true,
|
|
213
|
+
showRootOrg: true,
|
|
214
|
+
childDeptEnable: false,
|
|
215
|
+
showCC: true,
|
|
216
|
+
canEdit: true,
|
|
217
|
+
data: () => ({})
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
const emit = defineEmits(['update:approverList', 'update:ccList', 'update:data', 'change'])
|
|
221
|
+
|
|
222
|
+
// 状态变量
|
|
223
|
+
const showApproverSelector = ref(false) // 是否显示审批人选择器
|
|
224
|
+
const showCCSelector = ref(false) // 是否显示抄送人选择器
|
|
225
|
+
const currentNodeId = ref('')
|
|
226
|
+
const employeeList = ref<Employee[]>([])
|
|
227
|
+
const nodeConfigs = ref<ProcessNodeConfig[]>([])
|
|
228
|
+
const nodeApproverMap = ref<Map<string, NodeApproverData>>(new Map())
|
|
229
|
+
|
|
230
|
+
// 已选抄送人列表
|
|
231
|
+
const ccEmployees = ref<Employee[]>([])
|
|
232
|
+
const ccSelectorValue = ref<(string | number)[]>([]) // 抄送人选择器的值
|
|
233
|
+
|
|
234
|
+
// 获取头像文字
|
|
235
|
+
const getAvatarText = (name: string) => {
|
|
236
|
+
return name ? name.charAt(0) : ''
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 获取流程配置
|
|
240
|
+
const fetchProcessConfig = async () => {
|
|
241
|
+
if (!props.workFlowKey) return
|
|
242
|
+
|
|
243
|
+
try {
|
|
244
|
+
const response = await dataService.fetch(
|
|
245
|
+
{ processKey: props.workFlowKey },
|
|
246
|
+
{},
|
|
247
|
+
'/process-definitions/config'
|
|
248
|
+
)
|
|
249
|
+
nodeConfigs.value = response?.nodeConfigs || []
|
|
250
|
+
initializeNodeApproverData()
|
|
251
|
+
} catch (error) {
|
|
252
|
+
console.error('获取流程配置失败:', error)
|
|
253
|
+
nodeConfigs.value = []
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// 初始化节点审批人数据
|
|
258
|
+
const initializeNodeApproverData = () => {
|
|
259
|
+
nodeApproverMap.value.clear()
|
|
260
|
+
|
|
261
|
+
nodeConfigs.value.forEach(node => {
|
|
262
|
+
const nodeData: NodeApproverData = {
|
|
263
|
+
nodeId: node.nodeId,
|
|
264
|
+
approvers: [],
|
|
265
|
+
selectedIds: []
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// 设置默认审批人
|
|
269
|
+
if (node.defaultApprovers?.length) {
|
|
270
|
+
node.defaultApprovers.forEach(approver => {
|
|
271
|
+
if (approver.userId && approver.userName) {
|
|
272
|
+
const employee: Employee = {
|
|
273
|
+
id: approver.userId,
|
|
274
|
+
name: approver.userName,
|
|
275
|
+
no: approver.userAccount || '',
|
|
276
|
+
}
|
|
277
|
+
nodeData.approvers.push(employee)
|
|
278
|
+
nodeData.selectedIds.push(approver.userId)
|
|
279
|
+
if (!employeeList.value.find(emp => emp.id === employee.id)) {
|
|
280
|
+
employeeList.value.push(employee)
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
nodeApproverMap.value.set(node.nodeId, nodeData)
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
updateGlobalApproverList()
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// 分配审批人到节点
|
|
293
|
+
const distributeApproversToNodes = (approvers: any) => {
|
|
294
|
+
if (!approvers || !nodeConfigs.value.length) return
|
|
295
|
+
|
|
296
|
+
for (const k in approvers) {
|
|
297
|
+
const node = nodeConfigs.value.find(n => n.collection === k)
|
|
298
|
+
if (node && nodeApproverMap.value.has(node.nodeId)) {
|
|
299
|
+
const nodeData = nodeApproverMap.value.get(node.nodeId)!
|
|
300
|
+
if (approvers[k].length > 0 && (k === 'approverList' || node.needManualConfig)) {
|
|
301
|
+
nodeData.approvers = []
|
|
302
|
+
nodeData.selectedIds = []
|
|
303
|
+
approvers[k].forEach((info: Employee) => {
|
|
304
|
+
if (info.id && info.name) {
|
|
305
|
+
const employee: Employee = {
|
|
306
|
+
id: info.id,
|
|
307
|
+
name: info.name,
|
|
308
|
+
no: info.no || '',
|
|
309
|
+
}
|
|
310
|
+
nodeData.approvers.push(employee)
|
|
311
|
+
nodeData.selectedIds.push(info.id)
|
|
312
|
+
if (!employeeList.value.find(emp => emp.id === employee.id)) {
|
|
313
|
+
employeeList.value.push(employee)
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
updateGlobalApproverList()
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// 更新节点collection字段数据到data属性
|
|
324
|
+
const updateNodeCollectionData = (): void => {
|
|
325
|
+
// 将选择的人员ID列表写入data对应的collection字段
|
|
326
|
+
const newData = { ...props.data }
|
|
327
|
+
nodeApproverMap.value.forEach((nodeData, nodeId) => {
|
|
328
|
+
// 查找对应的节点配置
|
|
329
|
+
const nodeConfig = nodeConfigs.value.find(n => n.nodeId === nodeId)
|
|
330
|
+
if (!nodeConfig || !nodeConfig.collection) return
|
|
331
|
+
newData[nodeConfig.collection] = nodeData.selectedIds
|
|
332
|
+
})
|
|
333
|
+
emit('update:data', newData)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// 更新全局审批人列表
|
|
337
|
+
const updateGlobalApproverList = () => {
|
|
338
|
+
const allApproverIds: (string | number)[] = []
|
|
339
|
+
nodeApproverMap.value.forEach((nodeData, nodeId) => {
|
|
340
|
+
const node = nodeConfigs.value.find(n => n.nodeId === nodeId)
|
|
341
|
+
if (node && node.collection === 'approverList') {
|
|
342
|
+
allApproverIds.push(...nodeData.selectedIds)
|
|
343
|
+
}
|
|
344
|
+
})
|
|
345
|
+
// 同时更新节点collection字段数据到data属性
|
|
346
|
+
updateNodeCollectionData()
|
|
347
|
+
emit('update:approverList', allApproverIds)
|
|
348
|
+
emit('change', {
|
|
349
|
+
type: 'approver',
|
|
350
|
+
ids: allApproverIds,
|
|
351
|
+
employees: getAllApprovers()
|
|
352
|
+
})
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// 获取所有审批人
|
|
356
|
+
const getAllApprovers = (): Employee[] => {
|
|
357
|
+
const allApprovers: Employee[] = []
|
|
358
|
+
nodeApproverMap.value.forEach(nodeData => {
|
|
359
|
+
allApprovers.push(...nodeData.approvers)
|
|
360
|
+
})
|
|
361
|
+
return allApprovers
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// 检查节点是否为会签节点
|
|
365
|
+
const isParallelNode = (node: ProcessNodeConfig): boolean => {
|
|
366
|
+
return node.nodeType === 'PARALLEL'
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// 检查节点是否需要手动配置
|
|
370
|
+
const needManualConfig = (node: ProcessNodeConfig): boolean => {
|
|
371
|
+
return node.needManualConfig === true || isParallelNode(node)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// 获取节点的审批人数据
|
|
375
|
+
const getNodeApprovers = (nodeId: string): Employee[] => {
|
|
376
|
+
return nodeApproverMap.value.get(nodeId)?.approvers || []
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// 获取员工列表
|
|
380
|
+
const fetchEmployeeList = async () => {
|
|
381
|
+
try {
|
|
382
|
+
const response = await dataService.fetch({}, {}, '/process/userList')
|
|
383
|
+
employeeList.value = response || []
|
|
384
|
+
if (props.id) {
|
|
385
|
+
fetchHistory()
|
|
386
|
+
}
|
|
387
|
+
} catch (error) {
|
|
388
|
+
employeeList.value = []
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// 获取历史审批信息
|
|
393
|
+
const fetchHistory = () => {
|
|
394
|
+
dataService.fetch({
|
|
395
|
+
bussinessKey: props.id ? props.id.toString() : null,
|
|
396
|
+
type: props.workFlowKey
|
|
397
|
+
}, {}, '/tasks/process/detail').then(res => {
|
|
398
|
+
const ccList = res?.variables?.form?.ccList ?? []
|
|
399
|
+
ccEmployees.value = ccList.map(id => employeeList.value.find(emp => emp.id == id)).filter(Boolean)
|
|
400
|
+
|
|
401
|
+
const approverList = res?.variables?.form?.approverList ?? []
|
|
402
|
+
if (approverList.length) {
|
|
403
|
+
distributeApproversToNodes(approverList)
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// 处理审批人选择
|
|
409
|
+
const handleApproverSelect = (id: string | number, employees: Employee[]) => {
|
|
410
|
+
console.log('选择的审批人:', id, employees[0])
|
|
411
|
+
if (!currentNodeId.value || !id) return
|
|
412
|
+
|
|
413
|
+
const employee = employees[0]
|
|
414
|
+
// 添加到全局员工列表
|
|
415
|
+
if (!employeeList.value.find(emp => emp.id === id)) {
|
|
416
|
+
employeeList.value.push(employee)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const nodeData = nodeApproverMap.value.get(currentNodeId.value)
|
|
420
|
+
if (!nodeData) return
|
|
421
|
+
|
|
422
|
+
// 检查是否已存在
|
|
423
|
+
if (nodeData.selectedIds.includes(id)) {
|
|
424
|
+
const index = nodeData.selectedIds.indexOf(id)
|
|
425
|
+
nodeData.selectedIds.splice(index, 1)
|
|
426
|
+
nodeData.approvers.splice(index, 1)
|
|
427
|
+
} else {
|
|
428
|
+
nodeData.approvers.push(employee)
|
|
429
|
+
nodeData.selectedIds.push(id)
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
console.log('节点审批人数据:', nodeData)
|
|
433
|
+
updateGlobalApproverList()
|
|
434
|
+
showApproverSelector.value = false
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// 移除节点审批人
|
|
438
|
+
const removeNodeApprover = (nodeId: string, employeeId: string | number) => {
|
|
439
|
+
const nodeData = nodeApproverMap.value.get(nodeId)
|
|
440
|
+
if (!nodeData) return
|
|
441
|
+
|
|
442
|
+
const index = nodeData.selectedIds.findIndex(id => Number(id) === Number(employeeId))
|
|
443
|
+
if (index !== -1) {
|
|
444
|
+
nodeData.selectedIds.splice(index, 1)
|
|
445
|
+
nodeData.approvers.splice(index, 1)
|
|
446
|
+
updateGlobalApproverList()
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// 处理添加节点审批人
|
|
451
|
+
const handleAddNodeApprover = (nodeId: string) => {
|
|
452
|
+
currentNodeId.value = nodeId
|
|
453
|
+
showApproverSelector.value = true
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// 更新抄送人列表
|
|
457
|
+
const updateCCList = (ccIds: (string | number)[]): void => {
|
|
458
|
+
ccEmployees.value = ccIds.map((id) => employeeList.value.find((emp) => emp.id == id)).filter((emp): emp is Employee => emp !== undefined)
|
|
459
|
+
ccSelectorValue.value = ccIds
|
|
460
|
+
|
|
461
|
+
emit('update:ccList', ccIds)
|
|
462
|
+
emit('change', {
|
|
463
|
+
type: 'cc',
|
|
464
|
+
ids: ccIds,
|
|
465
|
+
employees: ccEmployees.value
|
|
466
|
+
})
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// 处理抄送人选择
|
|
470
|
+
const handleCCSelect = (ids: (string | number)[], employees: Employee[]):void => {
|
|
471
|
+
employeeList.value = [...employeeList.value, ...employees]
|
|
472
|
+
ccSelectorValue.value = ids
|
|
473
|
+
updateCCList(ids)
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// 处理添加抄送人
|
|
477
|
+
const handleAddCC = () => {
|
|
478
|
+
showCCSelector.value = true
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// 移除抄送人
|
|
482
|
+
const removeEmployee = (employeeId: string | number) => {
|
|
483
|
+
const newCCIds = ccEmployees.value.filter(emp => Number(emp.id) !== Number(employeeId)).map(emp => emp.id)
|
|
484
|
+
updateCCList(newCCIds)
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// 自动填充功能
|
|
488
|
+
const autoFill = () => {
|
|
489
|
+
if (!props.workFlowKey) return
|
|
490
|
+
|
|
491
|
+
dataService.fetch(
|
|
492
|
+
{ businessType: props.workFlowKey },
|
|
493
|
+
{},
|
|
494
|
+
'/tasks/last-approver'
|
|
495
|
+
).then(res => {
|
|
496
|
+
const { ccList = [], ...rest } = res || {}
|
|
497
|
+
// 更新抄送人
|
|
498
|
+
employeeList.value = [...employeeList.value, ...ccList]
|
|
499
|
+
updateCCList(ccList.map((item) => item.id))
|
|
500
|
+
distributeApproversToNodes(rest)
|
|
501
|
+
}).catch(err => {
|
|
502
|
+
console.error('自动填充失败:', err)
|
|
503
|
+
})
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
onMounted(() => {
|
|
507
|
+
fetchEmployeeList()
|
|
508
|
+
if (props.workFlowKey) {
|
|
509
|
+
fetchProcessConfig().then(autoFill)
|
|
510
|
+
}
|
|
511
|
+
})
|
|
512
|
+
|
|
513
|
+
watch([() => props.workFlowKey], ([newKey, oldKey]) => {
|
|
514
|
+
if (newKey && newKey !== oldKey) {
|
|
515
|
+
fetchProcessConfig().then(autoFill)
|
|
516
|
+
}
|
|
517
|
+
})
|
|
518
|
+
</script>
|
|
519
|
+
|
|
520
|
+
<style lang="less" scoped>
|
|
521
|
+
.ebiz-approval {
|
|
522
|
+
.approval-title {
|
|
523
|
+
font-size: 16px;
|
|
524
|
+
font-weight: 500;
|
|
525
|
+
margin-bottom: 16px;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.section-header {
|
|
529
|
+
display: flex;
|
|
530
|
+
align-items: center;
|
|
531
|
+
margin-bottom: 16px;
|
|
532
|
+
|
|
533
|
+
.section-icon {
|
|
534
|
+
margin-right: 8px;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.section-title {
|
|
538
|
+
font-size: 14px;
|
|
539
|
+
color: var(--td-text-color-primary);
|
|
540
|
+
|
|
541
|
+
.required {
|
|
542
|
+
color: var(--td-error-color);
|
|
543
|
+
margin-left: 4px;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.node-list {
|
|
549
|
+
.node-item {
|
|
550
|
+
margin-bottom: 8px;
|
|
551
|
+
|
|
552
|
+
.node-header {
|
|
553
|
+
display: flex;
|
|
554
|
+
align-items: center;
|
|
555
|
+
margin-bottom: 8px;
|
|
556
|
+
|
|
557
|
+
.node-icon {
|
|
558
|
+
margin-right: 8px;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.node-name {
|
|
562
|
+
font-size: 14px;
|
|
563
|
+
color: var(--td-text-color-primary);
|
|
564
|
+
margin-right: 8px;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.node-type-badge {
|
|
568
|
+
padding: 0px 6px;
|
|
569
|
+
font-size: 10px;
|
|
570
|
+
height: 22px;
|
|
571
|
+
line-height: 22px;
|
|
572
|
+
background: #e6f7ff;
|
|
573
|
+
border-radius: 4px;
|
|
574
|
+
margin-right: 8px;
|
|
575
|
+
color: #1890ff;
|
|
576
|
+
|
|
577
|
+
&.parallel {
|
|
578
|
+
background: #fff2e8;
|
|
579
|
+
color: #fa8c16;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.required {
|
|
584
|
+
color: var(--td-error-color);
|
|
585
|
+
margin-left: 4px;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.node-desc {
|
|
589
|
+
font-size: 12px;
|
|
590
|
+
color: var(--td-text-color-secondary);
|
|
591
|
+
margin-left: 8px;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.approver-row {
|
|
596
|
+
display: flex;
|
|
597
|
+
align-items: center;
|
|
598
|
+
flex-wrap: wrap;
|
|
599
|
+
gap: 8px;
|
|
600
|
+
|
|
601
|
+
.approver-item {
|
|
602
|
+
display: flex;
|
|
603
|
+
align-items: center;
|
|
604
|
+
padding: 4px 8px;
|
|
605
|
+
background: var(--td-bg-color-container);
|
|
606
|
+
border: 1px solid var(--td-component-border);
|
|
607
|
+
border-radius: 3px;
|
|
608
|
+
|
|
609
|
+
.user-info {
|
|
610
|
+
margin-left: 8px;
|
|
611
|
+
display: flex;
|
|
612
|
+
align-items: center;
|
|
613
|
+
gap: 8px;
|
|
614
|
+
cursor: pointer;
|
|
615
|
+
user-select: none;
|
|
616
|
+
|
|
617
|
+
&.no-delete {
|
|
618
|
+
margin-right: 0;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
&.ready-only {
|
|
623
|
+
background: #f5f5f5;
|
|
624
|
+
border-color: #d9d9d9;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.approver-name {
|
|
628
|
+
font-size: 14px;
|
|
629
|
+
color: var(--td-text-color-primary);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.arrow-icon {
|
|
634
|
+
color: var(--td-text-color-secondary);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.no-approvers {
|
|
638
|
+
display: flex;
|
|
639
|
+
align-items: center;
|
|
640
|
+
gap: 8px;
|
|
641
|
+
padding: 8px 12px;
|
|
642
|
+
color: var(--td-text-color-secondary);
|
|
643
|
+
font-size: 12px;
|
|
644
|
+
background: var(--td-bg-color-container-weak);
|
|
645
|
+
border-radius: 4px;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.node-divider {
|
|
650
|
+
height: 1px;
|
|
651
|
+
// background: var(--td-component-border);
|
|
652
|
+
margin: 16px 0;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
.no-config {
|
|
658
|
+
display: flex;
|
|
659
|
+
align-items: center;
|
|
660
|
+
justify-content: center;
|
|
661
|
+
gap: 8px;
|
|
662
|
+
padding: 24px;
|
|
663
|
+
color: var(--td-text-color-secondary);
|
|
664
|
+
font-size: 14px;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
.cc-list {
|
|
668
|
+
|
|
669
|
+
.approver-row,
|
|
670
|
+
.cc-row {
|
|
671
|
+
display: flex;
|
|
672
|
+
align-items: center;
|
|
673
|
+
flex-wrap: wrap;
|
|
674
|
+
gap: 8px;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.approver-item,
|
|
678
|
+
.cc-item {
|
|
679
|
+
display: flex;
|
|
680
|
+
align-items: center;
|
|
681
|
+
padding: 4px 8px;
|
|
682
|
+
background: var(--td-bg-color-container);
|
|
683
|
+
border: 1px solid var(--td-component-border);
|
|
684
|
+
border-radius: 3px;
|
|
685
|
+
|
|
686
|
+
.user-info {
|
|
687
|
+
margin-left: 8px;
|
|
688
|
+
display: flex;
|
|
689
|
+
align-items: center;
|
|
690
|
+
gap: 8px;
|
|
691
|
+
cursor: pointer;
|
|
692
|
+
user-select: none;
|
|
693
|
+
|
|
694
|
+
&.no-delete {
|
|
695
|
+
margin-right: 0;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.approver-name,
|
|
700
|
+
.cc-name {
|
|
701
|
+
font-size: 14px;
|
|
702
|
+
color: var(--td-text-color-primary);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
.arrow-icon {
|
|
707
|
+
color: var(--td-text-color-secondary);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
.cc-section {
|
|
712
|
+
margin-top: 24px;
|
|
713
|
+
}
|
|
714
|
+
</style>
|