Files
SIPAIIS_WMS_JSSW/bin/WebRoot/jsp/user/userEdit.jsp

181 lines
5.2 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
<title></title>
<jsp:include page="../inc.jsp"></jsp:include>
<script type="text/javascript">
function dosave(dialog,grid) {
if ($(".form").form('validate')) {
$.post(ext.contextPath + "/user/updateUser.do", $(".form").serialize(), function(data) {
if (data.res == 1) {
var resmsg="";
//保存职位
var jobval = String($('#_jobs').combobox('getValues'));
$.post(ext.contextPath + "/user/updateJobByUserid.do",{jobstr:jobval,userid:data.id,unitid:$('#pid').val()},function(data1){
if(data1<0){
resmsg="职位保存失败 ";
}
});
//保存权限
var val = String($('#_roles').combobox('getValues'));
$.post(ext.contextPath + "/user/updateRoleUser.do",{rolestr:val,userid:data.id},function(data1){
if(data1<0){
resmsg+="权限保存失败";
}
});
if(resmsg.indexOf("失败")>0){
top.$.messager.alert('提示', resmsg, 'info');
}else{
top.$.messager.alert('提示', "保存成功", 'info',function(){
grid.datagrid('reload');
dialog.dialog('destroy');
});
}
}else if(data.res == 0){
top.$.messager.alert('提示', "保存失败", 'info');
}else{
top.$.messager.alert('提示', data.res, 'info');
}
},'json');
}
}
function initroles(){
var roleids = "";
<c:forEach var="role" items="${user.roles}">
roleids+="${role.id},";
</c:forEach>
$('#_roles').combobox('setValues',roleids.replace(/,$/g,""));
}
function initjobs(){
var jobids = "";
<c:forEach var="job" items="${user.jobs}">
if("${job.id}"!=""){
jobids+="${job.id},";
}
</c:forEach>
if(jobids!=""){
$('#_jobs').combobox('setValues',jobids.replace(/,$/g,""));
}
}
$(function() {
$('#pname').combotree({
url : ext.contextPath + '/user/getUnitsJson.do?random=' + Math.random(),
parentField : 'pid',
method:'get',
onBeforeSelect:function(node){
if(node.id=="-1"){
$("#pname").tree("unselect");
}
},
onClick : function(node) {
$("#pid").val(node.id);
}
});
$('#_jobs').combobox({
url:ext.contextPath + '/user/getJsonJob.do',
valueField:'id',
textField:'name',
multiple:true,
editable:false,
onLoadSuccess:function(){
initjobs();
}
});
$('#_roles').combobox({
url:ext.contextPath + '/user/getJsonRole.do',
valueField:'id',
textField:'name',
required:true,
multiple:true,
editable:false,
onLoadSuccess:function(){
initroles();
}
});
});
</script>
</head>
<body>
<form method="post" class="form">
<input type="hidden" name="id" value="${user.id }"/>
<table class="table">
<tr>
<th>名称</th>
<td><input name="name" class="easyui-textbox"
data-options="required:true,validType:'isBlank'" value="${user.name}" /></td>
</tr>
<tr>
<th>姓名</th>
<td><input name="caption" class="easyui-textbox"
data-options="required:true,validType:'isBlank'" value="${user.caption}" /></td>
</tr>
<tr>
<th>工号</th>
<td><input name="serial" class="easyui-textbox" value="${user.serial}" /></td>
</tr>
<tr>
<th>卡号</th>
<td><input name="cardid" class="easyui-textbox" value="${user.cardid}" /></td>
</tr>
<tr>
<th>性别</th>
<td>
<select name="sex" class="easyui-combobox" data-options="panelHeight:'auto',editable:false">
<option value="">请选择</option>
<option value="1" <c:if test="${user.sex=='1'}">selected</c:if>>男</option>
<option value="0" <c:if test="${user.sex=='0'}">selected</c:if>>女</option>
</select>
</td>
</tr>
<tr>
<th>部门</th>
<td>
<input id="pname" name="pname" class="easyui-combotree" value="${user._pname}" />
<input id="pid" name="pid" type="hidden" value="${user.pid}"/>
</td>
</tr>
<tr>
<th>职位</th>
<td>
<input id="_jobs" name="_jobs" class="easyui-combobox" value="" />
</td>
</tr>
<tr>
<th>手机</th>
<td><input name="mobile" class="easyui-textbox" value="${user.mobile}" /></td>
</tr>
<tr>
<th>权限</th>
<td>
<input id="_roles" name="_roles" class="easyui-combobox" style="width:300px" value=""/>
</td>
</tr>
<tr>
<th>用户状态</th>
<td>
<select name="active" class="easyui-combobox" data-options="panelHeight:'auto',editable:false">
<option value="1">启用</option>
<option value="0" <c:if test="${user.sex=='0'}">selected</c:if>>禁用</option>
<option value="3" <c:if test="${user.sex=='3'}">selected</c:if>>离职</option>
<option value="2" <c:if test="${user.sex=='2'}">selected</c:if>>退休</option>
</select>
</td>
</tr>
<tr>
<th>顺序</th>
<td><input name="morder" class="easyui-textbox" value="${user.morder}" /></td>
</tr>
</table>
</form>
</body>
</html>