123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483 |
- <link rel="stylesheet" type="text/css" href="/ops/pages/home/css/home.css" />
- <script src="/jq/prologui/dist/vendors/echarts/dist/echarts.js"></script>
- <script src="/jq/prologui/dist/vendors/echarts/dist/echarts.js"></script>
- <div id="home" home>
- <div class="plg-tab-container ">
- <div class="home-grid">
- <div class="home-grid-item">
- <div class="plg-flex">
- <i class="home-icon-a"></i>
- <div class="home-grid-item-wrap">
- <div class="title">
- <h3>登记服务</h3>
- </div>
- <div class="v-count value">0</div>
- </div>
- </div>
- </div>
- <div class="home-grid-item">
- <div class="plg-flex">
- <i class="home-icon-d"></i>
- <div class="home-grid-item-wrap">
- <div class="title">
- <h3>登记接口</h3>
- </div>
- <div class="v-count value">0</div>
- </div>
- </div>
- </div>
- <div class="home-grid-item">
- <div class="plg-flex">
- <i class="home-icon-b"></i>
- <div class="home-grid-item-wrap">
- <div class="title">
- <h3>在线服务</h3>
- </div>
- <div class="v-count value">0</div>
- </div>
- </div>
- </div>
- <div class="home-grid-item">
- <div class="plg-flex">
- <i class="home-icon-c"></i>
- <div class="home-grid-item-wrap">
- <div class="title">
- <h3>在线实例</h3>
- </div>
- <div class="v-count value">0</div>
- </div>
- </div>
- </div>
- <div class="home-grid-item user-map">
- <div class="plg-flex" style="flex-direction: column;align-items:normal">
- <div class="title">
- <h3>用户状态</h3>
- </div>
- <div id="userMap" class="plg-flex-item"></div>
- </div>
- </div>
- <div class="home-grid-item port-map">
- <div class="plg-flex" style="flex-direction: column;align-items:normal">
- <div class="title">
- <h3>接口分布</h3>
- </div>
- <div id="portMap" class="plg-flex-item"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
- (function () {
- //页面全部加载完成
- var dataList = [
- {
- color: '#ffb800',
- value: 0,
- name: '末激活'
- },
- {
- color: '#1e9fff',
- value: 0,
- name: '正常'
- },
- {
- color: '#ff5722',
- value: 0,
- name: '冻结'
- },
- ]
- $(document).ready(function () {
- /*4个模块*/
- var dom = document.querySelectorAll(".v-count");
- [APIS.home.service(), APIS.home.entry(), APIS.home.regService(), APIS.home.reginstance()]
- .forEach(function (item, index) {
- Prolog.ajax({
- url: item,
- type: "get",
- success: function (resolve) {
- if (resolve.success) {
- var sp = 10;
- var tiem = setInterval(function () {
- if (dom[index].innerText == resolve.data) return clearInterval(tiem)
- dom[index].innerText = Number(dom[index].innerText) + 1;
- }, sp += 10)
- }
- }
- })
- })
- /*用户状态*/
- Prolog.ajax({
- url: APIS.home.userStatus(),
- type: "get",
- success: function (resolve) {
- if (resolve.success) {
- var n = 0;
- resolve.data.forEach(function (item) {
- n += item.count;
- switch (item.status) {
- case 0: dataList[0].value = item.count
- return
- case 1: dataList[1].value = item.count
- return
- case 2: dataList[2].value = item.count
- return
- }
- })
- var userMapOption = {
- title: {
- text: n,
- subtext: '全部',
- x: 'center',
- y: 'center',
- textStyle: {
- fontSize: 30,
- fontWeight: 'normal',
- color: "#666",
- },
- subtextStyle: {
- color: '#666',
- fontSize: 16
- },
- },
- grid: {
- bottom: 130,
- left: 0,
- right: '10%'
- },
- legend: {
- show: false,
- orient: 'vertical',
- top: "middle",
- right: "5%",
- textStyle: {
- color: '#f2f2f2',
- fontSize: 25,
- },
- icon: 'roundRect'
- },
- series: [
- // 主要展示层的
- {
- radius: ['35%', '71%'],
- center: ['50%', '50%'],
- type: 'pie',
- itemStyle: {
- normal: {
- color: function (params) {
- return dataList[params.dataIndex].color
- }
- }
- },
- labelLine: {
- normal: {
- show: true,
- length: 20,
- length2: 40,
- lineStyle: {
- color: '#d3d3d3'
- },
- align: 'right'
- },
- color: "#000",
- emphasis: {
- show: true
- }
- },
- label: {
- normal: {
- formatter: function (params) {
- var str = '';
- switch (params.name) {
- case '末激活':
- str = '\n{nameStyle|末激活 }' + '{a|' + params.value + '}';
- break;
- case '正常':
- str = '\n{nameStyle|正常 }' + '{b|' + params.value + '}';
- break;
- case '冻结':
- str = '\n{nameStyle|冻结 }' + '{c|' + params.value + '}';
- break;
- }
- return str
- },
- padding: [0, 0],
- height: 40,
- rich: {
- nameStyle: {
- fontSize: 14,
- color: "#555",
- align: 'left'
- },
- a: {
- align: 'left',
- fontSize: 20,
- color: dataList[0].color,
- },
- b: {
- fontSize: 20,
- align: 'left',
- color: dataList[1].color,
- },
- c: {
- fontSize: 20,
- align: 'left',
- color: dataList[2].color,
- },
- }
- }
- },
- data: [
- {
- value: dataList[0].value,
- name: '末激活'
- },
- {
- value: dataList[1].value,
- name: '正常',
- },
- {
- value: dataList[2].value,
- name: '冻结'
- }
- ],
- },
- // 边框的设置
- {
- radius: ['65%', '71%'],
- center: ['50%', '50%'],
- type: 'pie',
- label: {
- normal: {
- show: false
- },
- emphasis: {
- show: false
- }
- },
- labelLine: {
- normal: {
- show: false
- },
- emphasis: {
- show: false
- }
- },
- animation: false,
- tooltip: {
- show: false
- },
- itemStyle: {
- normal: {
- color: 'rgba(250,250,250,0.5)'
- }
- },
- data: [{
- value: 1,
- }],
- }
- ]
- };
- echarts.init(document.getElementById("userMap")).setOption(userMapOption);
- }
- }
- });
- /*接口分布*/
- Prolog.ajax({
- url: APIS.home.distribute(),
- type: "get",
- success: function (resolve) {
- if (resolve.success) {
- var jkdata= resolve.data;
- var workOption = {
- tooltip: {
- show: true,
- trigger: 'axis',
- axisPointer: {
- animation: false
- },
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: "#6a7985"
- }
- }
- },
- grid: {
- top: '10%',
- left: '2%',
- right: '5%',
- bottom: '5%',
- containLabel: true,
- borderWidth: 0,
- },
- xAxis: [{
- type: 'category',
- boundaryGap: true,
- axisLine: {
- show: true,
- lineStyle: {
- color: 'rgba(0,0,0,0)'
- }
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: 'rgba(0,0,0,0.1)',
- }
- },
- data: (function () {
- var res =[];
- jkdata.filter(function(item){
- return res.push(item.serviceName)
- });
- return res
- })(),
- axisLabel: {
- //rotate :45,
- show: true,
- textStyle: {
- color: '#666'
- }
- }
- }],
- yAxis: [{
- type: 'value',
- min: 0,
- // max: 100,
- name: "数量",
- position: "left",
- nameTextStyle: {
- color: "#666"
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: 'rgba(0,0,0,0.1)'
- }
- },
- axisLabel: {
- show: true,
- textStyle: {
- color: '#666'
- }
- }
- }],
- series: [{
- // name: 'CPU占用率',
- type: 'bar',
- // barWidth:20,
- animation: true,
- areaStyle: {
- color: 'rgba(51, 204, 255,0.6)'
- },
- color: 'rgb(51, 204, 255)',
- data: (function(){
- var res =[];
- jkdata.filter(function(item){
- return res.push(item.count)
- });
- return res
- })(),
- smooth: true,
- boundaryGap: true,
- },
- ]
- };
- echarts.init(document.getElementById("portMap")).setOption(workOption);
- }
- }
- })
- })
- // Promise.resolve(UserDom).then(function(element){
- // debugger
- // })
- // window.addEventListener('DOMContentLoaded', (event) => {
- // console.log('DOM fully loaded and parsed');
- // debugger
- // });
- // addEventListener("load",function(){
- // console.log("load")
- // debugger
- // })
- })()
- </script>
|