n20-common-lib 2.22.50 → 2.22.51

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": "2.22.50",
3
+ "version": "2.22.51",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -133,6 +133,7 @@
133
133
  <script>
134
134
  import { $lc } from '../../../utils/i18n/index'
135
135
  import importG from '../../../utils/importGlobal.js'
136
+
136
137
  export default {
137
138
  filters: {
138
139
  zoomFormat(val) {
@@ -218,6 +219,20 @@ export default {
218
219
  }
219
220
  }
220
221
  })
222
+ for (let k in currAssMap) {
223
+ let submitter = currAssMap[k]
224
+ if (
225
+ !currentActivityIdList.includes(k) &&
226
+ !k.includes('@addTaskType') &&
227
+ typeof submitter === 'string' &&
228
+ submitter.trim()
229
+ ) {
230
+ let taskK = this.svgW.querySelector(`[data-element-id="${k}"]`)
231
+ if (taskK) {
232
+ this.addEvent(taskK, { assignee: `${$lc('发起人')}:${submitter.trim()}` }, 'pending')
233
+ }
234
+ }
235
+ }
221
236
  for (let k in taskDefIdMap) {
222
237
  if (!currentActivityIdList.includes(k)) {
223
238
  let taskK = this.svgW.querySelector(`[data-element-id="${k}"]`)
@@ -168,10 +168,12 @@
168
168
  </template>
169
169
 
170
170
  <script>
171
+ import child from './child.vue'
172
+
171
173
  import axios from '../../../utils/axios.js'
172
174
  import { $lc } from '../../../utils/i18n/index'
173
175
  import importG from '../../../utils/importGlobal.js'
174
- import child from './child.vue'
176
+
175
177
  export default {
176
178
  components: {
177
179
  child
@@ -264,34 +266,48 @@ export default {
264
266
  this.setTaskRecord(obj)
265
267
  })
266
268
 
267
- currentActivityIdList.forEach((currentActivityId) => {
268
- let assignee = currAssMap[currentActivityId]
269
- let assigneeEnd = taskDefIdMap[currentActivityId]
270
- let task = this.svgWrap.querySelector(`[data-element-id="${currentActivityId}"]`)
271
- if (task) {
272
- task.classList.add('activiti-node-at')
273
- if (!currentActivityId.includes('@addTaskType')) {
274
- this.addEvent(task, { assignee, assigneeEnd }, 'pending')
275
- }
269
+ // 非加签节点添加事件
270
+ currentActivityIdList.forEach((currentActivityId) => {
271
+ let assignee = currAssMap[currentActivityId]
272
+ let assigneeEnd = taskDefIdMap[currentActivityId]
273
+ let task = this.svgW.querySelector(`[data-element-id="${currentActivityId}"]`)
274
+ if (task) {
275
+ task.classList.add('activiti-node-at')
276
+ if (!currentActivityId.includes('@addTaskType')) {
277
+ this.addEvent(task, { assignee, assigneeEnd }, 'pending')
276
278
  }
277
- })
278
- for (let k in taskDefIdMap) {
279
- if (!currentActivityIdList.includes(k)) {
280
- let taskK = this.svgWrap.querySelector(`[data-element-id="${k}"]`)
281
- if (taskK) {
282
- if (!k.includes('@addTaskType')) {
283
- this.addEvent(taskK, taskDefIdMap[k])
284
- this.addChildEvent(taskK, taskDefIdMap[k])
285
- }
279
+ }
280
+ })
281
+ for (let k in currAssMap) {
282
+ let submitter = currAssMap[k]
283
+ if (
284
+ !currentActivityIdList.includes(k) &&
285
+ !k.includes('@addTaskType') &&
286
+ typeof submitter === 'string' &&
287
+ submitter.trim()
288
+ ) {
289
+ let taskK = this.svgW.querySelector(`[data-element-id="${k}"]`)
290
+ if (taskK) {
291
+ this.addEvent(taskK, { assignee: `${$lc('发起人')}:${submitter.trim()}` }, 'pending')
292
+ }
293
+ }
294
+ }
295
+ for (let k in taskDefIdMap) {
296
+ if (!currentActivityIdList.includes(k)) {
297
+ let taskK = this.svgW.querySelector(`[data-element-id="${k}"]`)
298
+ if (taskK) {
299
+ if (!k.includes('@addTaskType')) {
300
+ this.addEvent(taskK, taskDefIdMap[k])
301
+ this.addChildEvent(taskK, taskDefIdMap[k])
286
302
  }
287
303
  }
288
304
  }
289
- } catch (error) {
290
- console.warn('setTaskErr:', error)
291
305
  }
292
- },
293
- async initPanzoom() {
294
- let { default: panzoom } = await importG('panzoom', () => import(/*webpackChunkName: "panzoom"*/ 'panzoom'))
306
+ } catch (error) {
307
+ console.warn('setTaskErr:', error)
308
+ }
309
+
310
+ let { default: panzoom } = await importG('panzoom', () => import(/*webpackChunkName: "panzoom"*/ 'panzoom'))
295
311
 
296
312
  this.svgPanzoom = panzoom(this.svgElement, {
297
313
  maxZoom: this.max,
@@ -92,7 +92,7 @@ axios.interceptors.request.use((opt) => {
92
92
  return opt
93
93
  })
94
94
 
95
- function errorFn(status, msg, noMsg, isErr, res) {
95
+ function errorFn(status, msg, noMsg, res) {
96
96
  if (status === 401 || msg === 'Request failed with status code 401') {
97
97
  noMsg || showMsg($lc('超时未操作,请重新登录!'))
98
98
  setTimeout(() => {
@@ -118,7 +118,7 @@ function errorFn(status, msg, noMsg, isErr, res) {
118
118
  } else {
119
119
  // noMsg || showMsg(msg)
120
120
  }
121
- throw { code: status, msg: msg, response: res }
121
+ return { code: status, msg: msg, response: res }
122
122
  }
123
123
 
124
124
  axios.interceptors.response.use(
@@ -134,48 +134,51 @@ axios.interceptors.response.use(
134
134
  return new Promise((resolve, reject) => {
135
135
  const reader = new FileReader()
136
136
  reader.onload = (e) => {
137
+ let result
137
138
  try {
138
- const result = JSON.parse(e.target.result)
139
- console.log(result, 'result')
140
- msg = result.msg || result.message || msg
141
- errorFn(status, msg, noMsg, false, res)
142
- reject({ code: status, msg: msg, response: res })
139
+ result = JSON.parse(e.target.result)
143
140
  } catch (error) {
144
141
  // 如果解析失败,说明可能是正常的文件下载
145
142
  resolve(res)
143
+ return
146
144
  }
145
+
146
+ msg = (result && (result.msg || result.message)) || msg
147
+ reject(errorFn(status, msg, noMsg, res))
147
148
  }
149
+ reader.onerror = () => reject(errorFn(status, msg, noMsg, res))
148
150
  reader.readAsText(res.data)
149
151
  })
150
152
  }
151
153
 
152
- return errorFn(status, msg, noMsg, false, res)
154
+ throw errorFn(status, msg, noMsg, res)
153
155
  }
154
156
  },
155
157
  (err) => {
156
- let status = err.status
158
+ let status = (err.response && err.response.status) || err.code || err.status
157
159
  let msg = err.message || ''
158
160
  let noMsg = err.config && err.config.noMsg
159
161
  // 如果是 blob 类型的错误响应
160
- if (err.config && err.config.responseType === 'blob') {
162
+ if (err.config && err.config.responseType === 'blob' && err.response && err.response.data) {
161
163
  return new Promise((resolve, reject) => {
162
164
  const reader = new FileReader()
163
165
  reader.onload = (e) => {
166
+ let result
164
167
  try {
165
- const result = JSON.parse(e.target.result)
166
- msg = result.msg || result.message || msg
167
- errorFn(status, msg, noMsg, true)
168
- reject({ code: status, msg: msg, response: err.response })
168
+ result = JSON.parse(e.target.result)
169
169
  } catch (error) {
170
- errorFn(status, msg, noMsg, true)
171
- reject(err)
170
+ // 保留 axios 原始错误信息
172
171
  }
172
+
173
+ msg = (result && (result.msg || result.message)) || msg
174
+ reject(errorFn(status, msg, noMsg, err.response))
173
175
  }
176
+ reader.onerror = () => reject(errorFn(status, msg, noMsg, err.response))
174
177
  reader.readAsText(err.response.data)
175
178
  })
176
179
  }
177
180
 
178
- return errorFn(status, msg, noMsg, true)
181
+ throw errorFn(status, msg, noMsg, err.response)
179
182
  }
180
183
  )
181
184
 
@@ -184,9 +187,11 @@ function request(opt) {
184
187
  showLoading({ loading })
185
188
 
186
189
  if (debounceObj[opt.method + opt.url]) {
187
- debounceObj[opt.method + opt.url].finally(() => {
188
- closeLoading({ loading })
189
- })
190
+ debounceObj[opt.method + opt.url]
191
+ .finally(() => {
192
+ closeLoading({ loading })
193
+ })
194
+ .catch(() => {})
190
195
 
191
196
  // 短时间多次请求,均返回第一次请求结果
192
197
  return debounceObj[opt.method + opt.url]