123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834 |
- package com.jtgh.yjpt.model.zyfzndjy
- {
- import com.jtgh.yjpt.common.BusinessContext;
- import com.jtgh.yjpt.common.Global;
- import com.jtgh.yjpt.common.IModule;
- import com.jtgh.yjpt.common.component.ui.DataGridColumn;
- import com.jtgh.yjpt.common.component.ui.ZysqbpPager;
- import com.jtgh.yjpt.common.component.ui.PopImageMX;
- import com.jtgh.yjpt.common.util.Constants;
- import com.jtgh.yjpt.common.util.Utils;
- import com.jtgh.yjpt.model.BaseModel;
- import com.jtgh.yjpt.model.SystemModel;
- import com.jtgh.yjpt.model.task.TaskModel;
- import com.jtgh.yjpt.select.WorkflowStatusSelect;
- import com.jtgh.yjpt.view.yjzyxxgl.yjwz.flxxListEdit;
- import com.jtgh.yjpt.view.zyfzndjy.FzChoose;
- import com.jtgh.yjpt.view.zyfzndjy.FzEdit;
- import com.jtgh.yjpt.view.zyfzndjy.GkwxhwzyfzblhhzEdit;
- import com.jtgh.yjpt.view.zyfzndjy.GkwxhwzyfzblhhzLayout;
- import com.jtgh.yjpt.view.zyfzndjy.GkwxhwzyfzblhhzView;
- import com.jtgh.yjpt.vo.common.AccessoryVo;
- import com.jtgh.yjpt.vo.common.CodeVo;
- import com.jtgh.yjpt.vo.common.SinglePageRequestVo;
- import com.jtgh.yjpt.vo.common.TaskInfoVo;
- import com.jtgh.yjpt.vo.gkgq.GqVo;
- import com.jtgh.yjpt.vo.jyr.JyrVo;
- import com.jtgh.yjpt.vo.zyfzndjy.Gkwxhwzyfzbl_fzVo;
- import com.jtgh.yjpt.vo.zyfzndjy.GkwxhwzyfzblhhzVo;
-
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.DisplayObject;
- import flash.display.Loader;
- import flash.display.LoaderInfo;
- import flash.events.Event;
- import flash.events.MouseEvent;
- import flash.net.FileReference;
- import flash.net.URLRequest;
- import flash.net.URLRequestMethod;
- import flash.net.URLVariables;
- import flash.utils.ByteArray;
-
- import mx.binding.utils.BindingUtils;
- import mx.collections.ArrayCollection;
- import mx.collections.ArrayList;
- import mx.controls.Alert;
- import mx.controls.Image;
- import mx.core.FlexGlobals;
- import mx.core.UIComponent;
- import mx.events.CloseEvent;
- import mx.events.FlexEvent;
- import mx.events.ListEvent;
- import mx.managers.CursorManager;
- import mx.managers.PopUpManager;
- import mx.rpc.events.ResultEvent;
- import mx.utils.ObjectUtil;
-
- import spark.components.Image;
- import spark.components.gridClasses.GridColumn;
- import spark.events.GridSortEvent;
- [Bindable]
- public class GkwxhwzyfzblhhzModel extends BaseModel
- {
- public var thisView:Object;
- public var pager:ZysqbpPager;
- public var canLink:Boolean = false;
- public var fzs:ArrayCollection ;
- public var editView:Object;
- public var text:String;//用于 作业“附证”申请 列表页脚显示有附证的企业数量
- public var thisDataList:ArrayCollection;
- public static var instance:GkwxhwzyfzblhhzModel=new GkwxhwzyfzblhhzModel;
- public function GkwxhwzyfzblhhzModel()
- {
- super(IModule.MODEL_004003001);
- }
- /**
- * 待办任务页面调用
- */
- public static function showWorkflow(busId:String,mode:String,layout:DisplayObject,model:TaskModel):void
- {
- instance.thisView=layout;
- if("view"==mode)// 查看
- {
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var editView:GkwxhwzyfzblhhzView= new GkwxhwzyfzblhhzView();
- editView.vo = bc.result as GkwxhwzyfzblhhzVo;
- editView.mode = Constants.mode_view;
- editView.model.zdAndCzgcList=bc.getAttribute("zdList") as ArrayCollection;
- editView.model.ryList=bc.getAttribute("ryList") as ArrayCollection;
- editView.model.yaList=bc.getAttribute("yaList") as ArrayCollection;
- editView.model.fileList = bc.getAttribute("fileList") as ArrayCollection;
- editView.model.ssList=bc.getAttribute("wzList") as ArrayCollection;
- editView.model.fzs = bc.getAttribute("fzList") as ArrayCollection;
- // editView.hwpm.text = editView.model.concatWhpm()["hwpmStr"];
- Utils.popupWindow("查看", editView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject,null,0,0);
- },0,new Number(busId));
- }else{//审批
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:GkwxhwzyfzblhhzVo = bc.result as GkwxhwzyfzblhhzVo;
-
- if(vo.recordStatus==Constants.RECORD_STATE_REJECT){
- var edit:GkwxhwzyfzblhhzEdit =new GkwxhwzyfzblhhzEdit()
- if(vo.recordStatus==Constants.RECORD_STATE_REJECT){
- edit.btnSave.enabled=false;
- }
- edit.vo=vo;
- edit.taskModel=model;
- edit.model.zdAndCzgcList=bc.getAttribute("zdList") as ArrayCollection;
- edit.model.ryList=bc.getAttribute("ryList") as ArrayCollection;
- edit.model.yaList=bc.getAttribute("yaList") as ArrayCollection;
- edit.model.ssList=bc.getAttribute("wzList") as ArrayCollection;
- edit.model.fzs = bc.getAttribute("fzList") as ArrayCollection;
- // editView.hwpm.text = editView.model.concatWhpm()["hwpmStr"];
- Utils.popupWindow("编辑", edit as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject,null,780,600);
- }else{
- var editView :GkwxhwzyfzblhhzView= new GkwxhwzyfzblhhzView();
- editView.taskModel=model;
- editView.vo=vo;
- editView.mode =mode;
- editView.model.zdAndCzgcList=bc.getAttribute("zdList") as ArrayCollection;
- editView.model.ryList=bc.getAttribute("ryList") as ArrayCollection;
- editView.model.yaList=bc.getAttribute("yaList") as ArrayCollection;
- editView.model.fileList = bc.getAttribute("fileList") as ArrayCollection;
- editView.model.ssList=bc.getAttribute("wzList") as ArrayCollection;
- editView.model.fzs = bc.getAttribute("fzList") as ArrayCollection;
- Utils.popupWindow("审核", editView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject,null,0,0);
- }
- },0,new Number(busId));
- }
- }
- /**********************
- * 此方法只能调用一次
- */
- public function doCreationComplete(view:Object):void
- {
- thisView = view;
- BindingUtils.bindProperty(thisView.dataGrid, "dataProvider", this, "thisDataList");
- thisView.dataGrid.addEventListener(MouseEvent.DOUBLE_CLICK, toView);
- var pageVo:SinglePageRequestVo = pager.pageVo;
- pageVo.direction = "desc";
- pageVo.sortField = "addDate";
- thisView.add.addEventListener(MouseEvent.CLICK, toAdd);
- thisView.del.addEventListener(MouseEvent.CLICK, doDel);
- thisView.edit.addEventListener(MouseEvent.CLICK, toEdit);
- //thisView.view.addEventListener(MouseEvent.CLICK, toView);
- // if(view is GkwxhwzyfzblhhzLayout)
- thisView.query.addEventListener(MouseEvent.CLICK, switchSearchBox);
- thisView.print.addEventListener(MouseEvent.CLICK, doPrint);
-
- thisView.query_szd.addEventListener(ListEvent.CHANGE,reloadGq);
- doQuery(null);//初始查询
- if(Global.user.jyr){// 经营人自动打开新增
- // 打开新增页
- // thisView.add.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
- }else{
- thisView.wfHistory.addEventListener(MouseEvent.CLICK, doWfHistory);
- thisView.dataGrid.addEventListener(MouseEvent.CLICK, showFlow);
- }
- }
- /**
- * 打印
- */
- public function doPrint(e:MouseEvent):void
- {
- var szd:CodeVo;
- var gq:GqVo;
- if(null != thisView.query_szd.selectedVO&&"NaN"!=(thisView.query_szd.selectedVO as CodeVo).id.toString()){
- szd = thisView.query_szd.selectedVO as CodeVo;
- }
- if(null != thisView.query_gq.selectedVO ){
- gq = thisView.query_gq.selectedVO as GqVo;
- }
- var jyr:String = thisView.jyr.text;
- var fddbr:String=thisView.fddbr.text;
- var whdj:CodeVo=thisView.query_whdj.selectedVO as CodeVo;
- var lcStatus:String = "";//thisView.query_lcStatus.textValue as String;
- if(queryByFlowDisplay){
- if(Global.deployMode==Constants.DEPLOY_MODE_0){//省级 只能点击省级部分的节点
- if(selectedNodeName!= "查询与统计"){
- return;
- }else{
- lcStatus = selectedNodeName;
- }
- }else{//市级只能点击所在地和经营人的节点
- if(selectedNodeName == "whzyfzsq_cxtj"||selectedNodeName=="查询"){
- }else if(selectedNodeName== "查询与统计"){
- }else{
- lcStatus = selectedNodeName;
- }
- }
- }
-
-
- //任务状态筛选条件:
- var _status:String = '';
- if(thisView.query_lcStatus!=null && thisView.query_lcStatus.selectedItem!=null){
- var _xml:XML = thisView.query_lcStatus.selectedItem as XML;
- _status = _xml.@id;
- }
- if(_status=='' && _status.length==0){
- //任务状态下拉为空状态是默认状态,查看非未提交、非待填报状态的记录
- lcStatus = 'default';
- }
- else{
- if(_status=='wf.qb'){
- //全部
- lcStatus = '';
- }
- else{
- lcStatus = _status;
- }
- }
-
- var title:String="作业附证申请";
- var columns:ArrayList=thisView.dataGrid.columns as ArrayList;
- var headers:Array=new Array;
- for each(var column:DataGridColumn in columns.source){
- if(column.visible&&""!=column.headerText&&resourceManager.getString('common','btn.cz')!=column.headerText)
- headers.push(column.headerText);
- }
- var param:Vector.<String>=new Vector.<String>();
- param.push(
- null==szd?"":szd.id+"",
- jyr,
- null==gq?"":gq.id+"",
- fddbr,
- "",
- null==whdj?"":whdj.id+"",
- lcStatus,
- Utils.getFunctionId(thisView)+""
- );
- var params:URLVariables = new URLVariables();
- params.title=title;
- params.headers=headers;
- params.controller="gkwxhwzyfzblhhzController";
- params.method="print";
- params.param=param;
- var url:String = Utils.getBaseUrl()+"exportExcel.do";
- var request:URLRequest = new URLRequest(url);
- request.data = params;
- request.method = URLRequestMethod.POST;
- var file:FileReference = new FileReference();
- file.addEventListener(Event.COMPLETE, downloadCompleteHandler);
- file.addEventListener(Event.CANCEL, downloadCompleteHandler);
- file.download(request, title+".xls");
- CursorManager.setBusyCursor();
- }
- private function downloadCompleteHandler(event:Event):void {
- CursorManager.removeBusyCursor();
- }
- /**
- * 查看
- */
- protected function toView(event:MouseEvent):void
- {
- //检查选中项
- if(thisView.dataGrid.selectedIndex==-1){
- Utils.showInfoMessage("msg.select.one");
- return;
- }
- // 获取选中项
- var vo:GkwxhwzyfzblhhzVo = thisView.dataGrid.selectedItem as GkwxhwzyfzblhhzVo;
- editView= new GkwxhwzyfzblhhzView();
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- editView.vo = bc.result as GkwxhwzyfzblhhzVo;
- editView.mode = Constants.mode_view;
- editView.model.zdAndCzgcList=bc.getAttribute("zdList") as ArrayCollection;
- editView.model.ryList=bc.getAttribute("ryList") as ArrayCollection;
- editView.model.yaList=bc.getAttribute("yaList") as ArrayCollection;
- editView.model.fileList = bc.getAttribute("fileList") as ArrayCollection;
- editView.model.ssList=bc.getAttribute("wzList") as ArrayCollection;
- editView.model.fzs = bc.getAttribute("fzList") as ArrayCollection;
- // editView.hwpm.text = editView.model.concatWhpm()["hwpmStr"];
- Utils.popupWindow(resourceManager.getString('common','btn.view'), editView as DisplayObject, thisView as DisplayObject,null,0,0);
- },Utils.getFunctionId(thisView),vo.id);
- }
-
- /**
- * 查看窗口弹出
- */
- public function doViewPop(id:Number,mode:String,taskModel:TaskModel):void
- {
- editView = new GkwxhwzyfzblhhzView();
- editView.thisModel = this;
- if(taskModel!=null)
- editView.taskModel=taskModel;
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:GkwxhwzyfzblhhzVo = bc.result as GkwxhwzyfzblhhzVo;
- editView.vo=vo;
- editView.model.zdAndCzgcList=bc.getAttribute("zdList") as ArrayCollection;
- editView.model.ryList=bc.getAttribute("ryList") as ArrayCollection;
- editView.model.yaList=bc.getAttribute("yaList") as ArrayCollection;
- editView.model.fileList = bc.getAttribute("fileList") as ArrayCollection;
- editView.model.ssList=bc.getAttribute("wzList") as ArrayCollection;
- editView.model.fzs = bc.getAttribute("fzList") as ArrayCollection;
- Utils.popupWindow(resourceManager.getString('common','btn.view'), editView as DisplayObject, thisView as DisplayObject,null,0,0);
- },Utils.getFunctionId(thisView),id);
- }
- /**
- * 新增
- */
- protected function toAdd(event:MouseEvent):void
- {
- editView = new GkwxhwzyfzblhhzEdit();
- editView.mode=Constants.mode_add;
- editView.layoutModel=this;
- editView.vo = new GkwxhwzyfzblhhzVo();
- editView.functionId = Utils.getFunctionId(event.target);
- Utils.popupWindow(resourceManager.getString('Gkwxhwzyfzblhhz','add'), editView as DisplayObject, thisView as DisplayObject, thisView.pager.doQuery, 780, 600);
- }
- /**
- * 窗口关闭
- */
- public function doCloseThis():void{
- editView.dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
- doQuery(null);
- }
- /**
- * 编辑
- */
- public function toEdit(event:MouseEvent):void
- {
- //检查选中项
- if(thisView.dataGrid.selectedIndex==-1){
- Utils.showInfoMessage("msg.select.one");
- return;
- }
- // 获取选中项
- var vo:GkwxhwzyfzblhhzVo = thisView.dataGrid.selectedItem as GkwxhwzyfzblhhzVo;
- editView = new GkwxhwzyfzblhhzEdit();
- editView.mode=Constants.mode_edit;
- editView.vo = vo;
- editView.layoutModel=this;
- editView.functionId = Utils.getFunctionId(thisView);
- if(vo.recordStatus==Constants.RECORD_STATE_REJECT&&Global.user.id!=vo.task.startUser.id){//数据状态为退回重提,如果当前用户不是提交人,不能修改
- Alert.show("该数据只能由提交人编辑",resourceManager.getString("common","tip"));
- return;
- }
- if(vo.recordStatus==Constants.RECORD_STATE_COMPLETED||vo.recordStatus==Constants.RECORD_STATE_SUBMIT){
- Alert.show(resourceManager.getString("common","msg.no.edit"),resourceManager.getString("common","tip"));
- return;
- }
- if(vo.recordStatus==Constants.RECORD_STATE_REJECT&&Global.user.id!=vo.task.startUser.id){//数据状态为退回重提,如果当前用户不是提交人,不能修改
- Alert.show("该数据只能由提交人编辑",resourceManager.getString("common","tip"));
- return;
- }
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","doEditInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- // if(vo.recordStatus==Constants.RECORD_STATE_REJECT){
- // editView.btnSave.enabled=false;
- // }
- editView.model.zdAndCzgcList=bc.getAttribute("zdList") as ArrayCollection;
- editView.model.ryList=bc.getAttribute("ryList") as ArrayCollection;
- editView.model.yaList=bc.getAttribute("yaList") as ArrayCollection;
- editView.model.ssList=bc.getAttribute("wzList") as ArrayCollection;
- editView.model.fzs = bc.getAttribute("fzList") as ArrayCollection;
- // editView.hwpm.text = editView.model.concatWhpm()["hwpmStr"];
- Utils.popupWindow(resourceManager.getString('common','btn.edit'), editView as DisplayObject, thisView as DisplayObject, thisView.pager.doQuery, 780, 500);
- },vo)
- }
-
- /**
- * 复制
- */
- public function doCopy(event:MouseEvent) :void
- {
- //检查选中项
- if(thisView.dataGrid.selectedIndex==-1){
- Utils.showInfoMessage("msg.select.one");
- return;
- }
- // 获取选中项
- var vo:GkwxhwzyfzblhhzVo = thisView.dataGrid.selectedItem as GkwxhwzyfzblhhzVo;
- if(vo.recordStatus!=Constants.RECORD_STATE_COMPLETED){
- Alert.show("只能复制已完成的附证",resourceManager.getString("common","tip"));
- return;
- }
- editView = new GkwxhwzyfzblhhzEdit();
- editView.mode=Constants.mode_edit;
- editView.flag =true;
- editView.layoutModel=this;
- editView.functionId = Utils.getFunctionId(thisView);
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- editView.vo = bc.result as GkwxhwzyfzblhhzVo;
- editView.model.zdAndCzgcList=bc.getAttribute("zdList") as ArrayCollection;
- editView.model.ryList=bc.getAttribute("ryList") as ArrayCollection;
- editView.model.yaList=bc.getAttribute("yaList") as ArrayCollection;
- editView.model.fileList = bc.getAttribute("fileList") as ArrayCollection;
- editView.model.ssList=bc.getAttribute("wzList") as ArrayCollection;
- editView.model.fzs = bc.getAttribute("fzList") as ArrayCollection;
- Utils.popupWindow(resourceManager.getString('common','btn.edit'), editView as DisplayObject, thisView as DisplayObject, thisView.pager.doQuery, 780, 500);
- },editView.functionId,vo.id);
- }
- /**
- * 删除
- */
- public function doDel(event:MouseEvent):void
- {
- if(thisView.dataGrid.selectedItems == null){
- Utils.showInfoMessage("msg.select");//请选择记录!
- return;
- }
- var items:Vector.<Object> = thisView.dataGrid.selectedItems;
- var records:ArrayCollection = new ArrayCollection();
- if(items != null)
- {
- for(var i : int=0;i< items.length;i++){
- var obj:GkwxhwzyfzblhhzVo = GkwxhwzyfzblhhzVo(items[i]);
- if(obj.recordStatus!=Constants.RECORD_STATE_VALID && obj.recordStatus!=Constants.RECORD_STATE_REJECT){
- //该记录处于流程中,不能删除
- Alert.show(resourceManager.getString("common","msg.no.del"),resourceManager.getString("common","tip"));
- return;
- }
- records.addItem(obj);
- }
- }
- Utils.doDelConfirm(function():void
- {
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","logicDelete",resultCallback,records);
- });
- }
- /**
- * 根据流程节点查询
- */
- private var selectedNodeName:String;
- public function nodeClick(nodeName:String):void{
- queryByFlowDisplay=true;
- selectedNodeName = nodeName;
- this.thisView.pager.doQuery();
- }
- /**
- * 查询
- */
- public function doQuery(event:MouseEvent):void
- {
- queryByFlowDisplay=false;
- this.thisView.pager.doQuery();
- }
- /**
- * 分页
- */
- private var queryByFlowDisplay:Boolean = false;
- public function pageQuery(pager:SinglePageRequestVo):void
- {
- var szd:CodeVo;
- var queryAction:String;
- if(Global.user.jyr){
- queryAction="listByQy";
- }else{
- queryAction="list";
- }
- var gq:GqVo;
- if(null != thisView.query_szd.selectedVO&&"NaN"!=(thisView.query_szd.selectedVO as CodeVo).id.toString()){
- szd = thisView.query_szd.selectedVO as CodeVo;
- }
- if(null != thisView.query_gq.selectedVO ){
- gq = thisView.query_gq.selectedVO as GqVo;
- }
- var jyr:String = thisView.jyr.text;
- var fddbr:String=thisView.fddbr.text;
- var whdj:CodeVo=thisView.query_whdj.selectedVO as CodeVo;
- var lcStatus:String = "";
- if(queryByFlowDisplay){
- if(Global.deployMode==Constants.DEPLOY_MODE_0){//省级 只能点击省级部分的节点
- if(selectedNodeName!= "查询与统计"){
- return;
- }else{
- lcStatus = selectedNodeName;
- }
- }else{//市级只能点击所在地和经营人的节点
- if(selectedNodeName == "whzyfzsq_cxtj"||selectedNodeName=="查询"){
- }else if(selectedNodeName== "查询与统计"){
- return;
- }else{
- lcStatus = selectedNodeName;
- }
- }
- }
-
- //任务状态筛选条件:
- var _status:String = '';
- if(thisView.query_lcStatus!=null && thisView.query_lcStatus.selectedItem!=null){
- var _xml:XML = thisView.query_lcStatus.selectedItem as XML;
- _status = _xml.@id;
- }
- if(_status=='' && _status.length==0){
- //任务状态下拉为空状态是默认状态,查看非未提交、非待填报状态的记录
- lcStatus = 'default';
- }
- else{
- if(_status=='wf.qb'){
- //全部
- lcStatus = '';
- }
- else{
- lcStatus = _status;
- }
- }
-
-
-
- Utils.callRemote("gkwxhwzyfzblhhzcontroller", queryAction,
- resultCallback,Utils.getFunctionId(thisView), pager, jyr,szd,gq,whdj,lcStatus,fddbr);
-
- if(queryAction == "list"){
- Utils.callRemote("gkwxhwzyfzblhhzcontroller", "countValidFz_Jyr", function (r:ResultEvent):void{
- var bc:BusinessContext = r.result as BusinessContext;
- var validFzRecords:String = bc.getAttribute("validFz") as String;
- var validFzJyrMtRecords:String = bc.getAttribute("validFzJyrMt") as String;
- var validFzJyrMtJzxRecords:String = bc.getAttribute("validFzJyrMtJzx") as String;
- var validFzJyrCcRecords:String = bc.getAttribute("validFzJyrCc") as String;
- text = "附证在有效期之内的危货港口经营人共有<font color='#ff0000'>" + validFzRecords + "</font>" + "个,码头企业<font color='#ff0000'>"
- + validFzJyrMtRecords + "</font>" + "个,其中危险货物集装箱码头经营人<font color='#ff0000'>"+ validFzJyrMtJzxRecords +"</font>个,仓储企业<font color='#ff0000'>"
- + validFzJyrCcRecords + "</font>个";
-
- },szd,gq,whdj);
- }
- }
- /**
- * 排序方法
- */
- public function doSort(e:GridSortEvent):void
- {
- var sortColumn:GridColumn = thisView.dataGrid.columns.getItemAt(e.columnIndices[0]) as GridColumn;
- var sortField:String = sortColumn.dataField;
- var pageVo:SinglePageRequestVo = thisView.pager.pageVo;
- if(pageVo.sortField == sortField)
- {
- if(sortColumn.sortDescending)
- {
- pageVo.direction = Constants.SORT_DIRECTION_ASC;
- sortColumn.sortDescending = false;
- }
- else
- {
- pageVo.direction = Constants.SORT_DIRECTION_DESC;
- sortColumn.sortDescending = true;
- }
- }
- else
- {
- pageVo.sortField = sortField;
- pageVo.direction = Constants.SORT_DIRECTION_ASC;
- sortColumn.sortDescending = false;
- }
- doQuery(null);
- }
- /**
- * 回调函数,通过r.token.message["operation"]区分调用的方法名
- */
- private function resultCallback(r:ResultEvent):void
- {
- var doAction:String = r.token.message["operation"];
- var bc:BusinessContext=r.result as BusinessContext;
- //check error msgs
- if(Utils.checkMsgError(bc.msgs))
- {
- Alert.show(Utils.getFirstErrorMsg(bc.msgs).localeLabel,resourceManager.getString("common","errorTitle"));
- return;
- }
- if(doAction == "list"||doAction=="listByQy")
- {
- var pageVo:SinglePageRequestVo = thisView.pager.pageVo;
- pageVo.totalCount = bc.getAttribute("totalCount") as int;
- thisDataList=bc.getAttribute("records") as ArrayCollection;
- return;
- }
- else if(doAction == "logicDelete")
- {
- if(Utils.getTopMsg(bc.msgs)!=null)
- {
- Alert.show(Utils.getTopMsg(bc.msgs).localeLabel);
- }
- doQuery(null);
- return;
- }
- }
- /**
- * 刷新联动combobox
- */
- private function reloadGq(e:Event):void
- {
- thisView.query_gq.reload(thisView.query_szd.selectedVO);
- }
- /**
- * 显示流程
- */
- private function showFlow(event:MouseEvent):void{
- // 获取选中项
- var vo:GkwxhwzyfzblhhzVo = thisView.dataGrid.selectedItem as GkwxhwzyfzblhhzVo;
- if(vo==null)
- return;
- /* Set PassNodesCode*/
- var nodesCode:Array=new Array();
- for(var i:int=0; i<vo.taskList.length; i++){
- var task:TaskInfoVo = vo.taskList.getItemAt(i) as TaskInfoVo;
- nodesCode.push(task.currName);//trace(task.currName);
- }
- if(vo.recordStatus == 2){// 流程完成
- // nodesCode.push("whzyfzsq_rk");
- nodesCode.push("whzyfzsq_cxtj");
- }
- thisView.flowDisplay.passNodesCode=nodesCode;// 更新流程显示
- }
- /**
- * 开关查询框
- */
- private function switchSearchBox(event:MouseEvent):void{
- if(thisView.searchGroup.visible){
- thisView.searchGroup.visible=false;
- thisView.searchGroup.includeInLayout=false;
- }else{
- thisView.searchGroup.visible=true;
- thisView.searchGroup.includeInLayout=true;
- }
- }
- public function doClose(view:UIComponent):void{
- view.dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
- }
-
- public function link(vo:GkwxhwzyfzblhhzVo):void{
- if(vo.recordStatus==Constants.RECORD_STATE_COMPLETED){
- editView = new FzEdit();
- editView.vo=vo;
- editView.model = this;
- Utils.callRemote("gkwxhwzyfzblhhzcontroller", "queryfzs", function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- fzs = bc.result as ArrayCollection;
-
- //去掉加载附件代码,附证发放信息页附件相关已去除,一个作业地点需要一个附证,放到与每个作业地点相关的页面中去了 edit by xh-2016-11-10
- //editView.addEventListener(FlexEvent.CREATION_COMPLETE,loadfj);
-
- editView.enableflg=canLink;
- Utils.popupWindow("附证发放信息", editView as DisplayObject, thisView as DisplayObject,null,880,700);
- // if(vo.bh==null||vo.bh==""){//信息未添加
- // if(canLink==true){
- // editView.enableflg=true;
- // Utils.popupWindow("附证发放信息", editView as DisplayObject, thisView as DisplayObject,null,780,600);
- // }else{
- //
- // }
- // }else{//已添加
- // if(canLink==true){
- // editView.enableflg=true;
- // Utils.popupWindow("附证发放信息", editView as DisplayObject, thisView as DisplayObject,null,780,600);
- // }else{
- // Utils.popupWindow("附证发放信息", editView as DisplayObject, thisView as DisplayObject,null,780,600);
- // }
- // }
- },vo);
- }
- }
-
- private function loadfj(e:Event):void{
- Utils.callRemote("gkwxhwzyfzblhhzcontroller","findFj",function (r:ResultEvent):void{
- var bc:BusinessContext = r.result as BusinessContext;
- var yhrecords:ArrayCollection = bc.getAttribute("records") as ArrayCollection;
- for(var i:Number=0;i<yhrecords.length;i++){
- var image:ByteArray=yhrecords[i] as ByteArray;
- if(null!=image){
- // var loader:Loader=new Loader;
- // loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleterHandler);
- // loader.loadBytes(image);
- loadBytesImage(image);
- }
- }
-
- },editView.vo.id,Constants.FJSSLX_T_YJPT_FZSQ);
- }
-
- public function loadBytesImage(img:ByteArray):void{
- var image:mx.controls.Image=new mx.controls.Image;
- image.width=300;
- image.height=200;
- image.source=img;
- image.useHandCursor=true;
- image.addEventListener(MouseEvent.CLICK,Utils.showImageHandler);
- editView.fztps.addElement(image);
- }
-
- public function loadCompleterHandler(e:Event):void{
- var img:BitmapData;
- var loadInfo:LoaderInfo =e.target as LoaderInfo;
- if(loadInfo.content is Bitmap){
- img=(loadInfo.content as Bitmap).bitmapData;
- }
- var image:mx.controls.Image=new mx.controls.Image();
- image.width=300;
- image.height=200;
- image.source=img;
- image.useHandCursor=true;
- editView.fztps.addElement(image);
- }
- /**
- * 附证新增行操作
- */
- public function doFzAdd(vo:GkwxhwzyfzblhhzVo,view:FzEdit):void
- {
- editView = new FzChoose();
- editView.enableflg = true;
- editView.vo= vo;
- editView.view=view;
- editView.model=this;
- Utils.popupWindow("附证发放信息", editView as DisplayObject, thisView as DisplayObject,null,880,550);
- }
- /**
- * 附证新增行操作
- */
- public function doChoose(vo:Gkwxhwzyfzbl_fzVo):void
- {
- if(fzs==null||fzs.length<=0){
- fzs= new ArrayCollection();
- }
- fzs.addItem(vo);
- }
- /**
- * 附证修改操作
- */
- public function doChooseEdit(vo:Gkwxhwzyfzbl_fzVo):void
- {
- if(fzs==null||fzs.length<=0){
- fzs= new ArrayCollection();
- }
- if(vo.id>0)
- {
- for(var i:int;i<fzs.length;i++)
- {
- var fz:Gkwxhwzyfzbl_fzVo = fzs[i];
- if(fz.id==vo.id)
- {
- fzs.removeItemAt(i);
- fzs.addItemAt(vo,i);
- break;
- }
- }
- }
- }
-
- /**
- * 附证编辑操作
- */
- public function doFzEdit(vo:Gkwxhwzyfzbl_fzVo,view:FzEdit):void
- {
- editView = new FzChoose();
- editView.enableflg = true;
- editView.fzvo= vo;
- editView.vo= view.vo;
- editView.mode = Constants.mode_edit;
- editView.view=view;
- editView.model=this;
- Utils.popupWindow("附证发放信息", editView as DisplayObject, thisView as DisplayObject,null,880,550);
- }
-
- /**
- * 附证删除行操作
- */
- public function doFzDelete(vo:Gkwxhwzyfzbl_fzVo):void
- {
- fzs.removeItemAt(editView.view.fzDataGrid.selectedIndex);
- }
- public function doWfHistory(event:MouseEvent):void
- {
- //检查选中项
- if(thisView.dataGrid.selectedIndex==-1){
- Utils.showInfoMessage("msg.select.one");
- return;
- }
- // 获取选中项
- var vo:GkwxhwzyfzblhhzVo = thisView.dataGrid.selectedItem as GkwxhwzyfzblhhzVo;
- Utils.showWfHistory("whzyfzsq-city",vo.id.toString(),FlexGlobals.topLevelApplication as DisplayObject);
- }
- //显示附证信息页面
- public function doFzxxView(event:MouseEvent):void
- {
- thisView.fzlayout.visible=false;
- SystemModel.getInstance().getMainLayout().workView.workContent.pageName.text="附证信息";
- thisView.fzxxlayout.model.doQuery(null);
- }
-
- public function fzgqFun(item:Object):uint
- {
- var tempDate:Date = new Date();
- tempDate["date"]-=1;
- if((item as GkwxhwzyfzblhhzVo).yxqjssj !=null &&
- ObjectUtil.dateCompare((item as GkwxhwzyfzblhhzVo).yxqjssj ,tempDate )<0){
- return 0x999999
- }
- return 0xffffff;
- }
- }
- }
|