ui-process-h5 0.1.20 → 0.1.23

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.
@@ -0,0 +1,439 @@
1
+ <template>
2
+ <div class="process-warp">
3
+ <div class="process-main" v-if="processStatus.status">
4
+ <div class="process-ml-item border">
5
+ <div class="process-mli-name">流程状态</div>
6
+ <div class="process-mli-value">
7
+ <div
8
+ class="process-mliv-dd"
9
+ :style="{ background: getColor(processStatus.status) }"
10
+ v-if="
11
+ processStatus.status || processStatus.bizStatusName
12
+ "
13
+ >
14
+ {{
15
+ processStatus.bizStatusName
16
+ ? processStatus.bizStatusName
17
+ : processStatus.status
18
+ }}
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <div class="process-ml-item border">
23
+ <div class="process-mli-name">流程发起时间</div>
24
+ <div class="process-mli-value">
25
+ <span>{{ processStatus.createTime }}</span>
26
+ </div>
27
+ </div>
28
+
29
+ <div
30
+ class="process-ml-item"
31
+ v-if="
32
+ processStatus.allUserNames &&
33
+ processStatus.allUserNames.length
34
+ "
35
+ >
36
+ <div class="process-mli-name">审批节点</div>
37
+ <div class="process-mli-value">
38
+ <span class="process-mliv-jd">{{
39
+ `${
40
+ processStatus.taskState == 4
41
+ ? processStatus.currUserName
42
+ : processStatus.allUserNames.toString()
43
+ }审批中`
44
+ }}</span>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <div class="process-card" :style="{ height: processCardHeight }">
49
+ <TopTab :tapList="tapList">
50
+ <template #default><slot></slot></template>
51
+ </TopTab>
52
+ </div>
53
+ <div class="process-foot" v-if="isAdditional">
54
+ <div class="footBtnRow">
55
+ <slot name="btn"></slot>
56
+ </div>
57
+ </div>
58
+ <div class="process-btn">
59
+ <template v-if="processStatus.status != '已完成'">
60
+ <template v-for="(item, index) in operBtn" :key="item.name">
61
+ <TopButton
62
+ v-if="index < 3"
63
+ @click="handleTest"
64
+ :type="item.btnProps.type"
65
+ >
66
+ {{ item.name }}
67
+ </TopButton>
68
+ </template>
69
+ </template>
70
+ <div class="elips" v-if="operBtn.length > 3">
71
+ <div class="circle"></div>
72
+ <div class="circle"></div>
73
+ <div class="circle"></div>
74
+ </div>
75
+ <!-- <TopButton @click="handleTest">撤销</TopButton>
76
+ <TopButton @click="handleTest" type="danger">拒绝</TopButton>
77
+ <TopButton @click="handleTest" type="primary">同意</TopButton> -->
78
+ </div>
79
+ </div>
80
+ <TopPopup ref="TopPopup1" :cancel="handleCancel" :comfig="handleComfig">
81
+ csaasd1
82
+ </TopPopup>
83
+ </template>
84
+
85
+ <script lang="ts">
86
+ import { defineComponent, ref, watch, computed } from "vue-demi";
87
+ import TopTab from "../../tab";
88
+ import TopPopup from "../../popup";
89
+ import TopButton from "../../button";
90
+
91
+ export default defineComponent({
92
+ name: "TopProcess",
93
+ components: {
94
+ TopTab,
95
+ TopPopup,
96
+ TopButton,
97
+ },
98
+ props: {
99
+ tapList: { require: false, default: () => [], type: Array },
100
+ processId: { require: true, default: "", type: String },
101
+ processDefId: { require: true, default: "", type: String },
102
+ taskId: { require: true, default: "", type: String },
103
+ isAdditional: { require: false, default: false, type: Boolean },
104
+ isView: { default: false, type: Boolean },
105
+ },
106
+ setup(props: any) {
107
+ const processStatus = ref<any>({});
108
+
109
+ const TopPopup1 = ref<any>();
110
+
111
+ // 底部按钮
112
+ const taskNode = ref<any>([
113
+ {
114
+ taskId: "ecd82a93-4a62-42a7-b7bd-df38d2f1609a",
115
+ taskState: 1,
116
+ nodeId: "obj_026aac284c1a4303854f978b674be4b9",
117
+ customUniqueId: "",
118
+ nodeName: "部门负责人",
119
+ },
120
+ ]);
121
+
122
+ const taskObj = ref<any>({
123
+ id: "obj_026aac284c1a4303854f978b674be4b9",
124
+ name: "部门负责人",
125
+ no: "1",
126
+ buttons: [],
127
+ ccTaskButtonLabel: "",
128
+ ccTaskButtonAnnex: null,
129
+ completeButtonLabel: "同意",
130
+ completeButtonAnnex: null,
131
+ delegateTaskButtonLabel: "转办",
132
+ delegateTaskButtonAnnex: null,
133
+ printFormButtonLabel: "",
134
+ supplyUnusualTransferButtonLabel: "",
135
+ readingOfficeLabel: "",
136
+ readingOfficeButtonAnnex: null,
137
+ jointlySignLabel: "",
138
+ jointlySignButtonAnnex: null,
139
+ counterSignLabel: "加签",
140
+ counterSignButtonAnnex: null,
141
+ coordinationLabel: "",
142
+ coordinationButtonAnnex: null,
143
+ otherButtonAnnexList: null,
144
+ humanPerformer: {
145
+ id: "obj_2bd3494ae5c54309b7f2ea452921790b",
146
+ name: "任意指定",
147
+ resourceAssignmentExpressionModel: {
148
+ formalExpression: "",
149
+ },
150
+ },
151
+ commentModels: [
152
+ {
153
+ actionName: "提交",
154
+ isDefault: true,
155
+ },
156
+ {
157
+ actionName: "作废",
158
+ isDefault: false,
159
+ },
160
+ ],
161
+ routeTxt: {
162
+ departmentIds: null,
163
+ companyIds: null,
164
+ teamList: null,
165
+ routeType: "DynamicUsers",
166
+ },
167
+ loopCardinality: 1,
168
+ isHistoryRoute: false,
169
+ participantList: null,
170
+ historyRoute: false,
171
+ });
172
+
173
+ watch(
174
+ () => props.processId,
175
+ (val, preVal) => {
176
+ if (val) {
177
+ processStatus.value = {
178
+ status: "审批中",
179
+ createUid: "18ccbf63229f0c79f39940ae284c111e",
180
+ createTopUserId: "128ec9c9b7f26135272596fe01c57690",
181
+ createTime: "2023-04-20 15:01:48",
182
+ currUserName: "朱鸿飞",
183
+ allUserNames: ["朱鸿飞"],
184
+ userNodeGroup: {
185
+ 分管领导: ["朱鸿飞"],
186
+ },
187
+ appId: "com.awspaas.user.apps.top.study.project",
188
+ statusCode: "1",
189
+ statusName: "审批中",
190
+ bizStatusName: "审批中",
191
+ taskState: 1,
192
+ };
193
+ }
194
+ },
195
+ {
196
+ //如果加了这个参数,值为true的话,就消除了惰性,watch会在创建后立即执行一次
197
+ //那么首次执行,val为默认值,preVal为undefined
198
+ immediate: true,
199
+ //这个参数代表监听对象时,可以监听深度嵌套的对象属性
200
+ deep: true,
201
+ }
202
+ );
203
+
204
+ console.log("asd", taskNode.value[0].taskState);
205
+ /* copmuted */
206
+ // 按钮对象
207
+ const operBtn = computed<any>(() => {
208
+ let btnList = <any>[];
209
+ let flag =
210
+ taskNode.value &&
211
+ taskNode.value[0] &&
212
+ taskNode.value[0].taskState != 4;
213
+
214
+ if (flag && !props.isView && taskObj.value.completeButtonLabel) {
215
+ let obj = <any>{};
216
+ obj.name = taskObj.value.completeButtonLabel;
217
+ obj.btnProps = { type: "primary" };
218
+ btnList.push(obj);
219
+ }
220
+
221
+ if (flag && !props.isView && processStatus.value.currUserName) {
222
+ let obj = <any>{};
223
+ obj.name = "拒绝";
224
+ obj.btnProps = { type: "danger" };
225
+ btnList.push(obj);
226
+ }
227
+
228
+ if (
229
+ flag &&
230
+ !props.isView &&
231
+ taskObj.value.buttons &&
232
+ taskObj.value.buttons.length
233
+ ) {
234
+ taskObj.value.buttons.forEach((s: any) => {
235
+ if (s.label === "退回") {
236
+ let obj = <any>{};
237
+ obj.name = s.label;
238
+ obj.btnProps = { type: "danger" };
239
+ btnList.push(obj);
240
+ }
241
+ });
242
+ }
243
+
244
+ if (
245
+ flag &&
246
+ !props.isView &&
247
+ taskObj.value.delegateTaskButtonLabel
248
+ ) {
249
+ let obj = <any>{};
250
+ obj.name = taskObj.value.delegateTaskButtonLabel;
251
+ obj.btnProps = { type: "default" };
252
+ btnList.push(obj);
253
+ }
254
+ if (
255
+ props.processId &&
256
+ processStatus.value.createTopUserId == props.userId &&
257
+ taskNode.value[0]?.taskState != 2 &&
258
+ processStatus.value.status !== "已驳回" &&
259
+ processStatus.value.status !== "已撤销"
260
+ ) {
261
+ let obj = <any>{};
262
+ obj.name = "催办";
263
+ obj.btnProps = { type: "default" };
264
+ btnList.push(obj);
265
+ }
266
+ if (
267
+ props.processId &&
268
+ processStatus.value.createTopUserId == props.userId &&
269
+ taskNode.value[0]?.taskState != 2 &&
270
+ processStatus.value.status !== "已驳回" &&
271
+ processStatus.value.status !== "已撤销"
272
+ ) {
273
+ let obj = <any>{};
274
+ obj.name = "撤销";
275
+ obj.btnProps = { type: "default" };
276
+ btnList.push(obj);
277
+ }
278
+ if (flag && !props.isView && taskObj.value.counterSignLabel) {
279
+ let obj = <any>{};
280
+ obj.name = taskObj.value.counterSignLabel;
281
+ obj.btnProps = { type: "primary" };
282
+ btnList.push(obj);
283
+ }
284
+
285
+ return btnList;
286
+ });
287
+
288
+ //筛选
289
+ const actionBtn = computed(() => {
290
+ if (operBtn.value.length > 3) {
291
+ return operBtn.value.slice(3);
292
+ }
293
+ return [];
294
+ });
295
+
296
+ const handleCancel = () => {
297
+ console.log("handleCancel");
298
+ };
299
+
300
+ const handleComfig = () => {
301
+ console.log("handleComfig", "确定按钮");
302
+ TopPopup1.value.handleClose();
303
+ };
304
+
305
+ const processCardHeight = computed(() => {
306
+ /* let num = 210;
307
+ if (
308
+ ProcessInsObj.value.end ||
309
+ !operBtn.value ||
310
+ operBtn.value?.length == 0
311
+ ) {
312
+ num -= 80;
313
+ }
314
+ if (!processStatus.value.status) num -= 140;
315
+ else if (!processStatus.value.currUserName) num -= 40; */
316
+ return `calc(100vh - ${205}px)`;
317
+ });
318
+
319
+ const handleTest = () => {
320
+ TopPopup1.value.handleOpen();
321
+ };
322
+
323
+ return {
324
+ processStatus,
325
+ processCardHeight,
326
+ handleTest,
327
+ TopPopup1,
328
+ handleCancel,
329
+ handleComfig,
330
+ operBtn,
331
+ actionBtn,
332
+ };
333
+ },
334
+ methods: {
335
+ getColor(status: string) {
336
+ if (status == "审核中") return "#FFA52D";
337
+ if (status == "已驳回") return "#F14B4C";
338
+ if (status == "已撤销") return "#CECECE";
339
+ if (status == "已完成") return "#6DC743";
340
+
341
+ return "#1389FF";
342
+ },
343
+ },
344
+ });
345
+ </script>
346
+
347
+ <style scoped>
348
+ .process-warp {
349
+ overflow: hidden;
350
+ height: 100vh;
351
+ width: 100%;
352
+ position: relative;
353
+ background-color: #f3f3f7;
354
+ }
355
+ .process-main {
356
+ display: flex;
357
+ justify-content: space-between;
358
+ flex-direction: column;
359
+ align-items: center;
360
+ padding: 0 17px;
361
+ background: #fff;
362
+ margin: 0 0 10px 0;
363
+ }
364
+
365
+ .process-main .border {
366
+ border-bottom: #e8e8e8 1px solid;
367
+ }
368
+
369
+ .process-main .process-ml-item {
370
+ display: flex;
371
+ align-items: center;
372
+ font-size: 15px;
373
+ font-weight: 400;
374
+ width: 100%;
375
+ justify-content: space-between;
376
+ height: 44px;
377
+ }
378
+
379
+ .process-main .process-ml-item .process-mli-name {
380
+ color: #333333;
381
+ }
382
+
383
+ .process-main .process-ml-item .process-mli-value {
384
+ color: #888888;
385
+ }
386
+
387
+ .process-main .process-ml-item .process-mli-value .process-mliv-dd {
388
+ height: 26px;
389
+ min-width: 30px;
390
+ padding: 0 12px;
391
+ border-radius: 20px;
392
+ background: #1389ff;
393
+ color: #fff;
394
+ display: flex;
395
+ align-items: center;
396
+ justify-content: center;
397
+ font-size: 12px;
398
+ }
399
+
400
+ .process-main .process-ml-item .process-mli-value .process-mliv-jd {
401
+ color: #1389ff;
402
+ }
403
+
404
+ .process-btn {
405
+ display: flex;
406
+ min-height: 60px;
407
+ padding-top: 5px;
408
+ background: #fff;
409
+ border-top: 1px solid #dddddf9e;
410
+ box-sizing: border-box;
411
+ justify-content: center;
412
+ align-items: center;
413
+ flex-direction: row-reverse;
414
+ }
415
+
416
+ .process-btn .top-button,
417
+ .process-btn .elips {
418
+ margin: 0 5px;
419
+ }
420
+ /* .process-btn .top-button:first-child{
421
+ margin-left: 0;
422
+ } */
423
+
424
+ .elips {
425
+ min-width: 60px;
426
+ height: 100%;
427
+ background-color: white;
428
+ display: flex;
429
+ justify-content: center;
430
+ align-items: center;
431
+ }
432
+ .elips .circle {
433
+ width: 6px;
434
+ height: 6px;
435
+ margin: 0 2px;
436
+ background-color: #333333;
437
+ border-radius: 50%;
438
+ }
439
+ </style>