|
|
|
|
@ -1191,6 +1191,7 @@
|
|
|
|
|
:on-error="uploadError"
|
|
|
|
|
:file-list="scope.row.fileList"
|
|
|
|
|
accept=".pdf,.PDF"
|
|
|
|
|
:before-upload="pdfHandleBeforeUpload"
|
|
|
|
|
>
|
|
|
|
|
<el-button size="small" type="primary">点击上传</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
@ -1199,14 +1200,14 @@
|
|
|
|
|
<el-table-column label="操作">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="scope.row.link != null"
|
|
|
|
|
v-show="scope.row.save"
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
@click="copyInstructionNameUrl(scope.row)"
|
|
|
|
|
>复制说明书
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="scope.row.link != null"
|
|
|
|
|
v-show="scope.row.save"
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
@click="viewInstrumentInstruction(scope.row)"
|
|
|
|
|
@ -1216,7 +1217,7 @@
|
|
|
|
|
v-if="scope.row.link != null"
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
@click="saveInstrumentInstruction(scope.row)"
|
|
|
|
|
@click="saveInstrumentInstruction(scope.row, scope.$index)"
|
|
|
|
|
>保存说明书
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
@ -1297,6 +1298,14 @@ export default {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => ["bmp", "gif", "jpg", "jpeg", "png", "mp4", "avi", "rmvb"],
|
|
|
|
|
},
|
|
|
|
|
pdfFileSize: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 10,
|
|
|
|
|
},
|
|
|
|
|
pdfFileType: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => ["pdf", "PDF"],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
@ -1512,6 +1521,7 @@ export default {
|
|
|
|
|
instrumentId: null,
|
|
|
|
|
name: null,
|
|
|
|
|
link: null,
|
|
|
|
|
save: false,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
@ -2325,6 +2335,7 @@ export default {
|
|
|
|
|
instrumentId: this.instrumentInstructions.instrumentId,
|
|
|
|
|
name: null,
|
|
|
|
|
link: null,
|
|
|
|
|
save: false,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
editInstrumentInstructionVisible(row) {
|
|
|
|
|
@ -2370,19 +2381,24 @@ export default {
|
|
|
|
|
this.addInstrumentInstructionLine()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
saveInstrumentInstruction(item) {
|
|
|
|
|
saveInstrumentInstruction(item, index) {
|
|
|
|
|
if (item.instrumentId == null) {
|
|
|
|
|
this.$modal.msgError('参数异常')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (item.name == null) {
|
|
|
|
|
this.$modal.msgError('请输入说明书名称')
|
|
|
|
|
if (item.name == null || item.name.trim().length === 0) {
|
|
|
|
|
this.$modal.msgError('请输入说明书类型')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (item.link == null) {
|
|
|
|
|
this.$modal.msgError('请上传说明书')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let pattern = /^[a-zA-Z0-9]+$/;
|
|
|
|
|
if (!pattern.test(item.name)) {
|
|
|
|
|
this.$modal.msgError("说明书类型只能为数字和英文的组合");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (item.id != null) {
|
|
|
|
|
updateInstructions(item).then((response) => {
|
|
|
|
|
this.$modal.msgSuccess('修改成功')
|
|
|
|
|
@ -2390,6 +2406,7 @@ export default {
|
|
|
|
|
} else {
|
|
|
|
|
addInstructions(item).then((response) => {
|
|
|
|
|
this.$modal.msgSuccess('新增成功')
|
|
|
|
|
item.save = true;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -2473,6 +2490,28 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
pdfHandleBeforeUpload(file) {
|
|
|
|
|
// 校检文件类型
|
|
|
|
|
if (this.pdfFileType) {
|
|
|
|
|
const fileName = file.name.split('.');
|
|
|
|
|
const fileExt = fileName[fileName.length - 1];
|
|
|
|
|
const isTypeOk = this.pdfFileType.indexOf(fileExt) >= 0;
|
|
|
|
|
if (!isTypeOk) {
|
|
|
|
|
this.$modal.msgError(`说明书文件类型只能为PDF格式`);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校检文件大小
|
|
|
|
|
if (this.pdfFileSize) {
|
|
|
|
|
const isLt = file.size / 1024 / 1024 < this.pdfFileSize;
|
|
|
|
|
if (!isLt) {
|
|
|
|
|
this.$modal.msgError(`上传文件大小不能超过 ${this.pdfFileSize} MB!`);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|