|
|
@@ -1,12 +1,27 @@
|
|
|
<template>
|
|
|
- <div style="background:#f1f2f3" id="full">
|
|
|
+ <div style="background:#f1f2f3" id="full" :style="contentStyle">
|
|
|
<img style="width: 25px; height: 25px;float: right" v-if="!fullscreen" @click="enterFullscreen" src="@/assets/icons/amplify.svg" title="全屏">
|
|
|
<img style="width: 25px; height: 25px;float: right" @click="backFullscreen" v-if="fullscreen" src="@/assets/icons/reduce.svg" title="还原">
|
|
|
<div id="container"></div>
|
|
|
+ <el-drawer
|
|
|
+ :visible.sync="drawer"
|
|
|
+ append-to-body
|
|
|
+ size="900px"
|
|
|
+ :with-header="false">
|
|
|
+ <p style="padding: 10px 0px 0px 10px">{{title}}</p>
|
|
|
+ <competitorInfo v-if="title == '竞争对手列表'" :data="tableData"></competitorInfo>
|
|
|
+ <customInfo v-if="title == '关联客户列表'" :data="tableData"></customInfo>
|
|
|
+ <contractInfo v-if="title == '合同列表'" :data="tableData"></contractInfo>
|
|
|
+ <quotationInfo v-if="title == '报价列表'" :data="tableData"></quotationInfo>
|
|
|
+ </el-drawer>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import competitorInfo from "@/components/mindmap/modules/competitorInfo";
|
|
|
+import customInfo from "@/components/mindmap/modules/customInfo";
|
|
|
+import contractInfo from "@/components/mindmap/modules/contractInfo";
|
|
|
+import quotationInfo from "@/components/mindmap/modules/quotationInfo";
|
|
|
import G6 from '@antv/g6';
|
|
|
import axios from 'axios'
|
|
|
let graph;
|
|
|
@@ -35,25 +50,25 @@ const ERROR_COLOR = 'red';
|
|
|
const getNodeConfig = (node) => {
|
|
|
if (node.nodeUrl) {
|
|
|
return {
|
|
|
- basicColor: ERROR_COLOR,
|
|
|
- fontColor: '#FFF',
|
|
|
- borderColor: ERROR_COLOR,
|
|
|
- bgColor: '#ff5722',
|
|
|
+ basicColor: node.color,
|
|
|
+ fontColor: '#333',
|
|
|
+ borderColor: node.color,
|
|
|
+ bgColor: '#fff',
|
|
|
};
|
|
|
}
|
|
|
let config = {
|
|
|
- basicColor: '#fff',
|
|
|
+ basicColor: node.color,
|
|
|
fontColor: '#333',
|
|
|
- borderColor: '#fff',
|
|
|
- bgColor: '#fff',
|
|
|
+ borderColor: node.color,
|
|
|
+ bgColor: node.color,
|
|
|
};
|
|
|
switch (node.type) {
|
|
|
case 'root': {
|
|
|
config = {
|
|
|
- basicColor: '#E3E6E8',
|
|
|
+ basicColor: node.color,
|
|
|
fontColor: 'rgba(0,0,0,0.85)',
|
|
|
borderColor: '#E3E6E8',
|
|
|
- bgColor: '#5b8ff9',
|
|
|
+ bgColor: node.color,
|
|
|
};
|
|
|
break;
|
|
|
}
|
|
|
@@ -85,11 +100,14 @@ const EXPAND_ICON = function EXPAND_ICON(x, y, r) {
|
|
|
};
|
|
|
const nodeBasicMethod = {
|
|
|
createNodeBox: (group, config, w, h, isRoot) => {
|
|
|
+ console.log(config,'--')
|
|
|
/* 最外面的大矩形 */
|
|
|
const container = group.addShape('rect', {
|
|
|
attrs: {
|
|
|
x: 0,
|
|
|
y: 0,
|
|
|
+ fill: config.bgColor,
|
|
|
+ stroke: config.borderColor,
|
|
|
width: w,
|
|
|
height: h,
|
|
|
},
|
|
|
@@ -116,7 +134,7 @@ const nodeBasicMethod = {
|
|
|
y: 0,
|
|
|
width: w - 19,
|
|
|
height: h,
|
|
|
- fill: config.bgColor,
|
|
|
+ fill: config.basicColor,
|
|
|
stroke: config.borderColor,
|
|
|
radius: 2,
|
|
|
cursor: 'pointer',
|
|
|
@@ -358,10 +376,14 @@ G6.registerNode('card-node', {
|
|
|
setState: nodeBasicMethod.setState,
|
|
|
});
|
|
|
export default {
|
|
|
- props:['id'],
|
|
|
+ props:['id','contentStyle'],
|
|
|
+ components:{competitorInfo,customInfo,contractInfo,quotationInfo},
|
|
|
data () {
|
|
|
return {
|
|
|
- fullscreen:false
|
|
|
+ fullscreen:false,
|
|
|
+ drawer:false,
|
|
|
+ title:'',
|
|
|
+ tableData: []
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
@@ -375,7 +397,7 @@ export default {
|
|
|
createMenu (array) {
|
|
|
var that = this
|
|
|
let arr = []
|
|
|
- const HASLINKS = ['关联客户','竞争对手','报价单有效数','合同有效数']
|
|
|
+ const HASLINKS = ['关联客户','竞争对手','报价单有效数','合同有效数','报价','合同']
|
|
|
function convertToElementTree(node) {
|
|
|
// 新节点
|
|
|
var elNode = {
|
|
|
@@ -384,6 +406,8 @@ export default {
|
|
|
info:node['info']?node['info']:{},
|
|
|
infoSize:node['infoSize']?node['infoSize']:1,
|
|
|
value:node['labor']?node['labor'] !== node['name']?node['labor']:'-':'-',
|
|
|
+ data:node['data'],
|
|
|
+ color:node['color'],
|
|
|
children: [],
|
|
|
nodeUrl:HASLINKS.includes(node['name'])?'123':null
|
|
|
}
|
|
|
@@ -409,9 +433,10 @@ export default {
|
|
|
"sa_projectid": this.id
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
const container = document.getElementById('container');
|
|
|
const width = container.scrollWidth;
|
|
|
- const height = container.scrollHeight || 500;
|
|
|
+ const height = container.scrollHeight - 100 || 500;
|
|
|
const graph = new G6.TreeGraph({
|
|
|
container: 'container',
|
|
|
width,
|
|
|
@@ -432,7 +457,7 @@ export default {
|
|
|
type: 'dendrogram',
|
|
|
direction: 'RL',
|
|
|
nodeSep: 100,
|
|
|
- rankSep: 250,
|
|
|
+ rankSep: 500,
|
|
|
radial: true,
|
|
|
},
|
|
|
});
|
|
|
@@ -448,7 +473,12 @@ export default {
|
|
|
graph.fitView();
|
|
|
graph.on('node:click', evt => {
|
|
|
const item = evt.item;
|
|
|
- console.log(item)
|
|
|
+ console.log(item._cfg.model,'点击列表')
|
|
|
+ this.tableData = item._cfg.model.data
|
|
|
+ this.title = item._cfg.model.label + '列表'
|
|
|
+ if (item._cfg.model.label == '竞争对手' || item._cfg.model.label == '关联客户' || item._cfg.model.label == '报价' || item._cfg.model.label == '合同'){
|
|
|
+ this.drawer = true
|
|
|
+ }
|
|
|
})
|
|
|
if (typeof window !== 'undefined')
|
|
|
window.onresize = () => {
|
|
|
@@ -456,6 +486,44 @@ export default {
|
|
|
if (!container || !container.scrollWidth || !container.scrollHeight) return;
|
|
|
graph.changeSize(container.scrollWidth, container.scrollHeight);
|
|
|
};
|
|
|
+
|
|
|
+ if (this.$route.query.portrait === 'jzds'){
|
|
|
+ res.data.children.forEach(item=>{
|
|
|
+ if (item.name === '竞争对手'){
|
|
|
+ this.tableData = item.data
|
|
|
+ this.title = '竞争对手列表'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.drawer = true
|
|
|
+ this.$route.query.portrait = ''
|
|
|
+ }else if (this.$route.query.portrait === 'glkh'){
|
|
|
+ res.data.children.forEach(item=>{
|
|
|
+ if (item.name === '关联客户'){
|
|
|
+ this.tableData = item.data
|
|
|
+ this.title = '关联客户列表'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.drawer = true
|
|
|
+ this.$route.query.portrait = ''
|
|
|
+ }else if (this.$route.query.portrait === 'bj'){
|
|
|
+ res.data.children.forEach(item=>{
|
|
|
+ if (item.name === '报价'){
|
|
|
+ this.tableData = item.data
|
|
|
+ this.title = '报价列表'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.drawer = true
|
|
|
+ this.$route.query.portrait = ''
|
|
|
+ }else if (this.$route.query.portrait === 'ht'){
|
|
|
+ res.data.children.forEach(item=>{
|
|
|
+ if (item.name === '合同'){
|
|
|
+ this.tableData = item.data
|
|
|
+ this.title = '合同列表'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.drawer = true
|
|
|
+ this.$route.query.portrait = ''
|
|
|
+ }
|
|
|
},
|
|
|
enterFullscreen () {
|
|
|
/* 获取(<html>)元素以全屏显示页面 */
|
|
|
@@ -503,7 +571,7 @@ export default {
|
|
|
</script>
|
|
|
<style>
|
|
|
#container{
|
|
|
- height: 100vh;
|
|
|
+ height: calc(100vh - 200px);
|
|
|
width: 100vw;
|
|
|
}
|
|
|
</style>
|