n20-common-lib 2.22.40 → 2.22.41
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
|
@@ -428,6 +428,10 @@ export default {
|
|
|
428
428
|
align: {
|
|
429
429
|
type: String,
|
|
430
430
|
default: 'left-right'
|
|
431
|
+
},
|
|
432
|
+
seeTypes: {
|
|
433
|
+
type: RegExp,
|
|
434
|
+
default: /\.(jpg|png|gif|svg|pdf|swf|xlsx|xls|docx|doc|txt)$/i
|
|
431
435
|
}
|
|
432
436
|
},
|
|
433
437
|
data() {
|
|
@@ -464,7 +468,7 @@ export default {
|
|
|
464
468
|
imgType: /\.(jpg|png1|gif|svg)$/i,
|
|
465
469
|
previewName: '',
|
|
466
470
|
previewSameOrg: false,
|
|
467
|
-
|
|
471
|
+
|
|
468
472
|
seeRow: {},
|
|
469
473
|
showFlowHistory: true,
|
|
470
474
|
showFlowHistoryChild: true
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
<el-table
|
|
28
|
+
ref="elTable"
|
|
28
29
|
:key="tableKey"
|
|
29
30
|
:data="tableData"
|
|
30
31
|
:row-key="keys.rowKey"
|
|
@@ -35,6 +36,11 @@
|
|
|
35
36
|
<slot name="selection-column">
|
|
36
37
|
<el-table-column type="selection" width="50" align="center" />
|
|
37
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>
|
|
38
44
|
<template v-if="dataPorp.slotHeader">
|
|
39
45
|
<el-table-column
|
|
40
46
|
v-for="item in dataPorp.slotHeader"
|
|
@@ -316,6 +322,7 @@ import aiCheckDialog from './aiCheckDialog.vue'
|
|
|
316
322
|
import getJsonc from '../../assets/getJsonc.js'
|
|
317
323
|
import _axios from 'axios'
|
|
318
324
|
import dayjs from 'dayjs'
|
|
325
|
+
import Sortable from 'sortablejs'
|
|
319
326
|
import XEUtils from 'xe-utils'
|
|
320
327
|
|
|
321
328
|
import 'viewerjs/dist/viewer.css'
|
|
@@ -394,7 +401,7 @@ export default {
|
|
|
394
401
|
},
|
|
395
402
|
action: {
|
|
396
403
|
type: String,
|
|
397
|
-
default: '/
|
|
404
|
+
default: '/neams/eamsbaserecord/batchSavejson'
|
|
398
405
|
},
|
|
399
406
|
batchPrintMethod: {
|
|
400
407
|
type: Function,
|
|
@@ -499,7 +506,8 @@ export default {
|
|
|
499
506
|
previewName: undefined,
|
|
500
507
|
previewSameOrg: false,
|
|
501
508
|
seeRow: {},
|
|
502
|
-
officeStatus: false
|
|
509
|
+
officeStatus: false,
|
|
510
|
+
sortable: null
|
|
503
511
|
}
|
|
504
512
|
},
|
|
505
513
|
computed: {
|
|
@@ -542,12 +550,81 @@ export default {
|
|
|
542
550
|
},
|
|
543
551
|
immediate: true,
|
|
544
552
|
deep: true
|
|
553
|
+
},
|
|
554
|
+
tableKey() {
|
|
555
|
+
this.initSortable()
|
|
545
556
|
}
|
|
546
557
|
},
|
|
547
558
|
mounted() {
|
|
548
559
|
this.getConfiguration()
|
|
560
|
+
this.initSortable()
|
|
561
|
+
},
|
|
562
|
+
beforeDestroy() {
|
|
563
|
+
this.destroySortable()
|
|
549
564
|
},
|
|
550
565
|
methods: {
|
|
566
|
+
initSortable() {
|
|
567
|
+
this.$nextTick(() => {
|
|
568
|
+
this.destroySortable()
|
|
569
|
+
|
|
570
|
+
const $tbody = this.$refs.elTable?.$el?.querySelector('.el-table__body-wrapper > table > tbody')
|
|
571
|
+
if (!$tbody) {
|
|
572
|
+
return
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
this.sortable = Sortable.create($tbody, {
|
|
576
|
+
handle: '.file-upload-table__drag-handle',
|
|
577
|
+
ghostClass: 'file-upload-table__sortable-ghost',
|
|
578
|
+
setData(dataTransfer) {
|
|
579
|
+
dataTransfer.setData('Text', '')
|
|
580
|
+
},
|
|
581
|
+
onEnd: ({ oldIndex, newIndex }) => {
|
|
582
|
+
if (
|
|
583
|
+
oldIndex === newIndex ||
|
|
584
|
+
oldIndex === undefined ||
|
|
585
|
+
newIndex === undefined ||
|
|
586
|
+
oldIndex < 0 ||
|
|
587
|
+
newIndex < 0
|
|
588
|
+
) {
|
|
589
|
+
return
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const targetRow = this.tableData.splice(oldIndex, 1)[0]
|
|
593
|
+
if (!targetRow) {
|
|
594
|
+
return
|
|
595
|
+
}
|
|
596
|
+
this.tableData.splice(newIndex, 0, targetRow)
|
|
597
|
+
this.$emit('sort', this.tableData.slice())
|
|
598
|
+
this.saveFileSort().catch(() => {
|
|
599
|
+
this.$message.error($lc('附件排序保存失败'))
|
|
600
|
+
})
|
|
601
|
+
}
|
|
602
|
+
})
|
|
603
|
+
})
|
|
604
|
+
},
|
|
605
|
+
destroySortable() {
|
|
606
|
+
if (this.sortable) {
|
|
607
|
+
this.sortable.destroy()
|
|
608
|
+
this.sortable = null
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
async saveFileSort() {
|
|
612
|
+
const sortList = this.tableData
|
|
613
|
+
.map((row, index) => ({
|
|
614
|
+
beid: row.beid || row[this.keys.rowKey],
|
|
615
|
+
fileSort: String(index + 1)
|
|
616
|
+
}))
|
|
617
|
+
.filter((item) => item.beid)
|
|
618
|
+
|
|
619
|
+
if (!sortList.length) {
|
|
620
|
+
return
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
await axios.post(
|
|
624
|
+
this.apiPrefix ? `${this.apiPrefix}/neams/eamsbaserecord/fileSort` : '/neams/eamsbaserecord/fileSort',
|
|
625
|
+
sortList
|
|
626
|
+
)
|
|
627
|
+
},
|
|
551
628
|
// ai校验取消
|
|
552
629
|
aiCheckCancel(beid) {
|
|
553
630
|
this.tableData.forEach((item) => {
|
|
@@ -1014,4 +1091,21 @@ export default {
|
|
|
1014
1091
|
right: 46px;
|
|
1015
1092
|
top: 10px;
|
|
1016
1093
|
}
|
|
1094
|
+
|
|
1095
|
+
.file-upload-table__drag-handle {
|
|
1096
|
+
display: inline-block;
|
|
1097
|
+
color: #909399;
|
|
1098
|
+
font-size: 16px;
|
|
1099
|
+
cursor: move;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
.file-upload-table__drag-handle:hover {
|
|
1103
|
+
color: #606266;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
.file-upload-table__sortable-ghost {
|
|
1107
|
+
opacity: 0.8;
|
|
1108
|
+
color: #fff !important;
|
|
1109
|
+
background: #42b983 !important;
|
|
1110
|
+
}
|
|
1017
1111
|
</style>
|