修改
This commit is contained in:
parent
b2cb39bd84
commit
9e142de3de
@ -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 {
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user