123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <?xml version="1.0" encoding="utf-8"?>
- <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:acc="com.jtgh.yjpt.common.component.ui.*"
- 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.*">
- <fx:Script>
- <![CDATA[
- import com.jtgh.yjpt.common.Global;
- import com.jtgh.yjpt.vo.jyr.JyrVo;
- import com.jtgh.yjpt.common.util.Constants;
- import com.jtgh.yjpt.common.util.Utils;
- import com.jtgh.yjpt.model.check.ZcModel;
- import com.jtgh.yjpt.vo.check.ZcyhVo;
- import com.jtgh.yjpt.vo.common.AccessoryVo;
- import com.jtgh.yjpt.vo.common.CodeVo;
-
- import mx.collections.ArrayCollection;
- import mx.events.CloseEvent;
- import mx.events.FlexEvent;
- import mx.managers.CursorManager;
- import mx.rpc.events.ResultEvent;
-
- import spark.components.Image;
- import spark.events.IndexChangeEvent;
- public var uploadFile:FileReference=new FileReference;
- public var uploadFiles:FileReferenceList=new FileReferenceList;
- public var zplx:String;
- public var fjlx:String;
- [Bindable]
- public var thisData:ZcyhVo;
- public var zcModel:ZcModel;
- public var yhzpList:ArrayCollection=new ArrayCollection;
- public var zghzpList:ArrayCollection=new ArrayCollection;
- protected function init(event:FlexEvent):void
- {
- uploadFile.addEventListener(Event.SELECT,selectFileHandle);
- uploadFile.addEventListener(Event.COMPLETE, uploadCompleteHandler);
- uploadFile.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadCompleteDataHandler);
- uploadFiles.addEventListener(Event.SELECT,selectFilesHandle);
-
- if(wzg.selected){fileListView.filesList=thisData.zgcs;}
- if(thisData.yhqy=="2" ){
- szcgStr.visible=true;
- szcgStr.includeInLayout=true;
- szcg.visible=true;
- szcg.includeInLayout=true;
- } else if(thisData.yhqy=="1" ){
- szcgStr.visible=false;
- szcgStr.includeInLayout=false;
- szcg.visible=false;
- szcg.includeInLayout=false;
- }
- szcg.parentId=zcModel.zcVo.qymc;
- }
- public function doDownload(acc:AccessoryVo):void
- {
- downLoadFunction(acc);
- }
- public function updateFileStatus():void
- {
- }
- public function selectFile(zp:String,fj:String):void
- {
- uploadFile.browse();
- zplx=zp;
- fjlx=fj;
- }
- public function selectFiles(zp:String,fj:String):void
- {
- var images:FileFilter=new FileFilter("Images(*.jpg;*.gif;*.png;)", "*.jpg;*.gif;*.png;");
- uploadFiles.browse([images]);
- zplx=zp;
- fjlx=fj;
- }
- public function deleteFile(acc:AccessoryVo,zp:String):void
- {
- Utils.doDelConfirm(function():void{
- doDeleteFile(acc);
- thisData[zp] = null;
- });
- }
- private function doDeleteFile(vo:AccessoryVo):void
- {
- Utils.callRemote("accessoryController","deleteFj",refreshFile,vo.entityId,vo.entityType,vo.type);
- }
- private function refreshFile(r:ResultEvent):void
- {
- updateFileStatus();
- }
- /**
- * 文件上传
- */
- private function selectFileHandle(e:Event):void{
- // 验证上传文件大小
- if(!Utils.checkUploadFileSize(uploadFile))
- {
- var arr:Array = new Array();
- arr.push(Global.upload_file_size);
- Utils.showInfoMessage("msg.upload.FileSizeOutOfRange",arr);
- return;
- }
- if(thisData[zplx]!=null)
- {
- doDeleteFile(thisData[zplx]);
- }
- thisData[zplx]=new AccessoryVo;
- thisData[zplx].name = uploadFile.name;
- var params:URLVariables = new URLVariables();
- params.entityId=thisData.id;
- params.entityType=fjlx;
- params.type=0;
- var url:String = Utils.getBaseUrl()+"uploadtb.do;jsessionid="+Global.jsessionid;
- var request:URLRequest = new URLRequest(url);
- request.data = params;
- request.method = URLRequestMethod.POST;
- uploadFile.upload(request,"file");
- CursorManager.setBusyCursor();
- }
- /**
- * 文件批量上传
- */
- private function selectFilesHandle(e:Event):void{
- if(thisData[zplx+"List"]==null){
- thisData[zplx+"List"] = new ArrayCollection(uploadFiles.fileList);
- }else{
- thisData[zplx+"List"].addAll(new ArrayCollection(uploadFiles.fileList));
- }
- for each(var file:FileReference in uploadFiles.fileList){
- if(!Utils.checkUploadImageSize(file))
- {
- var arr:Array = new Array();
- arr.push(Global.upload_image_size);
- Utils.showInfoMessage("msg.upload.ImageSizeOutOfRange",arr);
- break;
- }
- file.load();
- file.addEventListener(Event.COMPLETE,showZp);
- }
- }
- private function uploadCompleteHandler(e:Event):void
- {
- CursorManager.removeBusyCursor();
- }
- private function uploadCompleteDataHandler(event:DataEvent):void
- {
- if(event.data)
- thisData[zplx].id = new Number(event.data);
- }
- private function showZp(e:Event):void
- {
- var image:Image=new Image();
- image.width=90;
- image.height=90;
- image.source=(e.target as FileReference).data;
- if("yhzp"==zplx){
- zpShow.addElement(image);
- thisData.yhzp.addItem(image.source as ByteArray);
- }else if("zghzp"==zplx){
- zghzpShow.addElement(image);
- thisData.zghzp.addItem(image.source as ByteArray);
- }
- }
- /**
- * 下载
- */
- private function downLoadFunction(acc:AccessoryVo):void
- {
- var url:String = Utils.getBaseUrl()+"download.do";
- var request:URLRequest = new URLRequest(url);
- var params:URLVariables = new URLVariables();
- params.accessoryId=acc.id;
- request.data = params;
- request.method = URLRequestMethod.POST;
- navigateToURL(request,"_self");
- // var file:FileReference = new FileReference();
- // file.addEventListener(Event.COMPLETE, downloadCompleteHandler);
- // file.addEventListener(Event.CANCEL, downloadCompleteHandler);
- // file.download(request, acc.name);
- // CursorManager.setBusyCursor();
- }
- /**
- * 附件下载完成
- */
- private function downloadCompleteHandler(event:Event):void {
- CursorManager.removeBusyCursor();
- }
- protected function getYhzlType(event:IndexChangeEvent):void
- {
- if(null!=(yhdl.selectedVO as CodeVo))
- yhzl.reload((yhdl.selectedVO as CodeVo).id);
- }
- protected function wzgFun():void
- {
- if(wzg.selected){
- yzg.selected=false;
- Utils.uiVisible(yzgGroup,false);
- Utils.uiVisible(wzgGroup,true);
- }
- else{
- Utils.uiVisible(wzgGroup,false);
- }
- }
- protected function yzgFun():void
- {
- if(yzg.selected){
- wzg.selected=false;
- Utils.uiVisible(wzgGroup,false);
- Utils.uiVisible(yzgGroup,true);
- }
- else{
- Utils.uiVisible(yzgGroup,false);
- }
- }
- protected function delFileList(type:String):void
- {
- if(Constants.FJSSLX_YHZP==type){
- zpShow.removeAllElements();
- thisData.yhzp.removeAll();
- if(thisData.yhzpList!=null)
- thisData.yhzpList.removeAll();
- }else if(Constants.FJSSLX_ZGHZP==type){
- zghzpShow.removeAllElements();
- thisData.zghzp.removeAll();
- thisData.zghzpList.removeAll();
- }
- Utils.callRemote("accessoryController","deleteFj", function (r:ResultEvent):void{
- },thisData.id,type,0,thisData.tbdyid);
- }
- protected function yhqy_changeHandler(event:IndexChangeEvent):void
- {
- if((yhqy.textValue as String)=="2" ){
- szcgStr.visible=true;
- szcgStr.includeInLayout=true;
- szcg.visible=true;
- szcg.includeInLayout=true;
- if(zcModel!=null&&zcModel.zcEdit!=null){
- szcg.reload(zcModel.zcEdit.dwmc.selectedVO as JyrVo);
- }
- } else if((yhqy.textValue as String)=="1" ){
- szcgStr.visible=false;
- szcgStr.includeInLayout=false;
- szcg.visible=false;
- szcg.includeInLayout=false;
- szcg.selectedIndex=0;
- }
-
- }
-
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- 将非可视元素(例如服务、值对象)放在此处 -->
- </fx:Declarations>
- <s:VGroup width="100%" height="100%" paddingTop="5">
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.xmmc')}" notNull="true"/>
- <cus:QTextInput width="200" text="@{thisData.xmmc}"/>
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.szwz')}" notNull="true"/>
- <cus:QTextInput width="200" text="@{thisData.szwz}"/>
- </s:HGroup>
- <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
- <cus:QLabel text="{resourceManager.getString('check','yhdl')}" textAlign="right" width="100" notNull="true"/>
- <cus:QComboBox id="yhdl" selectedVO="{thisData.yhdl}" comboxClass="CodeSelect" codeType="{Constants.GROUP_CODE_YHDL}" hasBlank="true" change="getYhzlType(event)" width="200"/>
- <cus:QLabel text="{resourceManager.getString('check','yhzl')}" textAlign="right" width="100" notNull="true"/>
- <cus:QComboBox id="yhzl" selectedVO="{thisData.yhzl}" width="200" comboxClass="CodeSelect" codeType="" parentId="{thisData.yhdl.id.toString()}" hasBlank="true"/>
- </s:HGroup>
- <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
- <cus:QLabel text="{resourceManager.getString('check','yhfl')}" textAlign="right" width="100" notNull="true"/>
- <cus:QComboBox id="yhfl" dataField="{thisData.yhfl}" comboxClass="YhflSelect" hasBlank="false" width="200"/>
- <cus:QLabel text="{resourceManager.getString('check','yhqy')}" textAlign="right" width="100" notNull="true"/>
- <cus:QComboBox id="yhqy" dataField="{thisData.yhqy}" width="200" comboxClass="YhqySelect" hasBlank="false" change="yhqy_changeHandler(event)"/>
- </s:HGroup>
- <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
- <cus:QLabel text="{resourceManager.getString('check','yhjb')}" textAlign="right" width="100" notNull="true"/>
- <cus:QComboBox id="yhjb" selectedVO="{thisData.yhjb}" width="200" comboxClass="CodeSelect" codeType="{Constants.GROUP_CODE_YHJB}" hasBlank="true"/>
- <cus:QLabel text="{resourceManager.getString('check','jhwcsj')}" textAlign="right" width="100"/>
- <ui:DateTime id="jhwcsj" dateTime="{thisData.jhwcsj}" width="200" />
- </s:HGroup>
- <s:HGroup width="100%" horizontalAlign="left" verticalAlign="middle">
- <cus:QLabel text="{resourceManager.getString('check','fxrq')}" textAlign="right" width="100"/>
- <ui:DateTime id="fxrq" dateTime="{thisData.fxrq}" width="200" />
- <cus:QLabel id="szcgStr" text="{resourceManager.getString('check','szcg')}" textAlign="right" width="100" visible="false" includeInLayout="false"/>
- <cus:QComboBox id="szcg" selectedVO="{thisData.cg}" width="200" comboxClass="CgSelect" hasBlank="true" visible="false" includeInLayout="false"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.bz')}"/>
- <cus:QTextArea width="512" height="60" text="@{thisData.bz}"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.yhzp')}"/>
- <mx:VBox width="300" height="100" borderVisible="true" borderStyle="inset" borderColor="#d2d2d2" >
- <s:HGroup width="100%" id="zpShow" horizontalAlign="left" verticalAlign="middle">
- </s:HGroup>
- </mx:VBox>
- <s:Button id="delYhzp" label="{resourceManager.getString('common','btn.del')}" click="delFileList(Constants.FJSSLX_YHZP)"
- enabled="{null!=thisData&&thisData.yhzp.length>0}"/>
- <s:Button id="browseYhzp" label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFiles('yhzp',Constants.FJSSLX_YHZP)" width="75"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.yhms')}"/>
- <cus:QTextInput width="512" text="@{thisData.yhms}"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.yjffcs')}"/>
- <cus:QTextInput width="512" text="@{thisData.yjffcs}"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.zgcs')}"/>
- <cus:QTextInput width="512" text="@{thisData.zghjkcs}"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','mqzt')}"/>
- <ui:CheckBox id="wzg" selected="{'0'==thisData.mqzt}" label="{resourceManager.getString('check','wzg')}" valueCommit="wzgFun()"/>
- <ui:CheckBox id="yzg" selected="{'1'==thisData.mqzt}" label="{resourceManager.getString('check','yzg')}" valueCommit="yzgFun()"/>
- </s:HGroup>
- <s:VGroup width="100%" id="wzgGroup" verticalAlign="middle" visible="false" includeInLayout="false">
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.wzgyy')}"/>
- <cus:QTextInput width="512" text="@{thisData.wzgyy}"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <!--cus:QLabel width="100" text="{resourceManager.getString('check','zgcsfj')}"/>
- <mx:LinkButton textDecoration="underline" textAlign="left"
- enabled="{!(thisData.zgcs==null)}"
- label="@{thisData.zgcs.name}" width="300" click="doDownload(thisData.zgcs)"/>
- <s:Button label="{resourceManager.getString('common','btn.del')}" click="deleteFile(thisData.zgcs,'zgcs')"
- enabled="{null!=thisData&&null!=thisData.zgcs}"/>
- <s:Button label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFile('zgcs',Constants.FJSSLX_ZGCSFJ)"/-->
- <acc:AccessoryList id="fileListView" width="100%" height="98%" parentView="{this}"
- entityType="{new Number(Constants.FJSSLX_ZGCSFJ)}" entityId="{thisData.id}"
- groupCode_fileType="{Constants.GROUP_CODE_DC}" />
- </s:HGroup>
- </s:VGroup>
- <s:VGroup width="100%" id="yzgGroup" verticalAlign="middle" visible="false" includeInLayout="false">
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.zghzp')}"/>
- <mx:VBox width="300" height="100" borderVisible="true" borderStyle="inset" borderColor="#d2d2d2">
- <s:HGroup width="100%" id="zghzpShow" horizontalAlign="left" verticalAlign="middle">
- </s:HGroup>
- </mx:VBox>
- <s:Button label="{resourceManager.getString('common','btn.del')}" click="delFileList(Constants.FJSSLX_ZGHZP)"
- enabled="{null!=thisData&&thisData.zghzp.length>0}"/>
- <s:Button label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFiles('zghzp',Constants.FJSSLX_ZGHZP)" width="75"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zcyh.zgwcqkfj')}"/>
- <mx:LinkButton textDecoration="underline" textAlign="left"
- enabled="{!(thisData.zgjg==null)}"
- label="@{thisData.zgjg.name}" width="300" click="doDownload(thisData.zgjg)"/>
- <s:Button label="{resourceManager.getString('common','btn.del')}" click="deleteFile(thisData.zgjg,'zgjg')"
- enabled="{null!=thisData&&null!=thisData.zgjg}"/>
- <s:Button label="{resourceManager.getString('common','btn.browse')}" enabled="{null!=thisData}" click="selectFile('zgjg',Constants.FJSSLX_ZGJGFJ)" width="75"/>
- </s:HGroup>
- <s:HGroup width="100%" verticalAlign="middle">
- <cus:QLabel width="100" text="{resourceManager.getString('check','zgtrzj')}"/>
- <cus:QTextInput width="200" text="@{thisData.zgtrzj_s}"/>
- </s:HGroup>
- </s:VGroup>
- <s:HGroup width="100%" horizontalAlign="center">
- <s:Button id="save" label="{resourceManager.getString('common','btn.save')}" click="{zcModel.saveYh()}" skinClass="skins.cus.ButtonSkin"/>
- <s:Button id="close" label="{resourceManager.getString('common','btn.close')}" click="{this.dispatchEvent(new CloseEvent(CloseEvent.CLOSE));}" skinClass="skins.cus.ButtonSkin"/>
- </s:HGroup>
- </s:VGroup>
- </s:Group>
|