n20-common-lib 3.1.16 → 3.1.18

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.1.16",
3
+ "version": "3.1.18",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,12 +1,14 @@
1
1
  .n20-form-expandable-pane {
2
- padding-bottom: 8px;
2
+ margin-top: 24px;
3
+ padding-bottom: 24px;
4
+ border-bottom: 1px solid #e5e6eb;
3
5
  .n20-title {
4
6
  height: auto;
5
7
  line-height: 24px;
6
8
  color: #1d2129;
7
- padding: 0 12px;
9
+ padding: 0 8px;
8
10
  margin-bottom: 12px;
9
- margin-top: 8px;
11
+
10
12
  font-size: 16px;
11
13
  font-weight: 500;
12
14
  &__algin_l {
@@ -20,8 +20,8 @@
20
20
  flex-direction: column;
21
21
  align-items: center;
22
22
  padding: 12px 8px;
23
- background: #fff;
24
- border: 1px solid var(--border-2, #e5e6eb);
23
+ background: $--color-white;
24
+ border: 1px solid $--border-color-base;
25
25
  border-radius: 15.5px;
26
26
  filter: drop-shadow(0px 8px 10px rgba(0, 0, 0, 0.1));
27
27
  }
@@ -30,7 +30,7 @@
30
30
  flex-shrink: 0;
31
31
  width: 2px;
32
32
  height: 4px;
33
- background: var(--fill-4, #c9cdd4);
33
+ background: $--color-text-placeholder;
34
34
  transition: height 0.2s ease, background 0.2s ease;
35
35
 
36
36
  & + & {
@@ -39,7 +39,7 @@
39
39
 
40
40
  &.is-active {
41
41
  height: 16px;
42
- background: var(--primary-6, #007aff);
42
+ background: $--color-primary;
43
43
  }
44
44
  }
45
45
 
@@ -48,8 +48,8 @@
48
48
  flex-direction: column;
49
49
  align-items: flex-start;
50
50
  padding: 8px;
51
- background: #fff;
52
- border: 1px solid var(--border-2, #e5e6eb);
51
+ background: $--color-white;
52
+ border: 1px solid $--border-color-base;
53
53
  border-radius: 4px;
54
54
  filter: drop-shadow(0px 8px 10px rgba(0, 0, 0, 0.1));
55
55
  }
@@ -77,16 +77,16 @@
77
77
  }
78
78
 
79
79
  &:not(.is-active):not(.is-disabled):hover {
80
- background: var(--fill-1, #f7f8fa);
80
+ background: $--background-color-base;
81
81
  }
82
82
 
83
83
  &.is-active {
84
84
  .n20-anchor-v3__bar {
85
85
  height: 12px;
86
- background: var(--primary-6, #007aff);
86
+ background: $--color-primary;
87
87
  }
88
88
  .n20-anchor-v3__label {
89
- color: var(--primary-6, #007aff);
89
+ color: $--color-primary;
90
90
  }
91
91
  }
92
92
 
@@ -101,7 +101,7 @@
101
101
  flex-shrink: 0;
102
102
  width: 2px;
103
103
  height: 2px;
104
- background: var(--fill-4, #c9cdd4);
104
+ background: $--color-text-placeholder;
105
105
  border-radius: 0 4px 4px 0;
106
106
  transition: height 0.15s ease, background 0.15s ease;
107
107
  }
@@ -112,7 +112,7 @@
112
112
  font-size: 13px;
113
113
  font-weight: 400;
114
114
  line-height: 22px;
115
- color: var(--text-1, #1d2129);
115
+ color: $--color-text-primary;
116
116
  white-space: nowrap;
117
117
  word-break: break-word;
118
118
  }
@@ -288,30 +288,31 @@ export default {
288
288
  previewName: undefined,
289
289
  previewSameOrg: false,
290
290
  seeRow: {},
291
- uploadProgressMap: {}
291
+ uploadProgressMap: {},
292
+ tableKey: 0
292
293
  }
293
294
  },
294
295
  computed: {
295
296
  fileAccept() {
296
- return this.dataProp.fileAccept || undefined
297
+ return this.dataProp?.fileAccept || undefined
297
298
  },
298
299
  fileSize() {
299
- return this.dataProp.fileSize || undefined
300
+ return this.dataProp?.fileSize || undefined
300
301
  },
301
302
  fileData() {
302
- return this.dataProp.fileData || undefined
303
+ return this.dataProp?.fileData || undefined
303
304
  },
304
305
  typeOptions() {
305
- return this.dataProp.typeOptions.map((item, index) => ({ no: index + 1, ...item })) ?? []
306
+ return this.dataProp?.typeOptions?.map((item, index) => ({ no: index + 1, ...item })) ?? []
306
307
  },
307
308
  keys() {
308
- return this.dataProp.keys || keysDefault
309
+ return this.dataProp?.keys || keysDefault
309
310
  },
310
311
  multiple() {
311
- return this.dataProp.multiple ?? true
312
+ return this.dataProp?.multiple ?? true
312
313
  },
313
314
  uploadedCount() {
314
- return this.tableData.filter((row) => row[this.keys.url] || row._name).length
315
+ return this.tableData?.filter((row) => row[this.keys.url] || row._name).length
315
316
  },
316
317
  typeRowsMap() {
317
318
  const map = Object.create(null)
@@ -332,11 +333,11 @@ export default {
332
333
  this.showAllTypes && !this.readonly
333
334
  ? this.typeOptions
334
335
  : this.typeOptions.filter((item) => {
335
- const typeValue = item[this.typeMap.value]
336
+ const typeValue = item[this.typeMap?.value]
336
337
  return (this.typeRowsMap[typeValue] || []).length > 0
337
338
  })
338
339
  return options.map((item) => {
339
- const typeValue = item[this.typeMap.value]
340
+ const typeValue = item[this.typeMap?.value]
340
341
  return {
341
342
  item,
342
343
  typeValue,
@@ -346,7 +347,7 @@ export default {
346
347
  },
347
348
  typeMap() {
348
349
  return (
349
- this.dataProp.typeMap || {
350
+ this.dataProp?.typeMap || {
350
351
  label: 'attname',
351
352
  value: 'attno'
352
353
  }
@@ -377,48 +378,59 @@ export default {
377
378
  // isOptionAiCheck为true,业务组件自己调ai校验
378
379
  if (this.AIOptions.isOptionAiCheck) {
379
380
  this.$emit('AiCheckFn', row, (result) => {
380
- row.aiCheckStatus = result.aiCheckStatus
381
+ if (result) {
382
+ row.aiCheckStatus = result.aiCheckStatus
383
+ }
381
384
  this.tableKey++
382
- this.$refs.aiCheckDialog.setView(result.list, row.beid)
385
+ this.$refs.aiCheckDialog && this.$refs.aiCheckDialog.setView(result && result.list, row.beid)
383
386
  })
384
387
  } else {
385
388
  if (!this.AIOptions.bussType) {
386
389
  this.$message.error('请先配置bussType')
387
- return false
390
+ return
388
391
  }
389
- let { data, code } = await axios.post(
390
- this.apiPrefix ? `${this.apiPrefix}/neams/eamsbaserecord/aiAttaFile` : `/neams/eamsbaserecord/aiAttaFile`,
391
- {
392
- ...this.AIOptions,
393
- beid: row.beid,
394
- bussType: this.AIOptions.bussType,
395
- extendPrompt: ''
392
+ try {
393
+ let { data, code } = await axios.post(
394
+ this.apiPrefix ? `${this.apiPrefix}/neams/eamsbaserecord/aiAttaFile` : `/neams/eamsbaserecord/aiAttaFile`,
395
+ {
396
+ ...this.AIOptions,
397
+ beid: row.beid,
398
+ bussType: this.AIOptions.bussType,
399
+ extendPrompt: ''
400
+ }
401
+ )
402
+ if (code === 200) {
403
+ this.$emit('AiCheckFn', data, (result) => {
404
+ if (result) {
405
+ row.aiCheckStatus = result.aiCheckStatus
406
+ }
407
+ this.tableKey++
408
+ this.$refs.aiCheckDialog && this.$refs.aiCheckDialog.setView(result && result.list, row.beid)
409
+ })
396
410
  }
397
- )
398
- if (code === 200) {
399
- this.$emit('AiCheckFn', data, (result) => {
400
- row.aiCheckStatus = result.aiCheckStatus
401
- this.tableKey++
402
- this.$refs.aiCheckDialog.setView(result.list, row.beid)
403
- })
411
+ } catch (e) {
412
+ this.$message.error('AI校验请求失败')
404
413
  }
405
414
  }
406
415
  },
407
416
  async getFileTypes() {
408
- if (this.dataProp?.bussValues?.length) {
417
+ if (!this.dataProp?.bussValues?.length) return
418
+ try {
409
419
  const { code, data } = await this.$axios.post(
410
420
  `/neams/eamsattachfile/getByBussValues`,
411
421
  this.dataProp?.bussValues
412
422
  )
413
- if (code !== 200) return
423
+ if (code !== 200 || !data) return
414
424
  const { label, value } = this.typeMap
415
- this.dataProp.typeOptions = data?.map((item) => {
425
+ this.dataProp.typeOptions = data.map((item) => {
416
426
  return {
417
427
  ...item,
418
428
  [label]: item.attname,
419
429
  [value]: item.attno
420
430
  }
421
431
  })
432
+ } catch (e) {
433
+ // 获取附件类型失败,使用已有的 typeOptions
422
434
  }
423
435
  },
424
436
  /**
@@ -466,9 +478,15 @@ export default {
466
478
  * @returns {Object} 供上传回调处理的行对象。
467
479
  */
468
480
  buildUploadRow(item) {
481
+ let uname = ''
482
+ try {
483
+ uname = JSON.parse(sessionStorage.getItem('userInfo') || '{}').uname || ''
484
+ } catch (e) {
485
+ // sessionStorage 不可用时忽略
486
+ }
469
487
  const row = {
470
488
  [this.keys.type]: item.type || item.attno,
471
- [this.keys.user]: JSON.parse(sessionStorage.getItem('userInfo') || '{}').uname || ''
489
+ [this.keys.user]: uname
472
490
  }
473
491
  return row
474
492
  },
@@ -519,17 +537,23 @@ export default {
519
537
  * @returns {void}
520
538
  */
521
539
  onTypeUploadSuccess(response, file, fileList, item) {
540
+ let uname = ''
541
+ try {
542
+ uname = JSON.parse(sessionStorage.getItem('userInfo') || '{}').uname || ''
543
+ } catch (e) {
544
+ // sessionStorage 不可用时忽略
545
+ }
522
546
  const row = {
523
547
  id: 'n' + Math.random(),
524
548
  _name: file.name,
525
- [this.keys.rowKey]: response.data,
549
+ [this.keys.rowKey]: response?.data,
526
550
  [this.keys.type]: item.type || item.attno,
527
551
  [this.keys.time]: dayjs().format('YYYY-MM-DD HH:mm:ss'),
528
- [this.keys.user]: JSON.parse(sessionStorage.getItem('userInfo') || '{}').uname || '',
529
- [this.keys.url]: response.data,
552
+ [this.keys.user]: uname,
553
+ [this.keys.url]: response?.data,
530
554
  [this.keys.name]: file.name,
531
- _percent: response.code >= 900 || response.code === -1 ? 99 : 100,
532
- _status: response.code >= 900 || response.code === -1 ? 'error' : 'success',
555
+ _percent: response?.code >= 900 || response?.code === -1 ? 99 : 100,
556
+ _status: response?.code >= 900 || response?.code === -1 ? 'error' : 'success',
533
557
  _typeDisabled: true
534
558
  }
535
559