n20-common-lib 3.1.15 → 3.1.17

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.
@@ -190,7 +190,7 @@ const keysDefault = {
190
190
  }
191
191
 
192
192
  export default {
193
- name: 'UploadList',
193
+ name: 'FileUploadTableV3',
194
194
  components: {
195
195
  Upload,
196
196
  Dialog,
@@ -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
 
package/src/index.js CHANGED
@@ -124,6 +124,8 @@ import TimePicker from './components/TimePicker/index.vue'
124
124
  import Tree from './components/Tree/index.vue'
125
125
  import Upload from './components/Upload/index.vue'
126
126
  import UploadMsg from './components/Upload/uploadMsg.vue'
127
+ import AnchorV3 from './components/v3/Anchor/index.vue'
128
+ import Collapse from './components/v3/Collapse/index.vue'
127
129
  import Footer from './components/v3/Footer/index.vue'
128
130
  import Header from './components/v3/Header/index.vue'
129
131
  import RadioCard from './components/v3/RadioCard/index.vue'
@@ -287,7 +289,9 @@ const components = [
287
289
  SecondaryTabV3,
288
290
  Header,
289
291
  Footer,
290
- RadioCard
292
+ RadioCard,
293
+ Collapse,
294
+ AnchorV3
291
295
  ]
292
296
 
293
297
  const install = function (Vue, opts = { prefix: 'Cl', i18nConfig: {} }) {
@@ -437,6 +441,8 @@ export {
437
441
  Header,
438
442
  Footer,
439
443
  RadioCard,
444
+ Collapse,
445
+ AnchorV3,
440
446
  asyncGetRelaNos,
441
447
  // 方法
442
448
  auth,