|
@@ -1,113 +1,95 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <el-form
|
|
|
- :model="queryParams"
|
|
|
- ref="queryForm"
|
|
|
- size="small"
|
|
|
- :inline="true"
|
|
|
- label-width="68px"
|
|
|
- >
|
|
|
- <el-form-item :label="name1" prop="firstName" >
|
|
|
- <el-input
|
|
|
- v-model="queryParams.firstName"
|
|
|
- placeholder="请输入"
|
|
|
- clearable
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="name2" prop="secondName">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.secondName"
|
|
|
- placeholder="请输入"
|
|
|
- clearable
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="length">
|
|
|
- <el-radio-group v-model="queryParams.length">
|
|
|
- <el-radio-button :label="0">最短</el-radio-button>
|
|
|
- <el-radio-button :label="10">所有</el-radio-button>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
|
|
|
- >搜索</el-button
|
|
|
- >
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <Graph ref="charts" :chartList="chartData" />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
|
|
|
+ <el-form-item :label="name1" prop="firstName">
|
|
|
+ <el-input v-model="queryParams.firstName" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="name2" prop="secondName">
|
|
|
+ <el-input v-model="queryParams.secondName" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="length">
|
|
|
+ <el-radio-group v-model="queryParams.length">
|
|
|
+ <el-radio-button :label="0">最短</el-radio-button>
|
|
|
+ <el-radio-button :label="10">所有</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <Graph ref="charts" :chartList="chartData" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
|
|
|
- <script>
|
|
|
- import Graph from "@/components/Echarts/graph";
|
|
|
- import { getGraphByEntiry } from "@/api/knowledge/search";
|
|
|
-
|
|
|
- export default {
|
|
|
- name: "GranphSearch",
|
|
|
- dicts: ["graph_search_length"],
|
|
|
- components: { Graph },
|
|
|
- props:{
|
|
|
- name1: {
|
|
|
- type: String,
|
|
|
- required: true
|
|
|
- },
|
|
|
- name2: {
|
|
|
- type: String,
|
|
|
- required: true
|
|
|
- }
|
|
|
+<script>
|
|
|
+import Graph from "@/components/Echarts/graph";
|
|
|
+import { getGraphByEntiry } from "@/api/knowledge/search";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "GranphSearch",
|
|
|
+ dicts: ["graph_search_length"],
|
|
|
+ components: { Graph },
|
|
|
+ props: {
|
|
|
+ name1: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- queryParams: {
|
|
|
- firstName: "",
|
|
|
- secondName: "",
|
|
|
- length: "0",
|
|
|
- },
|
|
|
- chartData: {
|
|
|
- seriesData:[],
|
|
|
- linksData:[],
|
|
|
- },
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- handleQuery() {
|
|
|
- if(this.queryParams.firstName == this.queryParams.secondName){
|
|
|
- this.$message.error('不能查询自己的关联');
|
|
|
- return
|
|
|
- }
|
|
|
- getGraphByEntiry(this.queryParams).then((resp) => {
|
|
|
- let respData = resp.data
|
|
|
- let seriesData = []
|
|
|
- let linksData = []
|
|
|
- for(let item of respData.data){
|
|
|
- seriesData.push(
|
|
|
- {name: item.name}
|
|
|
- )
|
|
|
- }
|
|
|
- for(let link of respData.links){
|
|
|
- linksData.push(
|
|
|
- {
|
|
|
- source: link.fromName,
|
|
|
- target: link.toName,
|
|
|
- label: {
|
|
|
- show: true, // 是否显示line的文字
|
|
|
- formatter: link.name // line的文字
|
|
|
- },
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
- this.chartData = {
|
|
|
- seriesData,
|
|
|
- linksData,
|
|
|
- }
|
|
|
- });
|
|
|
+ name2: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ queryParams: {
|
|
|
+ firstName: "",
|
|
|
+ secondName: "",
|
|
|
+ length: "0",
|
|
|
},
|
|
|
- resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
+ chartData: {
|
|
|
+ seriesData: [],
|
|
|
+ linksData: [],
|
|
|
},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleQuery() {
|
|
|
+ if (this.queryParams.firstName == this.queryParams.secondName) {
|
|
|
+ this.$message.error('不能查询自己的关联');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ getGraphByEntiry(this.queryParams).then((resp) => {
|
|
|
+ let respData = resp.data
|
|
|
+ let seriesData = []
|
|
|
+ let linksData = []
|
|
|
+ for (let item of respData.data) {
|
|
|
+ seriesData.push(
|
|
|
+ { name: item.name }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ for (let link of respData.links) {
|
|
|
+ linksData.push(
|
|
|
+ {
|
|
|
+ source: link.fromName,
|
|
|
+ target: link.toName,
|
|
|
+ label: {
|
|
|
+ show: true, // 是否显示line的文字
|
|
|
+ formatter: link.name // line的文字
|
|
|
+ },
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ this.chartData = {
|
|
|
+ seriesData,
|
|
|
+ linksData,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
},
|
|
|
- };
|
|
|
- </script>
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
|