@ebiz/designer-components 0.1.12 → 0.1.13
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 +11057 -11011
- package/package.json +1 -1
- package/src/components/EbizApproval.vue +74 -17
- package/src/components/EbizEmployeeSelector.vue +310 -336
- package/src/components/EbizSApprovalProcess.vue +2 -0
- package/src/views/EbizApprovalDemo.vue +11 -0
package/package.json
CHANGED
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
</span>
|
|
14
14
|
</div>
|
|
15
15
|
<div class="approver-list">
|
|
16
|
-
<div class="approver-row">
|
|
16
|
+
<div class="approver-row" v-if="props.type != 'limited'">
|
|
17
17
|
<template v-for="(approver, index) in approvers" :key="index">
|
|
18
18
|
<div class="approver-item">
|
|
19
19
|
<t-avatar :image="approver.avatar" size="small">
|
|
20
20
|
{{ getAvatarText(approver.name) }}
|
|
21
21
|
</t-avatar>
|
|
22
|
-
<div class="user-info"
|
|
22
|
+
<div class="user-info">
|
|
23
23
|
<span class="approver-name">{{ approver.name }}</span>
|
|
24
|
-
<t-icon
|
|
25
|
-
@click="removeEmployee(approver, 'approver')" />
|
|
24
|
+
<t-icon name="close" size="16px"
|
|
25
|
+
@click="removeEmployee(approver.id, 'approver')" />
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
<t-icon v-if="index < approvers.length - 1" name="chevron-right" class="arrow-icon" />
|
|
@@ -34,6 +34,29 @@
|
|
|
34
34
|
添加审批人
|
|
35
35
|
</t-button>
|
|
36
36
|
</div>
|
|
37
|
+
<div v-else class="approver-row">
|
|
38
|
+
<div style="display:flex;align-items:center" v-for="(i,inx) in props.limitedMap" :key="inx">
|
|
39
|
+
<template v-if="approvers[inx]">
|
|
40
|
+
<div class="approver-item">
|
|
41
|
+
<t-avatar :image="approvers[inx].avatar" size="small">
|
|
42
|
+
{{ getAvatarText(approvers[inx].name) }}
|
|
43
|
+
</t-avatar>
|
|
44
|
+
<div class="user-info">
|
|
45
|
+
<span class="approver-name">{{ approvers[inx].name }}</span>
|
|
46
|
+
<t-icon name="close" size="16px"
|
|
47
|
+
@click="removeEmployee(inx, 'approver',true)" />
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<t-icon name="chevron-right" class="arrow-icon" v-if="inx!=props.limitedMap.length-1"/>
|
|
51
|
+
</template>
|
|
52
|
+
<t-button v-else theme="default" variant="text" @click="addLimitedApprover(inx)" v-if="canEdit">
|
|
53
|
+
<template #icon>
|
|
54
|
+
<t-icon name="add" />
|
|
55
|
+
</template>
|
|
56
|
+
添加{{i.label}}
|
|
57
|
+
</t-button>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
37
60
|
</div>
|
|
38
61
|
</div>
|
|
39
62
|
|
|
@@ -52,7 +75,7 @@
|
|
|
52
75
|
</t-avatar>
|
|
53
76
|
<div class="user-info">
|
|
54
77
|
<span class="cc-name">{{ cc.name }}</span>
|
|
55
|
-
<t-icon name="close" size="16px" @click="removeEmployee(cc, 'cc')" />
|
|
78
|
+
<t-icon name="close" size="16px" @click="removeEmployee(cc.id, 'cc')" />
|
|
56
79
|
</div>
|
|
57
80
|
</div>
|
|
58
81
|
</template>
|
|
@@ -88,13 +111,20 @@ interface Employee {
|
|
|
88
111
|
avatar?: string
|
|
89
112
|
}
|
|
90
113
|
|
|
114
|
+
interface LimitItem{
|
|
115
|
+
label:string,
|
|
116
|
+
value:string
|
|
117
|
+
}
|
|
118
|
+
|
|
91
119
|
interface Props {
|
|
92
120
|
approverList: (string | number)[] // 选中的审批人ID列表
|
|
93
121
|
ccList: (string | number)[] // 选中的抄送人ID列表
|
|
94
122
|
key: string // 审批流程的唯一标识
|
|
95
123
|
id: number // 审批流程的编号
|
|
96
124
|
required: boolean // 是否必填
|
|
97
|
-
type?: 'organization' | 'role' | 'all' // 查询类型
|
|
125
|
+
type?: 'organization' | 'role' | 'all' | 'limited' // 查询类型
|
|
126
|
+
limitedType?:'organization' | 'role'
|
|
127
|
+
limitedMap?:LimitItem[]
|
|
98
128
|
value?: string // 查询值
|
|
99
129
|
showRootOrg?: boolean // 是否显示顶层组织
|
|
100
130
|
childDeptEnable?: boolean // 是否包含子部门
|
|
@@ -107,6 +137,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
107
137
|
ccList: () => [],
|
|
108
138
|
key: '',
|
|
109
139
|
id: 0,
|
|
140
|
+
limitedType:'role',
|
|
141
|
+
limitedMap:()=>[],
|
|
110
142
|
required: true,
|
|
111
143
|
showRootOrg: true,
|
|
112
144
|
childDeptEnable: false,
|
|
@@ -133,7 +165,6 @@ const fetchHistory = () => {
|
|
|
133
165
|
})
|
|
134
166
|
}
|
|
135
167
|
|
|
136
|
-
|
|
137
168
|
// 状态变量
|
|
138
169
|
const showApproverSelector = ref(false)
|
|
139
170
|
const showCCSelector = ref(false)
|
|
@@ -150,8 +181,7 @@ const ccEmployees = ref<Employee[]>([])
|
|
|
150
181
|
const selectedApprover = computed({
|
|
151
182
|
get: () => props.approverList,
|
|
152
183
|
set: (val) => {
|
|
153
|
-
approvers.value = val.map(id => employeeList.value.find(emp => emp.id == id))
|
|
154
|
-
console.log(approvers.value,val)
|
|
184
|
+
approvers.value = val.map(id => employeeList.value.find(emp => emp.id == id) || null)
|
|
155
185
|
emit('change', {
|
|
156
186
|
type: 'approver',
|
|
157
187
|
ids: val,
|
|
@@ -165,7 +195,6 @@ const selectedApprover = computed({
|
|
|
165
195
|
const selectedCC = computed({
|
|
166
196
|
get: () => props.ccList,
|
|
167
197
|
set: (val) => {
|
|
168
|
-
|
|
169
198
|
ccEmployees.value = val.map(id => employeeList.value.find(emp => emp.id == id)).filter(Boolean)
|
|
170
199
|
console.log(ccEmployees.value,161,val)
|
|
171
200
|
emit('change', {
|
|
@@ -185,6 +214,20 @@ const getAvatarText = (name: string) => {
|
|
|
185
214
|
// 获取员工列表
|
|
186
215
|
const fetchEmployeeList = async () => {
|
|
187
216
|
loading.value = true
|
|
217
|
+
if(props.type === 'limited') {
|
|
218
|
+
switch(props.limitedType) {
|
|
219
|
+
case 'organization':
|
|
220
|
+
break;
|
|
221
|
+
case 'role':{
|
|
222
|
+
Promise.all(props.limitedMap.map(i=>dataService.fetch({
|
|
223
|
+
roleKeyWord:i.value
|
|
224
|
+
},{},'/process/userList'))).then(res=>{
|
|
225
|
+
selectedApprover.value = new Array(res.length).fill(0);
|
|
226
|
+
})
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
188
231
|
try {
|
|
189
232
|
const response = await dataService.fetch(
|
|
190
233
|
{},
|
|
@@ -204,14 +247,19 @@ const fetchEmployeeList = async () => {
|
|
|
204
247
|
|
|
205
248
|
// 处理审批人选择
|
|
206
249
|
const handleApproverSelect = (data: []) => {
|
|
207
|
-
console.log(data,195)
|
|
208
250
|
if(!data[0]) return;
|
|
251
|
+
if(props.type === 'limited') {
|
|
252
|
+
selectedApprover.value[nowAdd.value] = data[0];
|
|
253
|
+
selectedApprover.value = [...selectedApprover.value];
|
|
254
|
+
nowAdd.value = 0;
|
|
255
|
+
tempApprover.value = [];
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
209
258
|
if(selectedApprover.value.includes(data[0])) {
|
|
210
259
|
let index = selectedApprover.value.indexOf(data[0]);
|
|
211
260
|
selectedApprover.value.splice(index, 1);
|
|
212
261
|
};
|
|
213
262
|
selectedApprover.value = [...selectedApprover.value, data[0]];
|
|
214
|
-
console.log(selectedApprover.value,200)
|
|
215
263
|
tempApprover.value = [];
|
|
216
264
|
}
|
|
217
265
|
|
|
@@ -221,19 +269,28 @@ const handleCCSelect = (data: []) => {
|
|
|
221
269
|
}
|
|
222
270
|
|
|
223
271
|
// 移除人员
|
|
224
|
-
const removeEmployee = (
|
|
272
|
+
const removeEmployee = (idOrInx: any, type: 'approver' | 'cc',isLimited=false) => {
|
|
225
273
|
if (type === 'approver') {
|
|
226
|
-
if
|
|
227
|
-
|
|
274
|
+
if(isLimited) {
|
|
275
|
+
selectedApprover.value[idOrInx] = 0;
|
|
276
|
+
selectedApprover.value = [...selectedApprover.value];
|
|
277
|
+
return;
|
|
228
278
|
}
|
|
229
|
-
const newList = props.approverList.filter(id => id !==
|
|
279
|
+
const newList = props.approverList.filter(id => id !== idOrInx);
|
|
230
280
|
selectedApprover.value = newList;
|
|
231
281
|
} else {
|
|
232
|
-
const newList = props.ccList.filter(id => id !==
|
|
282
|
+
const newList = props.ccList.filter(id => id !== idOrInx);
|
|
233
283
|
selectedCC.value = newList;
|
|
234
284
|
}
|
|
235
285
|
}
|
|
236
286
|
|
|
287
|
+
const nowAdd =ref(0);
|
|
288
|
+
|
|
289
|
+
const addLimitedApprover = (inx:number) => {
|
|
290
|
+
nowAdd.value = inx;
|
|
291
|
+
showApproverSelector.value = true;
|
|
292
|
+
}
|
|
293
|
+
|
|
237
294
|
// 处理添加审批人
|
|
238
295
|
const handleAddApprover = () => {
|
|
239
296
|
showApproverSelector.value = true
|