Browse Source

图谱实现,关系待修改

work_tab_bar
mk 1 year ago
parent
commit
bb111fda59
  1. 17
      components/custom-tab-bar/index.js
  2. 2
      ec-canvas/echarts.js
  3. 306
      subpages/searchResult/pages/resiInfo/component/graph/graph.js
  4. 2
      subpages/searchResult/pages/resiInfo/component/graph/graph.wxml
  5. 25
      subpages/searchResult/pages/resiInfo/resiInfo.js
  6. 9
      subpages/searchResult/pages/resiInfo/resiInfo.wxml

17
components/custom-tab-bar/index.js

@ -24,15 +24,6 @@ Component({
show: true show: true
}, },
,
{
"pagePath": "/pages/work2/work2",
"text": "工作",
"iconPath": "/images/home/work.png",
"selectedIconPath": "/images/home/workSelected.png",
show: true
},
{ {
"pagePath": "/pages/statistics/statistics", "pagePath": "/pages/statistics/statistics",
"text": "数据", "text": "数据",
@ -40,6 +31,14 @@ Component({
"selectedIconPath": "/images/home/informationSelected.png", "selectedIconPath": "/images/home/informationSelected.png",
show: false show: false
},
{
"pagePath": "/pages/work2/work2",
"text": "工作",
"iconPath": "/images/home/work.png",
"selectedIconPath": "/images/home/workSelected.png",
show: true
}, },
{ {
"pagePath": "/pages/mine/mine", "pagePath": "/pages/mine/mine",

2
ec-canvas/echarts.js

File diff suppressed because one or more lines are too long

306
subpages/searchResult/pages/resiInfo/component/graph/graph.js

@ -1,41 +1,36 @@
import * as echarts from '../../../../../../ec-canvas/ec-canvas'; import * as echarts from '../../../../../../ec-canvas/echarts';
import api from "../../../../../../utils/api"; import {
getFamilyRelationshipList
} from "../../../../../../utils/api";
var chart; var chart;
var listdata = [];
var links = [];
var legendes = ["手机IMSI", "人脸ID", "车牌号码", "人脸ID"];
var texts = [];
// function initChart(canvas, width, height, dpr) {
// chart = echarts.init(canvas, null, {
// width: width,
// height: height,
// devicePixelRatio: dpr // 像素比
// });
// canvas.setChart(chart);
// return chart;
// }
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
Component({ Component({
properties: { properties: {
resid: { resiId: {
type: String, type: String,
value: '', value: '',
observer(val) {
this.getData()
}
} }
}, },
data: { data: {
ec: { ec: {
lazyLoad: true lazyLoad: true
// onInit: initChart
}, },
tabList: [{
label: "问题突出类别",
value: 1
}, {
label: '行业领域分析',
value: 2
}],
tabValue: 1
}, },
lifetimes: { lifetimes: {
ready() { ready() {
console.log(this.data.resid);
this.getData() this.getData()
} }
}, },
@ -43,217 +38,104 @@ Component({
getData() { getData() {
this.selectComponent('#hotlineComplaints').init((canvas, width, height, dpr) => { this.selectComponent('#hotlineComplaints').init((canvas, width, height, dpr) => {
// chart = echarts.init(canvas, null, { chart = echarts.init(canvas, null, {
// width: width, width: width,
// height: height, height: height,
// devicePixelRatio: dpr // 像素比 devicePixelRatio: dpr // 像素比
// }); });
// canvas.setChart(chart); canvas.setChart(chart);
let params = { let params = {
type: 0, type: "0",
resid: this.data.resiId id: this.data.resiId
} }
api.getFamilyRelationshipList(params).then(({
getFamilyRelationshipList(params).then(({
data data
}) => { }) => {
console.log(data); let resiName = data.filter(item=>item.id === this.data.resiId)[0].name
var phoneNum = { let nodeList = data.map((item, index) => ({
"手机号:13856978256": "13856978256", 'name': item.name,
"手机号:13998745632": "13998745632", 'id':index+1,
"手机号:18812345678": "18812345678", 'category':0,
"手机号:16812345678": "16812345678", 'symbolSize': item.id == this.data.resiId ? 50 : 30,
"手机号:13856971111": "13856978256", 'symbol':item.type == 1?'image://https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/internal/20240402/a6cdfe6f699040f58fd8b2c10486b41d.png': item.houseHolderRel == '丈夫' ? 'image://https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/internal/20240402/1e21790833b04e9abe61e2a8f40446cb.png' : 'image://https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/internal/20240402/1e21790833b04e9abe61e2a8f40446cb.png',
"手机号:13998742222": "13998745632", // 'data': {
"手机号:18812344444": "18812345678", // id: item.id,
"手机号:16812343333": "16812345678", // type: item.type,
"手机号:13878978256": "13856978256", // name: item.name
"手机号:137895632": "13998745632", // },
}; }))
let links = data.map((item, index) => ({
var phoneIMSI = ["次数:1,匹配度:6%", "次数:3,匹配度:30%", "次数:2,匹配度:26%", "source": 0,
"次数:2,匹配度:26%", "次数:2,匹配度:26%", "次数:2,匹配度:26%", "target": index+1,
"匹配手机号码", "匹配手机号码", "匹配手机号码", "匹配手机号码" "name": item.houseHolderRel||'暂不清楚',
] "label": {
"align": "center",
"fontSize": 12
var carNum = {
"车牌号码:豫AJ9685": "豫AJ9685",
"车牌号码:豫AG5123": "豫AG5123",
"车牌号码:豫AG6822": "豫AG6822",
"车牌号码:豫CJ9685": "豫AJ9685",
"车牌号码:豫AD5123": "豫AG5123",
"车牌号码:豫AT6822": "豫AG6822",
"车牌号码:豫AG6622": "豫AG6822",
"车牌号码:豫CJ9885": "豫AJ9685",
}
const relationShipCar = ["匹配车牌号码", "匹配车牌号码", "匹配车牌号码", "匹配车牌号码", "匹配车牌号码", "匹配车牌号码", "匹配车牌号码", "匹配车牌号码", "匹配车牌号码"]
this.setDataPhone(phoneNum, 0);
this.setDataCar(carNum, 2);
this.setDataPerson(mainRelationShip, 3);
this.setLinkData(phoneNum, phoneIMSI, legendes[3]);
this.setLinkData(carNum, relationShipCar, legendes[3]);
let option = {
title: {
text: "关系图绑定点击事件",
top: "top",
left: "left",
textStyle: {
color: '#000000'
}
}, },
tooltip: { "lineStyle": {
formatter: '{b}' "color": "#ff7d18"
}
}))
links.splice(links.length-1,1)
let categories = data.map((item, index) => ({
"name":item.houseHolderRel||'暂不清楚',
"id":index+1,
"itemStyle": {
"color": 'red'
}, },
"lineStyle": {
"color": "#ff7d18"
}
}))
console.log(nodeList,links,categories);
console.log(JSON.stringify(nodeList));
console.log(JSON.stringify(links));
console.log(JSON.stringify(categories));
backgroundColor: '#f7f7f7', var option = {
legend: {
data: legendes, legend: [{
textStyle: { // selectedMode: 'single',
color: '#000000' // icon: 'circle'
}, show: false
icon: 'circle', }],
type: 'scroll',
orient: 'vertical',
left: 10,
top: 20,
bottom: 20,
itemWidth: 10,
itemHeight: 10
},
animationDuration: 1000,
animationEasingUpdate: 'quinticInOut',
series: [{ series: [{
type: 'graph', type: 'graph',
layout: 'force', layout: 'force',
force: { symbolSize: 10,
repulsion: 80, draggable: true,
gravity: 0,
edgeLength: 150,
layoutAnimation: true,
},
data: listdata,
links: links,
categories: texts,
roam: false, roam: false,
nodeScaleRatio: 0,
focusNodeAdjacency: false, focusNodeAdjacency: false,
lineStyle: { categories: categories,
normal: { edgeSymbol: ['', 'arrow'],
opacity: 0.5, // edgeSymbolSize: [80, 10],
width: 1.5,
curveness: 0
}
},
label: {
normal: {
show: true,
position: 'inside',
textStyle: {
color: '#000000',
fontWeight: 'normal',
fontSize: "12" //字体大小
},
formatter: function (params) {
return params.data.showName
},
fontSize: 18,
fontStyle: '600',
}
},
edgeLabel: { edgeLabel: {
normal: { normal: {
show: true, show: true,
textStyle: { textStyle: {
fontSize: 12 fontSize: 20
}, },
formatter: "{c}" formatter(x) {
return x.data.name;
}
} }
} },
}], label: {
color: ['#e8b842', '#41b1ef', '#667aed', '#347fbb', '#772cdc', show: true
'#ff69b4', '#ba55d3', '#cd5c5c', '#ffa500', '#40e0d0' },
] force: {
} repulsion: 2000,
edgeLength: 120
},
data: nodeList,
links: links
}]
};
chart.setOption(option); chart.setOption(option);
}) })
return chart; return chart;
}); });
},
setDataPhone(json, n) {
var i = 0;
for (var p in json) {
listdata.push({
x: i * 50,
y: size + i * 10,
"name": p,
"showName": json[p],
"symbol": 'image://' + "/asset/get/s/data-1561621386236-0IGCc48l6.png",
"symbolSize": size,
"category": n,
"draggable": "false",
formatter: function (params) {
return params.data.showName
},
label: {
position: 'bottom'
}
});
i++;
}
},
setDataCar(json, n) {
var i = 0;
for (var p in json) {
listdata.push({
x: i * 50,
y: size + i * 10,
"name": p,
"showName": json[p],
"symbol": 'image://' + "/asset/get/s/data-1561621379686-rZHoryrBV.png",
"symbolSize": size,
"category": n,
"draggable": "false",
formatter: function (params) {
return params.data.showName
},
label: {
position: 'bottom'
}
});
i++;
}
},
setLinkData(json, relarr, title) {
if (relarr !== "") {
var i = 0;
for (var p in json) {
links.push({
"source": p,
"target": title,
"value": relarr[i],
lineStyle: {
normal: {
// text: relarr[i],
color: 'source'
}
}
});
i++;
}
} else {
for (var p2 in json) {
links.push({
"source": p2,
"target": title,
"value": "",
lineStyle: {
normal: {
color: 'source'
}
}
});
}
}
} }
} }
}); });

2
subpages/searchResult/pages/resiInfo/component/graph/graph.wxml

@ -1,4 +1,4 @@
<!--subpages/searchResult/pages/resiInfo/modules/graph/graph.wxml--> <!--subpages/searchResult/pages/resiInfo/modules/graph/graph.wxml-->
<view class="hotlineComplaints"> <view class="hotlineComplaints">
<ec-canvas id="hotlineComplaints" canvas-id="hotlineComplaints" ec="{{ ec }}"></ec-canvas> <ec-canvas id="hotlineComplaints" canvas-id="hotlineComplaints" ec="{{ ec }}"></ec-canvas>
</view> </view>

25
subpages/searchResult/pages/resiInfo/resiInfo.js

@ -552,8 +552,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.updateTime(); // this.updateTime();
timerId = setInterval(this.updateTime, 1000); // timerId = setInterval(this.updateTime, 1000);
if (options.resiId) { if (options.resiId) {
this.setData({ this.setData({
resiId: options.resiId, resiId: options.resiId,
@ -573,15 +573,15 @@ Page({
}) })
// this.getLastLogs() // this.getLastLogs()
}, },
updateTime() { // updateTime() {
let date = new Date(); // let date = new Date();
let hours = date.getHours().toString().padStart(2, '0'); // let hours = date.getHours().toString().padStart(2, '0');
let minutes = date.getMinutes().toString().padStart(2, '0'); // let minutes = date.getMinutes().toString().padStart(2, '0');
let seconds = date.getSeconds().toString().padStart(2, '0'); // let seconds = date.getSeconds().toString().padStart(2, '0');
this.setData({ // this.setData({
currentTime: `${hours}:${minutes}:${seconds}` // currentTime: `${hours}:${minutes}:${seconds}`
}); // });
}, // },
getResiInfo: async function () { getResiInfo: async function () {
try { try {
let res = await api.getResiInfo(this.data.resiId); let res = await api.getResiInfo(this.data.resiId);
@ -894,8 +894,7 @@ Page({
url: '/subpages/statistics/pages/residentPortrait2/residentPortrait?id=' + this.data.resiId, url: '/subpages/statistics/pages/residentPortrait2/residentPortrait?id=' + this.data.resiId,
}) })
}, },
handelClickTab(e) {
handelClickTab: function(e) {
wx.pageScrollTo({ wx.pageScrollTo({
selector: `#${e.currentTarget.dataset.item.id}`, selector: `#${e.currentTarget.dataset.item.id}`,
duration:300 duration:300

9
subpages/searchResult/pages/resiInfo/resiInfo.wxml

@ -1,6 +1,5 @@
<!--subpages/searchResult/pages/resiInfo/resiInfo.wxml--> <!--subpages/searchResult/pages/resiInfo/resiInfo.wxml-->
<!-- 基本信息 --> <!-- 基本信息 -->
<resi-graph resiId="{{resiId}}"></resi-graph>
<view class="card"> <view class="card">
<view class="top"> <view class="top">
<view class="left"> <view class="left">
@ -84,6 +83,10 @@
</view> </view>
</view> </view>
</view> </view>
<view class="card">
<view class="title">关系图谱</view>
<resi-graph resiId="{{resiId}}"></resi-graph>
</view>
<view class="card" wx:for="{{expandList}}" wx:key="index" id="{{item.scrollId}}"> <view class="card" wx:for="{{expandList}}" wx:key="index" id="{{item.scrollId}}">
<view class="title">{{item.title}}</view> <view class="title">{{item.title}}</view>
<view class="info" wx:for="{{item.children}}" wx:for-index="indexC" wx:key="indexC" wx:for-item="itemC"> <view class="info" wx:for="{{item.children}}" wx:for-index="indexC" wx:key="indexC" wx:for-item="itemC">
@ -93,9 +96,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="card">
<view class="title">居民图谱</view>
</view>
<!-- 走访打卡 --> <!-- 走访打卡 -->
<!-- <view class="card "> <!-- <view class="card ">

Loading…
Cancel
Save