n20-common-lib 3.2.15 → 3.2.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.
package/package.json
CHANGED
|
@@ -580,7 +580,11 @@ export default {
|
|
|
580
580
|
}
|
|
581
581
|
},
|
|
582
582
|
defaultCheck() {
|
|
583
|
-
|
|
583
|
+
// 恢复默认不应清除固定的筛选条件(static / isNotClose),始终保留
|
|
584
|
+
const fixedIds = this.filterList
|
|
585
|
+
.filter((item) => item.static || item.isNotClose)
|
|
586
|
+
.map((item) => item[this.onlyKey])
|
|
587
|
+
this.checkList = Array.from(new Set([...fixedIds, ...this.defineCheckList]))
|
|
584
588
|
},
|
|
585
589
|
cancel() {
|
|
586
590
|
this.checkList = this.cancelCheck
|
|
@@ -32,15 +32,11 @@
|
|
|
32
32
|
:height="height"
|
|
33
33
|
border
|
|
34
34
|
@selection-change="(selection) => (selectionList = selection)"
|
|
35
|
+
@sort-change="onSortChange"
|
|
35
36
|
>
|
|
36
37
|
<slot name="selection-column">
|
|
37
38
|
<el-table-column type="selection" width="50" align="center" />
|
|
38
39
|
</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>
|
|
44
40
|
<template v-if="dataPorp.slotHeader">
|
|
45
41
|
<el-table-column
|
|
46
42
|
v-for="item in dataPorp.slotHeader"
|
|
@@ -77,7 +73,7 @@
|
|
|
77
73
|
</div>
|
|
78
74
|
</slot>
|
|
79
75
|
</el-table-column>
|
|
80
|
-
<el-table-column :label="'附件名称' | $lc" :prop="keys.name">
|
|
76
|
+
<el-table-column :label="'附件名称' | $lc" :prop="keys.name" sortable="custom">
|
|
81
77
|
<slot slot="header" slot-scope="scope" name="name-header" :column="scope.column">{{ '附件名称' | $lc }}</slot>
|
|
82
78
|
<slot slot-scope="{ row }" name="name" :row="row">
|
|
83
79
|
<span v-if="readonly">{{ row[keys.name] ? row[keys.name].replace(/\.[A-z0-9]+$/, '') : '' }}</span>
|
|
@@ -322,7 +318,6 @@ import aiCheckDialog from './aiCheckDialog.vue'
|
|
|
322
318
|
import getJsonc from '../../assets/getJsonc.js'
|
|
323
319
|
import _axios from 'axios'
|
|
324
320
|
import dayjs from 'dayjs'
|
|
325
|
-
import Sortable from 'sortablejs'
|
|
326
321
|
import XEUtils from 'xe-utils'
|
|
327
322
|
|
|
328
323
|
import 'viewerjs/dist/viewer.css'
|
|
@@ -502,8 +497,7 @@ export default {
|
|
|
502
497
|
previewName: undefined,
|
|
503
498
|
previewSameOrg: false,
|
|
504
499
|
seeRow: {},
|
|
505
|
-
officeStatus: false
|
|
506
|
-
sortable: null
|
|
500
|
+
officeStatus: false
|
|
507
501
|
}
|
|
508
502
|
},
|
|
509
503
|
computed: {
|
|
@@ -546,63 +540,31 @@ export default {
|
|
|
546
540
|
},
|
|
547
541
|
immediate: true,
|
|
548
542
|
deep: true
|
|
549
|
-
},
|
|
550
|
-
tableKey() {
|
|
551
|
-
this.initSortable()
|
|
552
543
|
}
|
|
553
544
|
},
|
|
554
545
|
mounted() {
|
|
555
546
|
this.getConfiguration()
|
|
556
|
-
this.initSortable()
|
|
557
|
-
},
|
|
558
|
-
beforeDestroy() {
|
|
559
|
-
this.destroySortable()
|
|
560
547
|
},
|
|
561
548
|
methods: {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (!$tbody) {
|
|
568
|
-
return
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
this.sortable = Sortable.create($tbody, {
|
|
572
|
-
handle: '.file-upload-table__drag-handle',
|
|
573
|
-
ghostClass: 'file-upload-table__sortable-ghost',
|
|
574
|
-
setData(dataTransfer) {
|
|
575
|
-
dataTransfer.setData('Text', '')
|
|
576
|
-
},
|
|
577
|
-
onEnd: ({ oldIndex, newIndex }) => {
|
|
578
|
-
if (
|
|
579
|
-
oldIndex === newIndex ||
|
|
580
|
-
oldIndex === undefined ||
|
|
581
|
-
newIndex === undefined ||
|
|
582
|
-
oldIndex < 0 ||
|
|
583
|
-
newIndex < 0
|
|
584
|
-
) {
|
|
585
|
-
return
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
const targetRow = this.tableData.splice(oldIndex, 1)[0]
|
|
589
|
-
if (!targetRow) {
|
|
590
|
-
return
|
|
591
|
-
}
|
|
592
|
-
this.tableData.splice(newIndex, 0, targetRow)
|
|
593
|
-
this.$emit('sort', this.tableData.slice())
|
|
594
|
-
this.saveFileSort().catch(() => {
|
|
595
|
-
this.$message.error($lc('附件排序保存失败'))
|
|
596
|
-
})
|
|
597
|
-
}
|
|
598
|
-
})
|
|
599
|
-
})
|
|
600
|
-
},
|
|
601
|
-
destroySortable() {
|
|
602
|
-
if (this.sortable) {
|
|
603
|
-
this.sortable.destroy()
|
|
604
|
-
this.sortable = null
|
|
549
|
+
// 点击附件名称表头排序(替代原拖动排序)
|
|
550
|
+
onSortChange({ prop, order }) {
|
|
551
|
+
// 仅处理附件名称列;order 为 null(取消排序)时不处理
|
|
552
|
+
if (prop !== this.keys.name || !order) {
|
|
553
|
+
return
|
|
605
554
|
}
|
|
555
|
+
const nameKey = this.keys.name
|
|
556
|
+
// 与显示一致:去除扩展名后再比较
|
|
557
|
+
const stripName = (v) => (v == null ? '' : String(v).replace(/\.[A-z0-9]+$/, ''))
|
|
558
|
+
const dir = order === 'ascending' ? 1 : -1
|
|
559
|
+
const sorted = [...this.tableData].sort(
|
|
560
|
+
(a, b) => stripName(a[nameKey]).localeCompare(stripName(b[nameKey]), 'zh-CN', { numeric:true }) * dir
|
|
561
|
+
)
|
|
562
|
+
// 原地更新 tableData(沿用现有 splice 修改 prop 数组的模式)
|
|
563
|
+
this.tableData.splice(0, this.tableData.length, ...sorted)
|
|
564
|
+
this.$emit('sort', this.tableData.slice())
|
|
565
|
+
this.saveFileSort().catch(() => {
|
|
566
|
+
this.$message.error($lc('附件排序保存失败'))
|
|
567
|
+
})
|
|
606
568
|
},
|
|
607
569
|
async saveFileSort() {
|
|
608
570
|
const sortList = this.tableData
|
|
@@ -1076,21 +1038,4 @@ export default {
|
|
|
1076
1038
|
right: 46px;
|
|
1077
1039
|
top: 10px;
|
|
1078
1040
|
}
|
|
1079
|
-
|
|
1080
|
-
.file-upload-table__drag-handle {
|
|
1081
|
-
display: inline-block;
|
|
1082
|
-
color: #909399;
|
|
1083
|
-
font-size: 16px;
|
|
1084
|
-
cursor: move;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
.file-upload-table__drag-handle:hover {
|
|
1088
|
-
color: #606266;
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
.file-upload-table__sortable-ghost {
|
|
1092
|
-
opacity: 0.8;
|
|
1093
|
-
color: #fff !important;
|
|
1094
|
-
background: #42b983 !important;
|
|
1095
|
-
}
|
|
1096
1041
|
</style>
|