n20-common-lib 1.3.55 → 1.3.58

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "1.3.55",
3
+ "version": "1.3.58",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -2,14 +2,20 @@
2
2
  <template>
3
3
  <div class="approve-img">
4
4
  <img v-if="blobUrl" :src="blobUrl" />
5
+ <flowImg v-else-if="dataPro" :data-pro="dataPro" />
5
6
  </div>
6
7
  </template>
7
8
 
8
9
  <script>
9
10
  import axios from '../../utils/axios'
11
+ import flowImg from './approvalImgPro/index.vue'
12
+ let hasQ004_1 = true
10
13
 
11
14
  export default {
12
15
  name: 'ApprovalImg',
16
+ components: {
17
+ flowImg
18
+ },
13
19
  props: {
14
20
  procInstId: {
15
21
  type: String,
@@ -18,22 +24,54 @@ export default {
18
24
  },
19
25
  data() {
20
26
  return {
21
- blobUrl: undefined
27
+ blobUrl: undefined,
28
+ dataPro: undefined
22
29
  }
23
30
  },
24
- created() {
25
- axios
26
- .get('/bems/activiti/sample/Q004', {
27
- procInstId: this.procInstId || this.$route.query.processInstanceId
28
- })
29
- .then(({ data }) => {
30
- if (data) {
31
- let file = new File([data], '流程图.svg', {
32
- type: 'image/svg+xml'
33
- })
34
- this.blobUrl = URL.createObjectURL(file)
35
- }
36
- })
31
+ async created() {
32
+ hasQ004_1 ? this.getFlowData() : this.getSvg()
33
+ },
34
+ methods: {
35
+ getSvg() {
36
+ axios
37
+ .get('/bems/activiti/sample/Q004', {
38
+ procInstId: this.procInstId || this.$route.query.processInstanceId
39
+ })
40
+ .then(({ data }) => {
41
+ if (data) {
42
+ let file = new File([data], '流程图.svg', {
43
+ type: 'image/svg+xml'
44
+ })
45
+ this.blobUrl = URL.createObjectURL(file)
46
+ }
47
+ })
48
+ },
49
+ getFlowData() {
50
+ axios
51
+ .get(
52
+ '/bems/activiti/sample/Q004_1',
53
+ {
54
+ procInstId: this.procInstId || this.$route.query.processInstanceId
55
+ },
56
+ { noMsg: true }
57
+ )
58
+ .then((res) => {
59
+ this.dataPro = res.data
60
+ })
61
+ .catch((err) => {
62
+ if (err.msg && err.msg.includes('404')) {
63
+ hasQ004_1 = false
64
+ this.getSvg()
65
+ } else {
66
+ this.$message({
67
+ showClose: true,
68
+ message: err.msg,
69
+ type: 'error',
70
+ customClass: 'xhr-msg-top'
71
+ })
72
+ }
73
+ })
74
+ }
37
75
  }
38
76
  }
39
77
  </script>