Browse Source

专利布局可视化

zhuliu 1 year ago
parent
commit
4a9ca59744

src/assets/svg/401.vue → src/assets/svg/403.vue


+ 12 - 12
src/router/index.js

@@ -186,14 +186,14 @@ const routes = [
             },
             component: () => import('@/views/product/components/details'),
           },
-          //     {
-          //       path: "/mindIndex",
-          //       meta: {
-          //        title: '可视化',
-          //        button: [],
-          //      },
-          //      component: () => import('@/views/product/components/jsMind'),
-          //    },
+          {
+            path: "/mindIndex",
+            meta: {
+              title: '可视化',
+              button: [],
+            },
+            component: () => import('@/views/product/components/jsMind'),
+          },
           {
             path: "/chartIndex",
             name: 'chartIndex',
@@ -527,13 +527,13 @@ const routes = [
         redirect: '/errorPage',
         children: [
           {
-            path: '/401',
+            path: '/403',
             meta: {
               title: '事件',
-              sign: '401',
+              sign: '403',
               belong: 'errorPage'
             },
-            component: () => import('@/views/components/errorPage/401.vue'),
+            component: () => import('@/views/components/errorPage/403.vue'),
           },
         ],
       },
@@ -563,7 +563,7 @@ router.beforeEach((to, from, next) => {
     next()
   }
   else if(to.meta.permission && !Permission.FunPermissions(to.meta.permission)){
-    next({ path: '/401' })
+    next({ path: '/403' })
   }
   else if (to.meta.allowPath) {
     if (to.meta.title) {

+ 1 - 1
src/utils/model/contextMenu/index.vue

@@ -99,7 +99,7 @@ export default {
   destroyed(){
     window.removeEventListener('mousedown',()=>{})
     window.removeEventListener('beforeunload',()=>{})
-  }
+  },
 };
 </script>
   

+ 3 - 0
src/utils/model/myView/index.vue

@@ -178,6 +178,9 @@
     },
     deactivated(){
       window.removeEventListener('resize',()=>{})
+    },
+    beforeDestroy(){
+      window.removeEventListener('resize',()=>{})
     }
   }
   </script>

+ 3 - 0
src/utils/model/myView/index1.vue

@@ -205,6 +205,9 @@ export default {
   },
   deactivated(){
     window.removeEventListener('resize',()=>{})
+  },
+  beforeDestroy(){
+    window.removeEventListener('resize',()=>{})
   }
 }
 </script>

+ 1 - 1
src/utils/model/route.vue

@@ -20,7 +20,7 @@
 import myView2 from './myView/index.vue'
 import avoidDirection from '@/views/report/avoid/components/avoidDirection.vue'
 import PatentField from '@/views/project/patentDetails/components/PatentField.vue'
-import errorPage from '@/views/components/errorPage/401.vue'
+import errorPage from '@/views/components/errorPage/403.vue'
 import noPermission from './noPermission/index.vue'
 export default {
   components: {

+ 6 - 2
src/views/components/dialog/fields.vue

@@ -41,7 +41,7 @@ export default {
       default: ''
     },
     projectId: {
-      default: 0,
+      default: null,
     },
     taskId: {
       default: null,
@@ -50,6 +50,9 @@ export default {
       type:Boolean,
       default: false,
     },
+    productId:{
+      default: null
+    }
   },
   data() {
     return {
@@ -113,8 +116,9 @@ export default {
         value: this.filedList,
         projectId: this.projectId,
         taskId: this.taskId,
+        productId:this.productId,
       }
-      let apiItem = (this.projectId == 0|| this.projectId) ? 'setTableColumns' : 'setCustomField'
+      let apiItem = (this.projectId == 0|| this.projectId || this.productId) ? 'setTableColumns' : 'setCustomField'
       // sign为true时是统计栏位
       if (this.sign) {
         apiItem = 'setShowCountColumns'

+ 3 - 3
src/views/components/errorPage/401.vue

@@ -1,18 +1,18 @@
 <template>
   <div class="height_100">
     <ErrorPageLayout>
-        <page401/>
+        <page403/>
     </ErrorPageLayout>
   </div>
 </template>
 
 <script>
 import ErrorPageLayout from './components/ErrorPageLayout.vue'
-import page401 from '@/assets/svg/401.vue'
+import page403 from '@/assets/svg/403.vue'
 export default {
   components: {
     ErrorPageLayout,
-    page401
+    page403
   },
   props: {},
   data() {

+ 3 - 0
src/views/home/components/carousel.vue

@@ -37,6 +37,9 @@ export default {
   },
   deactivated(){
     window.removeEventListener('resize',()=>{})
+  },
+  beforeDestroy(){
+    window.removeEventListener('resize',()=>{})
   }
 };
 </script>

+ 3 - 0
src/views/home/components/echarts/index.vue

@@ -44,6 +44,9 @@ export default {
   methods: {},
   deactivated(){
     window.removeEventListener('resize',()=>{})
+  },
+  beforeDestroy(){
+    window.removeEventListener('resize',()=>{})
   }
 };
 </script>

+ 3 - 0
src/views/patentMining/components/details/components/basicMessage.vue

@@ -147,6 +147,9 @@ export default {
   },
   deactivated() {
     window.removeEventListener('resize', () => { })
+  },
+  beforeDestroy(){
+    window.removeEventListener('resize',()=>{})
   }
 }
 </script>

+ 4 - 5
src/views/product/components/commodity/commodity.vue

@@ -77,7 +77,7 @@
       </el-footer>
     </el-container>
 
-    <field ref="field" type="patent" @getFieldList="getFieldList"></field>
+    <field ref="field" type="patent" :productId="productId" @getFieldList="getFieldList"></field>
   </div>
 </template>
 
@@ -157,7 +157,7 @@ export default {
     }
   },
   async mounted() {
-    this.customList = await this.$commonJS.getCustomField('patent', { projectId: `${this.productId}productId`, taskId: this.taskId || null, from: 'product', })
+    this.customList = await this.$commonJS.getCustomField('patent', { productId: this.productId })
     await this.getColumn()
     // 获取专利信息
     // this.getList()
@@ -192,8 +192,7 @@ export default {
     async getColumn() {
       let params = [{
         tableName: 'patent',
-        projectId: `${this.productId}productId`,
-        from: 'product',//来源
+        productId: this.productId,
       }]
       await this.$api.getQueryFields(params).then(res => {
         if (res.code == 200) {
@@ -205,7 +204,7 @@ export default {
             type: 'type',
             group: 'group',
             // fieldType: 'fieldType',
-            // groupBy: 'groupBy',
+            groupBy: 'groupBy',
           })
         }
       })

+ 1 - 1
src/views/product/components/index.vue

@@ -236,7 +236,7 @@ export default {
           this.showTrend(row,2)
           break;
         case '5'://专利布局可视化
-
+          this.MindIndex(row,2)
           break;
         case '6'://商品化专利
           this.toCommodity(row)

+ 152 - 134
src/views/product/components/jsMind/components/mind.vue

@@ -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) => {

+ 6 - 3
src/views/product/components/jsMind/index.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <mind :row="row"></mind>
+        <mind :type="type" :id="id"></mind>
     </div>
 </template>
 <script>
@@ -15,8 +15,11 @@ export default{
         }
     },
     computed:{
-        type:{//1是产品类别,2是产品
-            default:1
+        type(){//1是产品类别,2是产品,0是全部
+            return this.$route.query.type
+        },
+        id(){
+            return this.$route.query.id
         }
     }
 }

+ 12 - 0
src/views/product/components/mixins/fun.js

@@ -65,5 +65,17 @@ export default {
         closeViewer(){
             this.showImg = false
         },
+        //专利布局可视化
+        MindIndex(row,type){
+            console.log(row)
+            const router = this.$router.resolve({
+                path: '/MindIndex',
+                query: {
+                    id: row.id,
+                    type: type,
+                }
+            })
+            window.open(router.href, '_blank');
+        },
     },
 }

+ 3 - 0
src/views/project/components/TotalChart.vue

@@ -197,6 +197,9 @@ export default {
   },
   deactivated(){
     window.removeEventListener('resize',()=>{})
+  },
+  beforeDestroy(){
+    window.removeEventListener('resize',()=>{})
   }
 };
 </script>

+ 3 - 0
src/views/report/components/view/visual.vue

@@ -149,6 +149,9 @@
     },
     deactivated(){
       window.removeEventListener('resize',()=>{})
+    },
+    beforeDestroy(){
+      window.removeEventListener('resize',()=>{})
     }
   };
   </script>