Files
zszq-trs/YLErpWeb/Views/client/Clientlevel.cshtml
T
2024-05-09 14:06:26 +08:00

144 lines
5.7 KiB
Plaintext

@{
ViewBag.Title = "查看授信";
Layout = "~/Views/Shared/_InfoLayout.cshtml";
}
<style type="text/css">
.echart-cont {
width: 100%;
}
</style>
<script type="text/javascript" src="../../Statics/libs/echarts/echarts4.9.min.js"></script>
<div align="center" class="echart-cont" id="echartWrap"></div>
<script>
$(document).ready(function () {
$('#echartWrap').height($(window).height());
function toChildren(arr, pid) {
var color = (pid ==@ViewBag.clientid? "#D3D3D3" : "#fff");
return arr.filter(x => pid === x.ParentId).map(x => new Object({
name: x.Name + '\n' + (x.Credit == 0 ? "" : "授信:" + x.Credit) + '\n' + (x.StockEqvNotional == 0 ? "" : "名义本金:" + x.StockEqvNotional),
symbol: 'rect',
itemStyle: {
color: (x.id ==@ViewBag.clientid? "#D3D3D3" : "#fff")
},
label: {
formatter(params) {
return '{name|' + (x.Name.length > 8 ? x.Name.substring(0, 12) : x.Name) + '}\n' + '{Credit|' + (x.Credit == 0 ? '' : '授信:' + '\n' + x.Credit + '') + '}\n' + '{StockEqvNotional|' + (x.StockEqvNotional == 0 ? '' : '名义本金:' + '\n' + x.StockEqvNotional + '') + '}\n' + '{ProcessStatus|' + (x.ProcessStatus == "已开户" ? "" : '' + x.ProcessStatus + '') + '}';
},
rich: {
name: {
color: "#000",
fontSize: 15,
fontWeight: 'bolder',
align:'center'
},
Credit: {
color: '#000',
fontSize: 15,
fontWeight: 'bolder',
align: 'center',
},
StockEqvNotional: {
color: '#000',
fontSize: 15,
fontWeight: 'bolder',
align: 'center',
},
ProcessStatus: {
color: '#4B545C',
fontSize: 15,
fontWeight: 'bolder',
align: 'center',
},
},
color: '#00A0E9'
},
children: toChildren(arr,x.id)
}));
}
main.post("/Client/GetClientParents", { Clientid: @ViewBag.clientid }).done(function (res) {
var parentData = res.find(c => c.ParentId == 0);
let data = {
name: parentData.Name + '\n' + (parentData.Credit == 0 ? "" : "授信:" + parentData.Credit) + '\n' + (parentData.StockEqvNotional == 0 ? "" : "名义本金:" + parentData.StockEqvNotional),
itemStyle: {
color: (parentData.id ==@ViewBag.clientid? "#D3D3D3" :"#fff")
},
label: {
formatter(params) {
return '{name|' + (parentData.Name.length > 6 ? (parentData.Name.substring(0, 6) + "...") : parentData.Name) + '}\n' + '{Credit|' + (parentData.Credit == 0 ? '' : '授信:' + '\n' + parentData.Credit + '') + '}\n' + '{StockEqvNotional|' + (parentData.StockEqvNotional == 0 ? '' : '名义本金:' + '\n' + parentData.StockEqvNotional + '') + '}\n' + '{ProcessStatus|' + (parentData.ProcessStatus == "已开户" ? "" : '' + parentData.ProcessStatus + '') + '}';
},
rich: {
name: {
color: '#000',
fontSize: 15,
fontWeight: 'bolder',
align: 'center'
},
Credit: {
color: '#000',
fontSize: 15,
fontWeight: 'bolder',
align: 'center',
},
StockEqvNotional: {
color: '#000',
fontSize: 15,
fontWeight: 'bolder',
align: 'center',
},
ProcessStatus: {
color: '#4B545C',
fontSize: 15,
fontWeight: 'bolder',
align: 'center',
},
},
},
children: toChildren(res,parentData.id)
};
var myChart = echarts.init(document.getElementById('echartWrap'));
var option = {
title: {
show: false
},
tooltip: {
trigger: 'item',
formatter: "{b}"
},
series: [
{
type: 'tree',
//排列方式,横向、纵向
orient: 'vertical',
//图形形状
symbol: 'rect',
//尺寸大小
symbolSize: [120, 100],
//图的一些样式设置
itemStyle: {
color: '#fff',
borderColor: "#c23531"
},
data: [data]
}
]
};
myChart.setOption(option);
});
});
</script>