|
@@ -447,8 +447,6 @@ export default {
|
|
init() {
|
|
init() {
|
|
this.jm.view.minZoom = 0.1;
|
|
this.jm.view.minZoom = 0.1;
|
|
this.jm.view.maxZoom = 5;
|
|
this.jm.view.maxZoom = 5;
|
|
- // this.jm.expand_all()
|
|
|
|
- // this.setColor()
|
|
|
|
// 重写编辑完成事件
|
|
// 重写编辑完成事件
|
|
this.jm.view.edit_node_end = () => {
|
|
this.jm.view.edit_node_end = () => {
|
|
const node = this.jm.view.get_editing_node();
|
|
const node = this.jm.view.get_editing_node();
|
|
@@ -473,117 +471,11 @@ export default {
|
|
const selectedNode = this.jm.get_selected_node();
|
|
const selectedNode = this.jm.get_selected_node();
|
|
if (selectedNode) {
|
|
if (selectedNode) {
|
|
if (selectedNode.children.length == 0) {
|
|
if (selectedNode.children.length == 0) {
|
|
- // if (selectedNode.data.rowType == 1) {//查询产品
|
|
|
|
- // var queryParams = {
|
|
|
|
- // productCategoryId: selectedNode.data.ids,
|
|
|
|
- // };
|
|
|
|
- // this.$api.queryProducts(queryParams).then((res) => {
|
|
|
|
- // if (res.code == 200) {
|
|
|
|
- // this.jm.enable_edit();
|
|
|
|
- // res.data.list.forEach((item) => {
|
|
|
|
- // var data = {
|
|
|
|
- // expanded: false,
|
|
|
|
- // rowType: 2,
|
|
|
|
- // ids: item.id,
|
|
|
|
- // productName:item.productName,
|
|
|
|
- // children: [],
|
|
|
|
- // };
|
|
|
|
- // this.jm.toggle_node(selectedNode.id);
|
|
|
|
- // data.children = item.children ? item.children : [];
|
|
|
|
- // item.type = 2;
|
|
|
|
- // this.jm.add_node(
|
|
|
|
- // selectedNode.id,
|
|
|
|
- // "产品" + item.id,
|
|
|
|
- // this.getModelCardDom(item),
|
|
|
|
- // data
|
|
|
|
- // );
|
|
|
|
- // });
|
|
|
|
- // this.jm.disable_edit();
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
- // } else if (selectedNode.data.rowType == 2) {//查询产品架构
|
|
|
|
- // var queryParams = {
|
|
|
|
- // productId: selectedNode.data.ids,
|
|
|
|
- // structureId: 0,
|
|
|
|
- // };
|
|
|
|
- // this.$api.queryStructures(queryParams).then((res) => {
|
|
|
|
- // if (res.code == 200) {
|
|
|
|
- // this.jm.enable_edit();
|
|
|
|
-
|
|
|
|
- // res.data.children.forEach((item) => {
|
|
|
|
- // var data = {
|
|
|
|
- // expanded: false,
|
|
|
|
- // rowType: 3,
|
|
|
|
- // ids: item.id,
|
|
|
|
- // productId: selectedNode.data.ids,
|
|
|
|
- // productName:selectedNode.data.productName,
|
|
|
|
- // };
|
|
|
|
- // this.jm.toggle_node(selectedNode.id);
|
|
|
|
- // data.children = item.children ? item.children : [];
|
|
|
|
- // item.productName=selectedNode.data.productName,
|
|
|
|
- // item.type = 3;
|
|
|
|
- // this.jm.add_node(
|
|
|
|
- // selectedNode.id,
|
|
|
|
- // "架构" + item.id,
|
|
|
|
- // this.getModelCardDom(item),
|
|
|
|
- // data
|
|
|
|
- // );
|
|
|
|
- // // if(item.children&& item.children.length>0){
|
|
|
|
- // // this.deepChildren(item.id,item.children)
|
|
|
|
- // // }
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
- // this.jm.disable_edit();
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
- // } else {
|
|
|
|
- // if ((selectedNode.data.children&&selectedNode.data.children.length==0) ||( selectedNode.data.hasChildren && selectedNode.data.hasChildren.length==0)) {
|
|
|
|
- // return false;
|
|
|
|
- // }
|
|
|
|
- // var queryParams = {
|
|
|
|
- // structureId: selectedNode.data.ids,
|
|
|
|
- // productId: selectedNode.data.productId,
|
|
|
|
- // };
|
|
|
|
- // this.$api.queryStructures(queryParams).then((res) => {
|
|
|
|
- // if (res.code == 200) {
|
|
|
|
- // this.jm.enable_edit();
|
|
|
|
-
|
|
|
|
- // res.data.children.forEach((item) => {
|
|
|
|
- // var data = {
|
|
|
|
- // expanded: false,
|
|
|
|
- // rowType: 3,
|
|
|
|
- // ids: item.id,
|
|
|
|
- // productId: selectedNode.data.productId,
|
|
|
|
- // productName:selectedNode.data.productName,
|
|
|
|
- // };
|
|
|
|
- // this.jm.toggle_node(selectedNode.id);
|
|
|
|
- // data.children = item.children ? item.children : [];
|
|
|
|
- // item.productName=selectedNode.data.productName,
|
|
|
|
- // item.type = 3;
|
|
|
|
- // this.jm.add_node(
|
|
|
|
- // selectedNode.id,
|
|
|
|
- // "架构" + item.id,
|
|
|
|
- // this.getModelCardDom(item),
|
|
|
|
- // data
|
|
|
|
- // );
|
|
|
|
- // // if(item.children&& item.children.length>0){
|
|
|
|
- // // this.deepChildren(item.id,item.children)
|
|
|
|
- // // }
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
- // this.jm.disable_edit();
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
this.jm.toggle_node(selectedNode.id);
|
|
this.jm.toggle_node(selectedNode.id);
|
|
}
|
|
}
|
|
-
|
|
|
|
- // return selectedNode.id
|
|
|
|
}
|
|
}
|
|
- // else {
|
|
|
|
- // return null
|
|
|
|
- // }
|
|
|
|
},
|
|
},
|
|
|
|
|
|
// 拖拽
|
|
// 拖拽
|
|
@@ -702,6 +594,7 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
+ //获取当前数据
|
|
async getData() {
|
|
async getData() {
|
|
if (this.type == 1) {//产品类别
|
|
if (this.type == 1) {//产品类别
|
|
let params = {
|
|
let params = {
|
|
@@ -904,72 +797,6 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
},
|
|
- // //初始化JsMind数据
|
|
|
|
- // async initData(currentData){
|
|
|
|
- // if(currentData.MindType == 1){
|
|
|
|
- // let params = {
|
|
|
|
- // searchQuery:`product_id=${currentData.id}`,//检索条件
|
|
|
|
- // }
|
|
|
|
- // await this.$api.queryProduct(params).then(response=>{
|
|
|
|
- // if(response.code == 200){
|
|
|
|
- // if(response.data.data.length>0){
|
|
|
|
- // currentData.hasChildren = true
|
|
|
|
- // currentData.children = response.data.data.map(item=>{
|
|
|
|
- // item.MindId = `产品${item.id}`
|
|
|
|
- // item.MindType = 2
|
|
|
|
- // item.expanded = false
|
|
|
|
- // item.topic = this.getModelCardDom(item)
|
|
|
|
- // // this.jm.enable_edit();
|
|
|
|
- // // this.jm.update_node(item.MindId,this.getModelCardDom(item) )
|
|
|
|
- // // this.jm.disable_edit();
|
|
|
|
- // return item
|
|
|
|
- // })
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // }else if(currentData.MindType == 2){
|
|
|
|
- // var params = {
|
|
|
|
- // type: currentData.MindType,
|
|
|
|
- // typeId: currentData.id
|
|
|
|
- // }
|
|
|
|
- // await this.$api.queryTreeNodeTree(params).then(res => {
|
|
|
|
- // if (res.code == 200) {
|
|
|
|
- // var data = res.data.data
|
|
|
|
- // if(data.length>0){
|
|
|
|
- // currentData.hasChildren = true
|
|
|
|
- // var data = this.deepChildren(data,currentData)
|
|
|
|
- // }
|
|
|
|
- // currentData.children = data
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // }else if(currentData.MindType == 0){
|
|
|
|
- // let params = {
|
|
|
|
- // searchQuery:'',//检索条件
|
|
|
|
- // }
|
|
|
|
- // await this.$api.queryProductCategory(params).then(response=>{
|
|
|
|
- // if(response.code == 200){
|
|
|
|
- // if(response.data.data.length>0){
|
|
|
|
- // currentData.hasChildren = true
|
|
|
|
- // currentData.children = response.data.data.map(item=>{
|
|
|
|
- // item.MindId = `产品类别${item.id}`
|
|
|
|
- // item.MindType = 1
|
|
|
|
- // item.expanded = false
|
|
|
|
- // item.topic = this.getModelCardDom(item)
|
|
|
|
- // // this.jm.enable_edit();
|
|
|
|
- // // this.jm.update_node(item.MindId,this.getModelCardDom(item) )
|
|
|
|
- // // this.jm.disable_edit();
|
|
|
|
- // return item
|
|
|
|
- // })
|
|
|
|
-
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // },
|
|
|
|
-
|
|
|
|
//递归
|
|
//递归
|
|
deepChildren(data,currentData){
|
|
deepChildren(data,currentData){
|
|
for(var i = 0;i<data.length;i++){
|
|
for(var i = 0;i<data.length;i++){
|
|
@@ -999,7 +826,6 @@ export default {
|
|
async mounted() {
|
|
async mounted() {
|
|
window.check = this.check;
|
|
window.check = this.check;
|
|
await this.getData()
|
|
await this.getData()
|
|
- // await this.initData(this.currentData)
|
|
|
|
this.mind.data = this.currentData
|
|
this.mind.data = this.currentData
|
|
this.jm = jsMind.show(this.options, this.mind);
|
|
this.jm = jsMind.show(this.options, this.mind);
|
|
|
|
|
|
@@ -1009,7 +835,6 @@ export default {
|
|
// this.handleDrop(nextParentId, srcNode.id)
|
|
// this.handleDrop(nextParentId, srcNode.id)
|
|
// }
|
|
// }
|
|
this.editor = this.jm.view.e_editor;
|
|
this.editor = this.jm.view.e_editor;
|
|
- // this.init()
|
|
|
|
this.toggleStucture("side");
|
|
this.toggleStucture("side");
|
|
this.mouseWheel();
|
|
this.mouseWheel();
|
|
this.mouseDrag();
|
|
this.mouseDrag();
|