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

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

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

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

Loading…
Cancel
Save