This commit is contained in:
2024-06-28 14:13:59 +08:00
parent 4045310722
commit 9d0db56c87
2 changed files with 70 additions and 119 deletions

View File

@ -1,47 +1,23 @@
<template> <template>
<div style="border: 1px solid #ccc"> <div style="border: 1px solid #ccc">
<Toolbar <Toolbar style="border-bottom: 1px solid #ccc" :editor="editor" :defaultConfig="toolbarConfig" :mode="mode" />
style="border-bottom: 1px solid #ccc" <Editor style="height: 500px; overflow-y: hidden" v-model="html" :defaultConfig="editorConfig" :mode="mode"
:editor="editor" @onChange="onChange" @onCreated="onCreated" @onFocus="handleFocus" />
:defaultConfig="toolbarConfig" <el-dialog title="添加画像标签字段" :visible.sync="labelshow" width="40%" :before-close="beforeClose"
:mode="mode" class="category-cascader-panel">
/> <el-cascader-panel :key="isResouceShow" :options="labeloptions" @change="panelchange" v-if="labelshow"
<Editor ref="cascaderAddaddlist" v-model="selectedOptions" :props="{
style="height: 500px; overflow-y: hidden"
v-model="html"
:defaultConfig="editorConfig"
:mode="mode"
@onChange="onChange"
@onCreated="onCreated"
@onFocus="handleFocus"
/>
<el-dialog
title="添加画像标签字段"
:visible.sync="labelshow"
width="40%"
:before-close="beforeClose"
class="category-cascader-panel"
>
<el-cascader-panel
:key="isResouceShow"
:options="labeloptions"
@change="panelchange"
v-if="labelshow"
ref="cascaderAddaddlist"
v-model="selectedOptions"
:props="{
value: 'value', value: 'value',
label: 'label', label: 'label',
children: 'children', children: 'children',
checkStrictly: false, checkStrictly: false,
multiple: true, multiple: true,
}" }"></el-cascader-panel>
></el-cascader-panel>
<div> <div>
<div style="margin: 20px 0">结果预览:</div> <div style="margin: 20px 0">结果预览:</div>
<div v-for="(item, index) of addlist" :key="index"> <div v-for="(item, index) of addlist" :key="index">
<div>{{ item }}</div> <div>{{ item.label }}</div>
</div> </div>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -49,25 +25,15 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog <el-dialog title="添加知识库字段" :visible.sync="fieldshow" width="50%" :before-close="beforeClose"
title="添加知识库字段" class="category-cascader-panel">
:visible.sync="fieldshow" <el-cascader-panel :options="fieldoptions" @change="handleChange($event)" :props="{
width="50%"
:before-close="beforeClose"
class="category-cascader-panel"
>
<el-cascader-panel
:options="fieldoptions"
@change="handleChange($event)"
:props="{
value: 'termCode', value: 'termCode',
label: 'termContent', label: 'termContent',
children: 'children', children: 'children',
checkStrictly: false, checkStrictly: false,
multiple: true, multiple: true,
}" }" ref="cascaderAddr">
ref="cascaderAddr"
>
</el-cascader-panel> </el-cascader-panel>
<div style="margin: 20px 0">结果预览:</div> <div style="margin: 20px 0">结果预览:</div>
@ -223,43 +189,39 @@ export default {
this.$emit("on-nodeContent", { nodeContent: this.html }); this.$emit("on-nodeContent", { nodeContent: this.html });
}, },
panelchange(value) { panelchange(value) {
// console.log(value, "value");
this.addlist = []; this.addlist = [];
value.forEach((e) => { value.forEach((e) => {
// console.log(e, "eeeeee");
this.labeloptions.forEach((el) => { this.labeloptions.forEach((el) => {
el.children.forEach((ele) => { el.children.forEach((ele) => {
if (e[1] == ele.value) { if (e[1] == ele.value) {
console.log(e[1], "[1]"); this.addlist.push({
this.addlist.push(el.label + "-" + ele.label); lebel: el.label + "-" + ele.label,
// console.log(this.addlist, "this.addlist"); fileName: el.label,
fileSpan: ele.label,
fieldMark: ele.termCode
});
} }
}); });
}); });
}); });
}, },
labelclick() { labelclick() {
this.labelshow = false; this.labelshow = false;
setTimeout(() => {
this.editor.focus(); this.editor.focus();
}, 30);
setTimeout(() => {
this.editor.deleteBackward();
}, 50);
setTimeout(() => { setTimeout(() => {
if (this.modify) { if (this.modify) {
this.modify = false; this.modify = false;
this.editor.deleteBackward();
} }
this.addlist.forEach((e) => { this.addlist.forEach((e) => {
const resume = { const resume = { // JS
// JS type: 'attachment',
type: "attachment", link: '',
fileName: e.split("-")[0], fileName: e.fileName,
fileSpan: e.split("-")[1], fileSpan: e.fileSpan,
children: [{ text: "" }], // void children fieldMark: e.fieldMark,
}; children: [{ text: '' }], // void children
}
this.editor.insertNode(resume); this.editor.insertNode(resume);
}); });
// this.addlist = [ // this.addlist = [
@ -271,6 +233,7 @@ export default {
// ]; // ];
this.editor.focus(); this.editor.focus();
++this.isResouceShow; ++this.isResouceShow;
this.selectedOptions = []
}, 100); }, 100);
}, },
fieldclick() { fieldclick() {
@ -623,7 +586,7 @@ function renderAttachmenttwo(elem, children, editor) {
click() { click() {
that.modify = true; that.modify = true;
that.fieldshow = true; that.fieldshow = true;
this.add = []; that.add = [];
} /* 其他... */, } /* 其他... */,
}, },
} }
@ -802,8 +765,10 @@ Boot.registerModule(parseHtmlConfmodule);
<style lang="scss"> <style lang="scss">
.category-cascader-panel { .category-cascader-panel {
.el-cascader-panel { .el-cascader-panel {
// background-color: red !important; // background-color: red !important;
.el-scrollbar:first-child { .el-scrollbar:first-child {
// li[aria-haspopup="true"] { // li[aria-haspopup="true"] {
.el-checkbox { .el-checkbox {
display: none !important; display: none !important;

View File

@ -702,20 +702,6 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
width: 8px;
/*滚动条宽度*/
height: 6px;
/*滚动条高度*/
background: #C1C1C1;
border-radius: 10px;
/*滚动条的背景区域的圆角*/
// box-shadow: 0px 1px 3px #232335 inset;
}
::v-deep .el-table { ::v-deep .el-table {
overflow: auto; overflow: auto;
} }