n20-common-lib 3.2.31 → 3.2.33

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": "3.2.31",
3
+ "version": "3.2.33",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -56,13 +56,6 @@ $--header-color: #3d4a57;
56
56
  margin-right: 10px;
57
57
  cursor: pointer;
58
58
  }
59
-
60
- .el-badge {
61
- .el-badge__content {
62
- line-height: 14px;
63
- height: 14px;
64
- }
65
- }
66
59
  }
67
60
 
68
61
  .header-notice-tabs {
@@ -141,7 +134,6 @@ $--header-color: #3d4a57;
141
134
  }
142
135
  }
143
136
 
144
-
145
137
  .uif-user-w {
146
138
  box-sizing: border-box;
147
139
  height: 202px;
@@ -284,9 +276,9 @@ $--header-color: #3d4a57;
284
276
  color: #33383d;
285
277
  letter-spacing: 0;
286
278
  line-height: 22px;
287
- opacity: .98;
279
+ opacity: 0.98;
288
280
  background-color: #fff;
289
- box-shadow: 0 12px 30px -15px rgba(0, 0, 0, .1);
281
+ box-shadow: 0 12px 30px -15px rgba(0, 0, 0, 0.1);
290
282
  width: calc(100vw - 190px);
291
283
  height: 20px;
292
284
  position: fixed;
@@ -295,7 +287,9 @@ $--header-color: #3d4a57;
295
287
  z-index: 1000;
296
288
  max-height: 0;
297
289
  min-height: 0;
298
- transition: max-height .3s ease, min-height .3s ease;
290
+ transition:
291
+ max-height 0.3s ease,
292
+ min-height 0.3s ease;
299
293
  overflow: hidden;
300
294
  cursor: pointer;
301
295
  display: flex;
@@ -316,7 +310,6 @@ $--header-color: #3d4a57;
316
310
  padding-top: 32px;
317
311
 
318
312
  &_title {
319
-
320
313
  display: inline-block;
321
314
  font-weight: 700;
322
315
  padding: 4px;
@@ -337,7 +330,6 @@ $--header-color: #3d4a57;
337
330
  flex: 0 0 33.33%;
338
331
 
339
332
  &_title {
340
-
341
333
  display: inline-block;
342
334
  padding: 4px;
343
335
 
@@ -347,7 +339,6 @@ $--header-color: #3d4a57;
347
339
  }
348
340
  }
349
341
  }
350
-
351
342
  }
352
343
 
353
344
  .wrapper-mask {
@@ -367,4 +358,4 @@ $--header-color: #3d4a57;
367
358
  min-height: 350px;
368
359
  overflow-y: auto;
369
360
  padding-bottom: 20px;
370
- }
361
+ }
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  .n20-toggle-item.active {
37
- color: var(--primary-6, #007aff);
37
+ color: var(--color-primary);
38
38
  font-weight: 500;
39
39
  }
40
40
 
@@ -51,4 +51,4 @@
51
51
  border-radius: 2px;
52
52
  transition: transform 0.2s;
53
53
  z-index: 0;
54
- }
54
+ }
@@ -824,7 +824,15 @@ export default {
824
824
  showClose: true
825
825
  })
826
826
  }
827
- this.$emit('delete-rows', this.selectionList)
827
+ this.$msgboxPor({
828
+ title: $lc('确认删除所选附件吗?'),
829
+ message: $lc('删除后数据不可恢复'),
830
+ type: 'error',
831
+ confirmButtonText: $lc('确认'),
832
+ cancelButtonText: $lc('取消')
833
+ }).then(() => {
834
+ this.$emit('delete-rows', this.selectionList)
835
+ }).catch(() => undefined)
828
836
  },
829
837
 
830
838
  async getFileInfo(row, type) {
@@ -611,9 +611,17 @@ export default {
611
611
  * @returns {void}
612
612
  */
613
613
  deleteSingleRow(row) {
614
- const index = this.tableData.findIndex((item) => item === row)
615
- if (index > -1) this.tableData.splice(index, 1)
616
- this.$emit('delete-rows', [row])
614
+ this.$msgboxPor({
615
+ title: $lc('确认删除所选附件吗?'),
616
+ message: $lc('删除后数据不可恢复'),
617
+ type: 'error',
618
+ confirmButtonText: $lc('确认'),
619
+ cancelButtonText: $lc('取消')
620
+ }).then(() => {
621
+ const index = this.tableData.findIndex((item) => item === row)
622
+ if (index > -1) this.tableData.splice(index, 1)
623
+ this.$emit('delete-rows', [row])
624
+ }).catch(() => undefined)
617
625
  },
618
626
  /**
619
627
  * 切换展开/收起未上传类型。
@@ -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]