|
@@ -39,10 +39,27 @@
|
|
|
:key="tableKey"
|
|
:key="tableKey"
|
|
|
:cache-key="tableKey"
|
|
:cache-key="tableKey"
|
|
|
:row-style="rowStyle"
|
|
:row-style="rowStyle"
|
|
|
- rowClickChecked
|
|
|
|
|
- :rowClickCheckedIntelligent="false"
|
|
|
|
|
|
|
+ :row-click-checked="true"
|
|
|
|
|
+ :row-click-checked-intelligent="false"
|
|
|
@update:selection="handleSelectionChange"
|
|
@update:selection="handleSelectionChange"
|
|
|
|
|
+ @done="onDone"
|
|
|
>
|
|
>
|
|
|
|
|
+ <template v-slot:toolbar>
|
|
|
|
|
+ <el-alert type="info" :closable="false" class="ele-alert-border" style="width: 300px;">
|
|
|
|
|
+ <i class="el-icon-info ele-text-info"></i>
|
|
|
|
|
+ <span class="ele-text">
|
|
|
|
|
+ <span>
|
|
|
|
|
+ 已选择
|
|
|
|
|
+ <b class="ele-text-info">{{ allSelection.length }}</b>
|
|
|
|
|
+ 项数据<em></em>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <el-link type="primary" :underline="false" @click="clearChoose">
|
|
|
|
|
+ 清空
|
|
|
|
|
+ </el-link>
|
|
|
|
|
+ </el-alert>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
<template v-slot:code="{ row }">
|
|
<template v-slot:code="{ row }">
|
|
|
{{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
|
|
{{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
|
|
|
</template>
|
|
</template>
|
|
@@ -133,9 +150,6 @@
|
|
|
width: 45,
|
|
width: 45,
|
|
|
type: 'selection',
|
|
type: 'selection',
|
|
|
columnKey: 'selection',
|
|
columnKey: 'selection',
|
|
|
- selectable: (row, index) => {
|
|
|
|
|
- return !this.allSelection.some((it) => it.id == row.id);
|
|
|
|
|
- },
|
|
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
reserveSelection: true
|
|
reserveSelection: true
|
|
|
},
|
|
},
|
|
@@ -299,9 +313,23 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
handleSelectionChange(data) {
|
|
handleSelectionChange(data) {
|
|
|
|
|
+ this.allSelection = this.allSelection.filter(
|
|
|
|
|
+ (f) => f.rootCategoryLevelId != this.rootCategoryLevelId
|
|
|
|
|
+ );
|
|
|
this.allSelection = [...this.allSelection, ...data];
|
|
this.allSelection = [...this.allSelection, ...data];
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ onDone() {
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ const ids = this.allSelection.map((item) => item.id);
|
|
|
|
|
+ this.$refs.table.setSelectedRowKeys(ids);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /* 清空选择 */
|
|
|
|
|
+ clearChoose() {
|
|
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
|
|
+ },
|
|
|
rowStyle({ row }) {
|
|
rowStyle({ row }) {
|
|
|
return this.selection.includes(row) ? { background: '#e6f7ff' } : null;
|
|
return this.selection.includes(row) ? { background: '#e6f7ff' } : null;
|
|
|
},
|
|
},
|