You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

293 lines
9.7 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.wdk.WDKConstant"%>
<%@ page import="org.wdk.WDKCore"%>
<%@ page import="org.wdk.WDK"%>
<%@ page import="com.noblelift.imp.platform.module.portal.source.SessionUser"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
String WDK_ROOT = WDKCore.WDK_ROOT;
SessionUser su = (SessionUser)WDK.getSessionUser(request, response);
WDK.writeSessionUser(out, su);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>用户管理-用户新增</title>
<base href="<%=basePath%>" target="_self">
<script type="text/javascript" src="<%=WDK_ROOT%>/theme/je/core/js/wdk.js"></script>
<script type="text/javascript">
var param = $.getURLParam('param');
var _wid = $.getURLParam('wid');
var jparam = $.str2json($.urlparam_decode(param));
var _actionflag = jparam.queryParams.actionflag; //操作类型 add-新增 update-修改,读取原信息
var _account_uuid = jparam.queryParams.account_uuid;
$(function(){
//不可输入空格键:
$(".nospaceinside").on("keypress",removeAllBlank);
function removeAllBlank(e) {
if(e.keyCode == 32){
e.preventDefault();
}
}
//如果是修改,则首先查询下详细信息
if('update'==_actionflag){
$.wait_open();
$("#login_name").attr("readonly","readonly");
$.cuajax({
url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:{
_SRVNAME:'service.usr.account'
,_SRVMETHOD:'queryAccInfoByID'
,_DATA:$.json2str({
op_account_uuid:$.getSessionUser().account_id
,account_uuid:_account_uuid
})
}
,success:function(result) {
$.wait_close();
//返回值字符串转json
var jres = $.str2json(result);
if(jres.code=="1"){ //查询成功
var juser = jres.account_info;
$('#account_uuid').val(juser.account_uuid);
$('#login_name').val(juser.login_name);
$('#nickname').val(juser.nickname);
$('#mobile_phone').val(juser.mobile_phone);
$('#email').val(juser.email);
initComboTree(juser);
}else{
alert(jres.desc);
}
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}else{
initComboTree(null);
}
});
function initComboTree(jres){
//员工选择
var dataJson = {
op_account_uuid: $.getSessionUser().account_id
,parent_uuid: ''
};
var dataParam = {
_SRVNAME: 'service.uum.staff',
_SRVMETHOD: 'queryNoAccountOrgStaffTree',
_DATA: $.json2str(dataJson),
_RSFIELD: 'orgstaff_info',
_RSTYPE: 'combotree',
_RSPARAM: $.json2str({
idField: 'nodeid'
,textField: 'nodename'
,parentField: 'parentid'
,asyn:'0' //是否是异步 0:同步;1:异步
,asyn_dataField:'parentid' //如果是异步,则从url中取出的参数替换_DATA参数的名
})
};
$.combotree({
id:"user_uuid",
checkbox: false,
expandall:false,
required:true,
editable : false,
tipPosition:'bottom',
asyn:false, //false: 同步; true: 异步
multiple:false,
onlyLeafCheck:true,
url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime(),
queryParams:dataParam,
onClick:function(node){
var tree = $('#user_uuid').combotree('tree');
var parent = tree.tree('getParent', node.target);
if(node.state){
$('#depart_uuid').val("");
$('#user_uuid').combotree('setValue', '');
alert("请选择员工,不能选择部门!");
}else{
$('#depart_uuid').val(parent.id);
var dataParam = {
_SRVNAME:'service.usr.staff'
,_SRVMETHOD:'queryStaffInfoByID'
,_DATA:$.json2str({
op_account_uuid:$.getSessionUser().account_id,
person_uuid:node.id,
resultfields:''
})
}
//初始化加载数据
$.cuajax({
url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:dataParam
,success:function(result) {
var jres = $.str2json(result);
$("#nickname").val(node.text);
//加载成功
if(jres.code=="1"){
$("#mobile_phone").val(jres.staff_info.master_mobile);
$("#email").val(jres.staff_info.backup_email);
}
},
error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
},
onLoadSuccess : function(data){
if(jres){
$('#user_uuid').combotree('setValue', jres.user_uuid);
$('#user_uuid').combotree('setText', jres.user_name);
$('#user_uuid').combotree('disable');
}
}
});
}
//注册关闭按钮事件
function opt_save(){
//验证
var isok = $("#edit_form").form('validate');
if (!isok) {
alert('尚有必填项未填或填写有误,请检查后提交');
return false;
}
var value = $('#login_name').val();
var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");
if(reg.test(value)){
alert('账号名不允许存在中文字符');
return false;
}
$.wait_open();
$.cuajax({
url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:{
_SRVNAME:'service.uum.account'
,_SRVMETHOD:'save'
,_DATA:$.json2str({
op_account_uuid:$.getSessionUser().account_id
,account_info:{
account_uuid:_account_uuid
,user_uuid:$('#user_uuid').combotree('getValue')
,depart_uuid:$('#depart_uuid').val()
,nickname:$('#nickname').val()
,login_name:$('#login_name').val()
,email:$('#email').val()
,mobile_phone:$('#mobile_phone').val()
}
})
}
,success:function(result) {
$.wait_close();
//返回值字符串转json
var jres = $.str2json(result);
if(jres.code=="1"){ //操作成功
alert(jres.desc);
$.closeWin();
}else{
alert(jres.desc);
}
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
//关闭当前页面
function opt_close() {
var wid = $.getURLParam("wid");
$.closeWin(wid);
}
</script>
</head>
<body class="easyui-layout win" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="height:50px;line-height:35px;">
<div class="page-toolbar">
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-save'" onclick="opt_save()">保存</a>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-close'" onclick="opt_close()">关闭</a>
</div>
</div>
<div data-options="region:'center',border:false,collapsed:false" >
<div class="edit-container-win1">
<form id="edit_form">
<input type="hidden" id="account_uuid">
<input type="hidden" id="depart_uuid">
<div class="row">
<div class="formgroup col-12">
<label class="required">选择人员</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside nospaceinside" id="user_uuid" name="user_uuid" value=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-12">
<label class="required">账号名</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside nospaceinside" id="login_name" name="login_name" value="" data-options="required:true,validType:'length[2,100]',tipPosition:'bottom'"/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-12">
<label>账号昵称</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside nospaceinside" id="nickname" name="nickname" value="" data-options="validType:'length[0,100]',tipPosition:'bottom'"/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-12">
<label >手机</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside nospaceinside" id="mobile_phone" name="mobile_phone" value="" data-options="validType:['isTel','length[11,15]'],tipPosition:'bottom'"/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-12">
<label >邮箱</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="email" name="email" value="" data-options="validType:['email','length[0,20]'],tipPosition:'bottom'"/>
</div>
</div>
</div>
</form>
</div>
</div>
</body>
</html>