|
@@ -97,7 +97,14 @@ import jsMind from "./jsmind/js/jsmind.js";
|
|
|
export default {
|
|
|
components:{
|
|
|
},
|
|
|
- props: ["row"],
|
|
|
+ props: {
|
|
|
+ id:{
|
|
|
+ default:0
|
|
|
+ },
|
|
|
+ type:{//1是产品类别,2是产品,0是全部
|
|
|
+ default:0
|
|
|
+ }
|
|
|
+ },
|
|
|
watch: {
|
|
|
"zoom.value"(val) {
|
|
|
const zoom = val / 100;
|
|
@@ -149,7 +156,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
+ currentData:{},
|
|
|
rowData:[],
|
|
|
next: true,
|
|
|
mind: {
|
|
@@ -235,84 +242,60 @@ export default {
|
|
|
methods: {
|
|
|
//自定义节点样式http://192.168.1.24:8084/20230307/59b706c15559422998f3e92a3a3b96d1.jpg
|
|
|
getModelCardDom(modelInfo) {
|
|
|
- if(modelInfo.type == 0){
|
|
|
+ if(modelInfo.MindType == 0){
|
|
|
return `
|
|
|
<div class="model-edit-card" style="width:150px;height:40px">
|
|
|
<p class="model-title-p"><span>产品专利布局可视化</span></p>
|
|
|
</div>
|
|
|
`;
|
|
|
- }else if (modelInfo.type == 1) {//产品类别
|
|
|
+ }else if (modelInfo.MindType == 1) {//产品类别
|
|
|
return `
|
|
|
<div class="model-edit-card" >
|
|
|
- <div class="img" onclick="vm.checkImg('${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url: ""}')">
|
|
|
- <img style="width:100%;height:100%" src="${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url: ""}" onerror="this.src='https://p26.toutiaoimg.com/origin/pgc-image/cafb19c6ccac41a3a03fb83826e66534?from=pc';" alt="图片不存在" :preview-src-list="[${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url : ""}]"></img>
|
|
|
+ <div class="img" onclick="vm.checkImg('${(modelInfo.systemFileList && modelInfo.systemFileList.length > 0)? this.$commonJS.checkViewer(modelInfo.systemFileList[0].guid): ""}')">
|
|
|
+ <img style="width:100%;height:100%" src="${ (modelInfo.systemFileList && modelInfo.systemFileList.length > 0)? this.$commonJS.checkViewer(modelInfo.systemFileList[0].guid): ""}" onerror="this.src='https://p26.toutiaoimg.com/origin/pgc-image/cafb19c6ccac41a3a03fb83826e66534?from=pc';" alt="图片不存在"></img>
|
|
|
</div>
|
|
|
<div class="patent">
|
|
|
- <p class="model-title-p"><span>${modelInfo.productCategoryName}</span></p>
|
|
|
+ <p class="model-title-p"><span>${modelInfo.name}</span></p>
|
|
|
</div>
|
|
|
- <div class="icon" style="display:${modelInfo.hasChildren && modelInfo.hasChildren.length>0? "block":"none"}">
|
|
|
+ <div class="icon" style="display:${modelInfo.hasChildren? "block":"none"}">
|
|
|
>>>
|
|
|
</div>
|
|
|
</div>
|
|
|
`;
|
|
|
- } else if (modelInfo.type == 2) {//产品
|
|
|
+ } else if (modelInfo.MindType == 2) {//产品
|
|
|
return `
|
|
|
<div class="model-edit-card">
|
|
|
- <div class="img" onclick="vm.checkImg('${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url: ""}')">
|
|
|
- <img style="width:100%;height:100%" src="${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url: ""}" onerror="this.src='https://p26.toutiaoimg.com/origin/pgc-image/cafb19c6ccac41a3a03fb83826e66534?from=pc';" alt="" :preview-src-list="[${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url: "" }]"></img>
|
|
|
+ <div class="img" onclick="vm.checkImg('${ (modelInfo.systemFileList && modelInfo.systemFileList.length > 0)? this.$commonJS.checkViewer(modelInfo.systemFileList[0].guid): ""}')">
|
|
|
+ <img style="width:100%;height:100%" src="${ (modelInfo.systemFileList && modelInfo.systemFileList.length > 0)? this.$commonJS.checkViewer(modelInfo.systemFileList[0].guid): ""}" onerror="this.src='https://p26.toutiaoimg.com/origin/pgc-image/cafb19c6ccac41a3a03fb83826e66534?from=pc';" alt=""></img>
|
|
|
</div>
|
|
|
<div class="patent">
|
|
|
- <p class="model-title-p"><span>${ modelInfo.productName}</span></p>
|
|
|
- <p class="model-title-p model-patent" onclick="check(${modelInfo.id},${modelInfo.type},'${modelInfo.productName}','1')">商品化专利:<span>${modelInfo.productPatentNum}</span></p>
|
|
|
- <p class="model-title-p model-patent" onclick="check(${modelInfo.id},${modelInfo.type},'${modelInfo.productName}','2')">相关专利:<span>${modelInfo.patentNum}</span></p>
|
|
|
+ <p class="model-title-p"><span>${ modelInfo.name}</span></p>
|
|
|
+ <p class="model-title-p model-patent" onclick="check(${modelInfo.id},${modelInfo.MindType},'${modelInfo.name}','1')">商品化专利:<span>${modelInfo.productPatentNum}</span></p>
|
|
|
+ <p class="model-title-p model-patent" onclick="check(${modelInfo.id},${modelInfo.MindType},'${modelInfo.name}','2')">相关专利:<span>${modelInfo.patentNum}</span></p>
|
|
|
</div>
|
|
|
- <div class="icon" style="display:${modelInfo.hasChildren && modelInfo.hasChildren.length>0? "block":"none"}">
|
|
|
+ <div class="icon" style="display:${modelInfo.hasChildren? "block":"none"}">
|
|
|
>>>
|
|
|
</div>
|
|
|
</div>
|
|
|
`;
|
|
|
- } else {//架构
|
|
|
+ } else if (modelInfo.MindType == 3) {//架构
|
|
|
return `
|
|
|
<div class="model-edit-card">
|
|
|
- <div class="img" onclick="vm.checkImg('${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url: ""}')">
|
|
|
- <img style="width:100%;height:100%" src="${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url : ""}" onerror="this.src='https://p26.toutiaoimg.com/origin/pgc-image/cafb19c6ccac41a3a03fb83826e66534?from=pc';" alt="图片不存在" :preview-src-list="[${ modelInfo.pictures.length > 0? this.$p + modelInfo.pictures[0].url: ""}]"></img>
|
|
|
+ <div class="img" onclick="vm.checkImg('${ (modelInfo.systemFileList && modelInfo.systemFileList.length > 0)? this.$commonJS.checkViewer(modelInfo.systemFileList[0].guid): ""}')">
|
|
|
+ <img style="width:100%;height:100%" src="${ (modelInfo.systemFileList && modelInfo.systemFileList.length > 0)? this.$commonJS.checkViewer(modelInfo.systemFileList[0].guid) : ""}" onerror="this.src='https://p26.toutiaoimg.com/origin/pgc-image/cafb19c6ccac41a3a03fb83826e66534?from=pc';" alt="图片不存在"></img>
|
|
|
</div>
|
|
|
<div class="patent">
|
|
|
- <p class="model-title-p"><span>${ modelInfo.structureName}</span></p>
|
|
|
- <p class="model-title-p model-patent" onclick="check(${modelInfo.id},${modelInfo.type},'${modelInfo.pathName}','${modelInfo.productName}')">相关专利:<span>${modelInfo.patentNum}</span></p>
|
|
|
+ <p class="model-title-p"><span>${ modelInfo.name}</span></p>
|
|
|
+ <p class="model-title-p model-patent" onclick="check(${modelInfo.id},${modelInfo.MindType},'${modelInfo.pathName}','${modelInfo.productName}')">相关专利:<span>${modelInfo.patentNum}</span></p>
|
|
|
</div>
|
|
|
- <div class="icon" style="display:${ modelInfo.children.length>0? "block":"none"}">
|
|
|
+ <div class="icon" style="display:${ modelInfo.hasChildren? "block":"none"}">
|
|
|
>>>
|
|
|
</div>
|
|
|
</div>
|
|
|
`;
|
|
|
}
|
|
|
},
|
|
|
- async getList(row){
|
|
|
- if (row.type == 1) {
|
|
|
- var queryParams = {
|
|
|
- productCategoryId: row.id,
|
|
|
- };
|
|
|
- await this.$api.queryProducts(queryParams).then(res=>{
|
|
|
- row.hasChildren = res.data.list
|
|
|
- this.jm.enable_edit();
|
|
|
- this.jm.update_node('产品类别'+row.id,this.getModelCardDom(row) )
|
|
|
- this.jm.disable_edit();
|
|
|
- })
|
|
|
- // return a
|
|
|
- } else if (row.type == 2) {
|
|
|
- var queryParams = {
|
|
|
- productId: row.id,
|
|
|
- structureId: 0,
|
|
|
- };
|
|
|
- await this.$api.queryStructures(queryParams).then(res=>{
|
|
|
- row.hasChildren = res.data.children
|
|
|
- this.jm.enable_edit();
|
|
|
- this.jm.update_node('产品'+row.id,this.getModelCardDom(row) )
|
|
|
- this.jm.disable_edit();
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
|
|
|
//查看相关专利
|
|
|
check(id, type,name,productName) {
|
|
@@ -596,26 +579,6 @@ export default {
|
|
|
// return null
|
|
|
// }
|
|
|
},
|
|
|
- deepChildren(parentId, row) {
|
|
|
- row.forEach((item) => {
|
|
|
- var data = {
|
|
|
- expanded: false,
|
|
|
- rowType: 3,
|
|
|
- ids: item.id,
|
|
|
- };
|
|
|
- data.children = item.children ? item.children : [];
|
|
|
- item.type = 3;
|
|
|
- this.jm.add_node(
|
|
|
- parentId,
|
|
|
- "架构" + item.id,
|
|
|
- this.getModelCardDom(item),
|
|
|
- data
|
|
|
- );
|
|
|
- if (item.children && item.children.length > 0) {
|
|
|
- this.deepChildren(item.id, item.children);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
|
|
|
// 拖拽
|
|
|
handleDrop(draggingNode, dropNode) {
|
|
@@ -731,81 +694,136 @@ export default {
|
|
|
};
|
|
|
};
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
async getData() {
|
|
|
- if (this.row.type == 1) {
|
|
|
- var queryParams = {
|
|
|
- productCategoryId: this.row.id,
|
|
|
- };
|
|
|
- var a= await this.$api.queryProducts(queryParams)
|
|
|
- return a
|
|
|
- } else if (this.row.type == 2) {
|
|
|
- var queryParams = {
|
|
|
- productId: this.row.id,
|
|
|
- structureId: 0,
|
|
|
- };
|
|
|
- var a= await this.$api.queryStructures(queryParams)
|
|
|
- return a
|
|
|
- }else if (this.row.type == 0){
|
|
|
- var a= await this.$api.queryProductCategorys({})
|
|
|
- return a
|
|
|
+ if (this.type == 1) {//产品类别
|
|
|
+ let params = {
|
|
|
+ searchQuery:`category_id=${this.id}`,//检索条件
|
|
|
+ }
|
|
|
+ await this.$api.queryProductCategory(params).then(response=>{
|
|
|
+ if(response.code == 200){
|
|
|
+ this.currentData = response.data.data[0]
|
|
|
+ this.currentData.MindId = `产品类别${this.currentData.id}`
|
|
|
+ this.currentData.MindType= this.type
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.type == 2) {//产品
|
|
|
+ let params = {
|
|
|
+ searchQuery:`product_id=${this.id}`,//检索条件
|
|
|
+ }
|
|
|
+ await this.$api.queryProduct(params).then(response=>{
|
|
|
+ if(response.code == 200){
|
|
|
+ this.currentData = response.data.data[0]
|
|
|
+ this.currentData.MindId = `产品${this.currentData.id}`
|
|
|
+ this.currentData.MindType= this.type
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else if (this.type == 0){//全部
|
|
|
+ this.currentData = {}
|
|
|
+ this.currentData.MindId = `产品${this.currentData.id}`
|
|
|
+ this.currentData.MindType= this.type
|
|
|
}
|
|
|
+ this.currentData.expanded = false
|
|
|
+ this.currentData.topic = this.getModelCardDom(this.currentData)
|
|
|
},
|
|
|
+
|
|
|
+ //初始化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.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
|
|
|
+ })
|
|
|
+ currentData.hasChildren = true
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else if(currentData.MindType == 2){
|
|
|
+ var params = {
|
|
|
+ type: 1,
|
|
|
+ typeId: currentData.id
|
|
|
+ }
|
|
|
+ await this.$api.queryTreeNodeTree(params).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ var data = res.data.data
|
|
|
+ var data = this.deepChildren(data,currentData)
|
|
|
+ console.log(data)
|
|
|
+ currentData.children = data
|
|
|
+ currentData.hasChildren = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }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.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
|
|
|
+ })
|
|
|
+ currentData.hasChildren = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ //递归
|
|
|
+ deepChildren(data,currentData){
|
|
|
+ for(var i = 0;i<data.length;i++){
|
|
|
+ data[i].MindId = `架构${data[i].id}`
|
|
|
+ data[i].MindType = 3
|
|
|
+ data[i].expanded = false
|
|
|
+ data[i].topic = this.getModelCardDom(data[i])
|
|
|
+ data[i].currentName = currentData.name
|
|
|
+ data[i].currentId = currentData.id
|
|
|
+ data[i].currentType = currentData.MindType
|
|
|
+ this.jm.enable_edit();
|
|
|
+ this.jm.update_node(item.MindId,this.getModelCardDom(item) )
|
|
|
+ this.jm.disable_edit();
|
|
|
+ if(data[i].child && data[i].child.length>0){
|
|
|
+ data[i].hasChildren = true
|
|
|
+ data[i].children = data[i].child
|
|
|
+ this.deepChildren(data[i].child,currentData)
|
|
|
+ }else{
|
|
|
+ data[i].hasChildren = false
|
|
|
+ data[i].children = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
async mounted() {
|
|
|
window.check = this.check;
|
|
|
- var list =await this.getData()
|
|
|
- var id = "";
|
|
|
- if (this.row.type == 1) {
|
|
|
- id = "类别";
|
|
|
- } else if (this.row.type == 2) {
|
|
|
- id = "产品";
|
|
|
- } else {
|
|
|
- id = "架构";
|
|
|
- }
|
|
|
- if(this.row.type == 1 || this.row.type == 0){
|
|
|
- var index = 'list'
|
|
|
- }else{
|
|
|
- var index = 'children'
|
|
|
- }
|
|
|
- this.row.hasChildren = list.data[index]
|
|
|
- this.mind.data = {
|
|
|
- id:this.row.type==0?'可视化': id + this.row.id,
|
|
|
- ids: this.row.id,
|
|
|
- topic: this.getModelCardDom(this.row),
|
|
|
- expanded: false,
|
|
|
- rowType: this.row.type,
|
|
|
- productName:this.row.productName,
|
|
|
- row:this.row,
|
|
|
- children: [],
|
|
|
- };
|
|
|
- if(list.code == 200){
|
|
|
- list.data[index].forEach(async item=>{
|
|
|
- item.type = this.row.type + 1;
|
|
|
- if(this.row.type == 1||this.row.type == 0){
|
|
|
- this.getList(item)
|
|
|
- item.hasChildren = this.rowData.children?this.rowData.children:[]
|
|
|
- }
|
|
|
- if(this.row.type == 2){
|
|
|
- item.productName=this.row.productName
|
|
|
- }
|
|
|
- var data = {
|
|
|
- id:item.type == 2?'产品'+item.id:(item.type == 1?'产品类别'+item.id:'架构'+item.id),
|
|
|
- expanded: false,
|
|
|
- topic: this.getModelCardDom(item),
|
|
|
- rowType: this.row.type + 1,
|
|
|
- ids: item.id,
|
|
|
- productId:this.row.id,
|
|
|
- productName:item.productName,
|
|
|
- row:item,
|
|
|
- hasChildren:item.children?item.children: [],
|
|
|
- };
|
|
|
-
|
|
|
- this.mind.data.children.push(data)
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
- this.jm = jsMind.show(this.options, this.mind);
|
|
|
+ await this.getData()
|
|
|
+ await this.initData(this.currentData)
|
|
|
+ this.mind.data = this.currentData
|
|
|
+
|
|
|
+ this.jm = jsMind.show(this.options, this.mind);
|
|
|
|
|
|
// 自定义拖拽完成事件
|
|
|
// jsMind.draggable.prototype.handleDrag= (srcNode, targetNode, targetDirect) => {
|