@ebiz/designer-components 0.1.131 → 0.1.133
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/README.md +29 -29
- package/dist/designer-components.css +1 -1
- package/dist/index.mjs +35742 -33665
- package/dist/{pdf-C9oIcL2N.js → pdf-KomaE0u5.js} +891 -891
- package/package.json +1 -1
- package/src/App.vue +26 -26
- package/src/apiService/SIMPLE_DATA_SERVICE.md +284 -284
- package/src/apiService/mockDataService.js +115 -115
- package/src/apiService/simpleDataService.js +312 -312
- package/src/assets/base.css +86 -86
- package/src/assets/logo.svg +1 -1
- package/src/components/Button.vue +149 -149
- package/src/components/DataContainer.vue +40 -40
- package/src/components/EbizApproval.vue +747 -747
- package/src/components/EbizApprovalDetail.vue +169 -169
- package/src/components/EbizApprovalForm.vue +510 -510
- package/src/components/EbizApprovalV2.vue +747 -747
- package/src/components/EbizAutoForm.vue +596 -596
- package/src/components/EbizAvatar.vue +115 -115
- package/src/components/EbizCheckbox.vue +93 -93
- package/src/components/EbizCheckboxGroup.vue +69 -69
- package/src/components/EbizDepartmentSelector.vue +148 -148
- package/src/components/EbizDescriptions.vue +340 -340
- package/src/components/EbizDescriptionsItem.vue +47 -47
- package/src/components/EbizDetailBlock.vue +81 -81
- package/src/components/EbizDetailItem.vue +559 -559
- package/src/components/EbizDetailView.md +438 -438
- package/src/components/EbizDetailView.vue +356 -355
- package/src/components/EbizDialog.vue +260 -260
- package/src/components/EbizDictionarySelect.vue +229 -229
- package/src/components/EbizDiv.vue +40 -40
- package/src/components/EbizDivider.vue +96 -96
- package/src/components/EbizDormDashboard.vue +314 -314
- package/src/components/EbizDropdown.vue +135 -135
- package/src/components/EbizDropdownItem.vue +85 -85
- package/src/components/EbizEmployeeInfo.vue +144 -144
- package/src/components/EbizEmployeeSelector.vue +1160 -1160
- package/src/components/EbizFileList.vue +502 -502
- package/src/components/EbizMap.vue +541 -541
- package/src/components/EbizMeetingRoomSelector.vue +1149 -1149
- package/src/components/EbizMobileMeetingRoomSelector.vue +727 -727
- package/src/components/EbizOkrTree.vue +99 -99
- package/src/components/EbizPageHeader.vue +98 -98
- package/src/components/EbizPagination.vue +162 -162
- package/src/components/EbizParkingDashboard.vue +152 -152
- package/src/components/EbizPdfViewer.vue +540 -540
- package/src/components/EbizPopconfirm.vue +47 -47
- package/src/components/EbizQrCode.vue +167 -167
- package/src/components/EbizRadio.vue +86 -86
- package/src/components/EbizRadioGroup.vue +83 -83
- package/src/components/EbizRemoteSelect.vue +232 -232
- package/src/components/EbizRichTextEditor.vue +338 -338
- package/src/components/EbizRouteBreadcrumb.vue +46 -46
- package/src/components/EbizSApprovalProcess.vue +1456 -1456
- package/src/components/EbizSelect.vue +85 -85
- package/src/components/EbizSpace.vue +100 -100
- package/src/components/EbizStatistic.vue +149 -149
- package/src/components/EbizStatsCard.vue +113 -113
- package/src/components/EbizSwiper.vue +113 -113
- package/src/components/EbizSwiperItem.vue +13 -13
- package/src/components/EbizSwitch.vue +85 -85
- package/src/components/EbizTabHeader.vue +132 -132
- package/src/components/EbizTabPanel.vue +22 -22
- package/src/components/EbizTable.vue +469 -469
- package/src/components/EbizTableColumn.vue +116 -116
- package/src/components/EbizTableSort.vue +179 -179
- package/src/components/EbizTabs.vue +142 -142
- package/src/components/EbizTdesignButtonDialog.vue +332 -332
- package/src/components/EbizTdesignLoading.vue +107 -107
- package/src/components/EbizTimePicker.vue +143 -143
- package/src/components/EbizTitle.vue +91 -91
- package/src/components/EbizTree.vue +141 -141
- package/src/components/EbizTreeMergeTable.vue +1494 -1494
- package/src/components/EbizTreeSelector.vue +469 -469
- package/src/components/EbizVideo.vue +553 -553
- package/src/components/EbizVxeTable.vue +290 -290
- package/src/components/Form.vue +28 -28
- package/src/components/Home.vue +7 -7
- package/src/components/LaunchInterview.vue +526 -526
- package/src/components/MyComponent.vue +39 -39
- package/src/components/Table.vue +45 -45
- package/src/components/TdesignAlert.vue +115 -115
- package/src/components/TdesignButton.vue +135 -135
- package/src/components/TdesignCalendar/index.vue +145 -145
- package/src/components/TdesignCard.vue +195 -195
- package/src/components/TdesignCol.vue +101 -101
- package/src/components/TdesignCollapse.vue +142 -142
- package/src/components/TdesignCollapsePanel.vue +79 -79
- package/src/components/TdesignDatePicker.vue +124 -124
- package/src/components/TdesignDescriptions.vue +74 -74
- package/src/components/TdesignDescriptionsItem.vue +50 -50
- package/src/components/TdesignDialog.vue +225 -225
- package/src/components/TdesignForm.vue +138 -138
- package/src/components/TdesignFormItem.vue +105 -105
- package/src/components/TdesignGrid.vue +55 -55
- package/src/components/TdesignIcon.vue +67 -67
- package/src/components/TdesignImage.vue +162 -162
- package/src/components/TdesignImageViewer.vue +200 -200
- package/src/components/TdesignInput.vue +242 -242
- package/src/components/TdesignSelect.vue +446 -446
- package/src/components/TdesignTag.vue +117 -117
- package/src/components/TdesignTextarea.vue +142 -142
- package/src/components/TdesignTimeline.vue +58 -58
- package/src/components/TdesignTimelineItem.vue +71 -71
- package/src/components/TdesignUpload.vue +414 -414
- package/src/components/TdesignWatermark.vue +107 -107
- package/src/components/ebiz-form/components/cascader.vue +61 -61
- package/src/components/ebiz-form/components/checkbox.vue +37 -37
- package/src/components/ebiz-form/components/city.vue +137 -137
- package/src/components/ebiz-form/components/date-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range.vue +56 -56
- package/src/components/ebiz-form/components/date.vue +52 -52
- package/src/components/ebiz-form/components/editor-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/editor.vue +78 -78
- package/src/components/ebiz-form/components/file-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/file.vue +149 -149
- package/src/components/ebiz-form/components/images-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/images.vue +129 -129
- package/src/components/ebiz-form/components/img-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/img.vue +129 -129
- package/src/components/ebiz-form/components/number.vue +50 -50
- package/src/components/ebiz-form/components/radio.vue +28 -28
- package/src/components/ebiz-form/components/select.vue +119 -119
- package/src/components/ebiz-form/components/switch.vue +23 -23
- package/src/components/ebiz-form/components/text-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/text.vue +52 -52
- package/src/components/ebiz-form/components/textarea-multi-language.vue +48 -48
- package/src/components/ebiz-form/components/textarea.vue +29 -29
- package/src/components/ebiz-form/components/video-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/video.vue +97 -97
- package/src/components/ebiz-form/index.vue +157 -157
- package/src/components/examples/PopconfirmExample.vue +149 -149
- package/src/components/icons/IconCommunity.vue +7 -7
- package/src/components/icons/IconDocumentation.vue +7 -7
- package/src/components/icons/IconEcosystem.vue +7 -7
- package/src/components/icons/IconSupport.vue +7 -7
- package/src/components/icons/IconTooling.vue +19 -19
- package/src/components/mItems/UserInfo.vue +349 -349
- package/src/components/senior/EbizApprovalList/ApprovalList.vue +127 -127
- package/src/components/senior/EbizSData/index.vue +280 -280
- package/src/components/senior/EbizSDialog/index.vue +776 -776
- package/src/components/senior/EbizSForm/README.md +157 -157
- package/src/components/senior/EbizSForm/index.vue +667 -667
- package/src/components/senior/EbizSForm/item.vue +1011 -1011
- package/src/components/senior/EbizSForm/mItems/DateTimePicker.vue +51 -51
- package/src/components/senior/EbizSForm/mItems/Picker.vue +63 -63
- package/src/index.js +327 -327
- package/src/main.js +55 -55
- package/src/router/index.js +436 -436
- package/src/utils/formatCode.js +24 -24
- package/src/utils/generateImportStatement.js +52 -52
- package/src/utils/hasJsx.js +25 -25
- package/src/utils/index.js +166 -166
- package/src/utils/mergeOptions.js +29 -29
- package/src/utils/parseRequiredBlocks.js +18 -18
- package/src/utils/vue-sfc-validator.js +155 -155
- package/src/views/Button.vue +23 -23
- package/src/views/CheckboxDemo.vue +104 -104
- package/src/views/DataContainer.vue +19 -19
- package/src/views/DialogDemo.vue +125 -125
- package/src/views/EbizApprovalDemo.vue +87 -87
- package/src/views/EbizApprovalFormDemo.vue +207 -207
- package/src/views/EbizAutoFormDemo.vue +129 -129
- package/src/views/EbizAvatar.vue +223 -223
- package/src/views/EbizDepartmentSelectorDemo.vue +169 -169
- package/src/views/EbizDetailBlockDemo.vue +30 -30
- package/src/views/EbizDetailViewDemo.vue +412 -412
- package/src/views/EbizDormDashboardDemo.vue +87 -87
- package/src/views/EbizEmployeeInfo.vue +249 -249
- package/src/views/EbizEmployeeSelector.vue +85 -85
- package/src/views/EbizFileListDemo.vue +339 -339
- package/src/views/EbizMap.vue +201 -201
- package/src/views/EbizMeetingRoomSelectorDemo.vue +293 -293
- package/src/views/EbizMobileMeetingRoomSelectorDemo.vue +566 -566
- package/src/views/EbizParkingDashboardDemo.vue +28 -28
- package/src/views/EbizRadioDemo.vue +151 -151
- package/src/views/EbizSDataDemo.vue +136 -136
- package/src/views/EbizSDialogDemo.vue +303 -303
- package/src/views/EbizSForm/index.vue +352 -352
- package/src/views/EbizSFormDemo.vue +420 -420
- package/src/views/EbizSpace.vue +185 -185
- package/src/views/EbizSwiper.vue +157 -157
- package/src/views/EbizTdesignButtonDialogExample.vue +437 -437
- package/src/views/Form.vue +19 -19
- package/src/views/GridDemo.vue +238 -238
- package/src/views/Home.vue +156 -156
- package/src/views/LaunchInterviewDemo.vue +111 -111
- package/src/views/Mindmap.vue +17 -17
- package/src/views/MyComponent.vue +19 -19
- package/src/views/OkrTree.vue +19 -19
- package/src/views/PageHeaderDemo.vue +104 -104
- package/src/views/PaginationDemo.vue +96 -96
- package/src/views/PdfViewerDemo.vue +433 -433
- package/src/views/PermissionBoxDemo.vue +85 -85
- package/src/views/PopconfirmDemo.vue +80 -80
- package/src/views/RemoteSelect.vue +350 -350
- package/src/views/StatisticDemo.vue +190 -190
- package/src/views/SwitchDemo.vue +79 -79
- package/src/views/Table.vue +19 -19
- package/src/views/TableDemo.vue +334 -334
- package/src/views/TableSortDemo.vue +143 -143
- package/src/views/TableView.vue +68 -68
- package/src/views/TabsDemo.vue +282 -282
- package/src/views/TagDemo.vue +101 -101
- package/src/views/TdesignAlert.vue +98 -98
- package/src/views/TdesignButton.vue +190 -190
- package/src/views/TdesignCalendar.vue +94 -94
- package/src/views/TdesignCard.vue +296 -296
- package/src/views/TdesignCollapse.vue +293 -293
- package/src/views/TdesignDatePicker.vue +187 -187
- package/src/views/TdesignDescriptions.vue +101 -101
- package/src/views/TdesignForm.vue +248 -248
- package/src/views/TdesignIcon.vue +203 -203
- package/src/views/TdesignImage.vue +215 -215
- package/src/views/TdesignImageViewer.vue +198 -198
- package/src/views/TdesignInput.vue +252 -252
- package/src/views/TdesignSelect.vue +473 -473
- package/src/views/TdesignSwiper.vue +157 -157
- package/src/views/TextareaDemo.vue +93 -93
- package/src/views/TimePickerDemo.vue +146 -146
- package/src/views/TimelineDemo.vue +160 -160
- package/src/views/Title.vue +19 -19
- package/src/views/TreeDemo.vue +254 -254
- package/src/views/TreeMergeTableDemo.vue +239 -239
- package/src/views/TreeSelectorDemo.vue +245 -245
- package/src/views/UploadDemo.vue +128 -128
- package/src/views/VideoDemo.vue +245 -245
- package/src/views/VxeTableDemo.vue +279 -279
- package/src/views/WatermarkDemo.vue +85 -85
|
@@ -1,748 +1,748 @@
|
|
|
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"
|
|
35
|
-
:class="{ 'no-delete': required && getNodeApprovers(node.nodeId).length <= 1 }">
|
|
36
|
-
<span class="approver-name">{{ approver.no }} - {{ approver.name }}</span>
|
|
37
|
-
<t-icon name="close" size="16px" @click="removeNodeApprover(node.nodeId, approver.id)" />
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
<t-icon v-if="approverIndex < getNodeApprovers(node.nodeId).length - 1" name="chevron-right"
|
|
41
|
-
class="arrow-icon" />
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<!-- 添加审批人按钮 -->
|
|
45
|
-
<t-button theme="default" variant="text" @click="handleAddNodeApprover(node.nodeId)">
|
|
46
|
-
<template #icon>
|
|
47
|
-
<t-icon name="add" />
|
|
48
|
-
</template>
|
|
49
|
-
添加审批人
|
|
50
|
-
</t-button>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<!-- 非会签节点:只读显示 -->
|
|
55
|
-
<template v-else>
|
|
56
|
-
<div class="readonly-approvers">
|
|
57
|
-
<template v-if="getNodeApprovers(node.nodeId).length > 0">
|
|
58
|
-
<div class="approver-row">
|
|
59
|
-
<template v-for="(approver, approverIndex) in getNodeApprovers(node.nodeId)" :key="approver.id">
|
|
60
|
-
<div class="approver-item readonly">
|
|
61
|
-
<t-avatar :image="approver.avatar" size="small">
|
|
62
|
-
{{ getAvatarText(approver.name) }}
|
|
63
|
-
</t-avatar>
|
|
64
|
-
<div class="user-info">
|
|
65
|
-
<span class="approver-name">{{ approver.no }} - {{ approver.name }}</span>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
<t-icon v-if="approverIndex < getNodeApprovers(node.nodeId).length - 1" name="chevron-right"
|
|
69
|
-
class="arrow-icon" />
|
|
70
|
-
</template>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
<div v-else class="no-approvers">
|
|
74
|
-
<t-icon name="user" size="16px" />
|
|
75
|
-
<span>系统自动分配审批人</span>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<!-- 节点分隔线 -->
|
|
82
|
-
<!-- <div v-if="index < nodeConfigs.length - 1" class="node-divider">
|
|
83
|
-
</div> -->
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<!-- 无配置提示 -->
|
|
88
|
-
<div v-else class="no-config">
|
|
89
|
-
<t-icon name="info-circle" size="20px" />
|
|
90
|
-
<span>暂无流程配置信息</span>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
<!-- 抄送人部分 -->
|
|
95
|
-
<div v-if="showCC" class="cc-section">
|
|
96
|
-
<div class="section-header">
|
|
97
|
-
<t-icon name="user-add" class="section-icon" />
|
|
98
|
-
<span class="section-title">抄送人</span>
|
|
99
|
-
</div>
|
|
100
|
-
<div class="cc-list">
|
|
101
|
-
<div class="cc-row">
|
|
102
|
-
<template v-for="(cc, index) in ccEmployees" :key="index">
|
|
103
|
-
<div class="cc-item">
|
|
104
|
-
<t-avatar :image="cc.avatar" size="small">
|
|
105
|
-
{{ getAvatarText(cc.name) }}
|
|
106
|
-
</t-avatar>
|
|
107
|
-
<div class="user-info">
|
|
108
|
-
<span class="cc-name">{{ cc.name }}</span>
|
|
109
|
-
<t-icon v-if="canEdit && !defaultCcEmployeesIds.includes(cc.id)" name="close" size="16px"
|
|
110
|
-
@click="removeEmployee(cc.id)" />
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</template>
|
|
114
|
-
<t-button theme="default" variant="text" @click="handleAddCC" v-if="canEdit">
|
|
115
|
-
<template #icon>
|
|
116
|
-
<t-icon name="add" />
|
|
117
|
-
</template>
|
|
118
|
-
添加抄送人
|
|
119
|
-
</t-button>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</t-card>
|
|
124
|
-
|
|
125
|
-
<!-- 审批人选择弹窗 -->
|
|
126
|
-
<ebiz-employee-selector v-if="showApproverSelector" :showDefault="false" v-model:visible="showApproverSelector"
|
|
127
|
-
@change="handleApproverSelect" :single="true" />
|
|
128
|
-
<ebiz-employee-selector v-if="showCCSelector" :showDefault="false" v-model:visible="showCCSelector"
|
|
129
|
-
@change="handleCCSelect" />
|
|
130
|
-
</div>
|
|
131
|
-
</template>
|
|
132
|
-
|
|
133
|
-
<script setup lang="ts">
|
|
134
|
-
import { ref, watch, computed, onMounted } from 'vue'
|
|
135
|
-
import { Icon as TIcon, Avatar as TAvatar, Card as TCard, Button as TButton } from 'tdesign-vue-next'
|
|
136
|
-
import EbizEmployeeSelector from './EbizEmployeeSelector.vue'
|
|
137
|
-
import dataService from '../apiService/simpleDataService'
|
|
138
|
-
|
|
139
|
-
interface Employee {
|
|
140
|
-
id: string | number
|
|
141
|
-
name: string
|
|
142
|
-
no: string
|
|
143
|
-
avatar?: string
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// 节点配置接口
|
|
147
|
-
interface ProcessNodeConfig {
|
|
148
|
-
nodeId: string
|
|
149
|
-
nodeName: string
|
|
150
|
-
nodeType: string
|
|
151
|
-
nodeTypeDesc: string
|
|
152
|
-
multiInstanceType: string
|
|
153
|
-
multiInstanceTypeDesc: string
|
|
154
|
-
isMultiInstance: boolean
|
|
155
|
-
needManualConfig: boolean
|
|
156
|
-
ruleType: string
|
|
157
|
-
ruleTypeDesc: string
|
|
158
|
-
deptIds: number[]
|
|
159
|
-
roleIds: number[]
|
|
160
|
-
userIds: number[]
|
|
161
|
-
defaultApprovers: ApproverConfig[]
|
|
162
|
-
defaultCcUserIds: (string | number)[]
|
|
163
|
-
defaultCcUsers: ApproverConfig[]
|
|
164
|
-
extensionProperties: Record<string, any>
|
|
165
|
-
description: string
|
|
166
|
-
priority: number
|
|
167
|
-
formKey: string
|
|
168
|
-
dueDate: string
|
|
169
|
-
collection: string
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
interface ApproverConfig {
|
|
173
|
-
userId: number | null
|
|
174
|
-
userName: string | null
|
|
175
|
-
userAccount: string | null
|
|
176
|
-
userNo: string | null
|
|
177
|
-
deptId: number | null
|
|
178
|
-
deptName: string | null
|
|
179
|
-
roleIds: number[] | null
|
|
180
|
-
roleNames: string[] | null
|
|
181
|
-
isDefault: boolean | null
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
interface NodeApproverData {
|
|
185
|
-
nodeId: string
|
|
186
|
-
approvers: Employee[]
|
|
187
|
-
selectedIds: (string | number)[]
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
interface Props {
|
|
191
|
-
approverList: (string | number)[]
|
|
192
|
-
ccList: (string | number)[]
|
|
193
|
-
workFlowKey: string
|
|
194
|
-
id: number
|
|
195
|
-
required: boolean
|
|
196
|
-
type?: 'organization' | 'role' | 'all'
|
|
197
|
-
value?: string
|
|
198
|
-
showRootOrg?: boolean
|
|
199
|
-
childDeptEnable?: boolean
|
|
200
|
-
showCC?: boolean
|
|
201
|
-
canEdit?: boolean,
|
|
202
|
-
data?: Record<string, any> // 数据对象,用于存储ccList、approverList和节点审批人数据
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
206
|
-
approverList: () => [],
|
|
207
|
-
ccList: () => [],
|
|
208
|
-
workFlowKey: '',
|
|
209
|
-
id: 0,
|
|
210
|
-
required: true,
|
|
211
|
-
showRootOrg: true,
|
|
212
|
-
childDeptEnable: false,
|
|
213
|
-
showCC: true,
|
|
214
|
-
canEdit: true,
|
|
215
|
-
data: () => ({})
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
const emit = defineEmits(['update:approverList', 'update:ccList', 'update:data', 'change'])
|
|
219
|
-
|
|
220
|
-
// 状态变量
|
|
221
|
-
const showApproverSelector = ref(false) // 是否显示审批人选择器
|
|
222
|
-
const showCCSelector = ref(false) // 是否显示抄送人选择器
|
|
223
|
-
const currentNodeId = ref('')
|
|
224
|
-
const employeeList = ref<Employee[]>([])
|
|
225
|
-
const nodeConfigs = ref<ProcessNodeConfig[]>([])
|
|
226
|
-
const nodeApproverMap = ref<Map<string, NodeApproverData>>(new Map())
|
|
227
|
-
|
|
228
|
-
// 已选抄送人列表
|
|
229
|
-
const ccEmployees = ref<Employee[]>([])
|
|
230
|
-
// 默认抄送人列表(不可删除)
|
|
231
|
-
const defaultCcEmployeesIds = ref<(string | number)[]>([])
|
|
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
|
-
// 设置默认抄送人
|
|
287
|
-
console.log("node.defaultCcUsers", node.defaultCcUsers)
|
|
288
|
-
if (node.defaultCcUsers && node.defaultCcUsers.length > 0) {
|
|
289
|
-
node.defaultCcUsers.forEach(approver => {
|
|
290
|
-
if (approver.userId && approver.userName) {
|
|
291
|
-
const employee: Employee = {
|
|
292
|
-
id: approver.userId,
|
|
293
|
-
name: approver.userName,
|
|
294
|
-
no: approver.userNo || '',
|
|
295
|
-
avatar: undefined
|
|
296
|
-
}
|
|
297
|
-
// 保存默认的抄送人ID
|
|
298
|
-
console.log(123123123, employee)
|
|
299
|
-
defaultCcEmployeesIds.value.push(employee.id);
|
|
300
|
-
|
|
301
|
-
// 添加到全局员工列表
|
|
302
|
-
if (!employeeList.value.find(emp => emp.id === employee.id)) {
|
|
303
|
-
employeeList.value.push(employee)
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
})
|
|
307
|
-
}
|
|
308
|
-
console.log("defaultCcEmployeesIds", defaultCcEmployeesIds.value)
|
|
309
|
-
if (defaultCcEmployeesIds.value && defaultCcEmployeesIds.value.length > 0) {
|
|
310
|
-
updateCCList(defaultCcEmployeesIds.value)
|
|
311
|
-
}
|
|
312
|
-
nodeApproverMap.value.set(node.nodeId, nodeData)
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
updateGlobalApproverList()
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// 分配审批人到节点
|
|
319
|
-
const distributeApproversToNodes = (approvers: any) => {
|
|
320
|
-
if (!approvers || !nodeConfigs.value.length) return
|
|
321
|
-
|
|
322
|
-
for (const k in approvers) {
|
|
323
|
-
const node = nodeConfigs.value.find(n => n.collection === k)
|
|
324
|
-
if (node && nodeApproverMap.value.has(node.nodeId)) {
|
|
325
|
-
const nodeData = nodeApproverMap.value.get(node.nodeId)!
|
|
326
|
-
if (approvers[k].length > 0 && (k === 'approverList' || node.needManualConfig)) {
|
|
327
|
-
nodeData.approvers = []
|
|
328
|
-
nodeData.selectedIds = []
|
|
329
|
-
approvers[k].forEach((info: Employee) => {
|
|
330
|
-
if (info.id && info.name) {
|
|
331
|
-
const employee: Employee = {
|
|
332
|
-
id: info.id,
|
|
333
|
-
name: info.name,
|
|
334
|
-
no: info.no || '',
|
|
335
|
-
}
|
|
336
|
-
nodeData.approvers.push(employee)
|
|
337
|
-
nodeData.selectedIds.push(info.id)
|
|
338
|
-
if (!employeeList.value.find(emp => emp.id === employee.id)) {
|
|
339
|
-
employeeList.value.push(employee)
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
})
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
updateGlobalApproverList()
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// 更新节点collection字段数据到data属性
|
|
350
|
-
const updateNodeCollectionData = (): void => {
|
|
351
|
-
// 将选择的人员ID列表写入data对应的collection字段
|
|
352
|
-
const newData = { ...props.data }
|
|
353
|
-
nodeApproverMap.value.forEach((nodeData, nodeId) => {
|
|
354
|
-
// 查找对应的节点配置
|
|
355
|
-
const nodeConfig = nodeConfigs.value.find(n => n.nodeId === nodeId)
|
|
356
|
-
if (!nodeConfig || !nodeConfig.collection) return
|
|
357
|
-
newData[nodeConfig.collection] = nodeData.selectedIds
|
|
358
|
-
})
|
|
359
|
-
emit('update:data', newData)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// 更新全局审批人列表
|
|
363
|
-
const updateGlobalApproverList = () => {
|
|
364
|
-
const allApproverIds: (string | number)[] = []
|
|
365
|
-
nodeApproverMap.value.forEach((nodeData, nodeId) => {
|
|
366
|
-
const node = nodeConfigs.value.find(n => n.nodeId === nodeId)
|
|
367
|
-
if (node && node.collection === 'approverList') {
|
|
368
|
-
allApproverIds.push(...nodeData.selectedIds)
|
|
369
|
-
}
|
|
370
|
-
})
|
|
371
|
-
// 同时更新节点collection字段数据到data属性
|
|
372
|
-
updateNodeCollectionData()
|
|
373
|
-
emit('update:approverList', allApproverIds)
|
|
374
|
-
emit('change', {
|
|
375
|
-
type: 'approver',
|
|
376
|
-
ids: allApproverIds,
|
|
377
|
-
employees: getAllApprovers()
|
|
378
|
-
})
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// 获取所有审批人
|
|
382
|
-
const getAllApprovers = (): Employee[] => {
|
|
383
|
-
const allApprovers: Employee[] = []
|
|
384
|
-
nodeApproverMap.value.forEach(nodeData => {
|
|
385
|
-
allApprovers.push(...nodeData.approvers)
|
|
386
|
-
})
|
|
387
|
-
return allApprovers
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// 检查节点是否为会签节点
|
|
391
|
-
const isParallelNode = (node: ProcessNodeConfig): boolean => {
|
|
392
|
-
return node.nodeType === 'PARALLEL'
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// 检查节点是否需要手动配置
|
|
396
|
-
const needManualConfig = (node: ProcessNodeConfig): boolean => {
|
|
397
|
-
return node.needManualConfig === true || isParallelNode(node)
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// 获取节点的审批人数据
|
|
401
|
-
const getNodeApprovers = (nodeId: string): Employee[] => {
|
|
402
|
-
return nodeApproverMap.value.get(nodeId)?.approvers || []
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// 获取员工列表
|
|
406
|
-
const fetchEmployeeList = async () => {
|
|
407
|
-
try {
|
|
408
|
-
const response = await dataService.fetch({}, {}, '/process/userList')
|
|
409
|
-
employeeList.value = response || []
|
|
410
|
-
if (props.id) {
|
|
411
|
-
fetchHistory()
|
|
412
|
-
}
|
|
413
|
-
} catch (error) {
|
|
414
|
-
employeeList.value = []
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
// 获取历史审批信息
|
|
419
|
-
const fetchHistory = () => {
|
|
420
|
-
dataService.fetch({
|
|
421
|
-
bussinessKey: props.id ? props.id.toString() : null,
|
|
422
|
-
type: props.workFlowKey
|
|
423
|
-
}, {}, '/tasks/process/detail').then(res => {
|
|
424
|
-
const ccList = res?.variables?.form?.ccList ?? []
|
|
425
|
-
if (!ccEmployees.value || ccEmployees.value.length === 0) {
|
|
426
|
-
ccEmployees.value = ccList.map(id => employeeList.value.find(emp => emp.id == id)).filter(Boolean)
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
const approverList = res?.variables?.form?.approverList ?? []
|
|
430
|
-
if (approverList.length) {
|
|
431
|
-
distributeApproversToNodes(approverList)
|
|
432
|
-
}
|
|
433
|
-
})
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// 处理审批人选择
|
|
437
|
-
const handleApproverSelect = (id: string | number, employees: Employee[]) => {
|
|
438
|
-
console.log('选择的审批人:', id, employees[0])
|
|
439
|
-
if (!currentNodeId.value || !id) return
|
|
440
|
-
|
|
441
|
-
const employee = employees[0]
|
|
442
|
-
// 添加到全局员工列表
|
|
443
|
-
if (!employeeList.value.find(emp => emp.id === id)) {
|
|
444
|
-
employeeList.value.push(employee)
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const nodeData = nodeApproverMap.value.get(currentNodeId.value)
|
|
448
|
-
if (!nodeData) return
|
|
449
|
-
|
|
450
|
-
// 检查是否已存在
|
|
451
|
-
if (nodeData.selectedIds.includes(id)) {
|
|
452
|
-
const index = nodeData.selectedIds.indexOf(id)
|
|
453
|
-
nodeData.selectedIds.splice(index, 1)
|
|
454
|
-
nodeData.approvers.splice(index, 1)
|
|
455
|
-
} else {
|
|
456
|
-
nodeData.approvers.push(employee)
|
|
457
|
-
nodeData.selectedIds.push(id)
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
console.log('节点审批人数据:', nodeData)
|
|
461
|
-
updateGlobalApproverList()
|
|
462
|
-
showApproverSelector.value = false
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
// 移除节点审批人
|
|
466
|
-
const removeNodeApprover = (nodeId: string, employeeId: string | number) => {
|
|
467
|
-
const nodeData = nodeApproverMap.value.get(nodeId)
|
|
468
|
-
if (!nodeData) return
|
|
469
|
-
|
|
470
|
-
const index = nodeData.selectedIds.findIndex(id => Number(id) === Number(employeeId))
|
|
471
|
-
if (index !== -1) {
|
|
472
|
-
nodeData.selectedIds.splice(index, 1)
|
|
473
|
-
nodeData.approvers.splice(index, 1)
|
|
474
|
-
updateGlobalApproverList()
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// 处理添加节点审批人
|
|
479
|
-
const handleAddNodeApprover = (nodeId: string) => {
|
|
480
|
-
currentNodeId.value = nodeId
|
|
481
|
-
showApproverSelector.value = true
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
// 更新抄送人列表
|
|
485
|
-
const updateCCList = (ccIds: (string | number)[]): void => {
|
|
486
|
-
ccEmployees.value = ccIds.map((id) => employeeList.value.find((emp) => emp.id == id)).filter((emp): emp is Employee => emp !== undefined)
|
|
487
|
-
console.log("ccEmployees.value", ccEmployees.value)
|
|
488
|
-
ccSelectorValue.value = ccIds
|
|
489
|
-
|
|
490
|
-
console.log("ccIds", ccIds)
|
|
491
|
-
emit('update:ccList', ccIds)
|
|
492
|
-
emit('change', {
|
|
493
|
-
type: 'cc',
|
|
494
|
-
ids: ccIds,
|
|
495
|
-
employees: ccEmployees.value
|
|
496
|
-
})
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// 处理抄送人选择
|
|
500
|
-
const handleCCSelect = (ids: (string | number)[], employees: Employee[]): void => {
|
|
501
|
-
employeeList.value = [...employeeList.value, ...employees]
|
|
502
|
-
const idsArr = [...new Set([...defaultCcEmployeesIds.value, ...ids])]
|
|
503
|
-
ccSelectorValue.value = idsArr
|
|
504
|
-
updateCCList(idsArr)
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
// 处理添加抄送人
|
|
508
|
-
const handleAddCC = () => {
|
|
509
|
-
showCCSelector.value = true
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// 移除抄送人
|
|
513
|
-
const removeEmployee = (employeeId: string | number) => {
|
|
514
|
-
const newCCIds = ccEmployees.value.filter(emp => Number(emp.id) !== Number(employeeId)).map(emp => emp.id)
|
|
515
|
-
updateCCList(newCCIds)
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
// 自动填充功能
|
|
519
|
-
const autoFill = () => {
|
|
520
|
-
if (!props.workFlowKey) return
|
|
521
|
-
|
|
522
|
-
dataService.fetch(
|
|
523
|
-
{ businessType: props.workFlowKey },
|
|
524
|
-
{},
|
|
525
|
-
'/tasks/last-approver'
|
|
526
|
-
).then(res => {
|
|
527
|
-
const { ccList = [], ...rest } = res || {}
|
|
528
|
-
// 更新抄送人
|
|
529
|
-
employeeList.value = [...employeeList.value, ...ccList]
|
|
530
|
-
if (ccList.length > 0) {
|
|
531
|
-
updateCCList(ccList.map((item) => item.id))
|
|
532
|
-
}
|
|
533
|
-
distributeApproversToNodes(rest)
|
|
534
|
-
}).catch(err => {
|
|
535
|
-
console.error('自动填充失败:', err)
|
|
536
|
-
})
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
onMounted(() => {
|
|
540
|
-
fetchEmployeeList()
|
|
541
|
-
if (props.workFlowKey) {
|
|
542
|
-
fetchProcessConfig().then(autoFill)
|
|
543
|
-
}
|
|
544
|
-
})
|
|
545
|
-
|
|
546
|
-
watch([() => props.workFlowKey], ([newKey, oldKey]) => {
|
|
547
|
-
if (newKey && newKey !== oldKey) {
|
|
548
|
-
fetchProcessConfig().then(autoFill)
|
|
549
|
-
}
|
|
550
|
-
})
|
|
551
|
-
</script>
|
|
552
|
-
|
|
553
|
-
<style lang="less" scoped>
|
|
554
|
-
.ebiz-approval {
|
|
555
|
-
.approval-title {
|
|
556
|
-
font-size: 16px;
|
|
557
|
-
font-weight: 500;
|
|
558
|
-
margin-bottom: 16px;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
.section-header {
|
|
562
|
-
display: flex;
|
|
563
|
-
align-items: center;
|
|
564
|
-
margin-bottom: 16px;
|
|
565
|
-
|
|
566
|
-
.section-icon {
|
|
567
|
-
margin-right: 8px;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
.section-title {
|
|
571
|
-
font-size: 14px;
|
|
572
|
-
color: var(--td-text-color-primary);
|
|
573
|
-
|
|
574
|
-
.required {
|
|
575
|
-
color: var(--td-error-color);
|
|
576
|
-
margin-left: 4px;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
.node-list {
|
|
582
|
-
.node-item {
|
|
583
|
-
margin-bottom: 8px;
|
|
584
|
-
|
|
585
|
-
.node-header {
|
|
586
|
-
display: flex;
|
|
587
|
-
align-items: center;
|
|
588
|
-
margin-bottom: 8px;
|
|
589
|
-
|
|
590
|
-
.node-icon {
|
|
591
|
-
margin-right: 8px;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
.node-name {
|
|
595
|
-
font-size: 14px;
|
|
596
|
-
color: var(--td-text-color-primary);
|
|
597
|
-
margin-right: 8px;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
.node-type-badge {
|
|
601
|
-
padding: 0px 6px;
|
|
602
|
-
font-size: 10px;
|
|
603
|
-
height: 22px;
|
|
604
|
-
line-height: 22px;
|
|
605
|
-
background: #e6f7ff;
|
|
606
|
-
border-radius: 4px;
|
|
607
|
-
margin-right: 8px;
|
|
608
|
-
color: #1890ff;
|
|
609
|
-
|
|
610
|
-
&.parallel {
|
|
611
|
-
background: #fff2e8;
|
|
612
|
-
color: #fa8c16;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
.required {
|
|
617
|
-
color: var(--td-error-color);
|
|
618
|
-
margin-left: 4px;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
.node-desc {
|
|
622
|
-
font-size: 12px;
|
|
623
|
-
color: var(--td-text-color-secondary);
|
|
624
|
-
margin-left: 8px;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
.approver-row {
|
|
629
|
-
display: flex;
|
|
630
|
-
align-items: center;
|
|
631
|
-
flex-wrap: wrap;
|
|
632
|
-
gap: 8px;
|
|
633
|
-
|
|
634
|
-
.approver-item {
|
|
635
|
-
display: flex;
|
|
636
|
-
align-items: center;
|
|
637
|
-
padding: 4px 8px;
|
|
638
|
-
background: var(--td-bg-color-container);
|
|
639
|
-
border: 1px solid var(--td-component-border);
|
|
640
|
-
border-radius: 3px;
|
|
641
|
-
|
|
642
|
-
.user-info {
|
|
643
|
-
margin-left: 8px;
|
|
644
|
-
display: flex;
|
|
645
|
-
align-items: center;
|
|
646
|
-
gap: 8px;
|
|
647
|
-
cursor: pointer;
|
|
648
|
-
user-select: none;
|
|
649
|
-
|
|
650
|
-
&.no-delete {
|
|
651
|
-
margin-right: 0;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
&.ready-only {
|
|
656
|
-
background: #f5f5f5;
|
|
657
|
-
border-color: #d9d9d9;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
.approver-name {
|
|
661
|
-
font-size: 14px;
|
|
662
|
-
color: var(--td-text-color-primary);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
.arrow-icon {
|
|
667
|
-
color: var(--td-text-color-secondary);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
.no-approvers {
|
|
671
|
-
display: flex;
|
|
672
|
-
align-items: center;
|
|
673
|
-
gap: 8px;
|
|
674
|
-
padding: 8px 12px;
|
|
675
|
-
color: var(--td-text-color-secondary);
|
|
676
|
-
font-size: 12px;
|
|
677
|
-
background: var(--td-bg-color-container-weak);
|
|
678
|
-
border-radius: 4px;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
.node-divider {
|
|
683
|
-
height: 1px;
|
|
684
|
-
// background: var(--td-component-border);
|
|
685
|
-
margin: 16px 0;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
.no-config {
|
|
691
|
-
display: flex;
|
|
692
|
-
align-items: center;
|
|
693
|
-
justify-content: center;
|
|
694
|
-
gap: 8px;
|
|
695
|
-
padding: 24px;
|
|
696
|
-
color: var(--td-text-color-secondary);
|
|
697
|
-
font-size: 14px;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
.cc-list {
|
|
702
|
-
|
|
703
|
-
.approver-row,
|
|
704
|
-
.cc-row {
|
|
705
|
-
display: flex;
|
|
706
|
-
align-items: center;
|
|
707
|
-
flex-wrap: wrap;
|
|
708
|
-
gap: 8px;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
.approver-item,
|
|
712
|
-
.cc-item {
|
|
713
|
-
display: flex;
|
|
714
|
-
align-items: center;
|
|
715
|
-
padding: 4px 8px;
|
|
716
|
-
background: var(--td-bg-color-container);
|
|
717
|
-
border: 1px solid var(--td-component-border);
|
|
718
|
-
border-radius: 3px;
|
|
719
|
-
|
|
720
|
-
.user-info {
|
|
721
|
-
margin-left: 8px;
|
|
722
|
-
display: flex;
|
|
723
|
-
align-items: center;
|
|
724
|
-
gap: 8px;
|
|
725
|
-
cursor: pointer;
|
|
726
|
-
user-select: none;
|
|
727
|
-
|
|
728
|
-
&.no-delete {
|
|
729
|
-
margin-right: 0;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
.approver-name,
|
|
734
|
-
.cc-name {
|
|
735
|
-
font-size: 14px;
|
|
736
|
-
color: var(--td-text-color-primary);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
.arrow-icon {
|
|
741
|
-
color: var(--td-text-color-secondary);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
.cc-section {
|
|
746
|
-
margin-top: 24px;
|
|
747
|
-
}
|
|
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"
|
|
35
|
+
:class="{ 'no-delete': required && getNodeApprovers(node.nodeId).length <= 1 }">
|
|
36
|
+
<span class="approver-name">{{ approver.no }} - {{ approver.name }}</span>
|
|
37
|
+
<t-icon name="close" size="16px" @click="removeNodeApprover(node.nodeId, approver.id)" />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<t-icon v-if="approverIndex < getNodeApprovers(node.nodeId).length - 1" name="chevron-right"
|
|
41
|
+
class="arrow-icon" />
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<!-- 添加审批人按钮 -->
|
|
45
|
+
<t-button theme="default" variant="text" @click="handleAddNodeApprover(node.nodeId)">
|
|
46
|
+
<template #icon>
|
|
47
|
+
<t-icon name="add" />
|
|
48
|
+
</template>
|
|
49
|
+
添加审批人
|
|
50
|
+
</t-button>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<!-- 非会签节点:只读显示 -->
|
|
55
|
+
<template v-else>
|
|
56
|
+
<div class="readonly-approvers">
|
|
57
|
+
<template v-if="getNodeApprovers(node.nodeId).length > 0">
|
|
58
|
+
<div class="approver-row">
|
|
59
|
+
<template v-for="(approver, approverIndex) in getNodeApprovers(node.nodeId)" :key="approver.id">
|
|
60
|
+
<div class="approver-item readonly">
|
|
61
|
+
<t-avatar :image="approver.avatar" size="small">
|
|
62
|
+
{{ getAvatarText(approver.name) }}
|
|
63
|
+
</t-avatar>
|
|
64
|
+
<div class="user-info">
|
|
65
|
+
<span class="approver-name">{{ approver.no }} - {{ approver.name }}</span>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<t-icon v-if="approverIndex < getNodeApprovers(node.nodeId).length - 1" name="chevron-right"
|
|
69
|
+
class="arrow-icon" />
|
|
70
|
+
</template>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
<div v-else class="no-approvers">
|
|
74
|
+
<t-icon name="user" size="16px" />
|
|
75
|
+
<span>系统自动分配审批人</span>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<!-- 节点分隔线 -->
|
|
82
|
+
<!-- <div v-if="index < nodeConfigs.length - 1" class="node-divider">
|
|
83
|
+
</div> -->
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<!-- 无配置提示 -->
|
|
88
|
+
<div v-else class="no-config">
|
|
89
|
+
<t-icon name="info-circle" size="20px" />
|
|
90
|
+
<span>暂无流程配置信息</span>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<!-- 抄送人部分 -->
|
|
95
|
+
<div v-if="showCC" class="cc-section">
|
|
96
|
+
<div class="section-header">
|
|
97
|
+
<t-icon name="user-add" class="section-icon" />
|
|
98
|
+
<span class="section-title">抄送人</span>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="cc-list">
|
|
101
|
+
<div class="cc-row">
|
|
102
|
+
<template v-for="(cc, index) in ccEmployees" :key="index">
|
|
103
|
+
<div class="cc-item">
|
|
104
|
+
<t-avatar :image="cc.avatar" size="small">
|
|
105
|
+
{{ getAvatarText(cc.name) }}
|
|
106
|
+
</t-avatar>
|
|
107
|
+
<div class="user-info">
|
|
108
|
+
<span class="cc-name">{{ cc.name }}</span>
|
|
109
|
+
<t-icon v-if="canEdit && !defaultCcEmployeesIds.includes(cc.id)" name="close" size="16px"
|
|
110
|
+
@click="removeEmployee(cc.id)" />
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</template>
|
|
114
|
+
<t-button theme="default" variant="text" @click="handleAddCC" v-if="canEdit">
|
|
115
|
+
<template #icon>
|
|
116
|
+
<t-icon name="add" />
|
|
117
|
+
</template>
|
|
118
|
+
添加抄送人
|
|
119
|
+
</t-button>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</t-card>
|
|
124
|
+
|
|
125
|
+
<!-- 审批人选择弹窗 -->
|
|
126
|
+
<ebiz-employee-selector v-if="showApproverSelector" :showDefault="false" v-model:visible="showApproverSelector"
|
|
127
|
+
@change="handleApproverSelect" :single="true" />
|
|
128
|
+
<ebiz-employee-selector v-if="showCCSelector" :showDefault="false" v-model:visible="showCCSelector"
|
|
129
|
+
@change="handleCCSelect" />
|
|
130
|
+
</div>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<script setup lang="ts">
|
|
134
|
+
import { ref, watch, computed, onMounted } from 'vue'
|
|
135
|
+
import { Icon as TIcon, Avatar as TAvatar, Card as TCard, Button as TButton } from 'tdesign-vue-next'
|
|
136
|
+
import EbizEmployeeSelector from './EbizEmployeeSelector.vue'
|
|
137
|
+
import dataService from '../apiService/simpleDataService'
|
|
138
|
+
|
|
139
|
+
interface Employee {
|
|
140
|
+
id: string | number
|
|
141
|
+
name: string
|
|
142
|
+
no: string
|
|
143
|
+
avatar?: string
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 节点配置接口
|
|
147
|
+
interface ProcessNodeConfig {
|
|
148
|
+
nodeId: string
|
|
149
|
+
nodeName: string
|
|
150
|
+
nodeType: string
|
|
151
|
+
nodeTypeDesc: string
|
|
152
|
+
multiInstanceType: string
|
|
153
|
+
multiInstanceTypeDesc: string
|
|
154
|
+
isMultiInstance: boolean
|
|
155
|
+
needManualConfig: boolean
|
|
156
|
+
ruleType: string
|
|
157
|
+
ruleTypeDesc: string
|
|
158
|
+
deptIds: number[]
|
|
159
|
+
roleIds: number[]
|
|
160
|
+
userIds: number[]
|
|
161
|
+
defaultApprovers: ApproverConfig[]
|
|
162
|
+
defaultCcUserIds: (string | number)[]
|
|
163
|
+
defaultCcUsers: ApproverConfig[]
|
|
164
|
+
extensionProperties: Record<string, any>
|
|
165
|
+
description: string
|
|
166
|
+
priority: number
|
|
167
|
+
formKey: string
|
|
168
|
+
dueDate: string
|
|
169
|
+
collection: string
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface ApproverConfig {
|
|
173
|
+
userId: number | null
|
|
174
|
+
userName: string | null
|
|
175
|
+
userAccount: string | null
|
|
176
|
+
userNo: string | null
|
|
177
|
+
deptId: number | null
|
|
178
|
+
deptName: string | null
|
|
179
|
+
roleIds: number[] | null
|
|
180
|
+
roleNames: string[] | null
|
|
181
|
+
isDefault: boolean | null
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
interface NodeApproverData {
|
|
185
|
+
nodeId: string
|
|
186
|
+
approvers: Employee[]
|
|
187
|
+
selectedIds: (string | number)[]
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface Props {
|
|
191
|
+
approverList: (string | number)[]
|
|
192
|
+
ccList: (string | number)[]
|
|
193
|
+
workFlowKey: string
|
|
194
|
+
id: number
|
|
195
|
+
required: boolean
|
|
196
|
+
type?: 'organization' | 'role' | 'all'
|
|
197
|
+
value?: string
|
|
198
|
+
showRootOrg?: boolean
|
|
199
|
+
childDeptEnable?: boolean
|
|
200
|
+
showCC?: boolean
|
|
201
|
+
canEdit?: boolean,
|
|
202
|
+
data?: Record<string, any> // 数据对象,用于存储ccList、approverList和节点审批人数据
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
206
|
+
approverList: () => [],
|
|
207
|
+
ccList: () => [],
|
|
208
|
+
workFlowKey: '',
|
|
209
|
+
id: 0,
|
|
210
|
+
required: true,
|
|
211
|
+
showRootOrg: true,
|
|
212
|
+
childDeptEnable: false,
|
|
213
|
+
showCC: true,
|
|
214
|
+
canEdit: true,
|
|
215
|
+
data: () => ({})
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
const emit = defineEmits(['update:approverList', 'update:ccList', 'update:data', 'change'])
|
|
219
|
+
|
|
220
|
+
// 状态变量
|
|
221
|
+
const showApproverSelector = ref(false) // 是否显示审批人选择器
|
|
222
|
+
const showCCSelector = ref(false) // 是否显示抄送人选择器
|
|
223
|
+
const currentNodeId = ref('')
|
|
224
|
+
const employeeList = ref<Employee[]>([])
|
|
225
|
+
const nodeConfigs = ref<ProcessNodeConfig[]>([])
|
|
226
|
+
const nodeApproverMap = ref<Map<string, NodeApproverData>>(new Map())
|
|
227
|
+
|
|
228
|
+
// 已选抄送人列表
|
|
229
|
+
const ccEmployees = ref<Employee[]>([])
|
|
230
|
+
// 默认抄送人列表(不可删除)
|
|
231
|
+
const defaultCcEmployeesIds = ref<(string | number)[]>([])
|
|
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
|
+
// 设置默认抄送人
|
|
287
|
+
console.log("node.defaultCcUsers", node.defaultCcUsers)
|
|
288
|
+
if (node.defaultCcUsers && node.defaultCcUsers.length > 0) {
|
|
289
|
+
node.defaultCcUsers.forEach(approver => {
|
|
290
|
+
if (approver.userId && approver.userName) {
|
|
291
|
+
const employee: Employee = {
|
|
292
|
+
id: approver.userId,
|
|
293
|
+
name: approver.userName,
|
|
294
|
+
no: approver.userNo || '',
|
|
295
|
+
avatar: undefined
|
|
296
|
+
}
|
|
297
|
+
// 保存默认的抄送人ID
|
|
298
|
+
console.log(123123123, employee)
|
|
299
|
+
defaultCcEmployeesIds.value.push(employee.id);
|
|
300
|
+
|
|
301
|
+
// 添加到全局员工列表
|
|
302
|
+
if (!employeeList.value.find(emp => emp.id === employee.id)) {
|
|
303
|
+
employeeList.value.push(employee)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
console.log("defaultCcEmployeesIds", defaultCcEmployeesIds.value)
|
|
309
|
+
if (defaultCcEmployeesIds.value && defaultCcEmployeesIds.value.length > 0) {
|
|
310
|
+
updateCCList(defaultCcEmployeesIds.value)
|
|
311
|
+
}
|
|
312
|
+
nodeApproverMap.value.set(node.nodeId, nodeData)
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
updateGlobalApproverList()
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// 分配审批人到节点
|
|
319
|
+
const distributeApproversToNodes = (approvers: any) => {
|
|
320
|
+
if (!approvers || !nodeConfigs.value.length) return
|
|
321
|
+
|
|
322
|
+
for (const k in approvers) {
|
|
323
|
+
const node = nodeConfigs.value.find(n => n.collection === k)
|
|
324
|
+
if (node && nodeApproverMap.value.has(node.nodeId)) {
|
|
325
|
+
const nodeData = nodeApproverMap.value.get(node.nodeId)!
|
|
326
|
+
if (approvers[k].length > 0 && (k === 'approverList' || node.needManualConfig)) {
|
|
327
|
+
nodeData.approvers = []
|
|
328
|
+
nodeData.selectedIds = []
|
|
329
|
+
approvers[k].forEach((info: Employee) => {
|
|
330
|
+
if (info.id && info.name) {
|
|
331
|
+
const employee: Employee = {
|
|
332
|
+
id: info.id,
|
|
333
|
+
name: info.name,
|
|
334
|
+
no: info.no || '',
|
|
335
|
+
}
|
|
336
|
+
nodeData.approvers.push(employee)
|
|
337
|
+
nodeData.selectedIds.push(info.id)
|
|
338
|
+
if (!employeeList.value.find(emp => emp.id === employee.id)) {
|
|
339
|
+
employeeList.value.push(employee)
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
updateGlobalApproverList()
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// 更新节点collection字段数据到data属性
|
|
350
|
+
const updateNodeCollectionData = (): void => {
|
|
351
|
+
// 将选择的人员ID列表写入data对应的collection字段
|
|
352
|
+
const newData = { ...props.data }
|
|
353
|
+
nodeApproverMap.value.forEach((nodeData, nodeId) => {
|
|
354
|
+
// 查找对应的节点配置
|
|
355
|
+
const nodeConfig = nodeConfigs.value.find(n => n.nodeId === nodeId)
|
|
356
|
+
if (!nodeConfig || !nodeConfig.collection) return
|
|
357
|
+
newData[nodeConfig.collection] = nodeData.selectedIds
|
|
358
|
+
})
|
|
359
|
+
emit('update:data', newData)
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// 更新全局审批人列表
|
|
363
|
+
const updateGlobalApproverList = () => {
|
|
364
|
+
const allApproverIds: (string | number)[] = []
|
|
365
|
+
nodeApproverMap.value.forEach((nodeData, nodeId) => {
|
|
366
|
+
const node = nodeConfigs.value.find(n => n.nodeId === nodeId)
|
|
367
|
+
if (node && node.collection === 'approverList') {
|
|
368
|
+
allApproverIds.push(...nodeData.selectedIds)
|
|
369
|
+
}
|
|
370
|
+
})
|
|
371
|
+
// 同时更新节点collection字段数据到data属性
|
|
372
|
+
updateNodeCollectionData()
|
|
373
|
+
emit('update:approverList', allApproverIds)
|
|
374
|
+
emit('change', {
|
|
375
|
+
type: 'approver',
|
|
376
|
+
ids: allApproverIds,
|
|
377
|
+
employees: getAllApprovers()
|
|
378
|
+
})
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// 获取所有审批人
|
|
382
|
+
const getAllApprovers = (): Employee[] => {
|
|
383
|
+
const allApprovers: Employee[] = []
|
|
384
|
+
nodeApproverMap.value.forEach(nodeData => {
|
|
385
|
+
allApprovers.push(...nodeData.approvers)
|
|
386
|
+
})
|
|
387
|
+
return allApprovers
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// 检查节点是否为会签节点
|
|
391
|
+
const isParallelNode = (node: ProcessNodeConfig): boolean => {
|
|
392
|
+
return node.nodeType === 'PARALLEL'
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// 检查节点是否需要手动配置
|
|
396
|
+
const needManualConfig = (node: ProcessNodeConfig): boolean => {
|
|
397
|
+
return node.needManualConfig === true || isParallelNode(node)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// 获取节点的审批人数据
|
|
401
|
+
const getNodeApprovers = (nodeId: string): Employee[] => {
|
|
402
|
+
return nodeApproverMap.value.get(nodeId)?.approvers || []
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// 获取员工列表
|
|
406
|
+
const fetchEmployeeList = async () => {
|
|
407
|
+
try {
|
|
408
|
+
const response = await dataService.fetch({}, {}, '/process/userList')
|
|
409
|
+
employeeList.value = response || []
|
|
410
|
+
if (props.id) {
|
|
411
|
+
fetchHistory()
|
|
412
|
+
}
|
|
413
|
+
} catch (error) {
|
|
414
|
+
employeeList.value = []
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// 获取历史审批信息
|
|
419
|
+
const fetchHistory = () => {
|
|
420
|
+
dataService.fetch({
|
|
421
|
+
bussinessKey: props.id ? props.id.toString() : null,
|
|
422
|
+
type: props.workFlowKey
|
|
423
|
+
}, {}, '/tasks/process/detail').then(res => {
|
|
424
|
+
const ccList = res?.variables?.form?.ccList ?? []
|
|
425
|
+
if (!ccEmployees.value || ccEmployees.value.length === 0) {
|
|
426
|
+
ccEmployees.value = ccList.map(id => employeeList.value.find(emp => emp.id == id)).filter(Boolean)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const approverList = res?.variables?.form?.approverList ?? []
|
|
430
|
+
if (approverList.length) {
|
|
431
|
+
distributeApproversToNodes(approverList)
|
|
432
|
+
}
|
|
433
|
+
})
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// 处理审批人选择
|
|
437
|
+
const handleApproverSelect = (id: string | number, employees: Employee[]) => {
|
|
438
|
+
console.log('选择的审批人:', id, employees[0])
|
|
439
|
+
if (!currentNodeId.value || !id) return
|
|
440
|
+
|
|
441
|
+
const employee = employees[0]
|
|
442
|
+
// 添加到全局员工列表
|
|
443
|
+
if (!employeeList.value.find(emp => emp.id === id)) {
|
|
444
|
+
employeeList.value.push(employee)
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const nodeData = nodeApproverMap.value.get(currentNodeId.value)
|
|
448
|
+
if (!nodeData) return
|
|
449
|
+
|
|
450
|
+
// 检查是否已存在
|
|
451
|
+
if (nodeData.selectedIds.includes(id)) {
|
|
452
|
+
const index = nodeData.selectedIds.indexOf(id)
|
|
453
|
+
nodeData.selectedIds.splice(index, 1)
|
|
454
|
+
nodeData.approvers.splice(index, 1)
|
|
455
|
+
} else {
|
|
456
|
+
nodeData.approvers.push(employee)
|
|
457
|
+
nodeData.selectedIds.push(id)
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
console.log('节点审批人数据:', nodeData)
|
|
461
|
+
updateGlobalApproverList()
|
|
462
|
+
showApproverSelector.value = false
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// 移除节点审批人
|
|
466
|
+
const removeNodeApprover = (nodeId: string, employeeId: string | number) => {
|
|
467
|
+
const nodeData = nodeApproverMap.value.get(nodeId)
|
|
468
|
+
if (!nodeData) return
|
|
469
|
+
|
|
470
|
+
const index = nodeData.selectedIds.findIndex(id => Number(id) === Number(employeeId))
|
|
471
|
+
if (index !== -1) {
|
|
472
|
+
nodeData.selectedIds.splice(index, 1)
|
|
473
|
+
nodeData.approvers.splice(index, 1)
|
|
474
|
+
updateGlobalApproverList()
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// 处理添加节点审批人
|
|
479
|
+
const handleAddNodeApprover = (nodeId: string) => {
|
|
480
|
+
currentNodeId.value = nodeId
|
|
481
|
+
showApproverSelector.value = true
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// 更新抄送人列表
|
|
485
|
+
const updateCCList = (ccIds: (string | number)[]): void => {
|
|
486
|
+
ccEmployees.value = ccIds.map((id) => employeeList.value.find((emp) => emp.id == id)).filter((emp): emp is Employee => emp !== undefined)
|
|
487
|
+
console.log("ccEmployees.value", ccEmployees.value)
|
|
488
|
+
ccSelectorValue.value = ccIds
|
|
489
|
+
|
|
490
|
+
console.log("ccIds", ccIds)
|
|
491
|
+
emit('update:ccList', ccIds)
|
|
492
|
+
emit('change', {
|
|
493
|
+
type: 'cc',
|
|
494
|
+
ids: ccIds,
|
|
495
|
+
employees: ccEmployees.value
|
|
496
|
+
})
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// 处理抄送人选择
|
|
500
|
+
const handleCCSelect = (ids: (string | number)[], employees: Employee[]): void => {
|
|
501
|
+
employeeList.value = [...employeeList.value, ...employees]
|
|
502
|
+
const idsArr = [...new Set([...defaultCcEmployeesIds.value, ...ids])]
|
|
503
|
+
ccSelectorValue.value = idsArr
|
|
504
|
+
updateCCList(idsArr)
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// 处理添加抄送人
|
|
508
|
+
const handleAddCC = () => {
|
|
509
|
+
showCCSelector.value = true
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// 移除抄送人
|
|
513
|
+
const removeEmployee = (employeeId: string | number) => {
|
|
514
|
+
const newCCIds = ccEmployees.value.filter(emp => Number(emp.id) !== Number(employeeId)).map(emp => emp.id)
|
|
515
|
+
updateCCList(newCCIds)
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// 自动填充功能
|
|
519
|
+
const autoFill = () => {
|
|
520
|
+
if (!props.workFlowKey) return
|
|
521
|
+
|
|
522
|
+
dataService.fetch(
|
|
523
|
+
{ businessType: props.workFlowKey },
|
|
524
|
+
{},
|
|
525
|
+
'/tasks/last-approver'
|
|
526
|
+
).then(res => {
|
|
527
|
+
const { ccList = [], ...rest } = res || {}
|
|
528
|
+
// 更新抄送人
|
|
529
|
+
employeeList.value = [...employeeList.value, ...ccList]
|
|
530
|
+
if (ccList.length > 0) {
|
|
531
|
+
updateCCList(ccList.map((item) => item.id))
|
|
532
|
+
}
|
|
533
|
+
distributeApproversToNodes(rest)
|
|
534
|
+
}).catch(err => {
|
|
535
|
+
console.error('自动填充失败:', err)
|
|
536
|
+
})
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
onMounted(() => {
|
|
540
|
+
fetchEmployeeList()
|
|
541
|
+
if (props.workFlowKey) {
|
|
542
|
+
fetchProcessConfig().then(autoFill)
|
|
543
|
+
}
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
watch([() => props.workFlowKey], ([newKey, oldKey]) => {
|
|
547
|
+
if (newKey && newKey !== oldKey) {
|
|
548
|
+
fetchProcessConfig().then(autoFill)
|
|
549
|
+
}
|
|
550
|
+
})
|
|
551
|
+
</script>
|
|
552
|
+
|
|
553
|
+
<style lang="less" scoped>
|
|
554
|
+
.ebiz-approval {
|
|
555
|
+
.approval-title {
|
|
556
|
+
font-size: 16px;
|
|
557
|
+
font-weight: 500;
|
|
558
|
+
margin-bottom: 16px;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.section-header {
|
|
562
|
+
display: flex;
|
|
563
|
+
align-items: center;
|
|
564
|
+
margin-bottom: 16px;
|
|
565
|
+
|
|
566
|
+
.section-icon {
|
|
567
|
+
margin-right: 8px;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.section-title {
|
|
571
|
+
font-size: 14px;
|
|
572
|
+
color: var(--td-text-color-primary);
|
|
573
|
+
|
|
574
|
+
.required {
|
|
575
|
+
color: var(--td-error-color);
|
|
576
|
+
margin-left: 4px;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.node-list {
|
|
582
|
+
.node-item {
|
|
583
|
+
margin-bottom: 8px;
|
|
584
|
+
|
|
585
|
+
.node-header {
|
|
586
|
+
display: flex;
|
|
587
|
+
align-items: center;
|
|
588
|
+
margin-bottom: 8px;
|
|
589
|
+
|
|
590
|
+
.node-icon {
|
|
591
|
+
margin-right: 8px;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.node-name {
|
|
595
|
+
font-size: 14px;
|
|
596
|
+
color: var(--td-text-color-primary);
|
|
597
|
+
margin-right: 8px;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.node-type-badge {
|
|
601
|
+
padding: 0px 6px;
|
|
602
|
+
font-size: 10px;
|
|
603
|
+
height: 22px;
|
|
604
|
+
line-height: 22px;
|
|
605
|
+
background: #e6f7ff;
|
|
606
|
+
border-radius: 4px;
|
|
607
|
+
margin-right: 8px;
|
|
608
|
+
color: #1890ff;
|
|
609
|
+
|
|
610
|
+
&.parallel {
|
|
611
|
+
background: #fff2e8;
|
|
612
|
+
color: #fa8c16;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.required {
|
|
617
|
+
color: var(--td-error-color);
|
|
618
|
+
margin-left: 4px;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.node-desc {
|
|
622
|
+
font-size: 12px;
|
|
623
|
+
color: var(--td-text-color-secondary);
|
|
624
|
+
margin-left: 8px;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.approver-row {
|
|
629
|
+
display: flex;
|
|
630
|
+
align-items: center;
|
|
631
|
+
flex-wrap: wrap;
|
|
632
|
+
gap: 8px;
|
|
633
|
+
|
|
634
|
+
.approver-item {
|
|
635
|
+
display: flex;
|
|
636
|
+
align-items: center;
|
|
637
|
+
padding: 4px 8px;
|
|
638
|
+
background: var(--td-bg-color-container);
|
|
639
|
+
border: 1px solid var(--td-component-border);
|
|
640
|
+
border-radius: 3px;
|
|
641
|
+
|
|
642
|
+
.user-info {
|
|
643
|
+
margin-left: 8px;
|
|
644
|
+
display: flex;
|
|
645
|
+
align-items: center;
|
|
646
|
+
gap: 8px;
|
|
647
|
+
cursor: pointer;
|
|
648
|
+
user-select: none;
|
|
649
|
+
|
|
650
|
+
&.no-delete {
|
|
651
|
+
margin-right: 0;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
&.ready-only {
|
|
656
|
+
background: #f5f5f5;
|
|
657
|
+
border-color: #d9d9d9;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
.approver-name {
|
|
661
|
+
font-size: 14px;
|
|
662
|
+
color: var(--td-text-color-primary);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.arrow-icon {
|
|
667
|
+
color: var(--td-text-color-secondary);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.no-approvers {
|
|
671
|
+
display: flex;
|
|
672
|
+
align-items: center;
|
|
673
|
+
gap: 8px;
|
|
674
|
+
padding: 8px 12px;
|
|
675
|
+
color: var(--td-text-color-secondary);
|
|
676
|
+
font-size: 12px;
|
|
677
|
+
background: var(--td-bg-color-container-weak);
|
|
678
|
+
border-radius: 4px;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.node-divider {
|
|
683
|
+
height: 1px;
|
|
684
|
+
// background: var(--td-component-border);
|
|
685
|
+
margin: 16px 0;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.no-config {
|
|
691
|
+
display: flex;
|
|
692
|
+
align-items: center;
|
|
693
|
+
justify-content: center;
|
|
694
|
+
gap: 8px;
|
|
695
|
+
padding: 24px;
|
|
696
|
+
color: var(--td-text-color-secondary);
|
|
697
|
+
font-size: 14px;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.cc-list {
|
|
702
|
+
|
|
703
|
+
.approver-row,
|
|
704
|
+
.cc-row {
|
|
705
|
+
display: flex;
|
|
706
|
+
align-items: center;
|
|
707
|
+
flex-wrap: wrap;
|
|
708
|
+
gap: 8px;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
.approver-item,
|
|
712
|
+
.cc-item {
|
|
713
|
+
display: flex;
|
|
714
|
+
align-items: center;
|
|
715
|
+
padding: 4px 8px;
|
|
716
|
+
background: var(--td-bg-color-container);
|
|
717
|
+
border: 1px solid var(--td-component-border);
|
|
718
|
+
border-radius: 3px;
|
|
719
|
+
|
|
720
|
+
.user-info {
|
|
721
|
+
margin-left: 8px;
|
|
722
|
+
display: flex;
|
|
723
|
+
align-items: center;
|
|
724
|
+
gap: 8px;
|
|
725
|
+
cursor: pointer;
|
|
726
|
+
user-select: none;
|
|
727
|
+
|
|
728
|
+
&.no-delete {
|
|
729
|
+
margin-right: 0;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
.approver-name,
|
|
734
|
+
.cc-name {
|
|
735
|
+
font-size: 14px;
|
|
736
|
+
color: var(--td-text-color-primary);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
.arrow-icon {
|
|
741
|
+
color: var(--td-text-color-secondary);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
.cc-section {
|
|
746
|
+
margin-top: 24px;
|
|
747
|
+
}
|
|
748
748
|
</style>
|