普元nui:demo

注意 :

  1. js与jquery无法取得nui组件value
  2. nui-htmlfile控件的url必须通过action提交
  3. datepicker组件不能通过setValue设值
  4. 通过$J调用的全局函数,当存在data参数时,其中data参数不能省略,可以设为“”或null
  5. 所有路径皆采用真实路径,如创建目录、读取路径等,曾因此导致页面不能自动刷新
  6. 合并项目时贴别注意:dao层调用mybaties代码、ctrller映射url、mybaties映射文件中数据模型的全限定名
  7. value值要通过$J().getValue方法取得,js与jquery是无法获得的
  8. 创建目录或者上传文件时,要在真实目录中检查是否成功创建或上传,开发工具并不一定能及时同步
  9. $J.getbyName("endtime").setValue( $J.getbyName("endtime").getFormValue());无法为表单时间格式化

confirm

				$J.confirm(" ", " ", function(action) {
					if (action == 'ok') { } else { }
				});

 

获取UUID

UUID.randomUUID().toString().replaceAll("-","")

获取登陆用户信息

		Cap4jUserInfo userInfo = ContextUtil.getLoginUser();

验证

JSP:
  		 
			
业务代码:

			
	  
				*
			
	
		//校验主键(业务种类编号)是否重复

function onExistValidation(e) {
		if (e.isValid) {
                if (isEnglishAndNumber(e.value) == false) {
                    e.errorText = "必须输入英文+数字";
                    e.isValid = false;
                }
            }
			var pageType = $J.getbyName("pageType").getValue();
			if (pageType == "edit") {
				return;
			}
			if (e.isValid) {
				var ajaxConf = new Cap4jAjaxConf();
				ajaxConf.setIsAsync(false);
				ajaxConf.setIsShowProcessBar(false);
				ajaxConf.setIsShowSuccMsg(false);
				ajaxConf.setSuccessFunc(function(data) {
					if (data) {
						e.errorText = "该业务代码已存在";
						e.isValid = false;
					}
				});
 $J.postByAjax({"id" : e.value},"                
 <%=request.getContextPath()%>/cmsBusincode/getCmsBusincodeVOById.do",ajaxConf);
			}
	}

关闭当前窗口

$J.closedialog("ok");

码表配置

	@FunctionDesc("[MisKhzlTemp]主页面")
	public String list(Model model) {
		List list = new ArrayList();
		addCodeType(list, "gj", "gj");
		getCodeInfoByIds(list, model);
		return "two/MisKhzlTempList";
	}


	@FunctionDesc("MisKhzlTemp详情页面")
	public String detail(Model model) {
		List list = new ArrayList();
		addCodeType(list, "gj", "gj");
		getCodeInfoByIds(list, model);
		return "two/MisKhzlTempForm";
	}
                                /* 	function onGJ(e) {
					return $J.codeTypeRender(e, "gj", "gj");
				} */
				function onGJ(e) {
					return $J.getDictText("gj", e.row.gj)
				}

	
国籍:

html
处理状态
反馈类型
融资状态
js fieldArr = ["allotstate", "handlestate", "feedbacktype", "financestate", "sendstate", "intervenstate", "notestate"]; function onMean(e) { for (i = 0; i < fieldArr.length; i++) { if (e.field == fieldArr[i]) { return $J.codeTypeRender(e, fieldArr[i], fieldArr[i]); } } } public String list(Model model) { this.Mean(model); return "syfh_zcd/dkgl/SyzcdDksqxxbList"; } public void Mean(Model model) { List list = new ArrayList(); addCodeType(list, "allotstate", "allotstate"); addCodeType(list, "handlestate", "handlestate"); addCodeType(list, "feedbacktype", "feedbacktype"); getCodeInfoByIds(list, model); }

自定义码表

var financestate = [{
	id : 0,
	text : "0-已融资"
}, {
	id : 1,
	text : '1-未融资'
}];
var handlestate = [{
	id : 0,
	text : "0-未审核"
}, {
	id : 1,
	text : '1-已通过'
},{
	id : 2,
	text : '1-已否决'
}];
function onMean(e) {
	switch (e.field) {
		case "financestate" : {
			for (var i = 0; i < financestate.length; i++) {
				if (financestate[i].id == e.value) {
					return financestate[i].text;
				} 
			}
		}
		case "handlestate" : {
			for (var i = 0; i < handlestate.length; i++) {
				if (handlestate[i].id == e.value) {
					return handlestate[i].text;
				} 
			}
		}
		default :
			break;
	}
}
var allotstate = [{
	id : 0,
	text : "0-未分配"
}, {
	id : 1,
	text : "1-已分配"
}];
var handlestate = [{
	id : 0,
	text : "0-未审核"
}, {
	id : 1,
	text : '1-已通过'
}];
var codeName = ["financestate", "handlestate"];
var codeValue = [financestate, handlestate];
function onMean(e) {
	for (i = 0; i < codeName.length; i++) {
		if (e.field == codeName[i]) {
			for (y = 0; y < codeValue[i].length; y++) {
				if (e.value == codeValue[i][y].id) {
					return codeValue[i][y].text;
				}
			}
		}
	}
}

日志

    
	
         
    
    
	
    	  
    
    

AJAX提交

jsp



总笔数:
总金额:
统计    导出
function total() { var data = form.getData(); params = ""; params += "fsrq=" + data.fsrq; params += "&jzrq=" + data.jzrq; params += "&gbrq=" + data.gbrq; params += "&qqwjm=" + data.qqwjm; ajaxConf = new Cap4jAjaxConf(); ajaxConf.setIsShowSuccMsg(false); ajaxConf.setSuccessFunc(function(data) { data = data.split(","); $J.getbyName("total").setValue(data[0]); $J.getbyName("moneyNum").setValue(data[1]); }); $J.postByAjax("", appContext + "/ywEtcXfmxb/total.do?" + params, ajaxConf); }

contro

@FunctionDesc("统计")
	@ResponseBody
	@SuppressWarnings("unchecked")
	public String total(HttpServletResponse response, @RequestParam String fsrq, @RequestParam String jzrq, @RequestParam String gbrq, @RequestParam String qqwjm) {
		log.info("YwEtcXfmxbCtrler total");
		YwEtcXfmxbVO vo = new YwEtcXfmxbVO();
		vo.setQqwjm(StringUtil.formatDbNoEscapeLikeValue(qqwjm));
		if (StringUtils.isNotBlank(fsrq)) {
			vo.setFsrq(DateUtils.getFormatDateTimeStr(fsrq));
		}
		if (StringUtils.isNotBlank(jzrq)) {
			vo.setJzrq(DateUtils.getFormatDateTimeStr(jzrq));
		}
		if (StringUtils.isNotBlank(gbrq)) {
			vo.setJzrq(DateUtils.getFormatDateTimeStr(gbrq));
		}
		// 获取数据
		List> dataList = new ArrayList>();
		Map map = iYwEtcXfmxbService.findAll(vo);
		List lists = (List) map.get("data");
		double moneyNum=0;
		for (YwEtcXfmxbVO voEach : lists) {
			moneyNum+=Double.parseDouble(voEach.getXfje().toString());
		}
		String data=String.valueOf(moneyNum)+","+lists.size();
		return data;
	}

slelect


	分配情况:
	
		
	

根据url获取下拉列表





	<%-- enter键触发查询 --%>
		function onKeyEnter(e) {
			search();
		}
	@FunctionDesc("下拉菜单回显值,供用户选择")
	@ResponseBody
	public List> searchValue(String paraid) {
		List> retList = new ArrayList>();
		Map map = null;
		List list = null;
		SyzcdXtcsbVO vo = new SyzcdXtcsbVO();
		vo.setParaid(paraid);
		list = iSyzcdXtcsbService.findAllInfosByParaid(vo);
		for (int i = 0; i < list.size(); i++) {
			if (null != list.get(i)) {
				map = new HashMap();
				map.put("text", list.get(i).getParanm() == null ? "" : list.get(i).getParaval().trim() + "-" + list.get(i).getParanm().trim());
				map.put("id", list.get(i).getParaval() == null ? "" : list.get(i).getParaval().trim());
				retList.add(map);
			}
		}
		return retList;
	}

格式化时间

	/* 格式化时间 */
		function format() {
			var formData = form.getData();
			formData.starttime = $J.getbyName("starttime").getFormValue();
			formData.endtime = $J.getbyName("endtime").getFormValue();
			return formData;
		}

find与findall

普元nui:demo_第1张图片

普元nui:demo_第2张图片

ajax

ajaxConf.setSuccessFunc(false);
ajaxConf.setSuccessFunc(refresh);
ajaxConf.setIsShowSuccMsg(false);
$J.postByAjax(null, "login/isReachMaxSessions.do", ajaxConf);

间隙调整


visible="true"显示

a标签字符串

'授信结果录入  '
"javascript:onSchedule('all')" 

遮罩

function ableall() {
			var inputarr = document.getElementsByTagName("input");
			for (var i = 0; i < inputarr.length; i++) {
				$J.getbyName(inputarr[i].name).disable();
			}
		}
div {
	width: 100%;
	height: 100%;
	position: fixed;
	top: 0;
	left: 0;
	background: rgba(250, 250, 250, 0);
}

input {
	background-color: #e3e3e3;
}

时间格式

function search() {
			var formData = form.getData();
			formData.fristintime = $J.getbyName("fristintime").getFormValue();
			grid.load(formData);
		}

 

 

你可能感兴趣的:(Work)