Commit f6079fcc by zhaochengxiang

价值评估

parent 042e2609
...@@ -241,5 +241,5 @@ export function subs(payload) { ...@@ -241,5 +241,5 @@ export function subs(payload) {
} }
export function getScore(payload) { export function getScore(payload) {
return GetJSON("/dataassetmanager/dataAssetApi/getScoreByDirectoryId", payload); return Get("/dataassetmanager/dataAssetApi/getScoreByDirectoryId", payload);
} }
\ No newline at end of file
import React from 'react'; import React from 'react';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { dispatch } from '../../../../model'
//https://echarts.apache.org/examples/zh/editor.html?c=treemap-show-parent&lang=js //https://echarts.apache.org/examples/zh/editor.html?c=treemap-show-parent&lang=js
class Thermodynamic extends React.Component { class Thermodynamic extends React.Component {
...@@ -8,6 +9,7 @@ class Thermodynamic extends React.Component { ...@@ -8,6 +9,7 @@ class Thermodynamic extends React.Component {
const { data, onClick } = this.props; const { data, onClick } = this.props;
if (data) { if (data) {
this.graph = init(this)(this.elem, data, onClick); this.graph = init(this)(this.elem, data, onClick);
this.getScore();
} }
} }
...@@ -16,11 +18,30 @@ class Thermodynamic extends React.Component { ...@@ -16,11 +18,30 @@ class Thermodynamic extends React.Component {
if (data !== prevProps.data) { if (data !== prevProps.data) {
this.graph = init(this)(this.elem, data, onClick); this.graph = init(this)(this.elem, data, onClick);
this.getScore();
} else if (resize !== prevProps.resize) { } else if (resize !== prevProps.resize) {
this.graph?.resize(); this.graph?.resize();
} }
} }
getScore() {
const { data } = this.props;
dispatch({
type: 'assetmanage.getScore',
payload: {
dirId: (data?.length>0) ? data[0]?.nodeId: ''
},
callback: newScore => {
this.graph?.setOption({
title: {
subtext: `价值评分 ${newScore}`,
itemGap: 2,
}
})
}
})
}
elem = undefined; elem = undefined;
graph = undefined; graph = undefined;
...@@ -75,9 +96,9 @@ const init = (ctx) => function (container, data, onClick) { ...@@ -75,9 +96,9 @@ const init = (ctx) => function (container, data, onClick) {
title: { title: {
text: ((data||[]).length>0) ? `${data[0]?.text||''} (${data[0]?.dataAssetAndSubDirCount})` : '', text: ((data||[]).length>0) ? `${data[0]?.text||''} (${data[0]?.dataAssetAndSubDirCount})` : '',
left: 'center', left: 'center',
bottom: 10, bottom: 0,
textStyle: { textStyle: {
fontSize: 16 fontSize: 14
} }
}, },
tooltip: { tooltip: {
......
...@@ -333,6 +333,9 @@ const AssetAction = (props) => { ...@@ -333,6 +333,9 @@ const AssetAction = (props) => {
{assets.currentPath||''} {assets.currentPath||''}
</a> </a>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>价值评分</div>} style={{ paddingBottom: 15 }}>
<div>{assets.score}</div>
</Descriptions.Item>
<Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产标签</div>} style={{ paddingBottom: 15 }}> <Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产标签</div>} style={{ paddingBottom: 15 }}>
<AppContext.Consumer> <AppContext.Consumer>
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment