低压工单查看功能

1.view.js部分

//增加工具栏
     toolbar.insertItem(nIndex++, {
			name : "chakanButton",
			text : "查看",
			
			//获取一个字符串,表示用户将鼠标悬停在该项上时显示的简短说明
			toolTip : "查看",
			
			//图标
			imageKey : "pmsimage/chakan",
			//点击触发事件
			onclick : me.controller._btnChakan_onclick
		}, true);
     
   
    //表单窗口对象
    var _detailWin = null;
    
    /**
     * 初始化表单视图窗口对象
     */
    function _initDetailWindow(){
    	//创建新的对话框
        var win = new mx.windows.WindowManager();
        
    	_detailWin = win.create({
    		reusable: true,//是否复用
			width:1000,
			height:700,
			title:"表单查看"
    	});
    }
    
    /**
     * 获取表单视图窗口对象
     */
    me.getDetailWindow = function(){
    	
    	_initDetailWindow();
    	return _detailWin;
    }
};

2.viewController.js部分

    /**
     * 查看按钮事件
     */
    me._btnChakan_onclick = function()
    {
    	var nCount = me.view.getDataGrid().getCheckedIDs() ? me.view.getDataGrid().getCheckedIDs().length : 0;//选中的条数
    	
    	if(nCount < 1){
    		mx.indicate("warn","请选择要查看的数据");
    		return;
    	}else if (nCount > 1) {
    		mx.indicate("warn","请选择一条数据查看");
    		return;
    	}
    	
    	var arrData = me.view.getDataGrid().getCheckedIDs();
    	//设置窗口类型
	    _viewType = 'info';
	    
	    //获取所选数据的ID
	    var arrData = me.view.getDataGrid().getCheckedIDs();
	    
	    base.gdid = arrData[0];
	    
        // TODO: 此处新增的数据需要将服务端返回的 id 值设置到 GridItem 上。
	    var _detailView = me._getDetailFromView();
	    
	    //设置对象id
	    _detailView.objID = null;
	    
        _showDetailFormView(_detailView,"表单查看");
    };
    /**
     * 获取表单视图对象(新增)
     */
    me._getDetailFromView = function(){
    	if (_detailView == null){
    		var mvc = null;
    		if (_viewType == 'info') {
    		//转到InfoViewController,并将工单的id传入
                mvc = new dygd.views.InfoViewController({
                	gdid:base.gdid
                });
			}
			//调用InfoViewController的getView()方法
    		_detailView = mvc.getView();
    		
        }
    	return _detailView;
    }

   /**
     * 显示表单视图
     * @param p_view : 需要显示的视图对象
     * @param p_title : 对话框的标题
     */
    function _showDetailFormView(p_view,p_title){
       //调用view里面的方法得到对话框
    	var win = me.view.getDetailWindow();
     	if(typeof p_view != "undefined"){
    		p_view.load();
    		//设置显示视图、标题信息
    		win.setView(p_view);
    		win.setTitle(p_title ? p_title : win.title);
    	}
		win.showDialog(function(p_context) {
			
			 _detailView = me._getDetailFromView();
		
			me.view.getDataGrid().load();
		});
    }

3.infoView.js

//设置显示的页面
function _initDataForm(){

    	var label;
		var rowheight = 21;		//行高
		var rowdistance = 8; 	//行间距
		var top = 8;			//初始高度
		var left = 40 			//初始左边距
		var input_w = 200  		//输入框宽   
		var text_w = 63 		//输入框前文字
		var it_w = 10			//输入框与文字间距
		var coldistance = 40 	//列间距
		var px = 'px'			//单位
		var star_w = 2			//*号与输入框前文字间距
		var title_left = 10     //标题左边距

		//第一行
		//第二行
		label = new mx.controls.Label(
				{text:"工单编号 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*1+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gdbh = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.gdbh.setCss({position:"absolute",top:top+(rowheight+rowdistance)*1+px,left:left+text_w+it_w+px,width:input_w,height:(rowheight+px)});
		me.addControl(me.gdbh);	
		label = new mx.controls.Label({text:"*"
            , css:{color:"red",position:"absolute"
               , left:left+(input_w+text_w+coldistance)*1,width:"6px"
               ,"font-weight":"bold"
               , top:top+(rowheight+rowdistance)*1+px
               , height:(rowheight+"px")}
		});
		me.addControl(label);
		label = new mx.controls.Label(
				{text:"等级 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*1+px,left:left+(input_w+text_w+coldistance)*1,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.dj = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.dj.setCss({position:"absolute",top:top+(rowheight+rowdistance)*1+px,left:left+(input_w+text_w+coldistance)*1+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.dj);
/*		me.dj.appendItem("一般","01");
		me.dj.appendItem("重要","02");
		me.dj.appendItem("紧急","03");*/
		label = new mx.controls.Label({text:"*"
            , css:{color:"red",position:"absolute"
               , left:left+(input_w+text_w+coldistance)*2+text_w+star_w,width:"6px"
               ,"font-weight":"bold"
               , top:top+(rowheight+rowdistance)*1+px
               , height:(rowheight+"px")
                }
		});
		me.addControl(label);
		label = new mx.controls.Label(
				{text:"类型 : ",
					width:text_w,
					css:{"text-align" : "right",position:"absolute",top:top+(rowheight+rowdistance)*1+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.lx = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:false,readOnly:true,value:"低压工程"});
		me.lx.setCss({position:"absolute",top:top+(rowheight+rowdistance)*1+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.lx);	
		//低压工作单默认类型是低压工程
		/*me.lx.appendItem("业扩工程","01");
		me.lx.appendItem("配网工程","02");
		me.lx.appendItem("配网检修","03");
		me.lx.appendItem("变电检修","04");
		me.lx.appendItem("用户影响","05");
		me.lx.appendItem("输电影响","06");
		me.lx.appendItem("市政工程","07");
		me.lx.appendItem("低压工程","08");
		me.lx.appendItem("消缺业务","09");*/
		//第三行
		label = new mx.controls.Label({text:"*"
            , css:{color:"red",position:"absolute"
               , left:left+(input_w+text_w+coldistance)*0,width:"6px"
               ,"font-weight":"bold"
               , top:top+(rowheight+rowdistance)*2+px
               , height:(rowheight+"px")}
		});
		me.addControl(label);
		label = new mx.controls.Label(
				{text:"所属辖区 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*2+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.ssxq = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.ssxq.setCss({position:"absolute",top:top+(rowheight+rowdistance)*2+px,left:left+text_w+it_w+px,width:input_w,height:(rowheight+px)});
		me.addControl(me.ssxq);	
		
		label = new mx.controls.Label(
				{text:"任务来源 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*2+px,left:left+(input_w+text_w+coldistance)*1,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.rwly = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.rwly.setCss({position:"absolute",top:top+(rowheight+rowdistance)*2+px,left:left+(input_w+text_w+coldistance)*1+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.rwly);
		
/*		me.rwly.appendItem("危急缺陷","0");
		me.rwly.appendItem("检修计划","1");
		me.rwly.appendItem("临时性检修","2");
*/
		label = new mx.controls.Label({text:"*"
            , css:{color:"red",position:"absolute"
               , left:left+(input_w+text_w+coldistance)*2+text_w+star_w,width:"6px"
               ,"font-weight":"bold"
               , top:top+(rowheight+rowdistance)*2+px
               , height:(rowheight+"px")
                }
		});
		me.addControl(label);
		label = new mx.controls.Label(
				{text:"班组类别 :  ",
					width:text_w,
					css:{"text-align" : "right",position:"absolute",top:top+(rowheight+rowdistance)*2+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.bzlb = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.bzlb.setCss({position:"absolute",top:top+(rowheight+rowdistance)*2+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.bzlb);
		
/*		me.bzlb.appendItem("工作班组","0");
		me.bzlb.appendItem("配合班组","1");
*/
		//第四行
		label = new mx.controls.Label({text:"*"
            , css:{color:"red",position:"absolute"
               , left:left+(input_w+text_w+coldistance)*0,width:"6px"
               ,"font-weight":"bold"
               , top:top+(rowheight+rowdistance)*2+px
               , height:(rowheight+"px")}
		});
		me.addControl(label);
		label = new mx.controls.Label(
				{text:"工作名称 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*3+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gzmc = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.gzmc.setCss({position:"absolute",top:top+(rowheight+rowdistance)*3+px,left:left+text_w+it_w+px,width:input_w*2+coldistance+text_w,height:(rowheight+px)});
		me.addControl(me.gzmc);	
		
		label = new mx.controls.Label(
				{text:"状态 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*3+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.zt = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,value:"拟定",readOnly:true});
		me.zt.setCss({position:"absolute",top:top+(rowheight+rowdistance)*3+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.zt);
		
		/*me.zt.appendItem("拟定","01");
		me.zt.appendItem("在执行","02");
		me.zt.appendItem("已挂起","03");
		me.zt.appendItem("在归档","04");
		me.zt.appendItem("已完成","05");
		me.zt.appendItem("已作废","06");*/

		
		//第五、六、七行
		label = new mx.controls.Label({text:"*"
            , css:{color:"red",position:"absolute"
               , left:left+(input_w+text_w+coldistance)*0,width:"6px"
               ,"font-weight":"bold"
               , top:top+(rowheight+rowdistance)*2+px
               , height:(rowheight+"px")}
		});
		me.addControl(label);
		label = new mx.controls.Label(
				{text:"工作内容 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*4+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight*3+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gznr = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true,height:(rowheight*6+px),textMode:"multiline"});
		me.gznr.setCss({position:"absolute",top:top+(rowheight+rowdistance)*4+px,left:left+text_w+it_w+px,width:input_w*2+coldistance+text_w,height:(rowheight*4+px)});
		me.addControl(me.gznr);	
		
		label = new mx.controls.Label(
				{text:"下达人 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*4+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.xdr = new mx.editors.CustomEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.xdr.setCss({position:"absolute",top:top+(rowheight+rowdistance)*4+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.xdr);
		
		label = new mx.controls.Label(
				{text:"下达时间 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*5+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.xdsj = new mx.editors.DateTimeEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.xdsj.setCss({position:"absolute",top:top+(rowheight+rowdistance)*5+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.xdsj);
		
		label = new mx.controls.Label(
				{text:"工程编号 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*6+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gcbh = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.gcbh.setCss({position:"absolute",top:top+(rowheight+rowdistance)*6+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.gcbh);
	
		//第八行
		label = new mx.controls.Label(
				{text:"工作地点 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*7+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gzdd = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.gzdd.setCss({position:"absolute",top:top+(rowheight+rowdistance)*7+px,left:left+text_w+it_w+px,width:input_w*2+coldistance+text_w,height:(rowheight+px)});
		me.addControl(me.gzdd);	
		
		label = new mx.controls.Label(
				{text:"督办人 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*7+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.dbr = new mx.editors.CustomEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.dbr.setCss({position:"absolute",top:top+(rowheight+rowdistance)*7+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.dbr);
		
		//第九行
		label = new mx.controls.Label(
				{text:"工作时间 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*8+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gzsjStart = new mx.editors.DateTimeEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true,formatString: "yyyy-MM-dd",onchanged:me.controller._timeStart_change});
		me.gzsjStart.setCss({position:"absolute",top:top+(rowheight+rowdistance)*8+px,left:left+text_w+it_w+px,width:input_w,height:(rowheight+px)});
		me.addControl(me.gzsjStart);	
		
		label = new mx.controls.Label(
				{text:"至 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*8+px,left:left+(input_w+text_w+coldistance)*1,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gzsjEnd = new mx.editors.DateTimeEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true,formatString: "yyyy-MM-dd",onchanged:me.controller._timeEnd_change});
		me.gzsjEnd.setCss({position:"absolute",top:top+(rowheight+rowdistance)*8+px,left:left+(input_w+text_w+coldistance)*1+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.gzsjEnd);
		label = new mx.controls.Label(
				{text:"工程登记号 :  ",
					width:text_w+20,
					css:{"text-align" : "right",position:"absolute",top:top+(rowheight+rowdistance)*8+px,left:left+(input_w+text_w+coldistance)*2-20,width:text_w+20,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.gcdjh = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.gcdjh.setCss({position:"absolute",top:top+(rowheight+rowdistance)*8+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.gcdjh);
		
		//第十行
		label = new mx.controls.Label(
				{text:"编制单位 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*9+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.bzdw = new mx.editors.CustomEditor({width:200, buttonCaption :"",enabledInput:true,readOnly:true});
		me.bzdw.setCss({position:"absolute",top:top+(rowheight+rowdistance)*9+px,left:left+text_w+it_w+px,width:input_w,height:(rowheight+px)});
		me.addControl(me.bzdw);	
		
		label = new mx.controls.Label(
				{text:"编制人 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*9+px,left:left+(input_w+text_w+coldistance)*1,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.bzr = new mx.editors.CustomEditor({width:200, buttonCaption :"",enabledInput:true,readOnly:true});	
		me.bzr.setCss({position:"absolute",top:top+(rowheight+rowdistance)*9+px,left:left+(input_w+text_w+coldistance)*1+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.bzr);
		label = new mx.controls.Label(
				{text:"编制时间 :  ",
					width:text_w,
					css:{"text-align" : "right",position:"absolute",top:top+(rowheight+rowdistance)*9+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.bzsj = new mx.editors.DateTimeEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.bzsj.setCss({position:"absolute",top:top+(rowheight+rowdistance)*9+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.bzsj);
		
		//第十一行
		label = new mx.controls.Label(
				{text:"备注 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*10+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight*3+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.bz = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true,height:(rowheight*6+px),textMode:"multiline"});
		me.bz.setCss({position:"absolute",top:top+(rowheight+rowdistance)*10+px,left:left+text_w+it_w+px,width:input_w*3+coldistance*2+text_w*2,height:(rowheight*4+px)});
		me.addControl(me.bz);	
		
		//隐藏行 保存数据用
		me.xdrid = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,visible:false });
		me.dbrid = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,visible:false });
		me.bzrid = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,visible:false });
		me.bzdwid = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,visible:false });
		me.addControl(me.xdrid);	
		me.addControl(me.dbrid);	
		me.addControl(me.bzrid);	
		me.addControl(me.bzdwid);	
		me.ztid = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,visible:false });
		me.lxid = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,visible:false });
		me.addControl(me.ztid);	
		me.addControl(me.lxid);	
		
		
		//第十二行
		label = new mx.controls.Label(
				{text:" 任 务 执 行: ",
					width:input_w*3,
					fontSize : "20px",
					css:{position:"absolute",top:top+(rowheight+rowdistance)*13.2+px,width:"100%",verticalAlign : "middle","background-color":"#E0ECFF",height:(rowheight*1.5+px)}});
		label.setVerticalAlign("middle");
		me.addControl(label);
		
		//第十三行
		label = new mx.controls.Label(
				{text:"反馈意见 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*15+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.fkyj = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:true,readOnly:true});
		me.fkyj.setCss({position:"absolute",top:top+(rowheight+rowdistance)*15+px,left:left+text_w+it_w+px,width:input_w*2+coldistance+text_w,height:(rowheight+px)});
		me.addControl(me.fkyj);	
		
		label = new mx.controls.Label(
				{text:"完成时间 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*15+px,left:left+(input_w+text_w+coldistance)*2,width:text_w,"font-weight":"bold",height:(rowheight+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.wcsj = new mx.editors.DateTimeEditor({width:input_w, buttonCaption :"",enabledInput:false,readOnly:true});
		me.wcsj.setCss({position:"absolute",top:top+(rowheight+rowdistance)*15+px,left:left+(input_w+text_w+coldistance)*2+text_w+it_w,width:input_w,height:(rowheight+px)});
		me.addControl(me.wcsj);
		
		//第十四行
		label = new mx.controls.Label(
				{text:"实际完成情况 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*16+px,left:left-20,width:text_w+20,"font-weight":"bold",height:(rowheight*3+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.sjwcqk = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:false,readOnly:true,height:(rowheight*6+px),textMode:"multiline"});
		me.sjwcqk.setCss({position:"absolute",top:top+(rowheight+rowdistance)*16+px,left:left+text_w+it_w+px,width:input_w*2+coldistance+text_w,height:(rowheight*3+px)});
		me.addControl(me.sjwcqk);	
		
		//第十五行
		label = new mx.controls.Label(
				{text:" 督 办: ",
					width:input_w*3,
					fontSize : "20px",
					css:{position:"absolute",top:top+(rowheight+rowdistance)*18.5+px,width:"100%",verticalAlign : "middle","background-color":"#E0ECFF",height:(rowheight*1.5+px)}});
		me.addControl(label);
		
		//第十六行
		label = new mx.controls.Label(
				{text:"督办意见 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*20+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight*3+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.dbyj = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:false,readOnly:true,height:(rowheight*6+px),textMode:"multiline"});
		me.dbyj.setCss({position:"absolute",top:top+(rowheight+rowdistance)*20+px,left:left+text_w+it_w+px,width:input_w*2+coldistance+text_w,height:(rowheight*3+px)});
		me.addControl(me.dbyj);	
		

		//第十五行
		label = new mx.controls.Label(
				{text:" 追 回: ",
					width:input_w*3,
					fontSize : "20px",
					css:{position:"absolute",top:top+(rowheight+rowdistance)*22.5+px,width:"100%",verticalAlign : "middle","background-color":"#E0ECFF",height:(rowheight*1.5+px)}});
		me.addControl(label);
		
		//第十六行
		label = new mx.controls.Label(
				{text:"追回意见 : ",
					width:text_w,
					css:{position:"absolute",top:top+(rowheight+rowdistance)*24+px,left:left,width:text_w,"font-weight":"bold",height:(rowheight*3+px)}});
		label.setCss({"text-align":"right"});
		me.addControl(label);
		me.sjwcqk = new mx.editors.TextEditor({width:input_w, buttonCaption :"",enabledInput:false,readOnly:true,height:(rowheight*6+px),textMode:"multiline"});
		me.sjwcqk.setCss({position:"absolute",top:top+(rowheight+rowdistance)*24+px,left:left+text_w+it_w+px,width:input_w*2+coldistance+text_w,height:(rowheight*3+px)});
		me.addControl(me.sjwcqk);	
		
		
		me.tabControl = new mx.containers.TabControl({
			onselectionchanging :me.tab_change,
			pages : [ {
				text : "相关业务",
				name : "xgyw"
			}, {
				text : "子工单",
				name : "zgd"
			}, {
				text : "附件",
				name : "fj"
			}]
		});
		me.tabControl.setCss({position:"absolute",top:top+(rowheight+rowdistance)*27+px,left:0+px,width:input_w*3+coldistance*3+text_w*3,height:(rowheight*10+px)});
		/* 初始化 DataGrid */
        _dataGrid = new mx.datacontrols.ComplexGrid({   
			// 构造查询属性。
			alias: "table",
			
			columns:[
	        {	name: "id", caption: "ID" , editorType: "TextEditor",readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "gdbh", caption: "工单编号" , editorType: "TextEditor"	,readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "ywlx", caption: "业务类型" , editorType: "TextEditor",readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "ywbh", caption: "业务编号" , editorType: "TextEditor",readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "ywzy", caption: "业务摘要" , editorType: "TextEditor"	,readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "lczt", caption: "流程状态" , editorType: "DateTimeEditor", formatString: "yyyy-MM-dd",dataAlign : "center",align : "center"},
	        {	name: "clr", caption: "处理人" , editorType: "DateTimeEditor", formatString: "yyyy-MM-dd",dataAlign : "center",align : "center"},
	        {	name: "ck", caption: "查看" , editorType: "TextEditor",dataAlign : "center",align : "center"},
	        {	name: "bl", caption: "办理" , editorType: "TextEditor",dataAlign : "center",align : "center"}
	        ],
            // 构造列排序条件,如果有多列,则以逗号分隔。例sorter: "school ASC, class DESC"
            displayCheckBox: true,
	        displayPrimaryKey:false,//列表是否显示主键
            allowEditing: false, //列表默认不可编辑
	        pageSize : 20
        });
        var toolbar = _dataGrid.toolBar;
        toolbar.clearItems();
        var nIndex = 0;
		toolbar.insertItem(nIndex++, {
			name : "startButton",
			text : "启动",
			toolTip : "start"
		}, true);
		toolbar.insertItem(nIndex++, "-", true);
		toolbar.insertItem(nIndex++, {
			name : "relateButton",
			text : "关联",
			toolTip : "relate"
		}, true);
		toolbar.insertItem(nIndex++, "-", true);
		
		/* 初始化 DataGrid */
        _zgd = new mx.datacontrols.ComplexGrid({   
			// 构造查询属性。
			alias: "zgdtable",
			
			columns:[
	        {	name: "id", caption: "ID" , editorType: "TextEditor",readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "gdbh", caption: "工单编号" , editorType: "TextEditor"	,readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "ywlx", caption: "业务类型" , editorType: "TextEditor",readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "ywbh", caption: "业务编号" , editorType: "TextEditor",readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "ywzy", caption: "业务摘要" , editorType: "TextEditor"	,readOnly:"true",dataAlign : "center",align : "center"},
	        {	name: "lczt", caption: "流程状态" , editorType: "DateTimeEditor", formatString: "yyyy-MM-dd",dataAlign : "center",align : "center"},
	        {	name: "clr", caption: "处理人" , editorType: "DateTimeEditor", formatString: "yyyy-MM-dd",dataAlign : "center",align : "center"},
	        {	name: "ck", caption: "查看" , editorType: "TextEditor",dataAlign : "center",align : "center"},
	        {	name: "bl", caption: "办理" , editorType: "TextEditor",dataAlign : "center",align : "center"}
	        ],
            // 构造列排序条件,如果有多列,则以逗号分隔。例sorter: "school ASC, class DESC"
            displayCheckBox: true,
	        displayPrimaryKey:false,//列表是否显示主键
            allowEditing: false, //列表默认不可编辑
	        pageSize : 20
        });
        var zgdbar = _zgd.toolBar;
        zgdbar.clearItems();
        var nIndex = 0;
        zgdbar.insertItem(nIndex++, {
			name : "startButton",
			text : "启动1",
			toolTip : "start"
		}, true);
        zgdbar.insertItem(nIndex++, "-", true);
        zgdbar.insertItem(nIndex++, {
			name : "relateButton",
			text : "关联",
			toolTip : "relate"
		}, true);
        zgdbar.insertItem(nIndex++, "-", true);		
		
     	//是否需要隐藏按钮,一般新建时显示全部按钮,查询时隐藏添加、上传、删除按钮
    	var sfycBtn = 1;
		var hideBtns = "";
		//对应的业务主键,例如试验报告id,设备id
		var id = me.controller.gdid;
		if(sfycBtn == 0)//1表示需要隐藏按钮
		{
			hideBtns = "add,upload,delete";
		}
		me.fileUpLoadPanel = new mxpms.controls.FileUpLoadPanel({
			width: "880px", 
			tableName: "gzrwdFile",//仅做标识作用,建议不要使用真正的表名,存在安全问题
			colName: "FJMC",
			pkVal: id,
			height:"130px",
			selectMore : true,
			type : "form", //传form和grid都可以
			hideBtns :hideBtns
			//onitemuploaded : me.controller.fileUploaded,
			//onitemremoved : me.controller.fileDeleted
		});
		me.on("activate", me.controller._onactivate);
		}
    

4.infoViewController.js

//将数据传到后台
//作业数据维护
dygd.views.InfoViewController = function(p_param)

{
    var me = $extend(mx.views.ViewController);
    var base = {};
    
    //工单ID
    //p_param是传过来的数据
    me.gdid = p_param.gdid;
    
    
    me.getView = function()
    {
        if (me.view == null)
        {
            me.view = new dygd.views.InfoView({controller: me});
        }
        return me.view;
    };
    
    
    me._onactivate = function(e)
    {
        // iscID 是界面的统一权限功能编码,默认值为 "-1" ,表示不应用权限设置。
    	var permission = new mx.permissions.Permission({iscID:"-1"});
        // 根据“统一权限”设置组件的可见和只读等属性
    	// me.view 是当前页面的view页面,可根据需要传入其他需要权限控制页面元素
        mx.permissions.PermissionAgent.setPermission(permission, me.view);
        //获取系统当前时间
        var myDate = new Date();
        var restResult = mx.rpc.RESTClient().getSync(
				dygd.mappath("~/rest/tyjfdwyjgzrwd/queryDygdnd"),
				{gdid:me.gdid});
		
		if (!restResult.successful) {
			if ($notEmpty(restResult.resultHint)) {
				mx.indicate("warn",restResult.resultHint);
				return ;
			} else {
				mx.indicate("warn","调用服务失败!");
				return ;
			}
        } else {
        	var rows = restResult.resultValue.items;
			me.view.gdbh.setValue(rows[0].GDBH);
			
			//me.view.dj.setValue(rows[0].RWDJ);
			
			if(rows[0].RWDJ == '01'){
				me.view.dj.setValue("一般");
			}else if(rows[0].RWDJ == '02'){
				me.view.dj.setValue("重要");
			}else if(rows[0].RWDJ == '03'){
				me.view.dj.setValue("紧急");
			}
			
			me.view.lxid.setValue(rows[0].GZLB);
			
			
			me.view.lx.setValue("低压工程");
			me.view.ssxq.setValue(rows[0].SSXQ);
			//me.view.rwly.setValue(rows[0].RWLYID);
			
			if(rows[0].RWLY == '0'){
				me.view.rwly.setValue("危急缺陷");
			}else if(rows[0].RWLY == '1'){
				me.view.rwly.setValue("检修计划");
			}else if(rows[0].RWLY == '2'){
				me.view.rwly.setValue("临时性检修");
			}
			
			
			//me.view.bzlb.setValue(rows[0].BZLB);
			
			if(rows[0].BZLB == '0'){
				me.view.bzlb.setValue("工作班组");
			}else if(rows[0].BZLB == '1'){
				me.view.bzlb.setValue("配合班组");
			}
			me.view.gzmc.setValue(rows[0].GZMC);
			
			if(rows[0].GDZT == '01'){
				me.view.zt.setValue("拟定");
			}else if(rows[0].GDZT == '02'){
				me.view.zt.setValue("在执行");
			}else if(rows[0].GDZT == '03'){
				me.view.zt.setValue("已挂起");
			}else if(rows[0].GDZT == '04'){
				me.view.zt.setValue("已归档");
			}else if(rows[0].GDZT == '05'){
				me.view.zt.setValue("已完成");
			}else if(rows[0].GDZT == '06'){
				me.view.zt.setValue("已作废");
			}
			
			
			//me.view.ztid.setValue(rows[0].GDZT);
			
			me.view.gznr.setValue(rows[0].GZNR);
			me.view.xdr.setValue(rows[0].XDR_MC);
			me.view.xdrid.setValue(rows[0].XDR_ID);
			me.view.xdsj.setValue(rows[0].XDSJ);
			me.view.gcbh.setValue(rows[0].GCBH);
			me.view.dbr.setValue(rows[0].DBR_MC);
			me.view.dbrid.setValue(rows[0].DBR_ID);
			me.view.gzdd.setValue(rows[0].GZDD);
			me.view.gzsjStart.setValue(rows[0].GZKSSJ);
			me.view.gzsjEnd.setValue(rows[0].GZJSSJ);
			me.view.gcdjh.setValue(rows[0].GCDJH);
			me.view.bzdw.setValue(rows[0].BZDW_MC);
			me.view.bzdwid.setValue(rows[0].BZDW_ID);
			me.view.bzr.setValue(rows[0].BZR_MC);
			me.view.bzrid.setValue(rows[0].BZR_ID);
			me.view.bzsj.setValue(rows[0].BZRQ);
			me.view.bz.setValue(rows[0].BZ);	
		}
    };
    
    //上传完成后的操作
    me.uploaded = function(code){
    	if (code == 'true') {
    		mx.indicate("info","导入成功");
        	me.view.parent.setDialogResult(false);
		} else {
			mx.indicate("warn","导入作业信息失败");
		}
    }
    
    return me.endOfClass(arguments);
};

5,根据mappath寻找后台,实现后台java语句
(1)controller层

	/**
	 * 查询拟定低压工单
	 * @return QueryResultObject
	 */
	@RequestMapping(value = "/queryDygdnd")
	public @ItemResponseBody
	QueryResultObject queryDygdnd(String gdid) {
		QueryResultObject qro = new QueryResultObject();
		List> workDataList = new ArrayList>();
		workDataList = dygdndBizc.queryDygdnd(gdid);
		qro.setItems(workDataList);
		return qro;
	}

(2)sevice层
接口

	/**
	 * 查询一条拟定低压工单
	 */
	public List> queryDygdnd(String strID);

接口实现

	/**
	 * 单条低压工单拟定数据查询
	 * strId : 该条记录主键id
	 */
	@Override
	public List> queryDygdnd(String strID) {
		List> rs = new ArrayList>();
		try {
			String sql = "select * from scyw.T_YJ_FDWYJ_DYGZRWD where OBJ_ID = ? ";
			rs = hibernateDao.queryForListWithSql(sql,new Object[]{strID});
		} catch (Exception e) {
			// TODO: handle exception
			if (logger.isErrorEnabled()) {
				logger.error("单条低压工单拟定数据查询异常-DygdndBizc:" + e.getMessage());
			}
		}
		return rs;
	}

你可能感兴趣的:(金现代)