|
@@ -151,13 +151,17 @@
|
|
ref="PreviewAttachment"
|
|
ref="PreviewAttachment"
|
|
:attachment-ids="attachmentIds"
|
|
:attachment-ids="attachmentIds"
|
|
></preview-attachment>
|
|
></preview-attachment>
|
|
|
|
+ <!-- PreviewFile -->
|
|
|
|
+ <preview-file ref="PreviewFile" :data="curFile"></preview-file>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { updatePlanLinkPaper, linkPaperNumberList } from "../api";
|
|
import { updatePlanLinkPaper, linkPaperNumberList } from "../api";
|
|
import { taskApplyDetail } from "../../exam/api";
|
|
import { taskApplyDetail } from "../../exam/api";
|
|
|
|
+import { attachmentPreview } from "../../login/api";
|
|
import PreviewAttachment from "@/components/PreviewAttachment.vue";
|
|
import PreviewAttachment from "@/components/PreviewAttachment.vue";
|
|
|
|
+import PreviewFile from "@/components/PreviewFile.vue";
|
|
|
|
|
|
const initModalForm = {
|
|
const initModalForm = {
|
|
id: null,
|
|
id: null,
|
|
@@ -168,7 +172,7 @@ const initModalForm = {
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "modify-plan-paper",
|
|
name: "modify-plan-paper",
|
|
- components: { PreviewAttachment },
|
|
|
|
|
|
+ components: { PreviewAttachment, PreviewFile },
|
|
props: {
|
|
props: {
|
|
instance: {
|
|
instance: {
|
|
type: Object,
|
|
type: Object,
|
|
@@ -215,6 +219,11 @@ export default {
|
|
},
|
|
},
|
|
// attachmentId preview
|
|
// attachmentId preview
|
|
attachmentIds: [],
|
|
attachmentIds: [],
|
|
|
|
+ // preview file
|
|
|
|
+ curFile: {
|
|
|
|
+ url: "",
|
|
|
|
+ type: "",
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -274,11 +283,25 @@ export default {
|
|
);
|
|
);
|
|
if (paper) this.paperTypes = paper.paperTypes;
|
|
if (paper) this.paperTypes = paper.paperTypes;
|
|
},
|
|
},
|
|
- toViewAttachment(attachment) {
|
|
|
|
|
|
+ async toViewAttachment(attachment) {
|
|
if (!attachment.jpgAttachmentId) {
|
|
if (!attachment.jpgAttachmentId) {
|
|
- this.$message.error("附件丢失!");
|
|
|
|
|
|
+ if (!attachment.attachmentId) {
|
|
|
|
+ this.$message.error("附件丢失!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const data = await attachmentPreview(attachment.attachmentId);
|
|
|
|
+ if (!data[0].url) {
|
|
|
|
+ this.$message.error("附件丢失!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.curFile = {
|
|
|
|
+ url: data[0].url,
|
|
|
|
+ type: "application/pdf",
|
|
|
|
+ };
|
|
|
|
+ this.$refs.PreviewFile.open();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
const datas = JSON.parse(attachment.jpgAttachmentId);
|
|
const datas = JSON.parse(attachment.jpgAttachmentId);
|
|
this.attachmentIds = datas.map((item) => item.attachmentId);
|
|
this.attachmentIds = datas.map((item) => item.attachmentId);
|
|
this.$refs.PreviewAttachment.open();
|
|
this.$refs.PreviewAttachment.open();
|