Browse Source

新增关联页面

wxxwjef 2 năm trước cách đây
mục cha
commit
8cd092c4fd

BIN
web/public/武器装备-本体模型.xlsx


+ 10 - 7
web/src/components/dialog/EdgeDetail.vue

@@ -20,13 +20,13 @@
         <label>查询中</label>
       </div>
       <el-form-item :label="item.comment" v-for="item in infoList" :key="item.field">
-        <el-input v-model="item.value"></el-input>
+        <el-input v-model="item.value" disabled></el-input>
       </el-form-item>
     </el-form>
-    <div class="btn-box">
-      <el-button type="danger" @click="removeItem" v-show="editFlag">删 除</el-button>
-      <el-button type="primary" @click="submitUpdate">保 存</el-button>
-    </div>
+<!--    <div class="btn-box">-->
+<!--      <el-button type="danger" @click="removeItem" v-show="editFlag">删 除</el-button>-->
+<!--      <el-button type="primary" @click="submitUpdate">保 存</el-button>-->
+<!--    </div>-->
   </div>
 </template>
 
@@ -96,7 +96,9 @@ export default {
         method: 'get',
         data: {}
       }).then(res => {
-        vm.form[comment] = getFirstStringProperty(res.data.properties);
+
+        // vm.form[comment] = getFirstStringProperty(res.data.properties);
+        vm.form[comment] = vid;
       });
     },
     queryEdgeDetail(edgeType, srcVid, dstVid) {
@@ -141,7 +143,8 @@ export default {
       let _infoList = [];
       Reflect.ownKeys(properties).forEach(key => {
         _infoList.push({
-          comment: map[key],
+          // comment: map[key],
+          comment: key,
           field: key,
           value: properties[key]
         });

+ 2 - 1
web/src/components/graph/GraphModel.vue

@@ -258,7 +258,7 @@ var _ = require('lodash');
 var nodeProps = {
   id: 'vid',
   label: 'properties.label',
-  name: 'properties.tagName',
+  name: 'vid',
   labelName: 'properties.label'
 };
 var edgeProps = {
@@ -873,6 +873,7 @@ function resolveGraphData(data) {
     Reflect.ownKeys(nodeProps).forEach(key => {
       node[key] = _.get(node, nodeProps[key], '');
     });
+    console.log(node);
   });
   data.relations.forEach(edge => {
     Reflect.ownKeys(edgeProps).forEach(key => {

+ 155 - 141
web/src/components/graph/GraphSpace.vue

@@ -5,22 +5,22 @@
         <div class="graph-info-child">
           <div class="info-item" style="margin-bottom: 15px">
             <div class="info-item-title">
-              <label>{{comment}}</label>
+              <label>{{ comment }}</label>
               <!--<div class="add-attribute-box" style="float: right" @click="showAddGraphSpaceDialog({Name:''})">新建-->
               <!--</div>-->
               <!--<div class="add-attribute-box" style="float: right;margin-right: 10px" @click="removeGraphSpace()">-->
-                <!--删除-->
+              <!--删除-->
               <!--</div>-->
             </div>
             <div class="info-item-content">
               <!--<el-select v-model="space" filterable placeholder="请选择" @change="handleSpaceChange">-->
-                <!--<el-option v-for="item in spaceList"-->
-                           <!--:key="item.name"-->
-                           <!--:label="item.comment"-->
-                           <!--:value="item.name">-->
-                <!--</el-option>-->
+              <!--<el-option v-for="item in spaceList"-->
+              <!--:key="item.name"-->
+              <!--:label="item.comment"-->
+              <!--:value="item.name">-->
+              <!--</el-option>-->
               <!--</el-select>-->
-              <div style="margin-top: 20px;font-size: 14px;color: #606266">本体名称:{{ontologyName}}</div>
+              <div style="margin-top: 20px;font-size: 14px;color: #606266">本体名称:{{ ontologyName }}</div>
             </div>
           </div>
           <el-tabs v-model="activeTab" class="el-tabs-item">
@@ -36,7 +36,7 @@
                   <template slot-scope="scope">
                     <div :style="scope.row.Name === activeSelectType ? 'color: #409EFF':''">
                       <label>{{ scope.row.comment }}</label>
-                      <label>({{ scope.row.count }})</label>
+                      <!--                      <label>({{ scope.row.count }})</label>-->
                     </div>
                   </template>
                 </el-table-column>
@@ -55,7 +55,7 @@
                   <template slot-scope="scope">
                     <div :style="scope.row.Name === activeSelectType ? 'color: #409EFF':''">
                       <label>{{ scope.row.comment }}</label>
-                      <label>({{ scope.row.count }})</label>
+                      <!--                      <label>({{ scope.row.count }})</label>-->
                     </div>
                   </template>
                 </el-table-column>
@@ -79,6 +79,9 @@
           <div v-show="tabModifyCmdType === 'nodeDetail'">
             <node-detail ref="nodeDetail"></node-detail>
           </div>
+          <div v-show="tabModifyCmdType === 'edgeDetail'">
+            <edge-detail ref="edgeDetail"></edge-detail>
+          </div>
           <div v-show="tabModifyCmdType === 'edgeAdd'">
             <edge-add ref="edgeAdd"></edge-add>
           </div>
@@ -92,7 +95,8 @@
         <div v-if="showFlag" style="display: inline-block;margin-right: 50px">
           <el-input placeholder="请输入关键词" v-model="keyword" style="width: 550px">
             <el-select v-model="searchTag" slot="prepend" placeholder="请选择概念" style="width: 150px" filterable>
-              <el-option :label="item.comment" :value="item.Name" v-for="(item,index) in tagList" v-if="index != 0"></el-option>
+              <el-option :label="item.comment" :value="item.Name" v-for="(item,index) in tagList"
+                         v-if="index != 0"></el-option>
             </el-select>
             <el-button slot="append" icon="el-icon-search" @click="searchBtn()"></el-button>
           </el-input>
@@ -111,8 +115,8 @@
           <i title="返回"></i>
         </div>
         <!--<div title="按住shift点选两节点可新增关系" :class="['icon icon-arrow', createEdgeModelFlag ? 'active' : '']"-->
-             <!--@click="changeCreateEdgeModel">-->
-          <!--<i title="按住shift点选两节点可新增关系"></i>-->
+        <!--@click="changeCreateEdgeModel">-->
+        <!--<i title="按住shift点选两节点可新增关系"></i>-->
         <!--</div>-->
         <!--        <div class="icon icon-remove" @click="removeNode">-->
         <!--          <i title="删除"></i>-->
@@ -212,7 +216,7 @@ export default {
     'node-detail': nodeDetail,
     'edge-detail': edgeDetail,
     'graph-space-add': graphSpaceAdd,
-    'edge-add':edgeAdd
+    'edge-add': edgeAdd
   },
   data() {
     return {
@@ -233,15 +237,15 @@ export default {
       },
       tagMap: {},
       edgeMap: {},
-      ontologyName:"",
-      showFlag:false,
-      keyword:"",
-      searchTag:"",
-      ontologyId:"",
-      comment:"",
-      qo:{
-          pageNo:"",
-          name:""
+      ontologyName: "",
+      showFlag: false,
+      keyword: "",
+      searchTag: "",
+      ontologyId: "",
+      comment: "",
+      qo: {
+        pageNo: "",
+        name: ""
       }
     }
   },
@@ -249,15 +253,15 @@ export default {
     vm = this;
   },
   mounted() {
-      vm.qo = {
-          pageNo: this.$route.query.pageNo,
-          name: this.$route.query.name
-      };
-      vm.ontologyId = this.$route.query.ontologyId;
-      vm.space = this.$route.query.space;
-      vm.comment = this.$route.query.comment;
-      vm.handleSpaceChange();
-      // vm.querySpaceList();
+    vm.qo = {
+      pageNo: this.$route.query.pageNo,
+      name: this.$route.query.name
+    };
+    vm.ontologyId = this.$route.query.ontologyId;
+    vm.space = this.$route.query.space;
+    vm.comment = this.$route.query.comment;
+    vm.handleSpaceChange();
+    // vm.querySpaceList();
     // vm.initGraph();
   },
   methods: {
@@ -271,34 +275,34 @@ export default {
         if (res.data.length > 0) {
           vm.space = res.data[0].name;
           vm.handleSpaceChange();
-        }else{
-            vm.space = "";
-            vm.tagMap = {};
-            vm.edgeMap = {};
-            vm.tagList = [];
-            vm.edgeList = [];
-            vm.ontologyName = "";
-            vm.destroyGraph();
+        } else {
+          vm.space = "";
+          vm.tagMap = {};
+          vm.edgeMap = {};
+          vm.tagList = [];
+          vm.edgeList = [];
+          vm.ontologyName = "";
+          vm.destroyGraph();
         }
       });
     },
-    queryOntologyDetail(){
-        var id = vm.ontologyId;
-        // vm.spaceList.forEach(item => {
-        //     if(item.name == vm.space){
-        //         id = item.OntologyId;
-        //     }
-        // })
-
-        if(id){
-            request({
-                url: `/ontology/getone/`+id,
-                method: 'post',
-                data: {id:id}
-            }).then(res => {
-                vm.ontologyName = res.data.name;
-            })
-        }
+    queryOntologyDetail() {
+      var id = vm.ontologyId;
+      // vm.spaceList.forEach(item => {
+      //     if(item.name == vm.space){
+      //         id = item.OntologyId;
+      //     }
+      // })
+
+      if (id) {
+        request({
+          url: `/ontology/getone/` + id,
+          method: 'post',
+          data: {id: id}
+        }).then(res => {
+          vm.ontologyName = res.data.name;
+        })
+      }
     },
     handleSpaceChange() {
       vm.initGraph();
@@ -342,10 +346,10 @@ export default {
         method: 'get',
         data: {}
       }).then(res => {
-        res.data.unshift({
-          Name: `All`,
-          comment: '实体数'
-        });
+        // res.data.unshift({
+        //   Name: `All`,
+        //   comment: '实体数'
+        // });
         res.data.forEach(row => {
           row.count = vm.tagMap[row.Name] ? vm.tagMap[row.Name] : 0;
         });
@@ -359,10 +363,10 @@ export default {
         method: 'get',
         data: {}
       }).then(res => {
-        res.data.unshift({
-          Name: `All`,
-          comment: '三元组数'
-        });
+        // res.data.unshift({
+        //   Name: `All`,
+        //   comment: '三元组数'
+        // });
         res.data.forEach(row => {
           row.count = vm.edgeMap[row.Name] ? vm.edgeMap[row.Name] : 0;
         });
@@ -405,6 +409,7 @@ export default {
     queryDetail(type, obj) { // type : node/edge
       vm.tabModifyCmdType = type + 'Detail';
       vm.propsInfoVisible = true;
+      console.log(type);
       vm.$nextTick(() => {
         vm.$refs[type + 'Detail'].queryDetail(vm.space, obj);
       });
@@ -478,8 +483,17 @@ export default {
           });
 
           if (node.properties) {
-            node.label = node.name = getFirstStringProperty(node.properties);
+            // node.label = node.name = getFirstStringProperty(node.properties);
+            node.label = node.name = node.vid;
           }
+
+          if(node.labels === 'tag_1412011336') {
+            node.style = {
+              fill: '#8fe8e8'
+            }
+          }
+
+
         });
       }
 
@@ -603,90 +617,90 @@ export default {
         vm.$refs['nodeDetail'].createItem(vm.space);
       });
     },
-    showAddEdgeDialog(){
-        vm.tabModifyCmdType = 'edgeAdd';
-        vm.propsInfoVisible = true;
-        vm.$nextTick(() => {
-            vm.$refs['edgeAdd'].createItem(vm.space);
-        });
+    showAddEdgeDialog() {
+      vm.tabModifyCmdType = 'edgeAdd';
+      vm.propsInfoVisible = true;
+      vm.$nextTick(() => {
+        vm.$refs['edgeAdd'].createItem(vm.space);
+      });
     },
     //搜索
-    searchBtn(){
-        if(!vm.searchTag){
-            vm.$message.warning("请选择概念");
-            return false;
-        }
-        if(!vm.keyword){
-            vm.$message.warning("请输入关键字");
-            return false;
-        }
-        vm.graphLoading = true;
-        request({
-            url: `/nebula_operate/findnodebykeyword/${vm.space}/${vm.searchTag}`,
-            method: 'post',
-            data: {keyword:vm.keyword}
-        }).then(res => {
-            if (res.data) {
-                res.data.forEach(node => {
-                    Reflect.ownKeys(nodeProps).forEach(key => {
-                        node[key] = _.get(node, nodeProps[key], '');
-                    });
-
-                    if (node.properties) {
-                        node.label = node.name = getFirstStringProperty(node.properties);
-                    }
-                });
+    searchBtn() {
+      if (!vm.searchTag) {
+        vm.$message.warning("请选择概念");
+        return false;
+      }
+      if (!vm.keyword) {
+        vm.$message.warning("请输入关键字");
+        return false;
+      }
+      vm.graphLoading = true;
+      request({
+        url: `/nebula_operate/findnodebykeyword/${vm.space}/${vm.searchTag}`,
+        method: 'post',
+        data: {keyword: vm.keyword}
+      }).then(res => {
+        if (res.data) {
+          res.data.forEach(node => {
+            Reflect.ownKeys(nodeProps).forEach(key => {
+              node[key] = _.get(node, nodeProps[key], '');
+            });
+
+            if (node.properties) {
+              node.label = node.name = getFirstStringProperty(node.properties);
             }
+          });
+        }
 
-            graphData = {
-                nodes: res.data ? res.data : [],
-                edges: []
-            };
-            // 读取数据
-            graph.data(graphData);
-            // 渲染图
-            graph.render();
-            vm.graphLoading = false;
-        });
+        graphData = {
+          nodes: res.data ? res.data : [],
+          edges: []
+        };
+        // 读取数据
+        graph.data(graphData);
+        // 渲染图
+        graph.render();
+        vm.graphLoading = false;
+      });
     },
-    findOnePathBySrcidAndDctid(srcId, dstId){
-        request({
-            url: `/nebula_operate/findonepathbysrcidanddctid/${vm.space}/${srcId}/${dstId}`,
-            method: 'get',
-            data: {}
-        }).then(res => {
-            vm.resolveGraphData(res);
-        });
+    findOnePathBySrcidAndDctid(srcId, dstId) {
+      request({
+        url: `/nebula_operate/findonepathbysrcidanddctid/${vm.space}/${srcId}/${dstId}`,
+        method: 'get',
+        data: {}
+      }).then(res => {
+        vm.resolveGraphData(res);
+      });
     },
-    findNodeById(tag,vid){
-        request({
-            url: `/nebula_operate/findnodebyid/${vm.space}/${tag}/${vid}`,
-            method: 'get',
-            data: {}
-        }).then(res => {
-            if (res.data) {
-                Reflect.ownKeys(nodeProps).forEach(key => {
-                    res.data[key] = _.get(res.data, nodeProps[key], '');
-                });
-
-                if (res.data.properties) {
-                    res.data.label = res.data.name = getFirstStringProperty(res.data.properties);
-                }
-            }
+    findNodeById(tag, vid) {
+      request({
+        url: `/nebula_operate/findnodebyid/${vm.space}/${tag}/${vid}`,
+        method: 'get',
+        data: {}
+      }).then(res => {
+        if (res.data) {
+          Reflect.ownKeys(nodeProps).forEach(key => {
+            res.data[key] = _.get(res.data, nodeProps[key], '');
+          });
 
-            graphData = {
-                nodes: res.data ? [res.data] : [],
-                edges: []
-            };
-            // 读取数据
-            graph.data(graphData);
-            // 渲染图
-            graph.render();
-            vm.graphLoading = false;
-        });
+          if (res.data.properties) {
+            res.data.label = res.data.name = getFirstStringProperty(res.data.properties);
+          }
+        }
+
+        graphData = {
+          nodes: res.data ? [res.data] : [],
+          edges: []
+        };
+        // 读取数据
+        graph.data(graphData);
+        // 渲染图
+        graph.render();
+        vm.graphLoading = false;
+      });
     },
     backGraph() { // 返回
-        vm.$router.push({path: "/graphSpaceManage", query: {pageNo: vm.qo.pageNo, name: vm.qo.name}})
+      vm.$router.push({path: "/graphSpaceManage", query: {pageNo: vm.qo.pageNo, name: vm.qo.name}})
     },
   }
 }

+ 2 - 2
web/src/components/menus/EntrysManage.vue

@@ -7,10 +7,10 @@
       <div>
         <el-form :inline="true" :model="qo" class="demo-form-inline">
           <el-form-item>
-            <el-input v-model="qo.LIKES_categories" placeholder="请输入种类"></el-input>
+            <el-input v-model="qo.LIKES_categories" placeholder="请输入种类" clearable></el-input>
           </el-form-item>
           <el-form-item>
-            <el-input v-model="qo.LIKES_labels" placeholder="请输入标签"></el-input>
+            <el-input v-model="qo.LIKES_labels" placeholder="请输入标签" clearable></el-input>
           </el-form-item>
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>

+ 1 - 1
web/src/components/menus/FeedbackTypeManage.vue

@@ -7,7 +7,7 @@
       <div>
         <el-form :inline="true" :model="qo" class="demo-form-inline">
           <el-form-item>
-            <el-input v-model="qo.LIKES_name" placeholder="请输入名称"></el-input>
+            <el-input v-model="qo.LIKES_name" placeholder="请输入名称" clearable></el-input>
           </el-form-item>
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>

+ 13 - 2
web/src/components/menus/UserManage.vue

@@ -7,7 +7,7 @@
       <div>
         <el-form :inline="true" :model="qo" class="demo-form-inline">
           <el-form-item>
-            <el-input v-model="qo.LIKES_fid" placeholder="请输入Fid"></el-input>
+            <el-input v-model="qo.LIKES_fid" placeholder="请输入Fid" clearable></el-input>
           </el-form-item>
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>
@@ -29,8 +29,11 @@
               <el-tag v-if="scope.row.labelsArr.length > 5">...</el-tag>
             </div>
           </el-table-column>
-          <el-table-column label="操作" width="180">
+          <el-table-column label="操作" width="240">
             <template slot-scope="scope">
+              <el-button @click.native.prevent="linkUser(scope.row)" type="text" size="small">
+                关联
+              </el-button>
               <el-button @click.native.prevent="similarUser(scope.row)" type="text" size="small">
                 相似
               </el-button>
@@ -127,6 +130,14 @@ export default {
       _this.qo.pageNo = val;
       _this.queryData();
     },
+    linkUser(item) {
+      _this.$router.push({
+        path: "linkUser", query: {
+          userId: item.fid,
+          qo: JSON.stringify(_this.qo)
+        }
+      });
+    },
     similarUser(item) {
       _this.$router.push({
         path: "similarUser", query: {

+ 1 - 5
web/src/components/menus/item/RecommendItem.vue

@@ -105,11 +105,7 @@ export default {
       });
     },
     backBtn() {
-      this.$router.push({
-        path: "userManage", query: {
-          qo: _this.qo
-        }
-      });
+      _this.$router.back();
     },
   }
 }

+ 122 - 0
web/src/components/menus/user/LinkUser.vue

@@ -0,0 +1,122 @@
+<template>
+  <div>
+    <div class="menu-title">
+      关联用户({{ userId }})
+      <div class="icon icon-back" @click="backBtn">
+        <i title="返回"></i>
+      </div>
+    </div>
+    <div class="block_box" style="margin-top: 0">
+      <div class="title">信息</div>
+      <div>
+        <el-form label-width="100px">
+          <el-form-item label="标签">
+            <template v-for="(tag,index) in user.labelsArr">
+              <el-tag :key="index">{{ tag }}</el-tag>
+            </template>
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
+    <div class="block_box">
+      <div class="title">Association Items</div>
+      <div>
+        <el-table :data="list" style="width: 100%">
+          <el-table-column type="index" label="行号" width="60"></el-table-column>
+          <el-table-column prop="vid" label="UserId"></el-table-column>
+          <el-table-column label="操作" width="210">
+            <template slot-scope="scope">
+              <el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small">
+                洞悉
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import request from '@/utils/request';
+
+var _this;
+export default {
+  name: "linkUser",
+  data() {
+    return {
+      qo: "",
+      userId: '',
+      user: {},
+      list: []
+    }
+  },
+  mounted() {
+    _this = this;
+    _this.qo = _this.$route.query.qo;
+    _this.userId = _this.$route.query.userId;
+    _this.queryUser();
+    _this.getLinkUser();
+  },
+  methods: {
+    queryUser() {
+      request({
+        url: '/risk-user/query_unique',
+        method: 'post',
+        data: {
+          EQS_fid: _this.userId
+        }
+      }).then(res => {
+        res.data.labelsArr = res.data.labels ? res.data.labels.split(',') : [];
+        _this.user = res.data;
+      });
+    },
+    getLinkUser() {
+      let space = 'recom_gorse';
+      request({
+        url: `/nebula_operate/findonepathbyidwithrelation/${space}/${_this.userId}`,
+        method: 'post',
+        data: {
+          relations: ['edge_6253525352']
+        }
+      }).then(res => {
+        _this.list = res.data.nodes;
+      });
+    },
+    recommendItem(item) {
+      _this.$router.push({
+        path: "recommendItem", query: {
+          userId: item.vid,
+          qo: JSON.stringify(_this.qo)
+        }
+      });
+    },
+    backBtn() {
+      this.$router.push({
+        path: "userManage", query: {
+          qo: _this.qo
+        }
+      });
+    },
+  }
+}
+</script>
+<style src="../../../css/back.css" scoped></style>
+<style scoped lang="scss">
+
+.block_box {
+  margin: 25px;
+  background: #FFFFFF;
+  border-radius: 3px;
+
+  .title {
+    border-bottom: 1px solid #ccc;
+    padding: 15px 25px;
+  }
+
+  >div {
+    padding: 25px;
+
+  }
+}
+</style>

+ 15 - 0
web/src/components/menus/user/SimilarUser.vue

@@ -37,6 +37,13 @@
               {{scope.row.Score.toFixed(5)}}
             </template>
           </el-table-column>
+          <el-table-column label="操作" width="210">
+            <template slot-scope="scope">
+              <el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small">
+                洞悉
+              </el-button>
+            </template>
+          </el-table-column>
         </el-table>
       </div>
     </div>
@@ -91,6 +98,14 @@ export default {
         _this.list = res.data;
       });
     },
+    recommendItem(item) {
+      _this.$router.push({
+        path: "recommendItem", query: {
+          userId: item.UserId,
+          qo: JSON.stringify(_this.qo)
+        }
+      });
+    },
     backBtn() {
       this.$router.push({
         path: "userManage", query: {

+ 1 - 0
web/src/css/back.css

@@ -10,6 +10,7 @@ div.icon {
   line-height: 50px;
   margin-right: 80px;
   margin-top: 9px;
+  padding: 0;
 }
 
 div.icon i {

+ 4 - 0
web/src/router/index.js

@@ -68,6 +68,10 @@ export default new Router({
                     component: () => import('@/components/menus/user/SimilarUser')
                 },
                 {
+                    path: 'linkUser',
+                    component: () => import('@/components/menus/user/LinkUser')
+                },
+                {
                     path: 'recommendItem',
                     component: () => import('@/components/menus/item/RecommendItem')
                 },

+ 1 - 1
web/src/utils/request.js

@@ -5,7 +5,7 @@ import {getToken} from '@/utils/auth'
 
 // var _baseURL = "http://localhost:4026";
 var _baseURL = "http://139.9.106.207:4026";
-var _fileURL = "http://118.31.22.243:80/web/";
+var _fileURL = "http://139.9.106.207:4026/web/";
 // create an axios instance
 const service = axios.create({
     baseURL: _baseURL, // url = base url + request url