GroupSelectView.mxml
4.07 KB
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
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="{resourceManager.getString('resources', 'LM072')}" width="400" height="300" showCloseButton="true" close="closeWin();" creationComplete="initApp()">
<mx:Script>
<![CDATA[
import common.StaticObj;
import mx.core.Application;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
import mx.controls.Alert;
import mx.managers.PopUpManager;
import mx.collections.ArrayCollection;
import util.XmlUtil;
import mx.utils.StringUtil;
[bindable]
private var versionList:ArrayCollection;
private function initApp():void{
var keyword:String = StringUtil.trim(Application.application.keyValue.text);
if(keyword==""){
Alert.okLabel=""+resourceManager.getString('resources', 'LM044');
Alert.show(resourceManager.getString('resources', 'LM073')+"!");
return;
}
var key:String = Application.application.region.selectedItem.data;
var jt_key:String=Application.application.groupList.selectedItem.data;
var yw_key:String=Application.application.businesstypeList.selectedItem.data;
var gs_key:String=Application.application.companyvestinList.selectedItem.data;
var http:HTTPService = new HTTPService;
http.addEventListener(ResultEvent.RESULT,bindData);
http.addEventListener(FaultEvent.FAULT,myFaultErrorEvent);
http.url="/companygroup/manage/companyoperation.jsp?method=getGroupidBySearch";
http.method = "post";
http.resultFormat = "e4x";
var val:URLVariables = new URLVariables;
val.key = key;
val.value=keyword;
val.jt_key=jt_key;
val.yw_key=yw_key;
val.gs_key=gs_key;
//val.groupid = staticObj.groupid;
val.random = Math.random();
http.send(val);
}
private function closeWin():void{
PopUpManager.removePopUp(this);
}
private function bindData(xmlContent:ResultEvent):void{
//Alert.show(resultContent.result as String)
try{
var content:XML = xmlContent.result as XML;
//Alert.show(content.toString());
//var node:XMLNode = content;
var xmlDoc:XMLDocument = new XMLDocument(content.toString());
versionList = XmlUtil.parseXmlToArray(xmlDoc);
groupListGrid.dataProvider = versionList;
}catch(e:Error){
}
}
public function myFaultErrorEvent(myFaultEvent:FaultEvent):void{ //异常处理函数
//Alert.show("333");
trace(myFaultEvent.message);
}
//数据项的双击事件
public function showGroupView(){
//Alert.show(groupListGrid.selectedItem.key+"%%%"+groupListGrid.selectedItem.keyvalue)
Application.application.staticObj.groupid=groupListGrid.selectedItem.groupid;
//Application.application.groupList.selectedItem.data = groupListGrid.selectedItem.groupid;
Application.application.showCompanys(groupListGrid.selectedItem.key,groupListGrid.selectedItem.keyvalue);
var statusArray:ArrayCollection = Application.application.groupList.dataProvider as ArrayCollection;
for(var i:int = 0; i<statusArray.length;i++){
if(statusArray.getItemAt(i).data==groupListGrid.selectedItem.groupid){
Application.application.groupList.selectedIndex = i;
break;
}
}
//Application.application.groupList.selectedItem = {label:"RY002--夏天平",data:groupListGrid.selectedItem.groupid};
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:DataGrid x="0" y="0" height="100%" width="100%" id="groupListGrid" doubleClickEnabled="true" doubleClick="showGroupView()">
<mx:columns>
<mx:DataGridColumn id="key" headerText="ID" dataField="key" visible="false"/>
<mx:DataGridColumn headerText="keyvalue" dataField="keyvalue" visible="false"/>
<mx:DataGridColumn id="groupid" headerText="groupid" dataField="groupid" visible="false"/>
<mx:DataGridColumn headerText="{resourceManager.getString('resources', 'LM031')}" dataField="archiveno"/>
<mx:DataGridColumn headerText="{resourceManager.getString('resources', 'LM032')}" dataField="companyname"/>
</mx:columns>
</mx:DataGrid>
</mx:TitleWindow>