GroupVersionView.mxml
7.23 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" width="490" height="300" title="{resourceManager.getString('resources', 'LM038')}" showCloseButton="true" fontSize="12" fontWeight="bold" color="#000000">
<mx:Style>
</mx:Style>
<mx:HBox width="100%" paddingTop="20" paddingLeft="20" verticalAlign="middle">
<mx:Label text="{resourceManager.getString('resources', 'LM034')}:" >
</mx:Label>
<mx:TextInput id="no" text="" editable="true" width="40%" maxChars="8" restrict="0-9\." focusOut="showChinaDate()">
</mx:TextInput>
<mx:Image source="@Embed(source='images/BacoError.gif')" id="img_s1"></mx:Image>
<mx:Label id="bbmsg" ></mx:Label>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="20" verticalAlign="middle">
<mx:Label text="{resourceManager.getString('resources', 'LM035')}:" >
</mx:Label>
<mx:TextInput id="vname" text="" editable="true" width="70%" focusOut="showChinaDate2()">
</mx:TextInput>
<mx:Image source="@Embed(source='images/BacoError.gif')" id="img_s2"></mx:Image>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="20" verticalAlign="middle">
<mx:Label text="{resourceManager.getString('resources', 'LM039')}:" >
</mx:Label>
<mx:DateField id="createdate" showToday="true" formatString="YYYY-MM-DD" width="100" focusOut="showChinaDate3()">
</mx:DateField>
<mx:Image source="@Embed(source='images/BacoError.gif')" id="img_s3"></mx:Image>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="20" verticalAlign="middle">
<mx:Label text="{resourceManager.getString('resources', 'LM037')}:" >
</mx:Label>
<mx:TextArea id="desc" text="" editable="true" height="60" width="70%" >
</mx:TextArea>
</mx:HBox>
<mx:HBox paddingLeft="300">
<mx:Button label="{resourceManager.getString('resources', 'LM040')}" id="btSave" paddingLeft="20" paddingRight="20" click="createVersion()">
</mx:Button>
</mx:HBox>
<mx:Validator id="v1" source="{no}" property="text" requiredFieldError="{resourceManager.getString('resources', 'LM041')}" trigger="{btSave}" triggerEvent="click"/>
<mx:Validator id="v2" source="{vname}" property="text" requiredFieldError="{resourceManager.getString('resources', 'LM042')}" trigger="{btSave}" triggerEvent="click"/>
<mx:Validator id="v3" source="{createdate}" property="text" requiredFieldError="{resourceManager.getString('resources', 'LM043')}" trigger="{btSave}" triggerEvent="click"/>
<mx:Style>
Label{
fontSize:12;
color:#cccccc;
}
Button {
fillAlphas: 1, 1, 1, 1;
fillColors: #51a7d6, #51a7d6, #51a7d6, #51a7d6;
color: #ffffff;
textRollOverColor: #ffffff;
textSelectedColor: #ffffff;
borderColor: #0b60a1;
themeColor: #0b60a1;
fontSize: 12;
fontWeight: normal;
paddingLeft:0;
paddingRight:0;
letterSpacing: 0;
}
</mx:Style>
<mx:Script>
<![CDATA[
import com.adobe.utils.StringUtil;
import common.StaticObj;
import mx.controls.Alert;
import mx.core.Application;
import mx.managers.PopUpManager;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
[bindable]
var staticObj :StaticObj=Application.application.staticObj;
//import model.CompanyInfo;
//var company:CompanyInfo =
protected function createVersion():void
{
var check:Array=Validator.validateAll([v1,v2,v3]);
if (check.length!=0){
Alert.okLabel=""+resourceManager.getString('resources', 'LM044');
Alert.show(resourceManager.getString('resources', 'LM045')+"!");
return ;
}
var http:HTTPService = new HTTPService();
http.addEventListener(ResultEvent.RESULT,parseObj);
http.addEventListener(FaultEvent.FAULT,myFaultErrorEvent);
http.url="/companygroup/manage/companyoperation.jsp?method=createVersion"
http.method = "post";
http.resultFormat = "e4x";
var val:URLVariables = new URLVariables;
val.no = no.text;
val.name = vname.text;
//Alert.show(createdate.text);
val.createdate = createdate.text;
val.desc = desc.text;
val.groupid = staticObj.groupid;
val.random = Math.random();
http.send(val);
// TODO Auto-generated method stub
}
//失去焦点
public function showChinaDate2():void{
var teststr:String = StringUtil.trim(vname.text);
if(teststr!=""){
img_s2.visible=false;
img_s2.includeInLayout=false;
}else{
img_s2.visible=true;
img_s2.includeInLayout=true;
}
}
//失去焦点
public function showChinaDate3():void{
var teststr:String = StringUtil.trim(createdate.text);
if(teststr!=""){
img_s3.visible=false;
img_s3.includeInLayout=false;
}else{
img_s3.visible=true;
img_s3.includeInLayout=true;
}
}
//失去焦点,验证版本号是否重复
public function showChinaDate():void{
var teststr:String = StringUtil.trim(no.text);
if(teststr!=""){
bbmsg.setStyle("color","black");
bbmsg.text=resourceManager.getString('resources', 'LM046')+".........";
var http:HTTPService = new HTTPService();
http.addEventListener(ResultEvent.RESULT,checkOK);
http.addEventListener(FaultEvent.FAULT,checkNoOK);
//if(event.result != null && event.result is XML){
http.url="/companygroup/manage/companyoperation.jsp?method=checkVersion"
http.method = "post";
http.resultFormat = "text";
var val:URLVariables = new URLVariables;
val.groupid = staticObj.groupid;
val.no = no.text;
val.random = Math.random();
http.send(val);
}else{
img_s1.visible=true;
img_s1.includeInLayout=true;
}
}
public function checkOK(event:ResultEvent):void{
var mess:Object=event.result;
var teststr:String = StringUtil.trim(mess.toString());
if(teststr=="ok"){
Alert.okLabel = ""+resourceManager.getString('resources', 'LM044');
//Alert.show("该版本号可以注册!");
bbmsg.setStyle("color","blue");
bbmsg.text=""+resourceManager.getString('resources', 'LM047');
btSave.visible=true;
btSave.includeInLayout=true;
img_s1.visible=false;
img_s1.includeInLayout=false;//也没不占空间
}else{
Alert.okLabel = ""+resourceManager.getString('resources', 'LM044');
//Alert.show("该版本号已被占用!");
bbmsg.setStyle("color","red");
bbmsg.text=""+resourceManager.getString('resources', 'LM048');
btSave.visible=false;
btSave.includeInLayout=false;
img_s1.visible=true;
img_s1.includeInLayout=true;
}
}
public function checkNoOK(event:ResultEvent):void{
Alert.okLabel = ""+resourceManager.getString('resources', 'LM044');
Alert.show(resourceManager.getString('resources', 'LM049')+"!");
img_s1.visible=true;
img_s1.includeInLayout=true;
}
public function parseObj(xmlContent:ResultEvent):void{
PopUpManager.removePopUp(this);
Alert.yesLabel = ""+resourceManager.getString('resources', 'LM044');
Alert.show(resourceManager.getString('resources', 'LM050')+"!");
}
public function myFaultErrorEvent(myFaultEvent:FaultEvent):void{ //异常处理函数
//Alert.show("333");
trace(myFaultEvent.message);
}
]]>
</mx:Script>
</mx:TitleWindow>