|
@@ -8,21 +8,17 @@
|
|
:close-on-press-escape="false"
|
|
:close-on-press-escape="false"
|
|
append-to-body
|
|
append-to-body
|
|
fullscreen
|
|
fullscreen
|
|
- @open="visibleChange"
|
|
|
|
|
|
+ @open="reloadData"
|
|
>
|
|
>
|
|
<div class="archives-student-body">
|
|
<div class="archives-student-body">
|
|
<div class="archives-student-content part-box">
|
|
<div class="archives-student-content part-box">
|
|
- <el-carousel
|
|
|
|
- height="100%"
|
|
|
|
- :autoplay="false"
|
|
|
|
- :loop="false"
|
|
|
|
- arrow="always"
|
|
|
|
- @change="imageChange"
|
|
|
|
- >
|
|
|
|
- <el-carousel-item v-for="item in imageList" :key="item">
|
|
|
|
- <el-image :src="item" fit="contain"></el-image>
|
|
|
|
- </el-carousel-item>
|
|
|
|
- </el-carousel>
|
|
|
|
|
|
+ <image-contain
|
|
|
|
+ ref="ImageContain"
|
|
|
|
+ :image="curImage"
|
|
|
|
+ @on-prev="toPrevImage"
|
|
|
|
+ @on-next="toNextImage"
|
|
|
|
+ @on-rotate="imageRotateChange"
|
|
|
|
+ ></image-contain>
|
|
</div>
|
|
</div>
|
|
<div class="archives-student-action part-box">
|
|
<div class="archives-student-action part-box">
|
|
<div class="archives-student-info">
|
|
<div class="archives-student-info">
|
|
@@ -53,6 +49,16 @@
|
|
</div>
|
|
</div>
|
|
<el-divider></el-divider>
|
|
<el-divider></el-divider>
|
|
<el-button type="primary" size="small" @click="toFix">纠错</el-button>
|
|
<el-button type="primary" size="small" @click="toFix">纠错</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ size="small"
|
|
|
|
+ :disabled="!curImageRotate"
|
|
|
|
+ @click="toSaveRotate"
|
|
|
|
+ >保存旋转</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="danger" size="small" @click="toDelete"
|
|
|
|
+ >删除</el-button
|
|
|
|
+ >
|
|
<p class="tips-info tips-error">
|
|
<p class="tips-info tips-error">
|
|
注意:<br />
|
|
注意:<br />
|
|
当图片里学生信息与右侧学生信息不一致时请执行纠错操作!
|
|
当图片里学生信息与右侧学生信息不一致时请执行纠错操作!
|
|
@@ -67,18 +73,24 @@
|
|
ref="LibraryDialog"
|
|
ref="LibraryDialog"
|
|
mode="fix"
|
|
mode="fix"
|
|
:student="studentInfo"
|
|
:student="studentInfo"
|
|
- @closed="getImageList"
|
|
|
|
|
|
+ @closed="reloadData"
|
|
></library-dialog>
|
|
></library-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import LibraryDialog from "./LibraryDialog.vue";
|
|
import LibraryDialog from "./LibraryDialog.vue";
|
|
-import { studentPictureList } from "../api";
|
|
|
|
|
|
+import ImageContain from "@/components/ImageContain.vue";
|
|
|
|
+import {
|
|
|
|
+ studentPictureList,
|
|
|
|
+ updateDocumentImageRotate,
|
|
|
|
+ deleteDocumentImage,
|
|
|
|
+} from "../api";
|
|
|
|
+import { uncacheUrl } from "@/plugins/utils";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "archives-detail-student-dialog",
|
|
name: "archives-detail-student-dialog",
|
|
- components: { LibraryDialog },
|
|
|
|
|
|
+ components: { LibraryDialog, ImageContain },
|
|
props: {
|
|
props: {
|
|
student: {
|
|
student: {
|
|
type: Object,
|
|
type: Object,
|
|
@@ -91,14 +103,25 @@ export default {
|
|
return {
|
|
return {
|
|
modalIsShow: false,
|
|
modalIsShow: false,
|
|
imageList: [],
|
|
imageList: [],
|
|
- imageIndex: 0,
|
|
|
|
pageList: [],
|
|
pageList: [],
|
|
studentInfo: {},
|
|
studentInfo: {},
|
|
|
|
+ // image preview
|
|
|
|
+ curImage: { url: "" },
|
|
|
|
+ curImageIndex: 0,
|
|
|
|
+ curImageRotate: 0,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- visibleChange() {
|
|
|
|
- this.getImageList();
|
|
|
|
|
|
+ async reloadData() {
|
|
|
|
+ this.initData();
|
|
|
|
+ await this.getImageList();
|
|
|
|
+ },
|
|
|
|
+ initData() {
|
|
|
|
+ this.imageList = [];
|
|
|
|
+ this.pageList = [];
|
|
|
|
+ this.curImage = { url: "" };
|
|
|
|
+ this.curImageRotate = 0;
|
|
|
|
+ this.curImageIndex = 0;
|
|
},
|
|
},
|
|
cancel() {
|
|
cancel() {
|
|
this.modalIsShow = false;
|
|
this.modalIsShow = false;
|
|
@@ -112,31 +135,94 @@ export default {
|
|
studentId: this.student.studentId,
|
|
studentId: this.student.studentId,
|
|
});
|
|
});
|
|
this.pageList = resData.fileUrls || [];
|
|
this.pageList = resData.fileUrls || [];
|
|
- let imageList = [];
|
|
|
|
- this.pageList.forEach((item) => {
|
|
|
|
- imageList.push(...item.fileUrls);
|
|
|
|
- });
|
|
|
|
- this.imageList = imageList;
|
|
|
|
- },
|
|
|
|
- imageChange(imageIndex) {
|
|
|
|
- this.imageIndex = imageIndex;
|
|
|
|
|
|
+ // this.pageList.forEach((item) => {
|
|
|
|
+ // item.fileUrls = item.fileUrls.map((img) => uncacheUrl(img));
|
|
|
|
+ // });
|
|
|
|
+ this.imageList = this.pageList.map((item) => item.fileUrls).flat();
|
|
|
|
+ this.selectImage(0);
|
|
},
|
|
},
|
|
|
|
+ // actions
|
|
toFix() {
|
|
toFix() {
|
|
- const curImage = this.imageList[this.imageIndex];
|
|
|
|
- const curPage = this.pageList.find((item) =>
|
|
|
|
- item.fileUrls.includes(curImage)
|
|
|
|
- );
|
|
|
|
- if (!curPage) return;
|
|
|
|
|
|
+ const info = this.getImageInfo(this.curImage.url);
|
|
|
|
|
|
this.studentInfo = {
|
|
this.studentInfo = {
|
|
...this.student,
|
|
...this.student,
|
|
- curPagePaperIndex: curPage.fileUrls.indexOf(curImage),
|
|
|
|
- pageList: [
|
|
|
|
- { ...curPage, paperScanTaskId: this.student.paperScanTaskId },
|
|
|
|
- ],
|
|
|
|
|
|
+ curPagePaperIndex: info.pindex,
|
|
|
|
+ pageList: [{ ...info, paperScanTaskId: this.student.paperScanTaskId }],
|
|
};
|
|
};
|
|
this.$refs.LibraryDialog.open();
|
|
this.$refs.LibraryDialog.open();
|
|
},
|
|
},
|
|
|
|
+ getImageInfo(url) {
|
|
|
|
+ const curPage = this.pageList.find((item) => item.fileUrls.includes(url));
|
|
|
|
+ const pindex = curPage.fileUrls.indexOf(url);
|
|
|
|
+ return { ...curPage, pindex };
|
|
|
|
+ },
|
|
|
|
+ imageRotateChange(rotate) {
|
|
|
|
+ this.curImageRotate = rotate;
|
|
|
|
+ },
|
|
|
|
+ async toSaveRotate() {
|
|
|
|
+ if (!this.curImageRotate) return;
|
|
|
|
+
|
|
|
|
+ const { paperLibraryId, pindex } = this.getImageInfo(this.curImage.url);
|
|
|
|
+
|
|
|
|
+ await updateDocumentImageRotate({
|
|
|
|
+ paperScanTaskId: this.student.paperScanTaskId,
|
|
|
|
+ studentId: this.student.studentId,
|
|
|
|
+ paperLibraryId,
|
|
|
|
+ pindex,
|
|
|
|
+ rotate: this.curImageRotate,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ this.updateImageSource(this.curImage.url, uncacheUrl(this.curImage.url));
|
|
|
|
+ },
|
|
|
|
+ updateImageSource(oldUrl, newUrl) {
|
|
|
|
+ const curPage = this.pageList.find((item) =>
|
|
|
|
+ item.fileUrls.includes(oldUrl)
|
|
|
|
+ );
|
|
|
|
+ const pindex = curPage.fileUrls.indexOf(oldUrl);
|
|
|
|
+ curPage.fileUrls[pindex] = newUrl;
|
|
|
|
+
|
|
|
|
+ const imgIndex = this.imageList.indexOf(oldUrl);
|
|
|
|
+ this.imgIndex[imgIndex] = newUrl;
|
|
|
|
+ },
|
|
|
|
+ async toDelete() {
|
|
|
|
+ const res = await this.$confirm(`确认要删除当前页已扫描数据?`, "提示", {
|
|
|
|
+ type: "warning",
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ if (res !== "confirm") return;
|
|
|
|
+
|
|
|
|
+ const { paperLibraryId } = this.getImageInfo(this.curImage.url);
|
|
|
|
+
|
|
|
|
+ await deleteDocumentImage({
|
|
|
|
+ paperScanTaskId: this.student.paperScanTaskId,
|
|
|
|
+ studentId: this.student.studentId,
|
|
|
|
+ paperLibraryId,
|
|
|
|
+ });
|
|
|
|
+ this.$message.success("操作成功!");
|
|
|
|
+ this.reloadData();
|
|
|
|
+ },
|
|
|
|
+ selectImage(index) {
|
|
|
|
+ this.curImage = { url: this.imageList[index] };
|
|
|
|
+ this.curImageRotate = 0;
|
|
|
|
+ },
|
|
|
|
+ toPrevImage() {
|
|
|
|
+ if (this.curImageIndex === 0) {
|
|
|
|
+ this.curImageIndex = this.imageList.length - 1;
|
|
|
|
+ } else {
|
|
|
|
+ this.curImageIndex--;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.selectImage(this.curImageIndex);
|
|
|
|
+ },
|
|
|
|
+ toNextImage() {
|
|
|
|
+ if (this.curImageIndex === this.imageList.length - 1) {
|
|
|
|
+ this.curImageIndex = 0;
|
|
|
|
+ } else {
|
|
|
|
+ this.curImageIndex++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.selectImage(this.curImageIndex);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|