ui-process-h5 0.1.32 → 0.1.36

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.
Files changed (36) hide show
  1. package/package.json +6 -49
  2. package/packages/components/approval/index.js +0 -0
  3. package/packages/components/process/{index.ts → index.js} +2 -3
  4. package/packages/components/process/src/attchlist-upload.vue +585 -0
  5. package/packages/components/process/src/operation/backNode.vue +141 -0
  6. package/packages/components/process/src/operation/cancel.vue +170 -0
  7. package/packages/components/process/src/operation/ccTask.vue +170 -0
  8. package/packages/components/process/src/operation/complete.vue +224 -0
  9. package/packages/components/process/src/operation/counterSign.vue +178 -0
  10. package/packages/components/process/src/operation/delegateTask.vue +168 -0
  11. package/packages/components/process/src/operation/index.js +9 -0
  12. package/packages/components/process/src/operation/restart.vue +172 -0
  13. package/packages/components/process/src/popup.vue +176 -74
  14. package/packages/components/process/src/process.vue +900 -0
  15. package/packages/components/process/src/tab.vue +189 -197
  16. package/packages/components/process/src/tip.vue +207 -0
  17. package/packages/components/process/theme/img/add-file.png +0 -0
  18. package/packages/components/process/theme/img/del.png +0 -0
  19. package/packages/components/process/theme/img/doc.png +0 -0
  20. package/packages/components/process/theme/img/file.png +0 -0
  21. package/packages/components/process/theme/img/image.png +0 -0
  22. package/packages/components/process/theme/img/pdf.png +0 -0
  23. package/packages/components/process/theme/img/xls.png +0 -0
  24. package/packages/components/process/theme/img/zip.png +0 -0
  25. package/packages/components/process/theme/status/error.png +0 -0
  26. package/packages/components/process/theme/status/loading.png +0 -0
  27. package/packages/components/process/theme/status/success.png +0 -0
  28. package/packages/index.js +4 -0
  29. package/packages/component.ts +0 -4
  30. package/packages/components/process/src/button.vue +0 -55
  31. package/packages/components/process/src/index.vue +0 -447
  32. package/packages/components/utils/request/api.ts +0 -11
  33. package/packages/components/utils/request/cache.d.ts +0 -52
  34. package/packages/components/utils/request/cache.js +0 -99
  35. package/packages/components/utils/request/request.ts +0 -62
  36. package/packages/index.ts +0 -4
package/package.json CHANGED
@@ -2,13 +2,8 @@
2
2
  "name": "ui-process-h5",
3
3
  "private": false,
4
4
  "description": "流程组件",
5
- "version": "0.1.32",
5
+ "version": "0.1.36",
6
6
  "type": "module",
7
- "scripts": {
8
- "dev": "vite",
9
- "build": "vue-tsc && vite build",
10
- "preview": "vite preview"
11
- },
12
7
  "files": [
13
8
  "packages/*",
14
9
  "Readme.md",
@@ -17,56 +12,18 @@
17
12
  "publicConfig": {
18
13
  "registry": "http://registry.npmjs.org/"
19
14
  },
20
- "main": "./packages/index.ts",
21
- "module": "./packages/index.ts",
15
+ "main": "./packages/index.js",
16
+ "module": "./packages/index.js",
22
17
  "exports": {
23
18
  ".": {
24
- "import": "./packages/index.ts",
25
- "require": "./packages/index.ts"
19
+ "import": "./packages/index.js",
20
+ "require": "./packages/index.js"
26
21
  }
27
22
  },
28
23
  "dependencies": {
29
- "axios": "^1.3.6",
30
- "dayjs": "^1.11.7",
31
- "less-loader": "^11.1.0",
32
- "sass": "^1.62.0",
33
- "vue": "^3.2.47",
34
24
  "vue-demi": "^0.14.0"
35
25
  },
36
- "devDependencies": {
37
- "@commitlint/cli": "^17.0.0",
38
- "@commitlint/config-conventional": "^17.0.0",
39
- "@types/node": "^18.15.12",
40
- "@types/sass": "^1.43.1",
41
- "@typescript-eslint/eslint-plugin": "^5.27.0",
42
- "@typescript-eslint/parser": "^5.27.0",
43
- "@vitejs/plugin-vue": "^4.1.0",
44
- "@vitejs/plugin-vue-jsx": "^2.0.0",
45
- "axios": "^1.3.5",
46
- "chalk": "^4.1.2",
47
- "commitizen": "^4.2.4",
48
- "cross-env": "^7.0.3",
49
- "cz-conventional-changelog": "^3.3.0",
50
- "eslint": "^8.17.0",
51
- "eslint-config-prettier": "^8.5.0",
52
- "eslint-define-config": "^1.5.0",
53
- "eslint-plugin-prettier": "^4.0.0",
54
- "eslint-plugin-vue": "^9.1.0",
55
- "good-storage": "^1.1.1",
56
- "husky": "^8.0.1",
57
- "js-cookie": "^3.0.1",
58
- "prettier": "^2.6.2",
59
- "rimraf": "^3.0.2",
60
- "sass": "^1.49.7",
61
- "standard-version": "^9.5.0",
62
- "typescript": "^4.9.3",
63
- "vite": "^4.2.0",
64
- "vite-plugin-dts": "^1.2.0",
65
- "vite-plugin-md": "^0.15.0",
66
- "vue": "^3.2.47",
67
- "vue-tsc": "^1.2.0"
68
- },
69
26
  "engines": {
70
27
  "node": ">=16.0.0"
71
28
  }
72
- }
29
+ }
File without changes
@@ -1,7 +1,6 @@
1
- import { App } from "vue-demi";
2
- import TopProcess from "./src/index.vue";
1
+ import TopProcess from "./src/process.vue";
3
2
 
4
- TopProcess.install = function (app: App) {
3
+ TopProcess.install = function (app) {
5
4
  // 组件注册,按需引入
6
5
  app.component(TopProcess.name, TopProcess);
7
6
  return app;
@@ -0,0 +1,585 @@
1
+ <template>
2
+ <div class="attch-upload">
3
+ <div class="attch-upload-mask" v-if="buttonLoading"></div>
4
+ <div class="attch-upload-body">
5
+ <div class="upload-header">
6
+ <div class="upload-header-title">
7
+ 附件
8
+ <span v-if="require" class="upload-header-title--re"
9
+ >*</span
10
+ >
11
+ </div>
12
+ <div class="upload-header-upload">
13
+ <div
14
+ v-if="!onlyShow"
15
+ class="upload-header-upload--item"
16
+ id="inputfile"
17
+ @click="handleClick"
18
+ >
19
+ <!-- <input
20
+ v-if="haveCount > 0"
21
+ class="upload-input"
22
+ type="file"
23
+ multiple
24
+ @change="handleSelect($event, item)"
25
+ /> -->
26
+ <img src="../theme/img/add-file.png" />上传附件
27
+ </div>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="upload-body">
32
+ <div class="upload-list" v-if="filesArr.length > 0">
33
+ <div
34
+ class="list-items"
35
+ v-for="(v, i) of filesArr"
36
+ :key="v.uuid"
37
+ >
38
+ <div class="list-items-icon">
39
+ <img
40
+ v-if="
41
+ xlsIcon.includes(
42
+ v.name.substring(
43
+ v.name.lastIndexOf('.') + 1
44
+ )
45
+ )
46
+ "
47
+ class="icon-img"
48
+ src="../theme/img/xls.png"
49
+ />
50
+ <img
51
+ v-else-if="
52
+ imgIcon.includes(
53
+ v.name.substring(
54
+ v.name.lastIndexOf('.') + 1
55
+ )
56
+ )
57
+ "
58
+ class="icon-img"
59
+ src="../theme/img/image.png"
60
+ />
61
+ <img
62
+ v-else-if="
63
+ v.name.substring(
64
+ v.name.lastIndexOf('.') + 1
65
+ ) == 'pdf'
66
+ "
67
+ class="icon-img"
68
+ src="../theme/img/pdf.png"
69
+ />
70
+ <img
71
+ v-else-if="
72
+ docIcon.includes(
73
+ v.name.substring(
74
+ v.name.lastIndexOf('.') + 1
75
+ )
76
+ )
77
+ "
78
+ class="icon-img"
79
+ src="../theme/img/doc.png"
80
+ />
81
+ <img
82
+ v-else-if="
83
+ zipIcon.includes(
84
+ v.name.substring(
85
+ v.name.lastIndexOf('.') + 1
86
+ )
87
+ )
88
+ "
89
+ class="icon-img"
90
+ src="../theme/img/zip.png"
91
+ />
92
+ <img
93
+ v-else
94
+ class="icon-img"
95
+ src="../theme/img/file.png"
96
+ />
97
+ </div>
98
+ <div class="list-items-info">
99
+ <div class="info-name">
100
+ {{ v.originFileName }}
101
+ </div>
102
+ <div class="info-attribute">
103
+ <span class="info-attribute-size"
104
+ >{{
105
+ v.fileSize < 1024
106
+ ? v.fileSize
107
+ : v.fileSize / 1024 > 1024
108
+ ? parseFloat(
109
+ (
110
+ v.fileSize /
111
+ 1024 /
112
+ 1024
113
+ ).toFixed(2)
114
+ )
115
+ : parseFloat(
116
+ (v.fileSize / 1024).toFixed(2)
117
+ )
118
+ }}{{
119
+ v.fileSize < 1024
120
+ ? "b"
121
+ : parseFloat(
122
+ (v.fileSize / 1024).toFixed(2)
123
+ ) < 1024
124
+ ? "kb"
125
+ : "M"
126
+ }}
127
+ </span>
128
+ <span
129
+ class="info-attribute-views"
130
+ @click="viewFile(v, i)"
131
+ >
132
+ 预览
133
+ </span>
134
+ </div>
135
+ </div>
136
+ <div class="list-items-operation" v-if="!onlyShow">
137
+ <div
138
+ @click="handleDel(i, v)"
139
+ class="list-items-operation-img"
140
+ >
141
+ <img src="../theme/img/del.png" />
142
+ </div>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </template>
150
+ <script>
151
+ /* props */
152
+ export default {
153
+ name: "attchViews",
154
+ props: {
155
+ api: {
156
+ type: Object,
157
+ defalut: () => {},
158
+ },
159
+ // 最大上传数
160
+ limit: {
161
+ type: Number | String,
162
+ default: 4,
163
+ },
164
+ //返回上传数据url
165
+ changeFn: {
166
+ type: Function,
167
+ default: null,
168
+ },
169
+ require: {
170
+ default: false,
171
+ },
172
+ inComing: {
173
+ type: Array,
174
+ defalut: () => [],
175
+ },
176
+ deletFn: {
177
+ type: Function,
178
+ },
179
+ onlyShow: {
180
+ type: Boolean,
181
+ default: false,
182
+ },
183
+ },
184
+
185
+ data() {
186
+ return {
187
+ // 列表展示 已选择文件列表
188
+ lists: [],
189
+ filesArr: [],
190
+ imgIcon: ["jpg", "jpeg", "png", "gif"],
191
+ docIcon: ["doc", "docx"],
192
+ xlsIcon: ["xls", "xlsx"],
193
+ zipIcon: ["zip", "rar", "7z"],
194
+ extension: [
195
+ "bmp",
196
+ "gif",
197
+ "jpg",
198
+ "jpeg",
199
+ "png",
200
+ "doc",
201
+ "docx",
202
+ "xls",
203
+ "xlsx",
204
+ "ppt",
205
+ "pptx",
206
+ "html",
207
+ "htm",
208
+ "txt",
209
+ "wps",
210
+ "rar",
211
+ "zip",
212
+ "gz",
213
+ "bz2",
214
+ "mp4",
215
+ "avi",
216
+ "rmvb",
217
+ "pdf",
218
+ ],
219
+ // ----
220
+ current: "",
221
+
222
+ buttonLoading: false,
223
+ handleCloseType: true,
224
+ uploadState: true,
225
+ };
226
+ },
227
+
228
+ watch: {
229
+ inComing: {
230
+ handler(val, preval) {
231
+ if (val) {
232
+ // 传入附件列表前预处理 originFileName fileSize , name与 size 无法渲染
233
+ this.filesArr = [].concat(val);
234
+ this.emitView();
235
+ }
236
+ },
237
+
238
+ //如果加了这个参数,值为true的话,就消除了惰性,watch会在创建后立即执行一次
239
+ //那么首次执行,val为默认值,preVal为undefined
240
+ immediate: true,
241
+ //这个参数代表监听对象时,可以监听深度嵌套的对象属性
242
+ deep: true,
243
+ },
244
+ },
245
+
246
+ computed: {
247
+ haveCount() {
248
+ if (this.limit == -1) return 100;
249
+ return this.limit - this.filesArr.length;
250
+ },
251
+ },
252
+
253
+ mounted() {
254
+ // 兼容uni(uni编译会修改input属性,在点击上传时创建dom) upload-header-upload--item
255
+ let input = document.createElement("input");
256
+ input.type = "file";
257
+ input.className = "upload-input";
258
+ input.style = "opacity: 0;position: absolute;";
259
+ input.multiple = true
260
+ input.addEventListener("change", this.handleSelect);
261
+ document.getElementById("inputfile").appendChild(input);
262
+ },
263
+
264
+ methods: {
265
+ // 拦截
266
+ handleClick() {
267
+ console.log("拦截", this.haveCount, this.limit);
268
+ if (this.haveCount <= 0) {
269
+ // Toast(`最多上传${props.limit}个文件`);
270
+ return;
271
+ }
272
+ if (
273
+ "undefined" != typeof nativeMethod &&
274
+ nativeMethod.vueSelectFile
275
+ ) {
276
+ nativeMethod.vueSelectFile(2, "*", this.limit || 1);
277
+ }
278
+ },
279
+ // 上传选择
280
+ async handleSelect(value, items) {
281
+ // loadingToast("loading");
282
+ const files = Array.from(value.target.files);
283
+ let num = 0;
284
+ let numLength =
285
+ this.haveCount > files.length ? files.length : this.haveCount;
286
+ try {
287
+ for (let i = 0; i < numLength; i++) {
288
+ if (
289
+ this.extension.includes(
290
+ files[i].name.substring(
291
+ files[i].name.lastIndexOf(".") + 1
292
+ )
293
+ )
294
+ ) {
295
+ const formData = new FormData();
296
+ formData.append("file", files[i]);
297
+ const res = await this.api.upload(formData);
298
+ if (res.code === 200) {
299
+ if (this.filesArr.length > 0) {
300
+ for (
301
+ let indexs = 0;
302
+ indexs < this.filesArr.length;
303
+ indexs++
304
+ ) {
305
+ // 导入文件是否重名
306
+ if (
307
+ res.originFileName ==
308
+ this.filesArr[indexs].originFileName
309
+ ) {
310
+ num++;
311
+ }
312
+
313
+ // 导入文件已存在重名
314
+ if (
315
+ this.filesArr[
316
+ indexs
317
+ ].originFileName.includes(`(${num})`)
318
+ ) {
319
+ num++;
320
+ }
321
+
322
+ if (num > 0) {
323
+ let nameIndex = res.originFileName.lastIndexOf(
324
+ "."
325
+ );
326
+ res.originFileName = `${res.originFileName.substring(
327
+ 0,
328
+ nameIndex
329
+ )} (${num}) .${res.originFileName.substring(
330
+ res.originFileName.lastIndexOf(
331
+ "."
332
+ ) + 1
333
+ )}`;
334
+ }
335
+ }
336
+ }
337
+
338
+ this.filesArr.push(res.data);
339
+ } else {
340
+ // loadingToast("fail");
341
+ this.viewImage();
342
+ return;
343
+ }
344
+ } else {
345
+ // Toast.clear();
346
+ // Toast.fail(`文件${files[i].name}格式错误,请重新上传`);
347
+ return;
348
+ }
349
+ }
350
+ // loadingToast("success");
351
+ this.viewImage();
352
+ console.log("当前已上传", this.filesArr);
353
+ this.emitView();
354
+ } catch (err) {
355
+ // console.log("失败", err);
356
+ // loadingToast("fail");
357
+ }
358
+ },
359
+ // 删除节点
360
+ handleDel(index, items) {
361
+ let delet;
362
+ if (this.deletFn) {
363
+ let delet = this.deletFn(items);
364
+ if (delet === false) {
365
+ // Toast.fail("删除失败");
366
+ return;
367
+ }
368
+ this.filesArr.splice(index, 1);
369
+ this.emitView();
370
+ } else {
371
+ this.filesArr.splice(index, 1);
372
+ this.emitView();
373
+ }
374
+ },
375
+ // 预览
376
+ viewFile(data, index) {
377
+ console.log("data", data);
378
+ /* if (
379
+ this.imgIcon.includes(
380
+ data.name.substring(data.name.lastIndexOf(".") + 1)
381
+ )
382
+ ) {
383
+ ImagePreview({
384
+ images: this.lists,
385
+ startPosition: this.lists.indexOf(data.url),
386
+ });
387
+ } else {
388
+ if (data.url) {
389
+ // router.push(`/webview?src=${data.url}`);
390
+ }
391
+ } */
392
+ },
393
+ // 预览图片 数组生成
394
+ viewImage() {
395
+ this.lists = [];
396
+ let arr = [];
397
+ this.filesArr.map((v, i) => {
398
+ if (
399
+ this.imgIcon.includes(
400
+ v.name.substring(v.name.lastIndexOf(".") + 1)
401
+ )
402
+ ) {
403
+ }
404
+ });
405
+ arr = this.filesArr.filter((value) => {
406
+ return this.imgIcon.includes(
407
+ value.name.substring(value.name.lastIndexOf(".") + 1)
408
+ );
409
+ });
410
+ arr.forEach((v, i) => {
411
+ this.lists.push(v.url);
412
+ });
413
+ },
414
+ // 加载中
415
+ loadingToast(type, text) {
416
+ if (type == "loading") {
417
+ /* Toast.loading({
418
+ message: "文件上传中",
419
+ forbidClick: true,
420
+ duration: 0,
421
+ }); */
422
+ } else if (type == "success") {
423
+ /* Toast.clear();
424
+ Toast.success("上传成功"); */
425
+ } else if (type == "fail") {
426
+ /* Toast.clear();
427
+ Toast.fail("上传失败"); */
428
+ }
429
+ },
430
+ // 发送数据
431
+ emitView() {
432
+ console.log("已发送数据:", this.filesArr);
433
+ this.$emit("getValue", this.filesArr);
434
+ },
435
+ // clear node
436
+ clearData() {
437
+ this.filesArr = [];
438
+ console.log("clear!!!!!");
439
+ },
440
+ },
441
+ };
442
+
443
+ /* defineEmits */
444
+ // const emit = defineEmits(["getValue"]);
445
+
446
+ // defineExpose({ clearData });
447
+ </script>
448
+ <style scoped>
449
+ .attch-upload-mask {
450
+ width: 100vw;
451
+ height: 100vh;
452
+ position: fixed;
453
+ top: 0;
454
+ left: 0;
455
+ background-color: #999;
456
+ opacity: 0.5;
457
+ overflow-x: hidden;
458
+ }
459
+ .attch-upload-body {
460
+ width: 100%;
461
+ position: relative;
462
+ }
463
+ .upload-close {
464
+ box-sizing: border-box;
465
+ width: 100%;
466
+ height: 20px;
467
+ padding: 5px;
468
+ text-align: right;
469
+ }
470
+ .upload-close-img {
471
+ width: 18px;
472
+ height: 18px;
473
+ }
474
+ .upload-header {
475
+ width: 100%;
476
+ /* position: fixed;
477
+ top: 0; */
478
+ height: 44px;
479
+ font-size: 14px;
480
+ display: flex;
481
+ justify-content: space-between;
482
+ box-sizing: border-box;
483
+ align-items: center;
484
+ overflow-x: hidden;
485
+ }
486
+
487
+ .upload-header-title--re {
488
+ color: #ee0000;
489
+ }
490
+
491
+ .upload-header-close {
492
+ width: 18px;
493
+ height: 18px;
494
+ }
495
+
496
+ .upload-header-upload {
497
+ height: 18px;
498
+
499
+ font-size: 14px;
500
+ color: #1389ff;
501
+ }
502
+
503
+ .upload-input {
504
+ opacity: 0;
505
+ position: absolute;
506
+ }
507
+ .upload-header-upload--item {
508
+ display: flex;
509
+ align-items: center;
510
+ }
511
+
512
+ .upload-header-upload--item img {
513
+ width: 18px;
514
+ height: 18px;
515
+ margin-right: 4px;
516
+ }
517
+
518
+ .upload-list {
519
+ padding-bottom: 20px;
520
+ }
521
+ .list-items {
522
+ display: flex;
523
+ margin-top: 18px;
524
+ }
525
+
526
+ .list-items-icon {
527
+ width: 36px;
528
+ height: 40px;
529
+ margin-right: 10px;
530
+ line-height: 44px;
531
+ }
532
+ .icon-img {
533
+ width: 100%;
534
+ height: 100%;
535
+ }
536
+
537
+ .list-items-info {
538
+ width: 225px;
539
+ }
540
+
541
+ .info-name {
542
+ width: 100%;
543
+ font-size: 15px;
544
+ color: #333;
545
+ word-wrap: break-word;
546
+ word-break: break-all;
547
+ }
548
+ .info-attribute {
549
+ color: #999;
550
+ font-size: 13px;
551
+ }
552
+ .info-attribute-time {
553
+ margin-right: 10px;
554
+ }
555
+ .info-attribute-views {
556
+ color: #1389ff;
557
+ }
558
+
559
+ .list-items-operation {
560
+ flex: 1;
561
+ }
562
+ .list-items-operation-img {
563
+ width: 18px;
564
+ height: 18px;
565
+ margin-left: auto;
566
+ line-height: 44px;
567
+ }
568
+ .list-items-operation-img img {
569
+ width: 100%;
570
+ height: 100%;
571
+ }
572
+
573
+ .upload-footer {
574
+ width: 100%;
575
+ position: fixed;
576
+ bottom: 0;
577
+ }
578
+
579
+ .attchlist-wrap {
580
+ width: 100%;
581
+ height: 100dvh;
582
+ display: flex;
583
+ flex-direction: column;
584
+ }
585
+ </style>