|
@@ -44,7 +44,15 @@ class HomePage extends BaseWidget {
|
|
|
"peopleNumber": "-"
|
|
|
}
|
|
|
pipeServicePath = "";
|
|
|
- isLoad = false
|
|
|
+ isLoad = false;
|
|
|
+ bYlChart = null;
|
|
|
+ bGjChart = null;
|
|
|
+ zYLChart = null;
|
|
|
+ bCzChart = null;
|
|
|
+ bMsChart = null;
|
|
|
+ zSbChart = null;
|
|
|
+ zGxChart = null;
|
|
|
+ lSbChart = null;
|
|
|
|
|
|
* @function 初始化启动
|
|
|
*/
|
|
@@ -57,6 +65,22 @@ class HomePage extends BaseWidget {
|
|
|
this.setHtml(this.template, "body");
|
|
|
this.initEvent();
|
|
|
this.setConfig();
|
|
|
+ let bYlDom = this.domObj.find(".rightPanle .ylLength .echart")[0];
|
|
|
+ this.bYlChart = echarts.init(bYlDom, 'macarons');
|
|
|
+ let bGjDom = this.domObj.find(".rightPanle .gjLength .echart")[0];
|
|
|
+ this.bGjChart = echarts.init(bGjDom, 'macarons');
|
|
|
+ let zYlDom = this.domObj.find(".rightPanle .ylZLength .echart")[0];
|
|
|
+ this.zYLChart = echarts.init(zYlDom, 'macarons');
|
|
|
+ let bczDom = this.domObj.find(".rightPanle .czLength .echart")[0];
|
|
|
+ this.bCzChart = echarts.init(bczDom, 'macarons');
|
|
|
+ let bMsDom = this.domObj.find(".rightPanle .msLength .echart")[0];
|
|
|
+ this.bMsChart = echarts.init(bMsDom, 'macarons');
|
|
|
+ let zSbDom = this.domObj.find(".rightPanle .sbtotal .echart")[0];
|
|
|
+ this.zSbChart = echarts.init(zSbDom, 'macarons');
|
|
|
+ let zGxDom = this.domObj.find(".rightPanle .gsgxtotal .echart")[0];
|
|
|
+ this.zGxChart = echarts.init(zGxDom, 'macarons');
|
|
|
+ let lSbDom = this.domObj.find(".rightPanle .gssbtotal .echart")[0];
|
|
|
+ this.lSbChart = echarts.init(lSbDom, 'macarons');
|
|
|
|
|
|
this.domObj.find(".close").off().click(e => {
|
|
|
$(window).unbind('beforeunload');
|
|
@@ -70,36 +94,16 @@ class HomePage extends BaseWidget {
|
|
|
Cookies.remove(hex_sha1("systemmodeid"));
|
|
|
Cookies.remove(hex_sha1("systemid"));
|
|
|
window.location.href = window.location.href.replace(/\/+$/, "/login");
|
|
|
- })
|
|
|
+ });
|
|
|
+ this.sendAjax(this,this.config.companyInfo,"GET",this.companyInfo);
|
|
|
|
|
|
- this.ylLength();
|
|
|
- this.gjLength();
|
|
|
- this.ylZLength();
|
|
|
- this.czLength();
|
|
|
- this.msLength();
|
|
|
- this.sbtotal();
|
|
|
- this.gsgxtotal();
|
|
|
+ this.clickChart(1);
|
|
|
+
|
|
|
+
|
|
|
this.gssbtotal();
|
|
|
- this.companyInfo();
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- this.domObj.find(".item .infoLook").off().click(e=>{
|
|
|
-
|
|
|
- let search=false;
|
|
|
- let value=$(e.currentTarget).attr("value");
|
|
|
- if(!this.currentCompany){
|
|
|
- this.currentCompany=value;
|
|
|
- search=true;
|
|
|
- }else{
|
|
|
- if(value!=this.currentCompany){
|
|
|
- this.currentCompany=value;
|
|
|
- search=true;
|
|
|
- }
|
|
|
- }
|
|
|
- if(search){
|
|
|
- this.domObj.find(".currentCompany").removeClass("currentCompany");
|
|
|
- $(e.currentTarget).parents(".item").addClass("currentCompany");
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -148,19 +152,22 @@ class HomePage extends BaseWidget {
|
|
|
* @param callBack 成功后的回调函数
|
|
|
* @param errorBack 失败后的回调函数
|
|
|
*/
|
|
|
- sendAjax(that, data, url, ajaxtype, callBack?, errorBack?) {
|
|
|
+ sendAjax(that, url, ajaxtype, callBack?,data?, errorBack?) {
|
|
|
if (!url) {
|
|
|
return;
|
|
|
}
|
|
|
let contentType = "application/json;charset=utf-8";
|
|
|
$.ajax({
|
|
|
headers: that.header,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
type: ajaxtype,
|
|
|
url: that.apiRoot + url,
|
|
|
contentType: contentType,
|
|
|
data: data,
|
|
|
success: function (result) {
|
|
|
- callBack.bind(that)(result);
|
|
|
+ callBack.bind(that)(result.result);
|
|
|
},
|
|
|
error: (errorBack != undefined ? errorBack.bind(that) : function (data) {
|
|
|
console.error('请求地址:' + url + ",报错数据:" + data);
|
|
@@ -182,111 +189,198 @@ class HomePage extends BaseWidget {
|
|
|
}
|
|
|
return check;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ clickChart(code){
|
|
|
+ this.ylLength(code,1);
|
|
|
+ this.gjLength(code,2);
|
|
|
+ this.ylZLength(code,1);
|
|
|
+ this.czLength(code,3);
|
|
|
+ this.msLength(code,4);
|
|
|
+ this.sbtotal(code);
|
|
|
+ }
|
|
|
|
|
|
* 公司列表信息
|
|
|
**/
|
|
|
- companyInfo() {
|
|
|
- let data = this.config.testCompany;
|
|
|
- let html = ""
|
|
|
+ companyInfo(data) {
|
|
|
+
|
|
|
+ let html = "";
|
|
|
if (data && data.length > 0) {
|
|
|
data.forEach(item => {
|
|
|
- html += "<div class='item'><div class='itemInfo'><span class='companyName' title='" + item.name + "'>" + item.name + "</span><span class='companyLength' title='" + item.length + "'>" + item.length + "</span></div>"+
|
|
|
- "<div class='itemOperation'><a class='infoLook' value='" + item.name + "' title='点击查看公司管网情况'>查看</a><a class='goToSys' value='" + item.name + "' title='点击进入系统'>进入系统</a></div></div>"
|
|
|
+ if(item.companyId == 1){
|
|
|
+ html += "<div class='item currentCompany'><div class='itemInfo'><span class='companyName' title='" + item.name + "'>" + item.name + "</span><span class='companyLength' title='" + item.value + "'>" + item.value + "</span></div>"+
|
|
|
+ "<div class='itemOperation'><a class='infoLook' name='"+item.name+"' value='" + item.companyId + "' title='点击查看公司管网情况'>查看</a><a class='goToSys' value='" + item.name + "' title='点击进入系统'>进入系统</a></div></div>"
|
|
|
+ }else{
|
|
|
+ html += "<div class='item'><div class='itemInfo'><span class='companyName' title='" + item.name + "'>" + item.name + "</span><span class='companyLength' title='" + item.value + "'>" + item.value + "</span></div>"+
|
|
|
+ "<div class='itemOperation'><a class='infoLook' name='"+item.name+"' value='" + item.companyId + "' title='点击查看公司管网情况'>查看</a><a class='goToSys' value='" + item.name + "' title='点击进入系统'>进入系统</a></div></div>"
|
|
|
+ }
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
this.domObj.find('.leftPanle .infoList').empty().append(html);
|
|
|
+ this.domObj.find(".infoList .infoLook").off().click(e=>{
|
|
|
+
|
|
|
+ let search=false;
|
|
|
+ let value=$(e.currentTarget).attr("value");
|
|
|
+ let name = $(e.currentTarget).attr("name");
|
|
|
+ if(!this.currentCompany){
|
|
|
+ this.currentCompany=value;
|
|
|
+ search=true;
|
|
|
+ }else{
|
|
|
+ if(value!=this.currentCompany){
|
|
|
+ this.currentCompany=value;
|
|
|
+ search=true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(search){
|
|
|
+ this.domObj.find(".currentCompany").removeClass("currentCompany");
|
|
|
+ $(e.currentTarget).parents(".item").addClass("currentCompany");
|
|
|
+ this.domObj.find(".currentPlace").html(name);
|
|
|
+ this.clickChart(value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.gsgxtotal(data);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
* 根据压力统计管线长度
|
|
|
**/
|
|
|
- ylLength(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testYl
|
|
|
+ ylLength(data,typeId) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let sendData = {
|
|
|
+ companyId:data,
|
|
|
+ typeId:typeId
|
|
|
}
|
|
|
- let dom = this.domObj.find(".rightPanle .ylLength .echart")[0];
|
|
|
- this.bEchart(data, dom);
|
|
|
+ this.sendAjax(this,this.config.getEchartData,"GET",(data)=>{
|
|
|
+
|
|
|
+ this.bEchart(data, this.bYlChart);
|
|
|
+ },sendData)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
* 根据管径统计管线长度
|
|
|
**/
|
|
|
- gjLength(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testGJ
|
|
|
+ gjLength(data,typeId) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let sendData = {
|
|
|
+ companyId:data,
|
|
|
+ typeId:typeId
|
|
|
}
|
|
|
- let dom = this.domObj.find(".rightPanle .gjLength .echart")[0];
|
|
|
- this.bEchart(data, dom);
|
|
|
+ this.sendAjax(this,this.config.getEchartData,"GET",(data)=>{
|
|
|
+
|
|
|
+ this.bEchart(data, this.bGjChart);
|
|
|
+ },sendData)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
* 根据压力统计管线长度(柱状)
|
|
|
**/
|
|
|
- ylZLength(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testYl
|
|
|
+ ylZLength(data,typeId) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let sendData = {
|
|
|
+ companyId:data,
|
|
|
+ typeId:typeId
|
|
|
}
|
|
|
- let dom = this.domObj.find(".rightPanle .ylZLength .echart")[0];
|
|
|
- this.zEchart(data, dom,this.echartDisplay.type.pressure);
|
|
|
+ this.sendAjax(this,this.config.getEchartData,"GET",(data)=>{
|
|
|
+
|
|
|
+ this.zEchart(data, this.zYLChart,this.echartDisplay.type.pressure);
|
|
|
+ },sendData)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
* 根据材质统计管线长度
|
|
|
**/
|
|
|
- czLength(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testCZ
|
|
|
+ czLength(data,typeId) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let sendData = {
|
|
|
+ companyId:data,
|
|
|
+ typeId:typeId
|
|
|
}
|
|
|
- let dom = this.domObj.find(".rightPanle .czLength .echart")[0];
|
|
|
- this.bEchart(data, dom);
|
|
|
+ this.sendAjax(this,this.config.getEchartData,"GET",(data)=>{
|
|
|
+
|
|
|
+ this.bEchart(data, this.bCzChart);
|
|
|
+ },sendData)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
* 根据埋设统计管线长度
|
|
|
**/
|
|
|
- msLength(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testMS
|
|
|
+ msLength(data,typeId) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let sendData = {
|
|
|
+ companyId:data,
|
|
|
+ typeId:typeId
|
|
|
}
|
|
|
- let dom = this.domObj.find(".rightPanle .msLength .echart")[0];
|
|
|
- this.bEchart(data, dom);
|
|
|
+ this.sendAjax(this,this.config.getEchartData,"GET",(data)=>{
|
|
|
+
|
|
|
+ this.bEchart(data, this.bMsChart);
|
|
|
+ },sendData)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
* 各设备情况(柱状)
|
|
|
**/
|
|
|
- sbtotal(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testSB
|
|
|
+ sbtotal(code) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let sendData = {
|
|
|
+ companyId:code,
|
|
|
}
|
|
|
- let dom = this.domObj.find(".rightPanle .sbtotal .echart")[0];
|
|
|
- this.zEchart(data, dom,this.echartDisplay.type.diameter);
|
|
|
+ this.sendAjax(this,this.config.devicebycompany,"GET",(data)=>{
|
|
|
+
|
|
|
+ this.zEchart(data, this.zSbChart,this.echartDisplay.type.diameter);
|
|
|
+ },sendData)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
* 各公司管线总数(柱状)
|
|
|
**/
|
|
|
- gsgxtotal(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testCompany
|
|
|
- }
|
|
|
- let dom = this.domObj.find(".rightPanle .gsgxtotal .echart")[0];
|
|
|
- this.zEchart(data, dom,this.echartDisplay.type.totalPipe);
|
|
|
+ gsgxtotal(data) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.zEchart(data, this.zGxChart,this.echartDisplay.type.diameter);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
* 各设备总数(柱状)
|
|
|
**/
|
|
|
- gssbtotal(data?) {
|
|
|
- if (!data) {
|
|
|
- data = this.config.testCompany
|
|
|
- }
|
|
|
- let dom = this.domObj.find(".rightPanle .gssbtotal .echart")[0];
|
|
|
- this.zEchart(data, dom,this.echartDisplay.type.totalEquipment);
|
|
|
+ gssbtotal() {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.sendAjax(this,this.config.totalDevice,"GET",(data)=>{
|
|
|
+
|
|
|
+ this.zEchart(data, this.lSbChart,this.echartDisplay.type.totalEquipment);
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -302,14 +396,20 @@ class HomePage extends BaseWidget {
|
|
|
};
|
|
|
dataList.forEach(item => {
|
|
|
echartData.x.push(item.name);
|
|
|
- echartData.data.push(item.length);
|
|
|
+ echartData.data.push(item.value);
|
|
|
});
|
|
|
if(type==this.echartDisplay.type.totalEquipment){
|
|
|
- this.echartDisplay.echartMRender(dom, echartData,type)
|
|
|
+ this.echartDisplay.echartMRender(dom, echartData,type,(option)=>{
|
|
|
+ dom.setOption(option, true);
|
|
|
+ })
|
|
|
}else if(type==this.echartDisplay.type.totalPipe){
|
|
|
- this.echartDisplay.echartZHRender(dom, echartData,type)
|
|
|
+ this.echartDisplay.echartZHRender(dom, echartData,type,(option)=>{
|
|
|
+ dom.setOption(option, true);
|
|
|
+ })
|
|
|
}else{
|
|
|
- this.echartDisplay.echartZRender(dom, echartData,type)
|
|
|
+ this.echartDisplay.echartZRender(dom, echartData,type,(option)=>{
|
|
|
+ dom.setOption(option, true);
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -323,9 +423,12 @@ class HomePage extends BaseWidget {
|
|
|
}
|
|
|
let echartData = [];
|
|
|
dataList.forEach(item => {
|
|
|
- echartData.push({ name: item.name, value: item.length });
|
|
|
+ echartData.push({ name: item.name, value: item.value });
|
|
|
+ })
|
|
|
+ this.echartDisplay.echartBRender(dom, echartData,(option)=>{
|
|
|
+
|
|
|
+ dom.setOption(option, true);
|
|
|
})
|
|
|
- this.echartDisplay.echartBRender(dom, echartData)
|
|
|
}
|
|
|
|
|
|
|