Browse Source

fix:[资源库管理][供试品入库记录]有效期

lkf
HanLong 2 months ago
parent
commit
3d98f42e10
4 changed files with 75 additions and 25 deletions
  1. +9
    -6
      src/views/business/form/nonTrial/comp/syff/Xq.vue
  2. +15
    -0
      src/views/business/resource/gsp/comps/rkjl/Bj.vue
  3. +10
    -0
      src/views/business/resource/gsp/comps/rkjl/Xz.vue
  4. +41
    -19
      src/views/business/study/comp/syff/Xq.vue

+ 9
- 6
src/views/business/form/nonTrial/comp/syff/Xq.vue View File

@ -54,8 +54,6 @@
<script>
import { studyMethod_readList, studyMethod_export } from '@/api/business/study/studyMethod'
import html2canvas from 'html2canvas';
import { PDFDocument } from 'pdf-lib'
import { mapGetters } from 'vuex'
import pdf from 'vue-pdf'
import Yd from './Yd.vue'
@ -115,18 +113,23 @@ export default {
// PDF
getPageNum() {
let loadingTask = pdf.createLoadingTask(this.pdfSrc);
const loadingTask = pdf.createLoadingTask({
url: this.pdfSrc,
cMapUrl: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@4.8.69/cmaps/',
cMapPacked: true,
})
let that = this
//let loadingTask = pdf.createLoadingTask(this.pdfSrc);
loadingTask.promise
.then((pdf) => {
this.totalPages = pdf.numPages;
this.loadPdfFromUrl()
//this.loadPdfFromUrl()
// this.$nextTick(() => {
// this.setWatermarkContent();
// });
})
.catch((err) => {
this.$message.msgError("pdf加载失败");
that.$message.msgError("pdf加载失败");
});
},

+ 15
- 0
src/views/business/resource/gsp/comps/rkjl/Bj.vue View File

@ -51,6 +51,16 @@
<BusinessSelect v-model="form.rkdw"
dictType="business_nddw,business_zldw,business_tjdw"></BusinessSelect>
</el-col>
<!-- 有效期 -->
<el-col :span="12">
<el-form-item :label="$t('page.business.resource.gsp.yxq')" prop="yxq">
<el-date-picker v-model="form.yxq" type="date" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" :placeholder="$t('form.placeholderInput')">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- 存储条件 -->
<el-col :span="12">
<el-form-item :label="$t('page.business.resource.gsp.cctj')" prop="cctj">
@ -151,6 +161,11 @@ export default {
message: ' ',
trigger: 'blur'
}],
yxq: [{
required: true,
message: ' ',
trigger: 'blur'
}],
cctj: [{
required: true,
message: ' ',

+ 10
- 0
src/views/business/resource/gsp/comps/rkjl/Xz.vue View File

@ -51,6 +51,16 @@
<BusinessSelect v-model="form.rkdw"
dictType="business_nddw,business_zldw,business_tjdw"></BusinessSelect>
</el-col>
<!-- 有效期 -->
<el-col :span="12">
<el-form-item :label="$t('page.business.resource.gsp.yxq')" prop="yxq">
<el-date-picker v-model="form.yxq" type="date" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" :placeholder="$t('form.placeholderInput')">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- 存储条件 -->
<el-col :span="12">
<el-form-item :label="$t('page.business.resource.gsp.cctj')" prop="cctj">

+ 41
- 19
src/views/business/study/comp/syff/Xq.vue View File

@ -19,7 +19,7 @@
<div class="edit-content ">
<div class="pdf-layout">
<div class="pdf-content">
<pdf id="pdfBox" :page="pageNum" :src="pdfSrc" @progress="loadedRatio = $event"
<pdf id="pdfBox" :page="pageNum" :src="pdfUrl" @progress="loadedRatio = $event"
@num-pages="totalPages = $event"></pdf>
</div>
<div class="btn-layout" v-if="totalPages">
@ -31,7 +31,7 @@
class="el-icon-arrow-right el-icon--right"></i></el-button>
</el-button-group>
</div>
<div ref="contentToPdf" v-show="showExportBtn" style="width: 100%; margin-top: 30px;">
<div ref="contentToPdf" v-show="showExportBtn" style="width: 100%; margin-top: 30px;">
<div class="content-title">
<div class="line"></div>
<div class="subtitle"> {{ $t('page.business.study.studyMethod.qmhz') }}</div>
@ -54,11 +54,11 @@
<script>
import { studyMethod_readList, studyMethod_export } from '@/api/business/study/studyMethod'
import html2canvas from 'html2canvas';
import { PDFDocument } from 'pdf-lib'
import { mapGetters } from 'vuex'
import pdf from 'vue-pdf'
import Yd from './Yd.vue'
export default {
name: "Xq",
components: { pdf, Yd },
@ -66,6 +66,7 @@ export default {
return {
showExportBtn: false,
pdfSrc: '',
pdfUrl: '',
open: false,
pageNum: 1,
loadedRatio: 0, // 0-1 1
@ -77,7 +78,7 @@ export default {
},
computed: {
...mapGetters([
'nickName','name'
'nickName', 'name'
]),
},
created() {
@ -115,20 +116,40 @@ export default {
// PDF
getPageNum() {
let loadingTask = pdf.createLoadingTask(this.pdfSrc);
loadingTask.promise
.then((pdf) => {
this.totalPages = pdf.numPages;
this.loadPdfFromUrl()
// this.$nextTick(() => {
// this.setWatermarkContent();
// });
})
.catch((err) => {
this.$message.msgError("pdf加载失败");
});
// this.pdfUrl = pdf.createLoadingTask({
// url: this.pdfSrc,
// cMapUrl: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@4.8.69/cmaps/',
// cMapPacked: true,
// })
// let loadingTask = pdf.createLoadingTask(this.pdfSrc);
// loadingTask.promise
// .then((pdf) => {
// this.totalPages = pdf.numPages;
// //this.loadPdfFromUrl()
// // this.$nextTick(() => {
// // this.setWatermarkContent();
// // });
// })
// .catch((err) => {
// console.log(err)
// });
const loadingTask = pdf.createLoadingTask({
url: this.pdfSrc,
withCredentials: false,
cMapUrl: 'https://unpkg.com/pdfjs-dist@2.16.105/cmaps/',
cMapPacked: true,
})
loadingTask.promise.then(pdf => {
this.pdfDoc = pdf
this.totalPages = pdf.numPages
}).catch(err => {
console.error('PDF加载失败:', err)
})
this.pdfUrl = loadingTask
},
//
prePage() {
@ -148,10 +169,11 @@ export default {
closeYd(val) {
this.form.zt = val
this.cancel()
},
handleExport() {
studyMethod_export({studyMethodId: this.form.id}).then(response => {
studyMethod_export({ studyMethodId: this.form.id }).then(response => {
let fileUrl = response.data.fileUrl
this.$download.saveAs(process.env.VUE_APP_FILE_DOMAIN + fileUrl, this.form.ffmc + ".pdf");
})

Loading…
Cancel
Save