ZcyhEdit.mxml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
  3. xmlns:s="library://ns.adobe.com/flex/spark"
  4. xmlns:acc="com.jtgh.yjpt.common.component.ui.*"
  5. xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" xmlns:cus="com.jtgh.yjpt.common.cus.*" creationComplete="init(event)" xmlns:ui="com.jtgh.yjpt.common.component.ui.*">
  6. <fx:Script>
  7. <![CDATA[
  8. import com.jtgh.yjpt.common.Global;
  9. import com.jtgh.yjpt.vo.jyr.JyrVo;
  10. import com.jtgh.yjpt.common.util.Constants;
  11. import com.jtgh.yjpt.common.util.Utils;
  12. import com.jtgh.yjpt.model.check.ZcModel;
  13. import com.jtgh.yjpt.vo.check.ZcyhVo;
  14. import com.jtgh.yjpt.vo.common.AccessoryVo;
  15. import com.jtgh.yjpt.vo.common.CodeVo;
  16. import mx.collections.ArrayCollection;
  17. import mx.events.CloseEvent;
  18. import mx.events.FlexEvent;
  19. import mx.managers.CursorManager;
  20. import mx.rpc.events.ResultEvent;
  21. import spark.components.Image;
  22. import spark.events.IndexChangeEvent;
  23. public var uploadFile:FileReference=new FileReference;
  24. public var uploadFiles:FileReferenceList=new FileReferenceList;
  25. public var zplx:String;
  26. public var fjlx:String;
  27. [Bindable]
  28. public var thisData:ZcyhVo;
  29. public var zcModel:ZcModel;
  30. public var yhzpList:ArrayCollection=new ArrayCollection;
  31. public var zghzpList:ArrayCollection=new ArrayCollection;
  32. protected function init(event:FlexEvent):void
  33. {
  34. uploadFile.addEventListener(Event.SELECT,selectFileHandle);
  35. uploadFile.addEventListener(Event.COMPLETE, uploadCompleteHandler);
  36. uploadFile.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadCompleteDataHandler);
  37. uploadFiles.addEventListener(Event.SELECT,selectFilesHandle);
  38. if(wzg.selected){fileListView.filesList=thisData.zgcs;}
  39. if(thisData.yhqy=="2" ){
  40. szcgStr.visible=true;
  41. szcgStr.includeInLayout=true;
  42. szcg.visible=true;
  43. szcg.includeInLayout=true;
  44. } else if(thisData.yhqy=="1" ){
  45. szcgStr.visible=false;
  46. szcgStr.includeInLayout=false;
  47. szcg.visible=false;
  48. szcg.includeInLayout=false;
  49. }
  50. szcg.parentId=zcModel.zcVo.qymc;
  51. }
  52. public function doDownload(acc:AccessoryVo):void
  53. {
  54. downLoadFunction(acc);
  55. }
  56. public function updateFileStatus():void
  57. {
  58. }
  59. public function selectFile(zp:String,fj:String):void
  60. {
  61. uploadFile.browse();
  62. zplx=zp;
  63. fjlx=fj;
  64. }
  65. public function selectFiles(zp:String,fj:String):void
  66. {
  67. var images:FileFilter=new FileFilter("Images(*.jpg;*.gif;*.png;)", "*.jpg;*.gif;*.png;");
  68. uploadFiles.browse([images]);
  69. zplx=zp;
  70. fjlx=fj;
  71. }
  72. public function deleteFile(acc:AccessoryVo,zp:String):void
  73. {
  74. Utils.doDelConfirm(function():void{
  75. doDeleteFile(acc);
  76. thisData[zp] = null;
  77. });
  78. }
  79. private function doDeleteFile(vo:AccessoryVo):void
  80. {
  81. Utils.callRemote("accessoryController","deleteFj",refreshFile,vo.entityId,vo.entityType,vo.type);
  82. }
  83. private function refreshFile(r:ResultEvent):void
  84. {
  85. updateFileStatus();
  86. }
  87. /**
  88. * 文件上传
  89. */
  90. private function selectFileHandle(e:Event):void{
  91. // 验证上传文件大小
  92. if(!Utils.checkUploadFileSize(uploadFile))
  93. {
  94. var arr:Array = new Array();
  95. arr.push(Global.upload_file_size);
  96. Utils.showInfoMessage("msg.upload.FileSizeOutOfRange",arr);
  97. return;
  98. }
  99. if(thisData[zplx]!=null)
  100. {
  101. doDeleteFile(thisData[zplx]);
  102. }
  103. thisData[zplx]=new AccessoryVo;
  104. thisData[zplx].name = uploadFile.name;
  105. var params:URLVariables = new URLVariables();
  106. params.entityId=thisData.id;
  107. params.entityType=fjlx;
  108. params.type=0;
  109. var url:String = Utils.getBaseUrl()+"uploadtb.do;jsessionid="+Global.jsessionid;
  110. var request:URLRequest = new URLRequest(url);
  111. request.data = params;
  112. request.method = URLRequestMethod.POST;
  113. uploadFile.upload(request,"file");
  114. CursorManager.setBusyCursor();
  115. }
  116. /**
  117. * 文件批量上传
  118. */
  119. private function selectFilesHandle(e:Event):void{
  120. if(thisData[zplx+"List"]==null){
  121. thisData[zplx+"List"] = new ArrayCollection(uploadFiles.fileList);
  122. }else{
  123. thisData[zplx+"List"].addAll(new ArrayCollection(uploadFiles.fileList));
  124. }
  125. for each(var file:FileReference in uploadFiles.fileList){
  126. if(!Utils.checkUploadImageSize(file))
  127. {
  128. var arr:Array = new Array();
  129. arr.push(Global.upload_image_size);
  130. Utils.showInfoMessage("msg.upload.ImageSizeOutOfRange",arr);
  131. break;
  132. }
  133. file.load();
  134. file.addEventListener(Event.COMPLETE,showZp);
  135. }
  136. }
  137. private function uploadCompleteHandler(e:Event):void
  138. {
  139. CursorManager.removeBusyCursor();
  140. }
  141. private function uploadCompleteDataHandler(event:DataEvent):void
  142. {
  143. if(event.data)
  144. thisData[zplx].id = new Number(event.data);
  145. }
  146. private function showZp(e:Event):void
  147. {
  148. var image:Image=new Image();
  149. image.width=90;
  150. image.height=90;
  151. image.source=(e.target as FileReference).data;
  152. if("yhzp"==zplx){
  153. zpShow.addElement(image);
  154. thisData.yhzp.addItem(image.source as ByteArray);
  155. }else if("zghzp"==zplx){
  156. zghzpShow.addElement(image);
  157. thisData.zghzp.addItem(image.source as ByteArray);
  158. }
  159. }
  160. /**
  161. * 下载
  162. */
  163. private function downLoadFunction(acc:AccessoryVo):void
  164. {
  165. var url:String = Utils.getBaseUrl()+"download.do";
  166. var request:URLRequest = new URLRequest(url);
  167. var params:URLVariables = new URLVariables();
  168. params.accessoryId=acc.id;
  169. request.data = params;
  170. request.method = URLRequestMethod.POST;
  171. navigateToURL(request,"_self");
  172. // var file:FileReference = new FileReference();
  173. // file.addEventListener(Event.COMPLETE, downloadCompleteHandler);
  174. // file.addEventListener(Event.CANCEL, downloadCompleteHandler);
  175. // file.download(request, acc.name);
  176. // CursorManager.setBusyCursor();
  177. }
  178. /**
  179. * 附件下载完成
  180. */
  181. private function downloadCompleteHandler(event:Event):void {
  182. CursorManager.removeBusyCursor();
  183. }
  184. protected function getYhzlType(event:IndexChangeEvent):void
  185. {
  186. if(null!=(yhdl.selectedVO as CodeVo))
  187. yhzl.reload((yhdl.selectedVO as CodeVo).id);
  188. }
  189. protected function wzgFun():void
  190. {
  191. if(wzg.selected){
  192. yzg.selected=false;
  193. Utils.uiVisible(yzgGroup,false);
  194. Utils.uiVisible(wzgGroup,true);
  195. }
  196. else{
  197. Utils.uiVisible(wzgGroup,false);
  198. }
  199. }
  200. protected function yzgFun():void
  201. {
  202. if(yzg.selected){
  203. wzg.selected=false;
  204. Utils.uiVisible(wzgGroup,false);
  205. Utils.uiVisible(yzgGroup,true);
  206. }
  207. else{
  208. Utils.uiVisible(yzgGroup,false);
  209. }
  210. }
  211. protected function delFileList(type:String):void
  212. {
  213. if(Constants.FJSSLX_YHZP==type){
  214. zpShow.removeAllElements();
  215. thisData.yhzp.removeAll();
  216. if(thisData.yhzpList!=null)
  217. thisData.yhzpList.removeAll();
  218. }else if(Constants.FJSSLX_ZGHZP==type){
  219. zghzpShow.removeAllElements();
  220. thisData.zghzp.removeAll();
  221. thisData.zghzpList.removeAll();
  222. }
  223. Utils.callRemote("accessoryController","deleteFj", function (r:ResultEvent):void{
  224. },thisData.id,type,0,thisData.tbdyid);
  225. }
  226. protected function yhqy_changeHandler(event:IndexChangeEvent):void
  227. {
  228. if((yhqy.textValue as String)=="2" ){
  229. szcgStr.visible=true;
  230. szcgStr.includeInLayout=true;
  231. szcg.visible=true;
  232. szcg.includeInLayout=true;
  233. if(zcModel!=null&&zcModel.zcEdit!=null){
  234. szcg.reload(zcModel.zcEdit.dwmc.selectedVO as JyrVo);
  235. }
  236. } else if((yhqy.textValue as String)=="1" ){
  237. szcgStr.visible=false;
  238. szcgStr.includeInLayout=false;
  239. szcg.visible=false;
  240. szcg.includeInLayout=false;
  241. szcg.selectedIndex=0;
  242. }
  243. }
  244. ]]>
  245. </fx:Script>
  246. <fx:Declarations>
  247. <!-- 将非可视元素(例如服务、值对象)放在此处 -->
  248. </fx:Declarations>
  249. <s:VGroup width="100%" height="100%" paddingTop="5">
  250. <s:HGroup width="100%" verticalAlign="middle">
  251. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.xmmc')}" notNull="true"/>
  252. <cus:QTextInput width="200" text="@{thisData.xmmc}"/>
  253. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.szwz')}" notNull="true"/>
  254. <cus:QTextInput width="200" text="@{thisData.szwz}"/>
  255. </s:HGroup>
  256. <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
  257. <cus:QLabel text="{resourceManager.getString('check','yhdl')}" textAlign="right" width="100" notNull="true"/>
  258. <cus:QComboBox id="yhdl" selectedVO="{thisData.yhdl}" comboxClass="CodeSelect" codeType="{Constants.GROUP_CODE_YHDL}" hasBlank="true" change="getYhzlType(event)" width="200"/>
  259. <cus:QLabel text="{resourceManager.getString('check','yhzl')}" textAlign="right" width="100" notNull="true"/>
  260. <cus:QComboBox id="yhzl" selectedVO="{thisData.yhzl}" width="200" comboxClass="CodeSelect" codeType="" parentId="{thisData.yhdl.id.toString()}" hasBlank="true"/>
  261. </s:HGroup>
  262. <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
  263. <cus:QLabel text="{resourceManager.getString('check','yhfl')}" textAlign="right" width="100" notNull="true"/>
  264. <cus:QComboBox id="yhfl" dataField="{thisData.yhfl}" comboxClass="YhflSelect" hasBlank="false" width="200"/>
  265. <cus:QLabel text="{resourceManager.getString('check','yhqy')}" textAlign="right" width="100" notNull="true"/>
  266. <cus:QComboBox id="yhqy" dataField="{thisData.yhqy}" width="200" comboxClass="YhqySelect" hasBlank="false" change="yhqy_changeHandler(event)"/>
  267. </s:HGroup>
  268. <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
  269. <cus:QLabel text="{resourceManager.getString('check','yhjb')}" textAlign="right" width="100" notNull="true"/>
  270. <cus:QComboBox id="yhjb" selectedVO="{thisData.yhjb}" width="200" comboxClass="CodeSelect" codeType="{Constants.GROUP_CODE_YHJB}" hasBlank="true"/>
  271. <cus:QLabel text="{resourceManager.getString('check','jhwcsj')}" textAlign="right" width="100"/>
  272. <ui:DateTime id="jhwcsj" dateTime="{thisData.jhwcsj}" width="200" />
  273. </s:HGroup>
  274. <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
  275. <cus:QLabel text="{resourceManager.getString('check','fxrq')}" textAlign="right" width="100"/>
  276. <ui:DateTime id="fxrq" dateTime="{thisData.fxrq}" width="200" />
  277. <cus:QLabel id="szcgStr" text="{resourceManager.getString('check','szcg')}" textAlign="right" width="100" visible="false" includeInLayout="false"/>
  278. <cus:QComboBox id="szcg" selectedVO="{thisData.cg}" width="200" comboxClass="CgSelect" hasBlank="true" visible="false" includeInLayout="false"/>
  279. </s:HGroup>
  280. <s:HGroup width="100%" verticalAlign="middle">
  281. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.bz')}"/>
  282. <cus:QTextArea width="512" height="60" text="@{thisData.bz}"/>
  283. </s:HGroup>
  284. <s:HGroup width="100%" verticalAlign="middle">
  285. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.yhzp')}"/>
  286. <mx:VBox width="300" height="100" borderVisible="true" borderStyle="inset" borderColor="#d2d2d2" >
  287. <s:HGroup width="100%" id="zpShow" horizontalAlign="left" verticalAlign="middle">
  288. </s:HGroup>
  289. </mx:VBox>
  290. <s:Button id="delYhzp" label="{resourceManager.getString('common','btn.del')}" click="delFileList(Constants.FJSSLX_YHZP)"
  291. enabled="{null!=thisData&amp;&amp;thisData.yhzp.length>0}"/>
  292. <s:Button id="browseYhzp" label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFiles('yhzp',Constants.FJSSLX_YHZP)" width="75"/>
  293. </s:HGroup>
  294. <s:HGroup width="100%" verticalAlign="middle">
  295. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.yhms')}"/>
  296. <cus:QTextInput width="512" text="@{thisData.yhms}"/>
  297. </s:HGroup>
  298. <s:HGroup width="100%" verticalAlign="middle">
  299. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.yjffcs')}"/>
  300. <cus:QTextInput width="512" text="@{thisData.yjffcs}"/>
  301. </s:HGroup>
  302. <s:HGroup width="100%" verticalAlign="middle">
  303. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.zgcs')}"/>
  304. <cus:QTextInput width="512" text="@{thisData.zghjkcs}"/>
  305. </s:HGroup>
  306. <s:HGroup width="100%" verticalAlign="middle">
  307. <cus:QLabel width="100" text="{resourceManager.getString('check','mqzt')}"/>
  308. <ui:CheckBox id="wzg" selected="{'0'==thisData.mqzt}" label="{resourceManager.getString('check','wzg')}" valueCommit="wzgFun()"/>
  309. <ui:CheckBox id="yzg" selected="{'1'==thisData.mqzt}" label="{resourceManager.getString('check','yzg')}" valueCommit="yzgFun()"/>
  310. </s:HGroup>
  311. <s:VGroup width="100%" id="wzgGroup" verticalAlign="middle" visible="false" includeInLayout="false">
  312. <s:HGroup width="100%" verticalAlign="middle">
  313. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.wzgyy')}"/>
  314. <cus:QTextInput width="512" text="@{thisData.wzgyy}"/>
  315. </s:HGroup>
  316. <s:HGroup width="100%" verticalAlign="middle">
  317. <!--cus:QLabel width="100" text="{resourceManager.getString('check','zgcsfj')}"/>
  318. <mx:LinkButton textDecoration="underline" textAlign="left"
  319. enabled="{!(thisData.zgcs==null)}"
  320. label="@{thisData.zgcs.name}" width="300" click="doDownload(thisData.zgcs)"/>
  321. <s:Button label="{resourceManager.getString('common','btn.del')}" click="deleteFile(thisData.zgcs,'zgcs')"
  322. enabled="{null!=thisData&amp;&amp;null!=thisData.zgcs}"/>
  323. <s:Button label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFile('zgcs',Constants.FJSSLX_ZGCSFJ)"/-->
  324. <acc:AccessoryList id="fileListView" width="100%" height="98%" parentView="{this}"
  325. entityType="{new Number(Constants.FJSSLX_ZGCSFJ)}" entityId="{thisData.id}"
  326. groupCode_fileType="{Constants.GROUP_CODE_DC}" />
  327. </s:HGroup>
  328. </s:VGroup>
  329. <s:VGroup width="100%" id="yzgGroup" verticalAlign="middle" visible="false" includeInLayout="false">
  330. <s:HGroup width="100%" verticalAlign="middle">
  331. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.zghzp')}"/>
  332. <mx:VBox width="300" height="100" borderVisible="true" borderStyle="inset" borderColor="#d2d2d2">
  333. <s:HGroup width="100%" id="zghzpShow" horizontalAlign="left" verticalAlign="middle">
  334. </s:HGroup>
  335. </mx:VBox>
  336. <s:Button label="{resourceManager.getString('common','btn.del')}" click="delFileList(Constants.FJSSLX_ZGHZP)"
  337. enabled="{null!=thisData&amp;&amp;thisData.zghzp.length>0}"/>
  338. <s:Button label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFiles('zghzp',Constants.FJSSLX_ZGHZP)" width="75"/>
  339. </s:HGroup>
  340. <s:HGroup width="100%" verticalAlign="middle">
  341. <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.zgwcqkfj')}"/>
  342. <mx:LinkButton textDecoration="underline" textAlign="left"
  343. enabled="{!(thisData.zgjg==null)}"
  344. label="@{thisData.zgjg.name}" width="300" click="doDownload(thisData.zgjg)"/>
  345. <s:Button label="{resourceManager.getString('common','btn.del')}" click="deleteFile(thisData.zgjg,'zgjg')"
  346. enabled="{null!=thisData&amp;&amp;null!=thisData.zgjg}"/>
  347. <s:Button label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFile('zgjg',Constants.FJSSLX_ZGJGFJ)" width="75"/>
  348. </s:HGroup>
  349. <s:HGroup width="100%" verticalAlign="middle">
  350. <cus:QLabel width="100" text="{resourceManager.getString('check','zgtrzj')}"/>
  351. <cus:QTextInput width="200" text="@{thisData.zgtrzj_s}"/>
  352. </s:HGroup>
  353. </s:VGroup>
  354. <s:HGroup width="100%" horizontalAlign="center">
  355. <s:Button id="save" label="{resourceManager.getString('common','btn.save')}" click="{zcModel.saveYh()}" skinClass="skins.cus.ButtonSkin"/>
  356. <s:Button id="close" label="{resourceManager.getString('common','btn.close')}" click="{this.dispatchEvent(new CloseEvent(CloseEvent.CLOSE));}" skinClass="skins.cus.ButtonSkin"/>
  357. </s:HGroup>
  358. </s:VGroup>
  359. </s:Group>