-
Notifications
You must be signed in to change notification settings - Fork 0
/
Substation.js
143 lines (129 loc) · 5.56 KB
/
Substation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
define([ 'dojo/_base/declare',
'dojo/_base/lang',
"dijit/registry",
"dojo/aspect",
'dijit/_WidgetBase',
"dojo/store/Memory",
"dijit/form/FilteringSelect",
"dijit/form/Button",
"dijit/_TemplatedMixin",
'dijit/_WidgetsInTemplateMixin',
'esri/tasks/query',
"esri/tasks/QueryTask",
"esri/tasks/StatisticDefinition",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/dijit/Search",
"dojo/text!./demo/templates/Substation.html"],
function(declare,lang,registry,aspect,BaseWidget,Memory, FilteringSelect, Button,TemplateMixedin,_WidgetsInTemplateMixin,Query,QueryTask,StatisticDefinition,DynamicLayer,FeatureLayer,Search,SubstationTemplate){
return declare([BaseWidget,TemplateMixedin,_WidgetsInTemplateMixin],{
templateString:SubstationTemplate,
stationNameList:[],
stationCodeList:[],
selStationName:"",
selStationID:"",
selStationCode:"",
stationNum:"",
_nOnClick:function(){
alert("locate by name");
},
_cOnClick:function(){
this.stationNumber.innerHTML="111";
alert("locate by code");
this.testFunc();
},
testFunc:function(){
this.stationNumber.innerHTML="112";
},
_sOnClick:function(){
alert("�������ƶ�λ");
},
//������վ�б���ӵ�Selection��
fillNameList:function(){
var stateStore = new Memory({
data: [
{name:"Alabama", id:"AL"},
{name:"Alaska", id:"AK"},
{name:"American Samoa", id:"AS"},
{name:"Arizona", id:"AZ"},
{name:"Arkansas", id:"AR"},
{name:"Armed Forces Europe", id:"AE"},
{name:"Armed Forces Pacific", id:"AP"},
{name:"Armed Forces the Americas", id:"AA"},
{name:"California", id:"CA"},
{name:"Colorado", id:"CO"},
{name:"Connecticut", id:"CT"},
{name:"Delaware", id:"DE"}
]
});
this.identifyLayerDijit.set("store",stateStore);
this.identifyLayerDijit.set("searchAtt","id");
this.identifyLayerDijit.set("value","");
},
//������վ�����ӵ�Selection��
fillCodeList:function(){
},
testFunc:function(){
alert("hello");
},
//��ȡ����վ�б�
getStationList:function(){
},
_nChange:function(){
alert(this.identifyLayerDijit.value);
},
postCreate: function(){
this.search=new Search(this.map,this.searchNode);
this.search.hasButtonMode=false;
this.search.allPlaceholder="输入换热站编号或名称";
this.search.sources=[];
this.search.autoSelect=true;
this.search.sources.push({
featureLayer: new FeatureLayer("http://services1.arcgis.com/EYwUC8SxXDiz08ND/ArcGIS/rest/services/China%20income%20per%20person/FeatureServer/0"),
searchFields: ["NAME"],
displayField: "NAME" ,
exactMatch: false,
name: "搜索换热站",
outFields: ["*"],
placeholder: "换热站名称或编号查询",
maxResults: 6,
maxSuggestions: 6,
//Create an InfoTemplate
// infoTemplate: new InfoTemplate("Senator information", "Name: ${Name}</br>State: ${State}</br>Party Affiliation: ${Party}</br>Phone No: ${Phone_Number}<br><a href=${Web_Page} target=_blank ;'>Website</a>"),
enableSuggestions: true,
minCharacters: 0
});
this.search.startup();
this.fillNameList();
// alert(this. this.identifyLayerDijit.get("value") );
this.totalStationNumber();
// this.stationNumber.innerHTML=stationNum;
},
listenParentClick:function(){
/* var myTitlePane=registry.byId("substation_parent");
aspect.after(myTitlePane, "toggle", function() {
alert("hello");
});
*/
},
//���ж��ٸ�����վ
totalStationNumber:function(){
var Url = "http://10.50.51.67:6080/arcgis/rest/services/hrb/hrbPipe_2015/MapServer/8";
var qWhere = "1=1";
console.log("in total");
var qTask = new QueryTask(Url);
var q=new Query();
q.where="1=1";
qTask.executeForCount(q,lang.hitch(this,function(count){
console.log(count);
this.stationNumber.innerHTML =count;
this.stationNum=count;
// console.log(this.stationNumber.innerHTML);
}),function(error){
console.log(error);
// console.log
});
}
})
}
)