|
@@ -13,15 +13,17 @@
|
|
|
@row-dblclick="paperClickHandle"
|
|
|
>
|
|
|
<el-table-column width="22" class-name="td-checkbox" align="center">
|
|
|
- <template slot-scope="props">
|
|
|
+ <template slot-scope="subScope">
|
|
|
<el-checkbox
|
|
|
- v-model="props.row.select"
|
|
|
- @change="selectionChange"
|
|
|
+ v-model="subScope.row.select"
|
|
|
+ @change="paperSelectionChange(scope.row)"
|
|
|
></el-checkbox>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="文件名">
|
|
|
- <template slot-scope="props"> 第{{ props.$index + 1 }}张 </template>
|
|
|
+ <template slot-scope="subScope">
|
|
|
+ 第{{ subScope.$index + 1 }}张
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
class-name="action-column"
|
|
@@ -29,12 +31,12 @@
|
|
|
align="center"
|
|
|
width="50"
|
|
|
>
|
|
|
- <template slot-scope="props">
|
|
|
+ <template slot-scope="subScope">
|
|
|
<el-button
|
|
|
class="btn-danger"
|
|
|
type="text"
|
|
|
icon="el-icon-error"
|
|
|
- @click="toDeletePaper(scope.row, props.row)"
|
|
|
+ @click="toDeletePaper(scope.row, subScope.row)"
|
|
|
>
|
|
|
</el-button>
|
|
|
</template>
|
|
@@ -46,7 +48,7 @@
|
|
|
<template slot-scope="scope">
|
|
|
<el-checkbox
|
|
|
v-model="scope.row.select"
|
|
|
- @change="selectionChange"
|
|
|
+ @change="rowSelectionChange(scope.row)"
|
|
|
></el-checkbox>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -90,7 +92,7 @@ import { deleteFiles } from "../../../plugins/imageOcr";
|
|
|
export default {
|
|
|
name: "scan-result-table",
|
|
|
props: {
|
|
|
- datas: {
|
|
|
+ tableData: {
|
|
|
type: Array,
|
|
|
default() {
|
|
|
return [];
|
|
@@ -102,25 +104,38 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
- return { selectList: [] };
|
|
|
+ return { selectList: [], datas: [] };
|
|
|
},
|
|
|
computed: {
|
|
|
isNormalTab() {
|
|
|
return this.tab === "normal";
|
|
|
},
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ tableData: {
|
|
|
+ immediate: true,
|
|
|
+ handler(val) {
|
|
|
+ if (val) this.datas = val;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ datas(val) {
|
|
|
+ this.$emit("update:tableData", val);
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
// table action
|
|
|
- selectionChange() {
|
|
|
+ rowSelectionChange(row) {
|
|
|
+ row.papers.forEach((p) => (p.select = row.select));
|
|
|
+ this.updateSelectList();
|
|
|
+ },
|
|
|
+ paperSelectionChange(row) {
|
|
|
+ const paperSelected = !row.papers.some((p) => !p.select);
|
|
|
+ row.select = paperSelected;
|
|
|
+ this.updateSelectList();
|
|
|
+ },
|
|
|
+ updateSelectList() {
|
|
|
const selectList = [];
|
|
|
this.datas.forEach((row) => {
|
|
|
- if (row.select) {
|
|
|
- row.papers.forEach((p) => (p.select = true));
|
|
|
- } else {
|
|
|
- const paperSelected = !row.papers.some((p) => !p.select);
|
|
|
- row.select = paperSelected;
|
|
|
- }
|
|
|
-
|
|
|
const selectPapers = row.papers.filter((p) => p.select);
|
|
|
if (selectPapers.length) {
|
|
|
selectList.push({
|
|
@@ -159,7 +174,7 @@ export default {
|
|
|
(item) => item.studentCode !== row.studentCode
|
|
|
);
|
|
|
|
|
|
- this.selectionChange();
|
|
|
+ this.updateSelectList();
|
|
|
this.$emit("delete-paper", selectedFiles);
|
|
|
},
|
|
|
async toDeletePaper(row, paper) {
|
|
@@ -181,7 +196,7 @@ export default {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- this.selectionChange();
|
|
|
+ this.updateSelectList();
|
|
|
this.$emit("delete-paper", selectedFiles);
|
|
|
},
|
|
|
studentClickHandle(row) {
|