富文本图片渲染失败的问题

master
blak-kong 2 years ago
parent 7a681d6412
commit e270a5b9f5

@ -140,10 +140,12 @@ export default {
handler(val) {
if (val !== this.currentValue) {
this.currentValue = val === null ? '' : val
setTimeout(() => {
let ele = document.body.querySelector(`#${this.tableName} .editor`)
if (ele) {
ele.children[0].innerHTML = this.currentValue
}
}, 100)
}
},
immediate: true,

@ -519,7 +519,11 @@
</el-select>
</el-form-item>
<el-form-item v-if="form.type === 2" label="仪器型号" prop="model">
<el-select v-model="form.model" @change="modelChange" style="width: 50%">
<el-select
v-model="form.model"
@change="modelChange"
style="width: 50%"
>
<el-option label="FR200" value="FR200"></el-option>
<el-option label="WL200" value="WL200"></el-option>
<el-option label="FR380" value="FR380"></el-option>
@ -957,7 +961,11 @@
/>
</el-form-item>
<!-- WE200 -->
<el-form-item v-if="form.type == 2" label="WE200IOT版本" prop="we200IotVersion">
<el-form-item
v-if="form.type == 2"
label="WE200IOT版本"
prop="we200IotVersion"
>
<div style="position: relative">
<el-tooltip
class="item"
@ -968,7 +976,10 @@
<i class="we200-iotVersion-absolute-info el-icon-info"></i>
</el-tooltip>
</div>
<el-input v-model="form.we200IotVersion" placeholder="请输入WE200IOT版本" />
<el-input
v-model="form.we200IotVersion"
placeholder="请输入WE200IOT版本"
/>
</el-form-item>
<el-form-item
v-if="form.type == 2"
@ -1181,7 +1192,8 @@
>
<!-- scope.row.link -->
<template slot-scope="scope">
<el-upload ref="bookUpload"
<el-upload
ref="bookUpload"
class="upload-demo"
:action="uploadUrl"
:headers="headers"
@ -1222,7 +1234,7 @@
@click="viewInstrumentInstruction(scope.row)"
>查看说明书
</el-button>
<br/>
<br />
<el-button
v-if="scope.row.link != null"
size="mini"
@ -1306,7 +1318,7 @@ export default {
},
imageFileType: {
type: Array,
default: () => ["bmp", "gif", "jpg", "jpeg", "png"],
default: () => ['bmp', 'gif', 'jpg', 'jpeg', 'png'],
},
videoFileSize: {
type: Number,
@ -1314,7 +1326,7 @@ export default {
},
videoFileType: {
type: Array,
default: () => ["mp4", "avi", "rmvb"],
default: () => ['mp4', 'avi', 'rmvb'],
},
pdfFileSize: {
type: Number,
@ -1322,7 +1334,7 @@ export default {
},
pdfFileType: {
type: Array,
default: () => ["pdf", "PDF"],
default: () => ['pdf', 'PDF'],
},
},
data() {
@ -1559,10 +1571,12 @@ export default {
/** 查询仪器列列表 */
getList() {
this.loading = true
listInstrument(this.queryParams).then((response) => {
listInstrument(this.queryParams)
.then((response) => {
this.instrumentList = response.rows
this.total = response.total
}).finally(() => {
})
.finally(() => {
this.loading = false
})
},
@ -1732,9 +1746,9 @@ export default {
this.open = true
this.title = '添加仪器列'
/* 所有模式选项 */
this.mode.modeIdsOptions = [];
this.mode.modeIdsOptions = []
listAllMode({
instrumentType: this.form.type
instrumentType: this.form.type,
}).then((response) => {
if (response.code != 200) {
this.$message.error('模式获取失败')
@ -1853,7 +1867,7 @@ export default {
this.mode.modeIdsOptions = []
listAllMode({
instrumentType: this.form.type,
instrumentModel: this.form.model
instrumentModel: this.form.model,
}).then((response) => {
if (response.code != 200) {
this.$message.error('模式获取失败')
@ -1868,49 +1882,57 @@ export default {
let temp = []
for (let i = 0; i < this.form.modeIdsValue.length; i++) {
let filterModeArr = this.mode.modeIdsOptions.filter(
(item) => item !== undefined && this.form.modeIdsValue[i] === item.id
(item) =>
item !== undefined && this.form.modeIdsValue[i] === item.id
)
if(filterModeArr !== undefined && filterModeArr.length > 0) {
if (filterModeArr !== undefined && filterModeArr.length > 0) {
temp.push(filterModeArr[0])
}
}
if(temp !== undefined && temp.length > 0) {
if (temp !== undefined && temp.length > 0) {
this.newModeOptionList = temp
}
}
})
// IOT
this.form.iotVersionUpgrade = decodeURIComponent(this.form.iotVersionUpgrade)
this.form.iotVersionUpgrade = decodeURIComponent(
this.form.iotVersionUpgrade
)
// WE200IOT
this.form.iotVersionUpgrade = decodeURIComponent(this.form.we200IotVersionUpgrade)
this.form.iotVersionUpgrade = decodeURIComponent(
this.form.we200IotVersionUpgrade
)
})
},
/** 提交按钮 */
submitForm() {
//
for (let i = 0; i < this.nurseList.length; i++) {
if(this.nurseList[i].file != '' || this.nurseList[i].message != '') {
if(this.nurseList[i].file == '') {
this.$modal.msgError('请上传初次护理弹窗提示视频或图片');
return;
if (this.nurseList[i].file != '' || this.nurseList[i].message != '') {
if (this.nurseList[i].file == '') {
this.$modal.msgError('请上传初次护理弹窗提示视频或图片')
return
}
if(this.nurseList[i].message == '') {
this.$modal.msgError('请输入初次护理规则提示内容');
return;
if (this.nurseList[i].message == '') {
this.$modal.msgError('请输入初次护理规则提示内容')
return
}
}
}
//
for (let i = 0; i < this.introduceList.length; i++) {
if(this.introduceList[i].file != '' || this.introduceList[i].message != '') {
if (
this.introduceList[i].file != '' ||
this.introduceList[i].message != ''
) {
if (this.introduceList[i].file == '') {
this.$modal.msgError('请上传仪器介绍弹窗提示视频或图片');
return;
this.$modal.msgError('请上传仪器介绍弹窗提示视频或图片')
return
}
if (this.introduceList[i].message == '') {
this.$modal.msgError('请输入仪器介绍规则提示内容');
return;
this.$modal.msgError('请输入仪器介绍规则提示内容')
return
}
}
}
@ -2100,30 +2122,30 @@ export default {
typeChange() {
// IOT
if (this.form.type == 1) {
this.form.model = null;
this.form.nursingTime = null;
this.form.iotVersion = null;
this.form.iotUpgradeData = null;
this.form.bluetoothConnecting = null;
this.form.bluetoothConnectingTitle = null;
this.form.bluetoothConnectingContent = null;
this.form.bluetoothConnectFail = null;
this.form.bluetoothConnectFailTitle = null;
this.form.bluetoothConnectFailContent = null;
this.form.bluetoothClosed = null;
this.form.bluetoothClosedTitle = null;
this.form.bluetoothClosedContent = null;
this.form.iotVersionUpgrade = null;
this.form.modeIdsValue = [];
this.form.model = null
this.form.nursingTime = null
this.form.iotVersion = null
this.form.iotUpgradeData = null
this.form.bluetoothConnecting = null
this.form.bluetoothConnectingTitle = null
this.form.bluetoothConnectingContent = null
this.form.bluetoothConnectFail = null
this.form.bluetoothConnectFailTitle = null
this.form.bluetoothConnectFailContent = null
this.form.bluetoothClosed = null
this.form.bluetoothClosedTitle = null
this.form.bluetoothClosedContent = null
this.form.iotVersionUpgrade = null
this.form.modeIdsValue = []
} else {
this.form.model = "WL200";
this.form.modeIdsValue = [];
this.form.model = 'WL200'
this.form.modeIdsValue = []
}
/* 模式选项 */
this.mode.modeIdsOptions = [];
this.mode.modeIdsOptions = []
listAllMode({
instrumentType: this.form.type,
instrumentModel: this.form.model
instrumentModel: this.form.model,
}).then((response) => {
if (response.code != 200) {
this.$message.error('模式获取失败')
@ -2133,10 +2155,10 @@ export default {
},
modelChange() {
/* 模式选项 */
this.mode.modeIdsOptions = [];
this.mode.modeIdsOptions = []
listAllMode({
instrumentType: this.form.type,
instrumentModel: this.form.model
instrumentModel: this.form.model,
}).then((response) => {
if (response.code != 200) {
this.$message.error('模式获取失败')
@ -2444,10 +2466,10 @@ export default {
this.$modal.msgError('请上传说明书')
return
}
let pattern = /^[a-zA-Z0-9]+$/;
let pattern = /^[a-zA-Z0-9]+$/
if (!pattern.test(item.name)) {
this.$modal.msgError("说明书类型只能为数字和英文的组合");
return;
this.$modal.msgError('说明书类型只能为数字和英文的组合')
return
}
if (item.id != null) {
updateInstructions(item).then((response) => {
@ -2456,7 +2478,7 @@ export default {
} else {
addInstructions(item).then((response) => {
this.$modal.msgSuccess('新增成功')
item.save = true;
item.save = true
})
}
},
@ -2477,7 +2499,7 @@ export default {
copyInstructionNameUrl(item) {
navigator.clipboard.writeText(item.nameUrl).then(() => {
this.$message.success('已成功复制到剪贴板')
});
})
},
/* 模式 */
openModeIdDialog() {
@ -2521,70 +2543,72 @@ export default {
//
handleBeforeUpload(file) {
//
const fileName = file.name.split('.');
const fileExt = fileName[fileName.length - 1];
const isImageTypeOk = this.imageFileType.indexOf(fileExt) >= 0;
const isVideoTypeOk = this.videoFileType.indexOf(fileExt) >= 0;
const fileName = file.name.split('.')
const fileExt = fileName[fileName.length - 1]
const isImageTypeOk = this.imageFileType.indexOf(fileExt) >= 0
const isVideoTypeOk = this.videoFileType.indexOf(fileExt) >= 0
if (!(isImageTypeOk || isVideoTypeOk)) {
this.$modal.msgError(`文件格式不正确`);
return false;
this.$modal.msgError(`文件格式不正确`)
return false
}
//
if(isImageTypeOk) {
const isLt = file.size / 1024 / 1024 < this.imageFileSize;
if (isImageTypeOk) {
const isLt = file.size / 1024 / 1024 < this.imageFileSize
if (!isLt) {
this.$modal.msgError(`上传图片大小不能超过 ${this.imageFileSize} MB!`);
return false;
this.$modal.msgError(`上传图片大小不能超过 ${this.imageFileSize} MB!`)
return false
}
}
if(isVideoTypeOk) {
const isLt = file.size / 1024 / 1024 < this.videoFileSize;
if (isVideoTypeOk) {
const isLt = file.size / 1024 / 1024 < this.videoFileSize
if (!isLt) {
this.$modal.msgError(`上传视频大小不能超过 ${this.videoFileSize} MB!`);
return false;
this.$modal.msgError(`上传视频大小不能超过 ${this.videoFileSize} MB!`)
return false
}
}
return true;
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;
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;
this.$modal.msgError(`说明书文件类型只能为PDF格式`)
return false
}
}
//
if (this.pdfFileSize) {
const isLt = file.size / 1024 / 1024 < this.pdfFileSize;
const isLt = file.size / 1024 / 1024 < this.pdfFileSize
if (!isLt) {
this.$modal.msgError(`上传文件大小不能超过 ${this.pdfFileSize} MB!`);
return false;
this.$modal.msgError(`上传文件大小不能超过 ${this.pdfFileSize} MB!`)
return false
}
}
//
var regex = /^[a-zA-Z0-9\-_.]+$/;
if(!regex.test(file.name)) {
this.$modal.msgError(`文件名只能由字母、数字、以及一些常用的特殊符号(比如连字符、下划线和点号等)组成`);
return false;
var regex = /^[a-zA-Z0-9\-_.]+$/
if (!regex.test(file.name)) {
this.$modal.msgError(
`文件名只能由字母、数字、以及一些常用的特殊符号(比如连字符、下划线和点号等)组成`
)
return false
}
return true;
return true
},
handleBeforeUploadImage(file) {
let fileType = ["jpg", "png", "JPG", "PNG"]
const fileName = file.name.split('.');
const fileExt = fileName[fileName.length - 1];
const isTypeOk = fileType.indexOf(fileExt) >= 0;
let fileType = ['jpg', 'png', 'JPG', 'PNG']
const fileName = file.name.split('.')
const fileExt = fileName[fileName.length - 1]
const isTypeOk = fileType.indexOf(fileExt) >= 0
if (!isTypeOk) {
this.$modal.msgError(`文件类型只能为jpg格式/png格式`);
return false;
this.$modal.msgError(`文件类型只能为jpg格式/png格式`)
return false
}
return true;
return true
},
},
}
@ -2617,41 +2641,41 @@ video {
position: absolute;
top: 10px;
left: -140px;
color: #FAAD14;
color: #faad14;
}
.iotVersion-absolute-info {
position: absolute;
top: 10px;
left: -84px;
color: #FAAD14;
color: #faad14;
}
.iotUpgradeData-absolute-info {
position: absolute;
top: 10px;
left: -140px;
color: #FAAD14;
color: #faad14;
}
.we200-absolute-info {
position: absolute;
top: 10px;
left: -183px;
color: #FAAD14;
color: #faad14;
}
.we200-iotVersion-absolute-info {
position: absolute;
top: 10px;
left: -128px;
color: #FAAD14;
color: #faad14;
}
.we200-iotUpgradeData-absolute-info {
position: absolute;
top: 10px;
left: -184px;
color: #FAAD14;
color: #faad14;
}
</style>

Loading…
Cancel
Save