This commit is contained in:
2024-04-08 10:58:02 +08:00
parent b2cb39bd84
commit 9e142de3de
2 changed files with 43 additions and 15 deletions

View File

@ -41,6 +41,7 @@ import { getToken } from "@/utils/auth";
var that var that
export default ({ export default ({
props: ['nodeContent'],
components: { Editor, Toolbar }, components: { Editor, Toolbar },
name: 'wangEditor', name: 'wangEditor',
data() { data() {
@ -86,6 +87,7 @@ export default ({
}, },
methods: { methods: {
emit() { emit() {
console.log()
this.$emit("on-nodeContent", { nodeContent: this.html }); this.$emit("on-nodeContent", { nodeContent: this.html });
}, },
panelchange(item) { panelchange(item) {
@ -124,7 +126,7 @@ export default ({
link: '', link: '',
fileName: this.addnode.fileName, fileName: this.addnode.fileName,
fileSpan: this.addnode.fileSpan, fileSpan: this.addnode.fileSpan,
children: [{ text: ' ' }], // void children children: [{ text: '' }], // void children
} }
this.editor.insertNode(resume) this.editor.insertNode(resume)
this.addnode = { this.addnode = {
@ -149,7 +151,7 @@ export default ({
link: '', link: '',
fileName: this.addnode.fileName, fileName: this.addnode.fileName,
fileSpan: this.addnode.fileSpan, fileSpan: this.addnode.fileSpan,
children: [{ text: ' ' }], // void children children: [{ text: '' }], // void children
} }
this.editor.insertNode(resume) this.editor.insertNode(resume)
this.addnode = { this.addnode = {
@ -192,7 +194,15 @@ export default ({
this.labelshow = false this.labelshow = false
}, },
}, },
watch: {
nodeContent(newValue, oldValue) {
if (newValue) {
this.html = newValue;
}
}
},
mounted() { mounted() {
this.html = this.nodeContent
}, },
beforeDestroy() { beforeDestroy() {
const editor = this.editor const editor = this.editor
@ -279,7 +289,6 @@ function withAttachment(editor) { // JS 语法
const type = DomEditor.getNodeType(elem) const type = DomEditor.getNodeType(elem)
if (type === 'attachment') return true // type: attachment inline if (type === 'attachment') return true // type: attachment inline
if (type === 'attachmenttwo') return true // type: attachment inline if (type === 'attachmenttwo') return true // type: attachment inline
if (type === 'text') return true // type: attachment inline
return isInline(elem) return isInline(elem)
} }
newEditor.isVoid = elem => { newEditor.isVoid = elem => {
@ -464,8 +473,7 @@ function attachmentToHtml(elem, childrenHtml) { // JS 语法
// //
const { link = '', fileName = '', fileSpan = '' } = elem const { link = '', fileName = '', fileSpan = '' } = elem
// HTML // HTML
const html = ` const html = `<span data-w-e-type="attachment"
<span data-w-e-type="attachment"
data-w-e-is-void data-w-e-is-void
data-w-e-is-inline data-w-e-is-inline
data-link="${link}" data-link="${link}"
@ -482,8 +490,7 @@ function attachmentToHtmltwo(elem, childrenHtml) { // JS 语法
// //
const { link = '', fileName = '', fileSpan = '' } = elem const { link = '', fileName = '', fileSpan = '' } = elem
// HTML // HTML
const html = ` const html = `<span data-w-e-type="attachmenttwo"
<span data-w-e-type="attachmenttwo"
data-w-e-is-void data-w-e-is-void
data-w-e-is-inline data-w-e-is-inline
data-link="${link}" data-link="${link}"
@ -523,11 +530,33 @@ function parseAttachmentHtml(domElem, children, editor) {
} }
return myResume return myResume
} }
function parseAttachmentHtmltwo(domElem, children, editor) { // JS
// DOM element
const link = domElem.getAttribute('data-link') || ''
const fileName = domElem.getAttribute('data-fileName') || ''
const fileSpan = domElem.getAttribute('data-fileSpan') || ''
//
const myResume = {
type: 'attachmenttwo',
link,
fileName,
fileSpan,
children: [{ text: '' }], // void node children
}
return myResume
}
const parseHtmlConf = { const parseHtmlConf = {
selector: 'span[data-w-e-type="attachment"]', // CSS HTML selector: 'span[data-w-e-type="attachment"]', // CSS HTML
parseElemHtml: parseAttachmentHtml, parseElemHtml: parseAttachmentHtml,
} }
Boot.registerParseElemHtml(parseHtmlConf) const parseHtmlConftwo = {
selector: 'span[data-w-e-type="attachmenttwo"]', // CSS HTML
parseElemHtml: parseAttachmentHtmltwo,
}
const parseHtmlConfmodule = {
parseElemsHtml: [parseHtmlConf, parseHtmlConftwo] // parseElemHtml
}
Boot.registerModule(parseHtmlConfmodule)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .el-textarea__inner { ::v-deep .el-textarea__inner {

View File

@ -96,7 +96,8 @@
</el-form> </el-form>
</div> </div>
<div class="bottomform"> <div class="bottomform">
<wangeditor style="width:100%;" @on-nodeContent="onNodeContent" ref="wangeditor" /> <wangeditor style="width:100%;" :nodeContent="form.nodeContent" @on-nodeContent="onNodeContent"
ref="wangeditor" />
<div class="card"> <div class="card">
<div class="flex"> <div class="flex">
<div class="pushMethod"> <div class="pushMethod">
@ -319,12 +320,10 @@ export default {
this.updata.specialDiseaseRouteId = this.$route.query.id this.updata.specialDiseaseRouteId = this.$route.query.id
selectSpecialDisease(this.$route.query.id).then(res => { selectSpecialDisease(this.$route.query.id).then(res => {
res.data.specialDiseaseNodeList.forEach(e => { res.data.specialDiseaseNodeList.forEach(e => {
if (e.taskType) { e.taskType = Number(e.taskType)
e.taskType = Number(e.taskType)
this.changeTaskType(e.taskType, e.taskSubdivision)
}
e.taskSubdivision = Number(e.taskSubdivision) e.taskSubdivision = Number(e.taskSubdivision)
e.taskStatus = Number(e.taskStatus) e.taskStatus = Number(e.taskStatus)
this.changeTaskType(e.taskType, e.taskSubdivision)
let item = { let item = {
routeNodeName: e.routeNodeName, routeNodeName: e.routeNodeName,
routeNodeDay: e.routeNodeDay, routeNodeDay: e.routeNodeDay,
@ -402,8 +401,7 @@ export default {
this.updata.specialDiseaseNodeList.push(el) this.updata.specialDiseaseNodeList.push(el)
}) : "" }) : ""
}) })
specialDiseaseNode(this.updata).then(res => { specialDiseaseNode(this.updata).then(res => { })
})
}, },
// //
questionontemplate(item) { questionontemplate(item) {
@ -454,6 +452,7 @@ export default {
}) })
}, },
changetaskSubdivision(e) { changetaskSubdivision(e) {
this.form.taskSubdivision = e
this.taskPartitionList.forEach(el => { this.taskPartitionList.forEach(el => {
if (e == el.id) { if (e == el.id) {
this.form.executionTime = el.executionTime this.form.executionTime = el.executionTime