修改话术
This commit is contained in:
parent
b9ad682d12
commit
221f6a7ddf
@ -274,7 +274,6 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" v-if="type == 'customNode'">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="nodeAttributeForm.labeltitle"
|
||||
@change="saveNodeAttribute"
|
||||
></el-input>
|
||||
@ -461,14 +460,14 @@
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import G6Editor from "@antv/g6-editor";
|
||||
import mixin from "../mianview/mixin";
|
||||
import { insertScriptEdgeNode,selectScriptEdgeNode } from "@/api/system/preview";
|
||||
import Cookies from 'js-cookie'
|
||||
import { construct } from "netflix-conductor-json-tree/dist/index";
|
||||
export default {
|
||||
</template>
|
||||
<script>
|
||||
import G6Editor from "@antv/g6-editor";
|
||||
import mixin from "../mianview/mixin";
|
||||
import { insertScriptEdgeNode, selectScriptEdgeNode } from "@/api/system/preview";
|
||||
import Cookies from 'js-cookie'
|
||||
import { construct } from "netflix-conductor-json-tree/dist/index";
|
||||
export default {
|
||||
name: "VueG6Editor",
|
||||
mixins: [mixin],
|
||||
data() {
|
||||
@ -522,14 +521,13 @@
|
||||
if (newVal.labeltitle || newVal.labelconcent) {
|
||||
this.$set(this.nodeAttributeForm, 'labelconcent', newVal.labelconcent)
|
||||
this.$set(this.nodeAttributeForm, 'labeltitle', newVal.labeltitle)
|
||||
// this.nodeAttributeForm.labelconcent=newVal.labelconcent
|
||||
// this.nodeAttributeForm.labeltitle=newVal.labeltitle
|
||||
this.nodeAttributeForm.label = newVal.labeltitle + '\n' + newVal.labelconcent;
|
||||
} else {
|
||||
this.nodeAttributeForm.label = newVal.label
|
||||
}
|
||||
console.log('obj发生了变化', newVal, oldVal)
|
||||
},
|
||||
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
@ -553,14 +551,32 @@
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
getlist(){
|
||||
selectScriptEdgeNode(Cookies.get('id')).then(res=>{
|
||||
this.form=JSON.parse(res.data.flowScheme)
|
||||
getlist() {
|
||||
selectScriptEdgeNode(Cookies.get('id')).then(res => {
|
||||
this.form = JSON.parse(res.data.flowScheme)
|
||||
this.form = JSON.parse(res.data.flowScheme)
|
||||
console.log(this.form)
|
||||
this.form.nodes.forEach(e => {
|
||||
if (e.label) {
|
||||
if (e.label.split('\n').shift() && e.label.split('\n').slice(1).join('\n')) {
|
||||
// e.labeltitle = e.label .split('\n').shift()
|
||||
// e.labelconcent = e.label.split('\n').slice(1).join('\n')
|
||||
// e.label= `<p>${e.label.split('\n').shift()}</p>`+'\n'+ e.label.split('\n').slice(1).join('\n')
|
||||
// console.log(e.label, 'e.la')
|
||||
// e.label={ // 关键形样式(优先级高于color)
|
||||
// fontSize: 14,
|
||||
// fontWeight:800,
|
||||
// text:e.label,
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
})
|
||||
this.editor.getCurrentPage().read(this.form);
|
||||
// console.log(this.form,'this.form')
|
||||
console.log(this.form,'this.form')
|
||||
|
||||
})
|
||||
},
|
||||
@ -607,6 +623,8 @@
|
||||
// e.label = e.label.text
|
||||
// }
|
||||
// })
|
||||
|
||||
// return
|
||||
insertScriptEdgeNode(newObj).then(res => {
|
||||
if (res.code == 200) {
|
||||
_this.$message.success("数据保存成功");
|
||||
@ -710,7 +728,6 @@
|
||||
editor.add(contextmenu);
|
||||
// 挂载到window,方便调试
|
||||
window.editor = editor;
|
||||
|
||||
// 获取当前画布
|
||||
const currentPage = editor.getCurrentPage();
|
||||
currentPage.on("afterchange", (e) => {
|
||||
@ -734,23 +751,21 @@
|
||||
// 如果选择的对象是节点
|
||||
if (ev.item.isNode) {
|
||||
this.type = selectedItemDataModel.shape
|
||||
if (selectedItemDataModel.label && selectedItemDataModel.labelconcent == '' && selectedItemDataModel.labeltitle == '') {
|
||||
if (selectedItemDataModel.label.split('\n').shift() && selectedItemDataModel.label.split('\n').slice(1).join('\n')) {
|
||||
|
||||
if (selectedItemDataModel.label && selectedItemDataModel.labelconcent=='' && selectedItemDataModel.labeltitle=='') {
|
||||
var text = selectedItemDataModel.label.replace(/\n/g, ",");
|
||||
var concet = text.split(',')
|
||||
console.log(concet, 'text')
|
||||
if (concet.length == 2) {
|
||||
this.nodeAttributeForm.labeltitle = concet[0]
|
||||
this.nodeAttributeForm.labelconcent = concet[1]
|
||||
// this.nodeAttributeForm.labeltitle = `<h2>${selectedItemDataModel.label.split('\n').shift()}</h2>`
|
||||
this.nodeAttributeForm.labeltitle = selectedItemDataModel.label.split('\n').shift()
|
||||
this.nodeAttributeForm.labelconcent = selectedItemDataModel.label.split('\n').slice(1).join('\n')
|
||||
|
||||
} else if (concet.length == 1) {
|
||||
this.nodeAttributeForm.label = concet[0];
|
||||
} else if (selectedItemDataModel.label.split('\n').shift()) {
|
||||
this.nodeAttributeForm.label = selectedItemDataModel.label.split('\n').shift();
|
||||
}
|
||||
} else {
|
||||
this.nodeAttributeForm.labelconcent = selectedItemDataModel.labelconcent;
|
||||
this.nodeAttributeForm.labeltitle = selectedItemDataModel.labeltitle;
|
||||
}
|
||||
if(!this.nodeAttributeForm.labelconcent && !this.nodeAttributeForm.labeltitle){
|
||||
if (!this.nodeAttributeForm.labelconcent && !this.nodeAttributeForm.labeltitle) {
|
||||
this.nodeAttributeForm.label = selectedItemDataModel.label;
|
||||
}
|
||||
// this.nodeAttributeForm.labelconcent = selectedItemDataModel.labelconcent;
|
||||
@ -817,16 +832,7 @@
|
||||
document.body.removeChild(downloadLink);
|
||||
this.saveAsImageDialogVisible = false;
|
||||
},
|
||||
// 保存
|
||||
// submitForm() {
|
||||
// const _this = this;
|
||||
// let needSaveData = editor.getCurrentPage().save();
|
||||
// console.log(needSaveData, 'needSaveData');
|
||||
// localStorage.setItem("flowData", JSON.stringify(needSaveData));
|
||||
// _this.save(needSaveData);
|
||||
// _this.$message.success("数据已保存");
|
||||
|
||||
// },
|
||||
// 保存为文件
|
||||
saveAsFile() {
|
||||
let sub = this.editor.getCurrentPage().save()
|
||||
@ -880,10 +886,9 @@
|
||||
console.log(JSON.stringify(res, null, 2));
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import url("../mianview/index.less");
|
||||
</style>
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import url("../mianview/index.less");
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user