n20-common-lib 2.22.59 → 2.22.61
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
|
@@ -32,11 +32,15 @@
|
|
|
32
32
|
:height="height"
|
|
33
33
|
border
|
|
34
34
|
@selection-change="(selection) => (selectionList = selection)"
|
|
35
|
-
@sort-change="onSortChange"
|
|
36
35
|
>
|
|
37
36
|
<slot name="selection-column">
|
|
38
37
|
<el-table-column type="selection" width="50" align="center" />
|
|
39
38
|
</slot>
|
|
39
|
+
<el-table-column :label="'排序' | $lc" width="50" align="center">
|
|
40
|
+
<template slot-scope="{ row }">
|
|
41
|
+
<i class="n20-icon-tuodong file-upload-table__drag-handle" :data-row-key="row[keys.rowKey]"></i>
|
|
42
|
+
</template>
|
|
43
|
+
</el-table-column>
|
|
40
44
|
<template v-if="dataPorp.slotHeader">
|
|
41
45
|
<el-table-column
|
|
42
46
|
v-for="item in dataPorp.slotHeader"
|
|
@@ -109,7 +113,7 @@
|
|
|
109
113
|
:action="apiPrefix ? apiPrefix + action : action"
|
|
110
114
|
:multiple="multiple"
|
|
111
115
|
:headers="headers"
|
|
112
|
-
:disabled="!row[keys.type] || row._typeDisabled"
|
|
116
|
+
:disabled="!row[keys.type] || row._typeDisabled || row._uploadDisabled"
|
|
113
117
|
:accept="row[keys.type] | acceptFilter(typeOptions, fileAccept)"
|
|
114
118
|
:size="row[keys.type] | sizeFilter(typeOptions, fileSize)"
|
|
115
119
|
:http-request="uploadHttpRequest ? (options) => uploadHttpRequest(options, row) : undefined"
|
|
@@ -320,13 +324,15 @@
|
|
|
320
324
|
</template>
|
|
321
325
|
|
|
322
326
|
<script>
|
|
323
|
-
import aiCheckDialog from './aiCheckDialog.vue'
|
|
324
|
-
import getJsonc from '../../assets/getJsonc.js'
|
|
325
327
|
import _axios from 'axios'
|
|
326
328
|
import dayjs from 'dayjs'
|
|
329
|
+
import Sortable from 'sortablejs'
|
|
330
|
+
import 'viewerjs/dist/viewer.css'
|
|
327
331
|
import XEUtils from 'xe-utils'
|
|
328
332
|
|
|
329
|
-
import '
|
|
333
|
+
import aiCheckDialog from './aiCheckDialog.vue'
|
|
334
|
+
|
|
335
|
+
import getJsonc from '../../assets/getJsonc.js'
|
|
330
336
|
import auth from '../../utils/auth'
|
|
331
337
|
import axios from '../../utils/axios'
|
|
332
338
|
import { $lc } from '../../utils/i18n/index'
|
|
@@ -334,7 +340,6 @@ import importG from '../../utils/importGlobal.js'
|
|
|
334
340
|
import Dialog from '../Dialog/index.vue'
|
|
335
341
|
import Upload from '../Upload/index.vue'
|
|
336
342
|
|
|
337
|
-
|
|
338
343
|
const ViewerImg = async function () {
|
|
339
344
|
let { component } = await importG('v-viewer', () => import(/*webpackChunkName: "v-viewer"*/ 'v-viewer'))
|
|
340
345
|
return component
|
|
@@ -348,9 +353,9 @@ const keysDefault = {
|
|
|
348
353
|
user: 'user'
|
|
349
354
|
}
|
|
350
355
|
const typeOptionsDefault = [
|
|
351
|
-
{ type: '001', label: $lc(
|
|
352
|
-
{ type: '002', label: $lc(
|
|
353
|
-
{ type: '003', label: $lc(
|
|
356
|
+
{ type: '001', label: $lc('信贷合同') },
|
|
357
|
+
{ type: '002', label: $lc('贴现合同') },
|
|
358
|
+
{ type: '003', label: $lc('其他合同') }
|
|
354
359
|
]
|
|
355
360
|
|
|
356
361
|
export default {
|
|
@@ -515,7 +520,8 @@ export default {
|
|
|
515
520
|
officeStatus: false,
|
|
516
521
|
batchUploading: false,
|
|
517
522
|
// 批量上传使用的文件数据(避免直接修改计算属性)
|
|
518
|
-
_batchFileData: null
|
|
523
|
+
_batchFileData: null,
|
|
524
|
+
sortable: null
|
|
519
525
|
}
|
|
520
526
|
},
|
|
521
527
|
computed: {
|
|
@@ -526,7 +532,7 @@ export default {
|
|
|
526
532
|
return this.dataPorp.fileSize || undefined
|
|
527
533
|
},
|
|
528
534
|
fileAcceptTip() {
|
|
529
|
-
return this.dataPorp.fileAcceptTip || $lc(
|
|
535
|
+
return this.dataPorp.fileAcceptTip || $lc('支持扩展名:.rar .zip .doc .docx .pdf .jpg...')
|
|
530
536
|
},
|
|
531
537
|
fileData() {
|
|
532
538
|
return this.dataPorp.fileData || undefined
|
|
@@ -558,32 +564,64 @@ export default {
|
|
|
558
564
|
},
|
|
559
565
|
immediate: true,
|
|
560
566
|
deep: true
|
|
567
|
+
},
|
|
568
|
+
tableKey() {
|
|
569
|
+
this.initSortable()
|
|
561
570
|
}
|
|
562
571
|
},
|
|
563
572
|
mounted() {
|
|
564
573
|
this.getConfiguration()
|
|
574
|
+
this.initSortable()
|
|
575
|
+
},
|
|
576
|
+
beforeDestroy() {
|
|
577
|
+
this.destroySortable()
|
|
565
578
|
},
|
|
566
579
|
methods: {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
580
|
+
initSortable() {
|
|
581
|
+
this.$nextTick(() => {
|
|
582
|
+
this.destroySortable()
|
|
583
|
+
|
|
584
|
+
const $tbody = this.$refs.elTable?.$el?.querySelector('.el-table__body-wrapper > table > tbody')
|
|
585
|
+
if (!$tbody) {
|
|
586
|
+
return
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
this.sortable = Sortable.create($tbody, {
|
|
590
|
+
handle: '.file-upload-table__drag-handle',
|
|
591
|
+
ghostClass: 'file-upload-table__sortable-ghost',
|
|
592
|
+
setData(dataTransfer) {
|
|
593
|
+
dataTransfer.setData('Text', '')
|
|
594
|
+
},
|
|
595
|
+
onEnd: ({ oldIndex, newIndex }) => {
|
|
596
|
+
if (
|
|
597
|
+
oldIndex === newIndex ||
|
|
598
|
+
oldIndex === undefined ||
|
|
599
|
+
newIndex === undefined ||
|
|
600
|
+
oldIndex < 0 ||
|
|
601
|
+
newIndex < 0
|
|
602
|
+
) {
|
|
603
|
+
return
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
const targetRow = this.tableData.splice(oldIndex, 1)[0]
|
|
607
|
+
if (!targetRow) {
|
|
608
|
+
return
|
|
609
|
+
}
|
|
610
|
+
this.tableData.splice(newIndex, 0, targetRow)
|
|
611
|
+
this.$emit('sort', this.tableData.slice())
|
|
612
|
+
this.saveFileSort().catch(() => {
|
|
613
|
+
this.$message.error($lc('附件排序保存失败'))
|
|
614
|
+
})
|
|
615
|
+
}
|
|
616
|
+
})
|
|
585
617
|
})
|
|
586
618
|
},
|
|
619
|
+
destroySortable() {
|
|
620
|
+
if (this.sortable) {
|
|
621
|
+
this.sortable.destroy()
|
|
622
|
+
this.sortable = null
|
|
623
|
+
}
|
|
624
|
+
},
|
|
587
625
|
async saveFileSort() {
|
|
588
626
|
const sortList = this.tableData
|
|
589
627
|
.map((row, index) => ({
|
|
@@ -634,7 +672,7 @@ export default {
|
|
|
634
672
|
})
|
|
635
673
|
} else {
|
|
636
674
|
if (!this.AIOptions.bussType) {
|
|
637
|
-
this.$message.error($lc(
|
|
675
|
+
this.$message.error($lc('请先配置bussType'))
|
|
638
676
|
return false
|
|
639
677
|
}
|
|
640
678
|
let { data, code } = await axios.post(
|
|
@@ -658,7 +696,7 @@ export default {
|
|
|
658
696
|
// ai识别
|
|
659
697
|
async AiFn(row) {
|
|
660
698
|
if (!this.AIOptions.bussType) {
|
|
661
|
-
this.$message.error($lc(
|
|
699
|
+
this.$message.error($lc('请先配置bussType'))
|
|
662
700
|
return false
|
|
663
701
|
}
|
|
664
702
|
const { data, code } = await axios.post(
|
|
@@ -745,7 +783,7 @@ export default {
|
|
|
745
783
|
if (code === 200) {
|
|
746
784
|
let aDom = document.createElement('a')
|
|
747
785
|
aDom.href = data
|
|
748
|
-
aDom.download =
|
|
786
|
+
aDom.download = '批量附件.pdf'
|
|
749
787
|
aDom.click()
|
|
750
788
|
|
|
751
789
|
this.$nextTick(() => {
|
|
@@ -794,14 +832,16 @@ export default {
|
|
|
794
832
|
}
|
|
795
833
|
}
|
|
796
834
|
|
|
835
|
+
let file = files.map((item) => item.raw)
|
|
797
836
|
let FD = new FormData()
|
|
798
|
-
|
|
799
|
-
FD.append('file', item
|
|
837
|
+
file.forEach((item) => {
|
|
838
|
+
FD.append('file', item)
|
|
800
839
|
})
|
|
801
840
|
|
|
802
|
-
let
|
|
803
|
-
|
|
804
|
-
|
|
841
|
+
let requestData = JSON.parse(this.fileData?.data || '{}')
|
|
842
|
+
requestData.bussId = requestData.bussId ?? this.fileData?.bussId ?? ''
|
|
843
|
+
requestData.bussValues = this.typeOptions.map((item) => item.type)
|
|
844
|
+
FD.append('data', JSON.stringify(requestData))
|
|
805
845
|
|
|
806
846
|
this.batchUploading = true
|
|
807
847
|
let { data } = await axios.post(
|
|
@@ -819,6 +859,18 @@ export default {
|
|
|
819
859
|
|
|
820
860
|
let responseList = Array.isArray(data) ? data : []
|
|
821
861
|
let rows = responseList.map((item) => this.buildAutoMatchBatchRow(item))
|
|
862
|
+
rows.forEach((row) => {
|
|
863
|
+
let type = row[this.keys.type]
|
|
864
|
+
if (!type) {
|
|
865
|
+
return
|
|
866
|
+
}
|
|
867
|
+
let placeholderIndex = this.tableData.findIndex(
|
|
868
|
+
(item) => item[this.keys.type] === type && !item[this.keys.url] && !item[this.keys.name] && !item._name
|
|
869
|
+
)
|
|
870
|
+
if (placeholderIndex > -1) {
|
|
871
|
+
this.tableData.splice(placeholderIndex, 1)
|
|
872
|
+
}
|
|
873
|
+
})
|
|
822
874
|
this.tableData.splice(0, 0, ...rows)
|
|
823
875
|
let pendingFiles = [...files]
|
|
824
876
|
rows.forEach((row) => {
|
|
@@ -844,6 +896,7 @@ export default {
|
|
|
844
896
|
_percent: 100,
|
|
845
897
|
_status: 'success',
|
|
846
898
|
_typeDisabled: false,
|
|
899
|
+
_uploadDisabled: true,
|
|
847
900
|
_typeUpdating: false,
|
|
848
901
|
_shouldUpdateFileType: !item.attno,
|
|
849
902
|
_lastFileType: item.attno,
|
|
@@ -981,20 +1034,22 @@ export default {
|
|
|
981
1034
|
deleteRows() {
|
|
982
1035
|
if (!this.selectionList.length) {
|
|
983
1036
|
return this.$message({
|
|
984
|
-
message: $lc(
|
|
1037
|
+
message: $lc('请先勾选要删除的数据!'),
|
|
985
1038
|
type: 'warning',
|
|
986
1039
|
showClose: true
|
|
987
1040
|
})
|
|
988
1041
|
}
|
|
989
1042
|
this.$msgboxPor({
|
|
990
|
-
title: $lc(
|
|
991
|
-
message: $lc(
|
|
1043
|
+
title: $lc('确认删除所选附件吗?'),
|
|
1044
|
+
message: $lc('删除后数据不可恢复'),
|
|
992
1045
|
type: 'error',
|
|
993
|
-
confirmButtonText: $lc(
|
|
994
|
-
cancelButtonText: $lc(
|
|
995
|
-
})
|
|
996
|
-
|
|
997
|
-
|
|
1046
|
+
confirmButtonText: $lc('确认'),
|
|
1047
|
+
cancelButtonText: $lc('取消')
|
|
1048
|
+
})
|
|
1049
|
+
.then(() => {
|
|
1050
|
+
this.$emit('delete-rows', this.selectionList)
|
|
1051
|
+
})
|
|
1052
|
+
.catch(() => undefined)
|
|
998
1053
|
},
|
|
999
1054
|
|
|
1000
1055
|
async getFileInfo(row, type) {
|
|
@@ -1228,4 +1283,21 @@ export default {
|
|
|
1228
1283
|
right: 46px;
|
|
1229
1284
|
top: 10px;
|
|
1230
1285
|
}
|
|
1286
|
+
|
|
1287
|
+
.file-upload-table__drag-handle {
|
|
1288
|
+
display: inline-block;
|
|
1289
|
+
color: #909399;
|
|
1290
|
+
font-size: 16px;
|
|
1291
|
+
cursor: move;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
.file-upload-table__drag-handle:hover {
|
|
1295
|
+
color: #606266;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
.file-upload-table__sortable-ghost {
|
|
1299
|
+
opacity: 0.8;
|
|
1300
|
+
color: #fff !important;
|
|
1301
|
+
background: #42b983 !important;
|
|
1302
|
+
}
|
|
1231
1303
|
</style>
|