|
@@ -61,19 +61,23 @@
|
|
|
v-if="showFix"
|
|
|
type="primary"
|
|
|
size="small"
|
|
|
- :disabled="!canFix"
|
|
|
+ :disabled="!canFixOrDelete"
|
|
|
@click="toFix"
|
|
|
>纠错</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
size="small"
|
|
|
- :disabled="!curImageRotate"
|
|
|
+ :disabled="!canSaveRotate"
|
|
|
:loading="loading"
|
|
|
@click="toSaveRotate"
|
|
|
>保存旋转</el-button
|
|
|
>
|
|
|
- <el-button type="danger" size="small" @click="toDelete"
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ :disabled="!canFixOrDelete"
|
|
|
+ @click="toDelete"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
<p v-if="showFix" class="tips-info tips-error">
|
|
@@ -155,9 +159,12 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- canFix() {
|
|
|
+ canFixOrDelete() {
|
|
|
return Boolean(this.multipleSelection.length || this.curImage.url);
|
|
|
},
|
|
|
+ canSaveRotate() {
|
|
|
+ return Boolean(this.curImageRotate && this.curImage.url);
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
async reloadData() {
|
|
@@ -270,21 +277,25 @@ export default {
|
|
|
this.curImage.url = newUrl;
|
|
|
},
|
|
|
async toDelete() {
|
|
|
- const res = await this.$confirm(`确认要删除当前页已扫描数据?`, "提示", {
|
|
|
+ const tips = this.multipleSelection.length
|
|
|
+ ? `确认要删除当前已选择的扫描数据?`
|
|
|
+ : `确认要删除当前页的扫描数据?`;
|
|
|
+ const res = await this.$confirm(tips, "提示", {
|
|
|
type: "warning",
|
|
|
}).catch(() => {});
|
|
|
if (res !== "confirm") return;
|
|
|
|
|
|
- const { paperLibraryId } = this.getImageInfo(this.curImage.url);
|
|
|
-
|
|
|
+ const paperLibraryIds = this.multipleSelection.length
|
|
|
+ ? this.multipleSelection
|
|
|
+ : [this.curPage.paperLibraryId];
|
|
|
await deleteDocumentImage({
|
|
|
- studentId: this.student.studentId,
|
|
|
- paperLibraryId,
|
|
|
+ paperLibraryIds: paperLibraryIds.join(),
|
|
|
});
|
|
|
this.$message.success("操作成功!");
|
|
|
this.reloadData();
|
|
|
},
|
|
|
selectImage(index) {
|
|
|
+ if (!this.imageList[index]) return;
|
|
|
this.curImage = { url: this.imageList[index] };
|
|
|
this.curImageRotate = 0;
|
|
|
this.curPage = this.getImageInfo(this.curImage.url);
|