n20-common-lib 2.22.60 → 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"
|
|
@@ -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'
|
|
@@ -514,7 +520,8 @@ export default {
|
|
|
514
520
|
officeStatus: false,
|
|
515
521
|
batchUploading: false,
|
|
516
522
|
// 批量上传使用的文件数据(避免直接修改计算属性)
|
|
517
|
-
_batchFileData: null
|
|
523
|
+
_batchFileData: null,
|
|
524
|
+
sortable: null
|
|
518
525
|
}
|
|
519
526
|
},
|
|
520
527
|
computed: {
|
|
@@ -557,32 +564,64 @@ export default {
|
|
|
557
564
|
},
|
|
558
565
|
immediate: true,
|
|
559
566
|
deep: true
|
|
567
|
+
},
|
|
568
|
+
tableKey() {
|
|
569
|
+
this.initSortable()
|
|
560
570
|
}
|
|
561
571
|
},
|
|
562
572
|
mounted() {
|
|
563
573
|
this.getConfiguration()
|
|
574
|
+
this.initSortable()
|
|
575
|
+
},
|
|
576
|
+
beforeDestroy() {
|
|
577
|
+
this.destroySortable()
|
|
564
578
|
},
|
|
565
579
|
methods: {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
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
|
+
})
|
|
584
617
|
})
|
|
585
618
|
},
|
|
619
|
+
destroySortable() {
|
|
620
|
+
if (this.sortable) {
|
|
621
|
+
this.sortable.destroy()
|
|
622
|
+
this.sortable = null
|
|
623
|
+
}
|
|
624
|
+
},
|
|
586
625
|
async saveFileSort() {
|
|
587
626
|
const sortList = this.tableData
|
|
588
627
|
.map((row, index) => ({
|
|
@@ -633,7 +672,7 @@ export default {
|
|
|
633
672
|
})
|
|
634
673
|
} else {
|
|
635
674
|
if (!this.AIOptions.bussType) {
|
|
636
|
-
this.$message.error($lc(
|
|
675
|
+
this.$message.error($lc('请先配置bussType'))
|
|
637
676
|
return false
|
|
638
677
|
}
|
|
639
678
|
let { data, code } = await axios.post(
|
|
@@ -657,7 +696,7 @@ export default {
|
|
|
657
696
|
// ai识别
|
|
658
697
|
async AiFn(row) {
|
|
659
698
|
if (!this.AIOptions.bussType) {
|
|
660
|
-
this.$message.error($lc(
|
|
699
|
+
this.$message.error($lc('请先配置bussType'))
|
|
661
700
|
return false
|
|
662
701
|
}
|
|
663
702
|
const { data, code } = await axios.post(
|
|
@@ -826,11 +865,7 @@ export default {
|
|
|
826
865
|
return
|
|
827
866
|
}
|
|
828
867
|
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
|
|
868
|
+
(item) => item[this.keys.type] === type && !item[this.keys.url] && !item[this.keys.name] && !item._name
|
|
834
869
|
)
|
|
835
870
|
if (placeholderIndex > -1) {
|
|
836
871
|
this.tableData.splice(placeholderIndex, 1)
|
|
@@ -1010,9 +1045,11 @@ export default {
|
|
|
1010
1045
|
type: 'error',
|
|
1011
1046
|
confirmButtonText: $lc('确认'),
|
|
1012
1047
|
cancelButtonText: $lc('取消')
|
|
1013
|
-
})
|
|
1014
|
-
|
|
1015
|
-
|
|
1048
|
+
})
|
|
1049
|
+
.then(() => {
|
|
1050
|
+
this.$emit('delete-rows', this.selectionList)
|
|
1051
|
+
})
|
|
1052
|
+
.catch(() => undefined)
|
|
1016
1053
|
},
|
|
1017
1054
|
|
|
1018
1055
|
async getFileInfo(row, type) {
|
|
@@ -1246,4 +1283,21 @@ export default {
|
|
|
1246
1283
|
right: 46px;
|
|
1247
1284
|
top: 10px;
|
|
1248
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
|
+
}
|
|
1249
1303
|
</style>
|