From 6db4de77bb9f1554854e50778fda8d9b479d6781 Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期五, 07 十二月 2018 13:53:08 +0800
Subject: [PATCH] Merge branch 'dev_lxw' of https://whychdw@gitlab.com/whyclxw1/gx_tieta.git into dev_lxw
---
gx_tieta/WebRoot/pages/js/pages/index-common.js | 117 ++++++++++++++++++++++++++++++++--------------------------
1 files changed, 65 insertions(+), 52 deletions(-)
diff --git a/gx_tieta/WebRoot/pages/js/pages/index-common.js b/gx_tieta/WebRoot/pages/js/pages/index-common.js
index 5223704..abeab81 100644
--- a/gx_tieta/WebRoot/pages/js/pages/index-common.js
+++ b/gx_tieta/WebRoot/pages/js/pages/index-common.js
@@ -3,76 +3,89 @@
gl.namespace('Index.Pie');
var pieType = [
+ {
+ name: '鏈烘埧鍋滅數'
+ ,cla: 'repair-pie'
+ },
+ {
+ name: '鏈烘埧缁埅鑳藉姏'
+ ,cla: 'endur-pie'
+ },
{
- name: '鐢垫睜鐘舵��',
- action: 'Batt_rtstateAction!serchBattStateRate',
- formatData: eleStatus
+ name: '鐢垫睜鐘舵��'
+ ,cla: 'brdn-pie'
},
{
- name: '鐢垫睜鍛婅鐜�',
- action: 'Battalarm_dataAction!serchAlm',
- formatData: eleWarn
+ name: '鐢垫睜鍛婅鐜�'
+ ,cla: 'warn-pie'
},
{
- name: '鏈烘埧鍋滅數',
- action: 'BattPower_offAction!serchPowerOff',
- formatData: homeCut
- },
- {
- name: '鍗曚綋瀹归噺鍋ュ悍鐜�',
- action: 'Battalarm_dataAction!serchGood',
- formatData: monCapGood
+ name: '鍗曚綋瀹归噺鍋ュ悍鐜�'
+ ,cla: 'health-pie'
}
];
// 灏唒ieType缁戝畾鍒癐ndex.Pie鍛藉悕绌洪棿涓�
gl.Index.Pie.pieType = pieType;
- // 鏍规嵁鏁扮粍璋冪敤鏌ヨ鍐呭
- function search(arr) {
- for(var i=0; i<arr.length; i++) {
- if(arr[i]) {
- ajax(pieType[i]);
- }
- }
- }
-
- // 灏唖earch缁戝畾鍒癐ndex.Pie鍛藉悕绌洪棿涓�
- gl.Index.Pie.search = search;
-
- // 璇锋眰鍚庡彴
- function ajax(obj) {
- // ajax璇锋眰鍚庡彴
+ // 鏌ヨ楗肩姸鍥剧姸鎬佽繑鍥為渶瑕佹樉绀洪ゼ鐘跺浘
+ function pieStatus() {
+ // 璁剧疆涓�涓悓姝ユ煡璇㈣繑鍥炰竴涓猟iv.pie-item-list
+ var pieItems;
$.ajax({
- type: 'post',
- url: obj.action,
- data: null,
- async: true,
- dataType: 'json',
- success:function(result) {
- var rs = JSON.parse(result.result);
- var pieData = obj.formatData(rs);
-
+ type: 'post'
+ ,async: false
+ ,url: 'Echarts_usrAction!serchByCondition'
+ ,data: null
+ ,dataType: 'json'
+ ,success: function(res) {
+ var rs = JSON.parse(res.result);
+ //console.log(rs);
+ if(rs.code == 1) {
+ var data = rs.data[0];
+ var rsStatus = formaterPieStauts(data);
+ pieItems = getPieList(rsStatus);
+ }else {
+ pieItems = getPieList([1, 1, 1, 1]);
+ }
}
});
+ //console.log(pieItems);
+ return pieItems;
}
- // 鐢垫睜鐘舵��
- function eleStatus(data) {
- console.log(data);
+ // 灏唒ieStatus缁戝畾鍒癐ndex.Pie鍛藉悕绌洪棿涓�
+ gl.Index.Pie.pieStatus = pieStatus;
+
+ // 鏍规嵁鏁扮粍杩斿洖
+ function getPieList(arr) {
+ var pieItems = $('<div class="pie-item-list"></div>');
+ for(var i=0; i<arr.length; i++) {
+ if(arr[i] == 1) {
+ var cla = pieType[i].cla;
+ var pieItem = $('<div class="'+cla+' module"></div>');
+ pieItems.append(pieItem);
+ }
+
+ }
+ return pieItems;
}
- // 鐢垫睜鍛婅
- function eleWarn(data) {
- console.log(data);
+ // 灏唃etPieList缁戝畾鍒癐ndex.Pie鍛藉悕绌洪棿涓�
+ gl.Index.Pie.getPieList = getPieList;
+
+ // 鏋勯�犳洿鏂伴ゼ鐘跺浘鍙傛暟
+ function formaterPieStauts(obj) {
+ var rs = [];
+ // 閬嶅巻pieType鐨勭被鍨�
+ for(var i=0; i<pieType.length; i++) {
+ var num = i+1;
+ var key = 'echarts'+num+'_enable';
+ rs.push(obj[key]);
+ }
+ return rs;
}
- // 鏈烘埧鍋滅數
- function homeCut(data) {
- console.log(data);
- }
- // 鍗曚綋瀹归噺鍋ュ悍鐜�
- function monCapGood(data) {
- console.log(data);
- }
+ // 灏唃etPieList缁戝畾鍒癐ndex.Pie鍛藉悕绌洪棿涓�
+ gl.Index.Pie.formaterPieStauts = formaterPieStauts;
})(jQuery, window, document, GLOBAL);
\ No newline at end of file
--
Gitblit v1.9.1