123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113 |
- package com.jtgh.yjpt.model.zysqbp
- {
- import com.jtgh.yjpt.common.BusinessContext;
- import com.jtgh.yjpt.common.Global;
- import com.jtgh.yjpt.common.IModule;
- import com.jtgh.yjpt.common.MyEvent;
- import com.jtgh.yjpt.common.component.ui.DataGridColumn;
- import com.jtgh.yjpt.common.component.ui.Pager;
- import com.jtgh.yjpt.common.component.ui.TitleWindow;
- import com.jtgh.yjpt.common.component.ui.ZysqbpPager;
- 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.YesNoSelect;
- import com.jtgh.yjpt.view.access.UserEdit;
- import com.jtgh.yjpt.view.task.TaskLayout;
- import com.jtgh.yjpt.view.zysqbp.BgEdit;
- import com.jtgh.yjpt.view.zysqbp.FrxzxkLayout;
- import com.jtgh.yjpt.view.zysqbp.HsdbInfo;
- import com.jtgh.yjpt.view.zysqbp.HwpmTree;
- import com.jtgh.yjpt.view.zysqbp.MessageLayout;
- import com.jtgh.yjpt.view.zysqbp.QxEdit;
- import com.jtgh.yjpt.view.zysqbp.ZdspszView;
- import com.jtgh.yjpt.view.zysqbp.ZysqKgEdit;
- import com.jtgh.yjpt.view.zysqbp.ZysqWgEdit;
- import com.jtgh.yjpt.view.zysqbp.ZysqbpAudit;
- import com.jtgh.yjpt.view.zysqbp.ZysqbpCount;
- import com.jtgh.yjpt.view.zysqbp.ZysqbpEdit;
- import com.jtgh.yjpt.view.zysqbp.ZysqbpLayout;
- import com.jtgh.yjpt.view.zysqbp.ZysqbpView;
- import com.jtgh.yjpt.view.zysqbp.ZysqqxAudit;
- import com.jtgh.yjpt.view.zysqbp.count.WhzysbContainerCount;
- import com.jtgh.yjpt.view.zysqbp.count.WhzysbCount;
- import com.jtgh.yjpt.view.zysqbp.count.WhzysbCountBw;
- import com.jtgh.yjpt.view.zysqbp.count.WhzysbHuizongInformate;
- import com.jtgh.yjpt.view.zysqbp.count.WhzysbTabMain;
- import com.jtgh.yjpt.vo.access.UserVo;
- import com.jtgh.yjpt.vo.common.AccessoryVo;
- import com.jtgh.yjpt.vo.common.CodeVo;
- import com.jtgh.yjpt.vo.common.PagerVo;
- 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.jyrxxgl.JyrxxglVo;
- import com.jtgh.yjpt.vo.zysqbp.ZysqbpBgVo;
- import com.jtgh.yjpt.vo.zysqbp.ZysqbpVo;
- import com.smapp.sg186.appframework.datamodel.ext.ReturnCode;
-
- import flash.display.DisplayObject;
- 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.net.navigateToURL;
-
- import mx.binding.utils.BindingUtils;
- import mx.collections.ArrayCollection;
- import mx.collections.ArrayList;
- import mx.controls.Alert;
- import mx.core.FlexGlobals;
- import mx.events.CloseEvent;
- import mx.events.FlexEvent;
- import mx.formatters.DateFormatter;
- import mx.managers.CursorManager;
- import mx.managers.PopUpManager;
- import mx.rpc.events.ResultEvent;
- import mx.utils.ObjectUtil;
- import mx.utils.StringUtil;
-
- import spark.components.gridClasses.GridColumn;
- import spark.events.GridSortEvent;
- [Bindable]
- public class ShbpModel extends BaseModel
- {
- public var thisView:Object;
- public var thisDataList:ArrayCollection;
- public var sfsbList:ArrayCollection;
- public var pager:ZysqbpPager;
- public var editView:Object;
- public var model:Object;
- public var text:String;
- public function ShbpModel()
- {
- super(IModule.MODEL_004001);
- }
-
- public static var instance:ShbpModel=new ShbpModel();
- /**********************
- * 此方法只能调用一次
- */
- public function doCreationComplete(view:Object):void
- {
- thisView = view;
- var pageVo:SinglePageRequestVo = pager.pageVo;
- pageVo.direction = "desc";
- pageVo.sortField = "bgsj";
- BindingUtils.bindProperty(thisView.dataGrid,"dataProvider",this,"thisDataList");
- thisView.dataGrid.addEventListener(MouseEvent.DOUBLE_CLICK,toView);
- thisView.add.addEventListener(MouseEvent.CLICK,toAdd);
- thisView.edit.addEventListener(MouseEvent.CLICK, toEdit);
- thisView.del.addEventListener(MouseEvent.CLICK, doDel);
- // if(view is ZysqbpLayout)
- thisView.query.addEventListener(MouseEvent.CLICK,switchSearchBox);
- thisView.print.addEventListener(MouseEvent.CLICK,doPrint);
-
-
- // thisView.wfHistory.addEventListener(MouseEvent.CLICK,doWfHistory);
- thisView.qxzy.addEventListener(MouseEvent.CLICK,doQxzy);
- thisView.bgzy.addEventListener(MouseEvent.CLICK,doBgzy);
- // thisView.displayhs.addEventListener(MouseEvent.CLICK,doDisplayHS);
- thisView.copy.addEventListener(MouseEvent.CLICK,doCopy);
- doQuery(null);
- if(!Global.user.jyr ){//非经营人特有的按钮
- thisView.wfHistory.addEventListener(MouseEvent.CLICK,doWfHistory);
- thisView.dataGrid.addEventListener(MouseEvent.CLICK,showFlow);
- }else{
-
- }
- }
-
- /**
- * 开关查询框
- */
- 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;
- }
- }
-
- /**
- * 单击记录显示流程
- */
- private function showFlow(event:MouseEvent):void{
- // 获取选中项
- var vo:ZysqbpVo = thisView.dataGrid.selectedItem as ZysqbpVo;
- 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("zdsgyhpc_rk");
- nodesCode.push("zdsgyhpc_cxtj");
- }
- thisView.flowDisplay.passNodesCode=nodesCode;// 更新流程显示
- }
-
- /**
- * 下载
- */
- public function downloadFile(vo:ZysqbpVo):void
- {
- var acc:AccessoryVo = vo.accessory;
- 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");
- }
-
- public function doWfHistory(event:MouseEvent):void
- {
- //检查选中项
- if(thisView.dataGrid.selectedIndex==-1){
- Utils.showInfoMessage("msg.select.one");
- return;
- }
- // 获取选中项
- var zysqbp:ZysqbpVo = thisView.dataGrid.selectedItem as ZysqbpVo;
- Utils.showWfHistory("zysbsp-city",zysqbp.id.toString(),FlexGlobals.topLevelApplication as DisplayObject);
- }
- /**
- * 新增页面跳转
- */
- public function toAdd(event:MouseEvent):void
- {
- if(Global.user.sfjyr=="Y"&&Global.user.sfyxzysq=="N"){
- Alert.show("该权限已被锁定","提示");
- return ;
- }
- editView = new ZysqbpEdit();
- editView.zysqbp = new ZysqbpVo();
- editView.functionId= Utils.getFunctionId(thisView);
- editView.model=this;
- Utils.popupWindow("危货作业申报申请",editView as DisplayObject,FlexGlobals.topLevelApplication as DisplayObject,thisView.pager.doQuery,780, 600);
- }
-
- /**
- * 窗口关闭
- */
- public function doCloseThis():void{
- editView.dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
- doQuery(null);
- }
-
- /**
- * 双击显示查看用户
- */
- public function toView(event:MouseEvent):void
- {
- //检查选中项
- if(thisView.dataGrid.selectedIndex==-1){
- Utils.showInfoMessage("msg.select.one");
- return;
- }
- // 获取选中项
- var zysqbp:ZysqbpVo = thisView.dataGrid.selectedItem as ZysqbpVo;
- editView = new ZysqbpView();
- editView.model = this;
- editView.zysqbp = zysqbp;
- if(zysqbp.recordStatus!=Constants.RECORD_STATE_COMPLETED&&zysqbp.recordStatus!=Constants.RECORD_STATE_CALEL){//审核已经完成的数据才能显示签章
- editView.qianzhang=false;
- }
- editView.enable = false;
- if(null != zysqbp.zydd){
- editView.zydd = zysqbp.zydd.id;
- }
- Utils.popupWindow(resourceManager.getString('common','btn.view'), editView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject, thisView.pager.doQuery, 0, 0);
- Utils.callRemote("zysqbpController","compare",function (r:ResultEvent):void{},zysqbp);
- }
-
- /**
- * 编辑
- */
- public function toEdit(event:MouseEvent):void
- {
- //检查选中项
- if(thisView.dataGrid.selectedIndex==-1){
- Utils.showInfoMessage("msg.select.one");
- return;
- }
- //只有在未提交状态下能删除,在未提交和退回重提状态下能编辑,前者能保存,能提交,后者不能保存,只能提交
- if(!editOrDelEnable(thisView.dataGrid.selectedItem as ZysqbpVo))//如果数据处于提交或者完成状态,不能编辑页不能删除
- return;
- // 获取选中项
- var zysqbp:ZysqbpVo = thisView.dataGrid.selectedItem as ZysqbpVo;
- editView = new ZysqbpEdit();
- //if(zysqbp.recordStatus==Constants.RECORD_STATE_REJECT){//如果是退回重提的,只能提交
- // editView.addSave.enabled=false;
- //}
- if(zysqbp.recordStatus==Constants.RECORD_STATE_SUBMIT){//如果是审核中,只能编辑
- editView.submitBtn.enabled=false;
- }
- editView.zysqbp = zysqbp;
- editView.model=this;
- editView.mode = Constants.mode_edit;
- editView.thisModel.thisView=editView;
- if(null != zysqbp.zydd){
- editView.zydd = zysqbp.zydd.id;
- }
- Utils.popupWindow(resourceManager.getString('common','btn.edit'), editView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject, thisView.pager.doQuery, 780, 600);
-
- }
- /**
- * 是否有附件
- */
- public function showFile(vo:ZysqbpVo):Boolean
- {
- if(vo!=null&&vo.accessory!=null)
- {
- return true;
- }
- return false;
- }
-
- /**
- * 附件名称
- */
- public function showFileName(vo:ZysqbpVo):String
- {
- if(vo!=null&&vo.accessory!=null)
- {
- return vo.accessory.name;
- }
- return "";
- }
- /**
- * 返回选中的记录
- */
- private function getSelectedRecords():ArrayCollection
- {
- 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:ZysqbpVo = ZysqbpVo(items[i]);
- records.addItem(obj);
- }
- }
- return records;
- }
-
- /**
- * 删除用户
- */
- public function doDel(event:MouseEvent):void
- {
- //检查选中项
- var records:ArrayCollection = getSelectedRecords();
- if(records.length == 0){
- Utils.showInfoMessage("msg.select");
- return;
- }
- Utils.doDelConfirm(function():void
- {
- if((thisView.dataGrid.selectedItem as ZysqbpVo).recordStatus!=Constants.RECORD_STATE_VALID){
- Alert.show(instance.resourceManager.getString("common","state.ytj"),resourceManager.getString("common","tip"));
- return ;
- }
- /* 删除操作 */
- Utils.callRemote("zysqbpController", "doDelete", function(res:ResultEvent):void{
- var bc:BusinessContext=res.result as BusinessContext;
- Alert.show(Utils.getTopMsg(bc.msgs).localeLabel,resourceManager.getString('common','tip'));
- doQuery(null);
- }, records);
- });
- }
- /**
- * 回调函数,通过r.token.message["operation"]区分调用的方法名
- */
- public function resultCallback(r:ResultEvent):void
- {
- var doAction:String = r.token.message["operation"];
- var bc:BusinessContext=r.result as BusinessContext;
- if(null == bc){
- return;
- }
- //check error msgs
- if(Utils.checkMsgError(bc.msgs))
- {
- Alert.show(Utils.getFirstErrorMsg(bc.msgs).localeLabel,resourceManager.getString("common","errorTitle"));
- return;
- }
- if(doAction == "list")
- {
- sfsbList = bc.getAttribute("sfsbList") as ArrayCollection;
- thisDataList = bc.getAttribute("records") as ArrayCollection;
- thisView.pager.pageVo.totalCount = bc.getAttribute("totalCount") as int;
- queryBty();
- return;
- }
- else if(doAction == "listNoFlow"){
- sfsbList = bc.getAttribute("sfsbList") as ArrayCollection;
- thisDataList = bc.getAttribute("records") as ArrayCollection;
- thisView.pager.pageVo.totalCount = bc.getAttribute("totalCount") as int;
- return;
- }
- else if(doAction == "deleteUser")
- {
- doQuery(null);
- return;
- } else if(doAction == "countStatus"){
- var btgs:int = bc.getAttribute("btgs") as int;
- var ths:int = bc.getAttribute("ths") as int;
- text="不通过"+"<font color='#ff0000'>" + btgs + "</font>" + "条,退回"+
- "<font color='#ff0000'>" + ths + "</font>" + "条";
- thisView.pager.extraText=text;
- return;
- }
- }
-
- /**
- * 查询
- */
- public function doQuery(e:Event):void{
- queryByFlowDisplay=false;
- if(thisView.pager!=null){
- thisView.pager.doQuery();
- }
- }
-
- /**
- * 显示海事申报货物信息
- */
- public function doDisplayHS(e:Event):void{
- thisView.zysblayout.visible=false;
- thisView.hssblayout.model.doQuery(null);
- }
-
- /**
- * 分页
- */
- private var queryByFlowDisplay:Boolean = false;
-
- public function pageQuery(pager:SinglePageRequestVo):void
- {
- var queryOperation:String;
- //查询一览
- var vo:ZysqbpVo = new ZysqbpVo();
- if(null !=thisView.query_gk.selectedVO&&"NaN"!=(thisView.query_gk.selectedVO as CodeVo).id.toString()){
- vo.szd = thisView.query_gk.selectedVO as CodeVo;
- }
- if(null != thisView.query_gq.selectedVO){
- vo.szgq = thisView.query_gq.selectedVO as GqVo;
- }
- if(null!=thisView.query_gkdw2.selectedVO){
- vo.zydw = thisView.query_gkdw2.selectedVO as JyrVo;
- }
- vo.bh = thisView.query_bh.text;
- vo.mao = thisView.mao.textValue as String;
- vo.cm = thisView.query_hmhc.text;
- vo.wxwpmc = thisView.query_hwpmbh.text;
- vo.wxhwmcbh = thisView.query_hwpm.text;
- vo.recordStatus=9;
- if(undefined != thisView.query_rwzt.selectedItem && ""!=thisView.query_rwzt.selectedItem.id){
- vo.recordStatus =new Number(thisView.query_rwzt.selectedItem.id);
- }
- // vo.jcg=thisView.jcg.text;
- //根据流程状态查询
- var lcStatus:String = "";
- if(queryByFlowDisplay){
- if(Global.deployMode=="0"){//省级 只能点击省级部分的节点
- if(selectedNodeName!= "查询与统计"&&selectedNodeName!="入库"){
- return;
- }else{
- lcStatus = selectedNodeName;
- }
- }else{//市级只能点击所在地和经营人的节点
- if(selectedNodeName == "zdsgyhpc_cxtj"||selectedNodeName=="查询"){
-
- }else if(selectedNodeName== "查询与统计"||selectedNodeName=="入库"){
- return;
- }else{
- lcStatus = selectedNodeName;
- }
- }
- }
- Utils.callRemote("zysqbpController","list",resultCallback,pager,
- Utils.getFunctionId(thisView),vo,lcStatus,
- thisView.query_bgsj_1.dateTime,thisView.query_bgsj_2.dateTime,
- thisView.query_kgsj_1.dateTime,thisView.query_kgsj_2.dateTime,
- thisView.query_wgsj_1.dateTime,thisView.query_wgsj_2.dateTime,
- thisView.query_shr.text,thisView.query_gkdw.text
- );
- }
-
- /**
- * 查询不同意数和退回数
- */
- public function queryBty():void
- {
- var queryOperation:String;
- //查询一览
- var vo:ZysqbpVo = new ZysqbpVo();
- if(null !=thisView.query_gk.selectedVO&&"NaN"!=(thisView.query_gk.selectedVO as CodeVo).id.toString()){
- vo.szd = thisView.query_gk.selectedVO as CodeVo;
- }
- if(null != thisView.query_gq.selectedVO){
- vo.szgq = thisView.query_gq.selectedVO as GqVo;
- }
- if(null!=thisView.query_gkdw2.selectedVO){
- vo.zydw = thisView.query_gkdw2.selectedVO as JyrVo;
- }
- vo.bh = thisView.query_bh.text;
- vo.mao = thisView.mao.textValue as String;
- vo.cm = thisView.query_hmhc.text;
- vo.wxwpmc = thisView.query_hwpmbh.text;
- vo.wxhwmcbh = thisView.query_hwpm.text;
- vo.recordStatus=9;
- if(undefined != thisView.query_rwzt.selectedItem && ""!=thisView.query_rwzt.selectedItem.id){
- vo.recordStatus =new Number(thisView.query_rwzt.selectedItem.id);
- }
- // vo.jcg=thisView.jcg.text;
- //根据流程状态查询
- var lcStatus:String = "";
- if(queryByFlowDisplay){
- if(Global.deployMode=="0"){//省级 只能点击省级部分的节点
- if(selectedNodeName!= "查询与统计"&&selectedNodeName!="入库"){
- return;
- }else{
- lcStatus = selectedNodeName;
- }
- }else{//市级只能点击所在地和经营人的节点
- if(selectedNodeName == "zdsgyhpc_cxtj"||selectedNodeName=="查询"){
-
- }else if(selectedNodeName== "查询与统计"||selectedNodeName=="入库"){
- return;
- }else{
- lcStatus = selectedNodeName;
- }
- }
- }
- Utils.callRemote("zysqbpController","countStatus",resultCallback,
- Utils.getFunctionId(thisView),vo,lcStatus,
- thisView.query_bgsj_1.dateTime,thisView.query_bgsj_2.dateTime,
- thisView.query_kgsj_1.dateTime,thisView.query_kgsj_2.dateTime,
- thisView.query_wgsj_1.dateTime,thisView.query_wgsj_2.dateTime,
- thisView.query_shr.text,thisView.query_gkdw.text
- );
- }
-
- /**
- * 打印
- */
- public function doPrint(e:Event):void{
- var vo:ZysqbpVo;
- vo=new ZysqbpVo;
- if(null !=thisView.query_gk.selectedVO&&"NaN"!=(thisView.query_gk.selectedVO as CodeVo).id.toString()){
- vo.szd = thisView.query_gk.selectedVO as CodeVo;
- }
- if(null != thisView.query_gq.selectedVO){
- vo.szgq = thisView.query_gq.selectedVO as GqVo;
- }
- if(null!=thisView.query_gkdw2.selectedVO){
- vo.zydw = thisView.query_gkdw2.selectedVO as JyrVo;
- }
- var status:String ="";
- if(undefined != thisView.query_rwzt.selectedItem){
- status=thisView.query_rwzt.selectedItem.id;
- }
- vo.bh = thisView.query_bh.text;
- vo.mao = thisView.mao.textValue as String;
- vo.cm = thisView.query_hmhc.text;
- vo.wxwpmc = thisView.query_hwpm.text;
- vo.wxhwmcbh = thisView.query_hwpmbh.text;
- //根据流程状态查询
- var lcStatus:String = "";
- if(queryByFlowDisplay){
- if(Global.deployMode=="0"){//省级 只能点击省级部分的节点
- if(selectedNodeName!= "查询与统计"&&selectedNodeName!="入库"){
- }else{
- lcStatus = selectedNodeName;
- }
- }else{//市级只能点击所在地和经营人的节点
- if(selectedNodeName == "zdsgyhpc_cxtj"||selectedNodeName=="查询"){
-
- }else if(selectedNodeName== "查询与统计"||selectedNodeName=="入库"){
- }else{
- lcStatus = selectedNodeName;
- }
- }
- }
-
- 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&&"附件下载"!=column.headerText&&resourceManager.getString('common','btn.cz')!=column.headerText)
- headers.push(column.headerText);
- }
- var fomaterDate:DateFormatter=new DateFormatter();
- fomaterDate.formatString="YYYY-MM-DD";
- var param:Vector.<String>=new Vector.<String>();
- param.push(
- vo.cm,
- vo.wxhwmcbh,
- thisView.query_gkdw.text,
- null==vo.szd?"":vo.szd.id+"",
- null==vo.szgq?"":vo.szgq.id+"",
- lcStatus,
- Utils.getFunctionId(thisView)+"",
- vo.mao,
- null==thisView.query_bgsj_1.dateTime?"":fomaterDate.format(thisView.query_bgsj_1.dateTime),
- null==thisView.query_bgsj_2.dateTime?"":fomaterDate.format(thisView.query_bgsj_2.dateTime),
- null==thisView.query_kgsj_1.dateTime?"":fomaterDate.format(thisView.query_kgsj_1.dateTime),
- null==thisView.query_kgsj_2.dateTime?"":fomaterDate.format(thisView.query_kgsj_2.dateTime),
- null==thisView.query_wgsj_1.dateTime?"":fomaterDate.format(thisView.query_wgsj_1.dateTime),
- null==thisView.query_wgsj_2.dateTime?"":fomaterDate.format(thisView.query_wgsj_2.dateTime),
- vo.bh,
- status,
- thisView.query_shr.text,
- null==vo.zydw?"":vo.zydw.id+"",
- vo.wxwpmc
- );
- var params:URLVariables = new URLVariables();
- params.title=title;
- params.headers=headers;
- params.controller="zysqbpController";
- 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();
- }
-
- /**
- * 根据流程节点查询
- */
- private var selectedNodeName:String;
- public function nodeClick(nodeName:String):void{
- queryByFlowDisplay=true;
- selectedNodeName = nodeName;
- this.thisView.pager.doQuery();
- }
- //显示开工情况的名称
- public function showKgqkName(vo:ZysqbpVo):String{
- if(vo.recordStatus!=Constants.RECORD_STATE_COMPLETED&&vo.recordStatus!=Constants.RECORD_STATE_BGCOMPLETED)
- return "";
- else{
- if(vo.kgzt=='N')
- return "未开工";
- else if(vo.kgzt=='Y')
- return "已开工";
- }
- return "";
- }
- //显示完工情况的名称
- public function showWgqkName(vo:ZysqbpVo):String{
- if(vo.recordStatus!=Constants.RECORD_STATE_COMPLETED&&vo.recordStatus!=Constants.RECORD_STATE_BGCOMPLETED)
- return "";
- else{
- if(vo.wgzt=='N')
- return "未完工";
- else if(vo.wgzt=='Y')
- return "已完工";
- }
- return "";
- }
- //开工按钮是否可点
- public function KgEnble(vo:ZysqbpVo):Boolean
- {
- // if(Global.user.id!=vo.addUser.id)
- // return false;
- //数据为完成或者变更完成状态并且 当前不是经营人,可以查看修改保存
- if((vo.recordStatus==Constants.RECORD_STATE_COMPLETED||vo.recordStatus==Constants.RECORD_STATE_BGCOMPLETED)&&(Global.user.sfjyr==YesNoSelect.NO)){
- return true;
- }
- //数据为完成或者变更完成状态并且 当前不是经营人,可以查看修改保存
- if((vo.recordStatus==Constants.RECORD_STATE_COMPLETED||vo.recordStatus==Constants.RECORD_STATE_BGCOMPLETED)
- &&(vo.kgsj==null || vo.kgzt !="Y"))
- return true;
- else
- return false;
- }
- //开工按钮是否可点
- public function WgEnble(vo:ZysqbpVo):Boolean
- {
- //数据为完成或者变更完成状态并且 当前不是经营人,可以查看修改保存
- if((vo.recordStatus==Constants.RECORD_STATE_COMPLETED||vo.recordStatus==Constants.RECORD_STATE_BGCOMPLETED)&&(Global.user.sfjyr==YesNoSelect.NO)){
- return true;
- }
- //数据为完成或者变更完成状态并且 当前不是经营人,可以查看修改保存
- if((vo.recordStatus==Constants.RECORD_STATE_COMPLETED||vo.recordStatus==Constants.RECORD_STATE_BGCOMPLETED)
- &&(vo.wgsj==null||vo.wgzt!="Y"))
- return true;
- else
- return false;
- }
- /**开工按钮处理事件*/
- public function KgHandle(vo:ZysqbpVo):void
- {
- var view:ZysqKgEdit=new ZysqKgEdit();
- view.vo=vo;
- view.model=this;
- Utils.popupWindow("开工情况", view, FlexGlobals.topLevelApplication as DisplayObject, thisView.pager.doQuery, 600, 300);
-
- }
- /**完工按钮处理事件*/
- public function WgHandle(vo:ZysqbpVo):void
- {
- var view:ZysqWgEdit=new ZysqWgEdit();
- view.vo=vo;
- view.model=this;
- Utils.popupWindow("完工情况", view, FlexGlobals.topLevelApplication as DisplayObject, thisView.pager.doQuery, 600, 300);
- }
-
-
- public function doViewPop(id:Number,mode:String,taskModel:TaskModel):void{
- var editView:ZysqbpAudit=new ZysqbpAudit();
- if(taskModel!=null&&instance.thisView is TaskLayout)
- editView.model = instance;
- else
- editView.model = this;
- Utils.callRemote("zysqbpController","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:ZysqbpVo=bc.result as ZysqbpVo;
- editView.taskModel=taskModel;
- editView.zysqbp=vo;
-
- editView.mode=mode;
- Utils.popupWindow("审核",editView as DisplayObject,FlexGlobals.topLevelApplication as DisplayObject);
- },id)
- }
-
- public function dolistView(id:Number):void{
- Utils.callRemote("zysqbpController","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:ZysqbpVo=bc.result as ZysqbpVo;
- var editView:ZysqbpAudit=new ZysqbpAudit();
- editView.zysqbp=vo;
- editView.model = this;
- Utils.popupWindow("审核",editView as DisplayObject,FlexGlobals.topLevelApplication as DisplayObject);
- },id)
-
-
- }
-
-
- /**
- * 开工报告超过72个小时过期
- */
- public function rowColorFunction(item:ZysqbpVo):uint
- {
- var bgsj:Date=item.bgsj;
- var currentDate:Date= new Date();
- currentDate.date -= 3;
- if(bgsj!=null&&item.wgsj==null&&ObjectUtil.dateCompare(bgsj,currentDate)<0&&item.recordStatus==Constants.RECORD_STATE_COMPLETED)
- return 0xff6666;
- return 0xffffff;
- }
-
- /**
- * 排序方法
- */
- 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);
- }
-
- /**
- * 待办任务页面调用
- */
- public static function showWorkflow(busId:String,mode:String,layout:DisplayObject,taskModel:TaskModel):void
- {
- instance.thisView=layout;
- Utils.callRemote("zysqbpController","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:ZysqbpVo=bc.result as ZysqbpVo;
- if("view"==mode){
- var editView:ZysqbpView=new ZysqbpView();
- editView.zysqbp=vo;
- editView.enable = false;
- if(null != vo.zydd){
- editView.zydd = vo.zydd.id;
- }
- Utils.popupWindow(instance.resourceManager.getString('common','btn.view'), editView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject, null, 0, 0);
- }else{
- if(vo.recordStatus==Constants.RECORD_STATE_SUBMIT){//点击办理,如果是退回重提,到编辑页面,如果是提交中,跳刀审核页面
- instance.doViewPop(new Number(busId),"audit",taskModel);
- }else if(vo.recordStatus==Constants.RECORD_STATE_REJECT){
- var edit:ZysqbpEdit = new ZysqbpEdit();
- edit.addSave.enabled=false;
- edit.zysqbp = vo;
- edit.taskModel=taskModel;
- if(null != vo.zydd){
- edit.zydd = vo.zydd.id;
- }
- Utils.popupWindow(instance.resourceManager.getString('common','btn.edit'), edit as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject,null, 780, 600);
- }
- }
-
- },new Number(busId))
- }
- //判断数据可以不可以编辑和删除
- private function editOrDelEnable(vo:ZysqbpVo):Boolean{//如果数据不是1状态,不能删除和编辑
- if(vo.recordStatus==Constants.RECORD_STATE_COMPLETED||vo.recordStatus==Constants.RECORD_STATE_CALEL
- || vo.recordStatus== Constants.RECORD_STATE_REJECT){
- Alert.show(instance.resourceManager.getString("common","state.ywc"),resourceManager.getString("common","tip"));
- return false;
- }
- if(vo.recordStatus!=Constants.RECORD_STATE_VALID
- &&vo.recordStatus!=Constants.RECORD_STATE_SUBMIT){
- Alert.show(instance.resourceManager.getString("common","state.shz"),resourceManager.getString("common","tip"));
- return false;
- }
- if(vo.recordStatus==Constants.RECORD_STATE_SUBMIT && Global.user.cd){
- Alert.show(instance.resourceManager.getString("common","state.shz"),resourceManager.getString("common","tip"));
- return false;
- }
-
- return true
- }
- //统计查询
- /** 统计处理 */
- public function doCountHandler(event:MouseEvent):void
- {
- var view:WhzysbCount= new WhzysbCount();
- Utils.popupWindow(resourceManager.getString('common','btn.count'),view as DisplayObject,thisView as DisplayObject);
- }
- /** 集装箱统计处理 */
- public function doContainerCountHandler(event:MouseEvent):void
- {
- var view:WhzysbContainerCount= new WhzysbContainerCount();
- Utils.popupWindow(resourceManager.getString('common','btn.count'),view as DisplayObject,thisView as DisplayObject);
- }
- //汇总功能
- public function gather(event:MouseEvent):void{
- var view:WhzysbHuizongInformate=new WhzysbHuizongInformate() ;
- Utils.popupWindow(resourceManager.getString('common','btn.gather1'),view as DisplayObject,thisView as DisplayObject);
- }
- //汇总功能
- public function gather1(event:MouseEvent):void{
- //var view:WhzysbCount1=new WhzysbCount1() ;
- var view:WhzysbTabMain = new WhzysbTabMain();
- Utils.popupWindow(resourceManager.getString('common','btn.count'),view as DisplayObject,thisView as DisplayObject);
- }
- //===================================================
- //取消作业
- public function doQxzy(event:MouseEvent):void{
- var zysqbp:ZysqbpVo = thisView.dataGrid.selectedItem as ZysqbpVo;
- if(zysqbp==null){
- Alert.show("请选择一条数据","提示");
- return;
- }
- if(zysqbp.recordStatus==Constants.RECORD_STATE_CALEL){
- Alert.show("该数据已作废","提示");
- return;
- }
- if(zysqbp.recordStatus!=Constants.RECORD_STATE_COMPLETED&&zysqbp.recordStatus!=Constants.RECORD_STATE_BGCOMPLETED){//状态为已完成才能取消,取消后便不可进行开工完工
- Alert.show("该数据暂时不能取消作业","提示");
- return;
- }
- if(zysqbp.kgzt=="Y" ){
- Alert.show("该数据已进行开工,不能变更!","提示");
- return;
- }
- // var dif:Number;
- // if(zysqbp.xsscTask!=null){
- // dif = (Number(new Date)-Number(zysqbp.xsscTask.auditTime))/3600000;
- //
- // }else{
- // dif = (Number(new Date)-Number(zysqbp.zdspTask.auditTime))/3600000;
- // }
- // if(dif>48000){
- // Alert.show("超出法规时限期限","提示");
- // return;
- // }
- // Alert.show("确认取消作业?","提示",Alert.YES | Alert.NO,null,
- // function (closeEvt:CloseEvent):void
- // {
- // if(closeEvt.detail == Alert.YES){
- // Utils.callRemote("zysqbpController","doQxzy",function(r:ResultEvent):void{
- // var bc:BusinessContext = r.result as BusinessContext;
- // if(bc.getAttribute("info")=="success"){
- // Alert.show("取消提交成功,请等待审核","提示");
- // doQuery(null);
- // }
- // },zysqbp);
- // }
- // }
- // );
- var view:QxEdit = new QxEdit;
- view.model=this;
- view.vo = zysqbp;
- Utils.popupWindow("危货作业取消", view, FlexGlobals.topLevelApplication as DisplayObject, null, 600, 150);
- }
- //取消作业办理
- public function doqxAudit(id:Number,mode:String,taskModel:TaskModel):void{
- var editView:ZysqqxAudit = new ZysqqxAudit();
- if(taskModel!=null&&instance.thisView is TaskLayout)
- editView.model = instance;
- else
- editView.model = this;
-
- Utils.callRemote("zysqbpController","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:ZysqbpVo=bc.result as ZysqbpVo;
- editView.taskModel=taskModel;
- editView.zysqbp=vo;
- editView.mode=Constants.mode_audit;
- Utils.popupWindow("取消作业审核",editView as DisplayObject,FlexGlobals.topLevelApplication as DisplayObject);
- },id)
- }
- //变更作业
- public function doBgzy(event:MouseEvent):void{
- var zysqbp:ZysqbpVo = thisView.dataGrid.selectedItem as ZysqbpVo;
- if(zysqbp==null){
- Alert.show("请选择一条数据","提示");
- return;
- }
- if(zysqbp.recordStatus==Constants.RECORD_STATE_CALEL){
- Alert.show("该数据已作废","提示");
- return;
- }
- if(zysqbp.recordStatus!=Constants.RECORD_STATE_COMPLETED){//状态为2和10时可以变更
- Alert.show("该数据暂时不能变更","提示");
- return;
- }
- if(zysqbp.kgzt=="Y" ){
- Alert.show("该数据已进行开工,不能变更!","提示");
- return;
- }
- var dif:Number;
- if(zysqbp.xsscTask!=null){
- dif = (Number(new Date)-Number(zysqbp.xsscTask.auditTime))/3600000;
-
- }else{
- dif = (Number(new Date)-Number(zysqbp.zdspTask.auditTime))/3600000;
- }
- // if(dif>48000){
- // Alert.show("超出法规时限期限","提示");
- // return;
- // }
- var view:BgEdit = new BgEdit();
- view.model=this;
- view.vo = zysqbp;
- view.bgvo = new ZysqbpBgVo;
- Utils.popupWindow("危货作业变更", view, FlexGlobals.topLevelApplication as DisplayObject, null, 600, 360);
- }
- //变更作业办理
- public function dobgAudit(id:Number,mode:String,taskModel:TaskModel):void{
- var editView:BgEdit = new BgEdit();
- if(taskModel!=null&&instance.thisView is TaskLayout)
- editView.model = instance;
- else
- editView.model = this;
-
- Utils.callRemote("zysqbpController","doAuditInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:ZysqbpVo=bc.result as ZysqbpVo;
- editView.taskModel=taskModel;
- editView.vo=vo;
- editView.bgvo = bc.getAttribute("bgvo") as ZysqbpBgVo;
- editView.mode=Constants.mode_audit;
- Utils.popupWindow("变更作业审核",editView as DisplayObject,FlexGlobals.topLevelApplication as DisplayObject,null, 600, 360);
- },id)
- }
- //变更办理代办跳转
- public static function showWorkflow2(busId:String,mode:String,layout:DisplayObject,taskModel:TaskModel):void
- {
- instance.thisView=layout;
- instance.dobgAudit(new Number(busId),mode,taskModel);
- }
- //取消办理代办跳转
- public static function showWorkflow3(busId:String,mode:String,layout:DisplayObject,taskModel:TaskModel):void
- {
- instance.thisView=layout;
- instance.doqxAudit(new Number(busId),mode,taskModel);
- }
-
- //查看海事对比详细
- public function showHsdbinfo(event:MouseEvent):void
- {
- var view:HsdbInfo = new HsdbInfo();
- //这边还需要设置一下ID view.pid=你传过来的id
- Utils.popupWindow("对比结果",view as DisplayObject,FlexGlobals.topLevelApplication as DisplayObject,null, 600, 400);
- }
-
- // 复制
- public function doCopy(event:MouseEvent):void
- {
- if(thisView.dataGrid.selectedIndex==-1)
- {
- Utils.showInfoMessage("msg.select.one");
- return ;
- }
- if(Global.user.sfjyr=="Y"&&Global.user.sfyxzysq=="N"){
- Alert.show("该权限已被锁定","提示");
- return ;
- }
- var zysqbp:ZysqbpVo=thisView.dataGrid.selectedItem as ZysqbpVo;
- //if(zysqbp.recordStatus != Constants.RECORD_STATE_COMPLETED && zysqbp.recordStatus != Constants.RECORD_STATE_BGCOMPLETED)
- //{
- // Alert.show("只能复制已完成和变更已完成的数据","提示");
- // return ;
- //}
- model=this;
- Utils.callRemote("zysqbpController","doCheck",function (r:ResultEvent):void{
- var bc:BusinessContext = r.result as BusinessContext;
- if(bc.getAttribute("info")=="yes"){
- editView = new ZysqbpEdit();
- editView.functionId= Utils.getFunctionId(thisView);
- editView.zysqbp= zysqbp;
- editView.zysqbp.recordStatus=1;
- editView.zysqbp.zysjq=null;
- editView.zysqbp.zysjz=null;
- //提单号置空
- editView.zysqbp.BLNo=null;
- editView.bgsj.dateTime = new Date();
- editView.model=model;
- editView.mode = Constants.mode_edit;
- editView.thisModel.thisView=editView;
- editView.thisModel.flag = true;
- if(null != zysqbp.zydd){
- editView.zydd = zysqbp.zydd.id;
- }
- Utils.popupWindow(resourceManager.getString('common','btn.edit'), editView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject, thisView.pager.doQuery, 780, 600);
- }else{
- Alert.show("该危货申报不能进行复制","提示");
- }
- },zysqbp)
- }
- //
- public function kgwgTxFun(item:Object):uint
- {
- if((item as ZysqbpVo).bgsj!=null &&
- ((item as ZysqbpVo).kgzt=="N"||(item as ZysqbpVo).wgzt=="N")&&
- ((item as ZysqbpVo).recordStatus==Constants.RECORD_STATE_COMPLETED||
- (item as ZysqbpVo).recordStatus==Constants.RECORD_STATE_BGCOMPLETED)) {
- var tempDate:Date = new Date();
- tempDate["date"]-=Constants.ZYSB_LIMIT;
- if(ObjectUtil.dateCompare((item as ZysqbpVo).bgsj,tempDate)<0)
- return 0xFF6666;
- }
- if((item as ZysqbpVo).recordStatus == Constants.RECORD_STATE_COMPLETED) {
- var shyj:String = "";
- if((item as ZysqbpVo).zdspTask!=null){
- shyj=(item as ZysqbpVo).zdspTask.auditMsg;
- }
- if((item as ZysqbpVo).xsscTask!=null){
- shyj=(item as ZysqbpVo).xsscTask.auditMsg;
- }
- if(""!=StringUtil.trim(shyj)&&"同意作业" !=StringUtil.trim(shyj))
- return 0xFFFF33;
- }
- //集装箱公司的申报如果未申报过则变色
- if((item as ZysqbpVo).recordStatus == Constants.RECORD_STATE_SUBMIT &&
- (item as ZysqbpVo).zyddqybh !=null &&
- (item as ZysqbpVo).zyddqybh.wxhwm.indexOf("LB")!=-1) {
- if(sfsbList.length >0 && !(sfsbList.getItemAt(thisView.dataGrid.dataProvider.getItemIndex(item)) as Boolean)) {
- return 0xFF8000;
- }
- }
- return 0xffffff;
- }
-
- //自动审批设置
- public function doAuto(event:Event):void {
- var zdspView:ZdspszView = new ZdspszView;
- Utils.popupWindow(resourceManager.getString('common','btn.automate'), zdspView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject, thisView.pager.doQuery, 860, 600);
- }
-
- /**
- * 待办任务页面调用
- */
- public static function showView(busId:String,mode:String,layout:DisplayObject,taskModel:TaskModel):void
- {
- instance.thisView=layout;
- Utils.callRemote("zysqbpController","doViewInit",function (r:ResultEvent):void{
- var bc:BusinessContext=r.result as BusinessContext;
- var vo:ZysqbpVo=bc.result as ZysqbpVo;
- if("view"==mode){
- var editView:ZysqbpView=new ZysqbpView();
- editView.zysqbp=vo;
- editView.enable = false;
- if(null != vo.zydd){
- editView.zydd = vo.zydd.id;
- }
- Utils.popupWindow(instance.resourceManager.getString('common','btn.view'), editView as DisplayObject, FlexGlobals.topLevelApplication as DisplayObject, null, 0, 0);
- }
- },new Number(busId))
- }
-
- /**
- * 显示行政许可信息
- */
- public function doAdministrative(e:Event):void{
- var view:FrxzxkLayout=new FrxzxkLayout();
- Utils.callRemote("zysqbpController","findDataMenu",function(r:ResultEvent):void{
- var bc:BusinessContext = r.result as BusinessContext;
- var fr:String = bc.getAttribute("fr") as String;
- var bd:String = bc.getAttribute("bd") as String;
- var xk:String = bc.getAttribute("xk") as String;
- if(fr!=null&& fr.length>16)
- view.frString = fr;
- if(bd!=null&& bd.length>39)
- view.bdString = bd;
- if(xk!=null&& xk.length>14)
- view.xkString = xk;
- Utils.popupWindow("法人行政许可",view,FlexGlobals.topLevelApplication as DisplayObject,null,1250,550);
- });
- }
-
- /**
- * 显示消息
- */
- public function showMessage (e:Event):void{
- var view:MessageLayout=new MessageLayout();
- view.parentView=thisView;
- Utils.popupWindow("消息",view,FlexGlobals.topLevelApplication as DisplayObject,null,1000,550);
- }
- }
- }
|