n20-common-lib 2.22.59 → 2.22.60

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.59",
3
+ "version": "2.22.60",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -109,7 +109,7 @@
109
109
  :action="apiPrefix ? apiPrefix + action : action"
110
110
  :multiple="multiple"
111
111
  :headers="headers"
112
- :disabled="!row[keys.type] || row._typeDisabled"
112
+ :disabled="!row[keys.type] || row._typeDisabled || row._uploadDisabled"
113
113
  :accept="row[keys.type] | acceptFilter(typeOptions, fileAccept)"
114
114
  :size="row[keys.type] | sizeFilter(typeOptions, fileSize)"
115
115
  :http-request="uploadHttpRequest ? (options) => uploadHttpRequest(options, row) : undefined"
@@ -334,7 +334,6 @@ import importG from '../../utils/importGlobal.js'
334
334
  import Dialog from '../Dialog/index.vue'
335
335
  import Upload from '../Upload/index.vue'
336
336
 
337
-
338
337
  const ViewerImg = async function () {
339
338
  let { component } = await importG('v-viewer', () => import(/*webpackChunkName: "v-viewer"*/ 'v-viewer'))
340
339
  return component
@@ -348,9 +347,9 @@ const keysDefault = {
348
347
  user: 'user'
349
348
  }
350
349
  const typeOptionsDefault = [
351
- { type: '001', label: $lc("信贷合同") },
352
- { type: '002', label: $lc("贴现合同") },
353
- { type: '003', label: $lc("其他合同") }
350
+ { type: '001', label: $lc('信贷合同') },
351
+ { type: '002', label: $lc('贴现合同') },
352
+ { type: '003', label: $lc('其他合同') }
354
353
  ]
355
354
 
356
355
  export default {
@@ -526,7 +525,7 @@ export default {
526
525
  return this.dataPorp.fileSize || undefined
527
526
  },
528
527
  fileAcceptTip() {
529
- return this.dataPorp.fileAcceptTip || $lc("支持扩展名:.rar .zip .doc .docx .pdf .jpg...")
528
+ return this.dataPorp.fileAcceptTip || $lc('支持扩展名:.rar .zip .doc .docx .pdf .jpg...')
530
529
  },
531
530
  fileData() {
532
531
  return this.dataPorp.fileData || undefined
@@ -575,13 +574,13 @@ export default {
575
574
  const stripName = (v) => (v == null ? '' : String(v).replace(/\.[A-z0-9]+$/, ''))
576
575
  const dir = order === 'ascending' ? 1 : -1
577
576
  const sorted = [...this.tableData].sort(
578
- (a, b) => stripName(a[nameKey]).localeCompare(stripName(b[nameKey]), 'zh-CN', { numeric: true }) * dir
577
+ (a, b) => stripName(a[nameKey]).localeCompare(stripName(b[nameKey]), 'zh-CN', { numeric:true }) * dir
579
578
  )
580
579
  // 原地更新 tableData(沿用现有 splice 修改 prop 数组的模式)
581
580
  this.tableData.splice(0, this.tableData.length, ...sorted)
582
581
  this.$emit('sort', this.tableData.slice())
583
582
  this.saveFileSort().catch(() => {
584
- this.$message.error($lc("附件排序保存失败"))
583
+ this.$message.error($lc('附件排序保存失败'))
585
584
  })
586
585
  },
587
586
  async saveFileSort() {
@@ -745,7 +744,7 @@ export default {
745
744
  if (code === 200) {
746
745
  let aDom = document.createElement('a')
747
746
  aDom.href = data
748
- aDom.download = $lc("批量附件.pdf")
747
+ aDom.download = '批量附件.pdf'
749
748
  aDom.click()
750
749
 
751
750
  this.$nextTick(() => {
@@ -794,14 +793,16 @@ export default {
794
793
  }
795
794
  }
796
795
 
796
+ let file = files.map((item) => item.raw)
797
797
  let FD = new FormData()
798
- files.forEach((item) => {
799
- FD.append('file', item.raw)
798
+ file.forEach((item) => {
799
+ FD.append('file', item)
800
800
  })
801
801
 
802
- let remoteFileUpload = JSON.parse(this.fileData?.data || '{}')
803
- remoteFileUpload.bussValues = this.typeOptions.map((item) => item.type)
804
- FD.append('remoteFileUpload', JSON.stringify(remoteFileUpload))
802
+ let requestData = JSON.parse(this.fileData?.data || '{}')
803
+ requestData.bussId = requestData.bussId ?? this.fileData?.bussId ?? ''
804
+ requestData.bussValues = this.typeOptions.map((item) => item.type)
805
+ FD.append('data', JSON.stringify(requestData))
805
806
 
806
807
  this.batchUploading = true
807
808
  let { data } = await axios.post(
@@ -819,6 +820,22 @@ export default {
819
820
 
820
821
  let responseList = Array.isArray(data) ? data : []
821
822
  let rows = responseList.map((item) => this.buildAutoMatchBatchRow(item))
823
+ rows.forEach((row) => {
824
+ let type = row[this.keys.type]
825
+ if (!type) {
826
+ return
827
+ }
828
+ let placeholderIndex = this.tableData.findIndex(
829
+ (item) =>
830
+ item[this.keys.type] === type &&
831
+ !item[this.keys.url] &&
832
+ !item[this.keys.name] &&
833
+ !item._name
834
+ )
835
+ if (placeholderIndex > -1) {
836
+ this.tableData.splice(placeholderIndex, 1)
837
+ }
838
+ })
822
839
  this.tableData.splice(0, 0, ...rows)
823
840
  let pendingFiles = [...files]
824
841
  rows.forEach((row) => {
@@ -844,6 +861,7 @@ export default {
844
861
  _percent: 100,
845
862
  _status: 'success',
846
863
  _typeDisabled: false,
864
+ _uploadDisabled: true,
847
865
  _typeUpdating: false,
848
866
  _shouldUpdateFileType: !item.attno,
849
867
  _lastFileType: item.attno,
@@ -981,17 +999,17 @@ export default {
981
999
  deleteRows() {
982
1000
  if (!this.selectionList.length) {
983
1001
  return this.$message({
984
- message: $lc("请先勾选要删除的数据!"),
1002
+ message: $lc('请先勾选要删除的数据!'),
985
1003
  type: 'warning',
986
1004
  showClose: true
987
1005
  })
988
1006
  }
989
1007
  this.$msgboxPor({
990
- title: $lc("确认删除所选附件吗?"),
991
- message: $lc("删除后数据不可恢复"),
1008
+ title: $lc('确认删除所选附件吗?'),
1009
+ message: $lc('删除后数据不可恢复'),
992
1010
  type: 'error',
993
- confirmButtonText: $lc("确认"),
994
- cancelButtonText: $lc("取消")
1011
+ confirmButtonText: $lc('确认'),
1012
+ cancelButtonText: $lc('取消')
995
1013
  }).then(() => {
996
1014
  this.$emit('delete-rows', this.selectionList)
997
1015
  }).catch(() => undefined)