Commit 2fb4195f authored by 乾坤平台's avatar 乾坤平台 Committed by 季圣华
Browse files

!35 添加选择人员的功能

Merge pull request !35 from 乾坤平台/master
parents 85d5098d 72e088c6
......@@ -99,4 +99,7 @@
}
.icon-basket_add{
background:url('icons/basket_add.png') no-repeat center center;
}
.icon-user{
background:url('icons/user.png') no-repeat center center;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@
<title>ERP系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=8" >
<meta name="referrer" content="Webkit">
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<link type="text/css" rel="stylesheet" href="/css/css.css"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
......
......@@ -80,8 +80,11 @@
<td>负责人</td>
<td style="padding:5px">
<input name="principalName" id="principalName"
style="width: 230px;height: 20px" readonly="readonly"/>
style="width: 175px;height: 20px" readonly="readonly"/>
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectUser">
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
<input name="principal" id="principal" type="hidden"/>
<input name="selectType" id="selectType" type="hidden"/>
</td>
</tr>
<tr>
......@@ -104,6 +107,9 @@
<a href="javascript:void(0)" id="cancelDepot" class="easyui-linkbutton" iconCls="icon-cancel"
onclick="javascript:$('#depotDlg').dialog('close')">取消</a>
</div>
<div id="forSelectUserDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
closed="true" modal="true" cache="false" collapsible="false" closable="true">
</div>
<script type="text/javascript">
//初始化界面
......@@ -164,7 +170,7 @@
formatter: function (value, rec) {
var str = '';
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.sort + 'AaBb' + rec.remark + 'AaBb'
+ rec.address + 'AaBb' + rec.warehousing + 'AaBb' + rec.truckage+ transferUndefined(rec.principalName)+transferUndefined(rec.principal);
+ rec.address + 'AaBb' + rec.warehousing + 'AaBb' + rec.truckage+'AaBb'+ transferUndefined(rec.principalName)+'AaBb'+transferUndefined(rec.principal);
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepot(\'' + rowInfo + '\');"/>&nbsp;&nbsp;&nbsp;';
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepot(' + rec.id + ');"/>';
return str;
......@@ -324,7 +330,7 @@
$(".window-mask").css({width: webW, height: webH});
$('#depotFM').form('clear');
$("#name").focus();
$("#selectType").val("principal");
oldDepot = "";
depotID = 0;
url = '/depot/add';
......@@ -370,7 +376,9 @@
$("#address").val(depotInfo[4]);
$("#warehousing").val(depotInfo[5]);
$("#truckage").val(depotInfo[6]);
$("#principalName").val(depotInfo[7]);
$("#principal").val(depotInfo[8]);
$("#selectType").val("principal");
oldDepot = depotInfo[1];
$('#depotDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑仓库信息');
$(".window-mask").css({width: webW, height: webH});
......@@ -486,6 +494,19 @@
parent.addTab(currentRow[0].id + "单元", "/pages/materials/building.jsp?ProjectId=" + currentRow[0].id, "");
});
//查询负责人信息
$("#lookForSelectUser").on("click", function () {
$('#forSelectUserDlg').dialog({
title: '负责人选择',
width: webW/2,
height: webH/2,
closed: false,
cache: false,
href: '/pages/manage/user_forselect.html',
modal: true,
resizable:true
});
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -116,6 +116,7 @@
var url;
//初始化界面
$(function () {
var id=$("#id").val();
var treeHeight=webH-35;
//初始化系统基础信息
$('#tableData').datagrid({
......@@ -142,7 +143,7 @@
});
$('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>");
$('#tt').tree({
url: '/organization/getOrganizationTree',
url: '/organization/getOrganizationTree?id='+id,
animate: true,
checkbox: true,
onDblClick: function(node){
......
......@@ -23,8 +23,9 @@
<script type="text/javascript">
$(function () {
var id=$("#id").val();
$('#ttForSelect').tree({
url: '/organization/getOrganizationTree',
url: '/organization/getOrganizationTree?id='+id,
animate: true,
onDblClick: function (node) {
//双击修改
......
......@@ -70,6 +70,8 @@
<input name="orgaId" id="orgaId" type="hidden"/>
<input name="selectType" id="selectType" type="hidden"/>
<input name="orgaUserRelId" id="orgaUserRelId" type="hidden"/>
<!--一个兼容input框,没有实际用处,但是必须存在-->
<input name="id" id="id" type="hidden"/>
</div>
<div class="fitem" style="padding:5px">
<label id="userBlngOrgaDsplSeqLabel">用户排序&nbsp;&nbsp;</label>
......
<!DOCTYPE html>
<html>
<head>
<title>机构选择</title>
<meta charset="utf-8">
<!-- 指定以IE8的方式来渲染 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/icon.css"/>
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/common/common.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div>
<ul id="ttForSelect"></ul>
</div>
<script type="text/javascript">
$(function () {
$('#ttForSelect').tree({
url: '/user/getOrganizationUserTree',
animate: true,
onDblClick: function (node) {
//双击修改
forSelectUser(node);
}
});
function forSelectUser(node) {
var selectType=$("#selectType").val();
console.log(node);
if(!node.attributes.type){
return;
}
if(selectType=='principal'){
$("#principalName").val(node.text);
$("#principal").val(node.id);
}else if(selectType=='org'){
$("#orgAbr").val(node.text);
$("#orgaId").val(node.id);
}
$('#forSelectUserDlg').dialog('close');
}
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -82,6 +82,7 @@
//初始化界面
$(function () {
var treeHeight=webH-35;
var id=$("#id").val();
//初始化系统基础信息
$('#tableData').datagrid({
height: treeHeight,
......@@ -107,7 +108,7 @@
});
$('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>");
$('#tt').tree({
url: '/materialCategory/getMaterialCategoryTree',
url: '/materialCategory/getMaterialCategoryTree?id='+id,
animate: true,
checkbox: true,
onDblClick: function(node){
......
......@@ -21,10 +21,19 @@
</div>
<script type="text/javascript">
/**
* create by: qiankunpingtai
* create time: 2019/3/14 11:41
* description:
* 为了防止当前节点选择父级目录为其子代节点造成闭环无法获取的问题
* 决定对树结构可选父级目录做一个筛选,只能为其上级目录
*
*/
$(function () {
var id=$("#id").val();
console.log(id);
$('#ttForSelect').tree({
url: '/materialCategory/getMaterialCategoryTree',
url: '/materialCategory/getMaterialCategoryTree?id='+id,
animate: true,
onDblClick: function (node) {
//双击修改
......
......@@ -83,7 +83,14 @@ public class BusinessConstants {
/**
* 商品类别根目录id
* */
public static final Long MATERIAL_CATEGORY_ROOT_ID = 1L;
/**
* create by: qiankunpingtai
* create time: 2019/3/14 11:41
* description:
* 为了使用户可以自己建初始目录,设定根目录的父级目录id为-1
*
*/
public static final Long MATERIAL_CATEGORY_ROOT_PARENT_ID = -1L;
/**
* 商品类别状态
* 0系统默认,1启用,2删除
......@@ -101,10 +108,10 @@ public class BusinessConstants {
public static final String ORGANIZATION_STCD_BUSINESS_TERMINATED = "4";
public static final String ORGANIZATION_STCD_REMOVED = "5";
/**
* 根机构编号
* 根机构编号默认为-1
* 根机构父级编号
* 根机父级构编号默认为-1
* */
public static final String ORGANIZATION_ROOT_NO = "-1";
public static final String ORGANIZATION_ROOT_PARENT_NO = "-1";
/**
* 新增用户默认密码
* */
......
......@@ -92,9 +92,9 @@ public class MaterialCategoryController {
* @return com.alibaba.fastjson.JSONArray
*/
@RequestMapping(value = "/getMaterialCategoryTree")
public JSONArray getMaterialCategoryTree() throws Exception{
public JSONArray getMaterialCategoryTree(@RequestParam("id") Long id) throws Exception{
JSONArray arr=new JSONArray();
List<TreeNode> materialCategoryTree = materialCategoryService.getMaterialCategoryTree();
List<TreeNode> materialCategoryTree = materialCategoryService.getMaterialCategoryTree(id);
if(materialCategoryTree!=null&&materialCategoryTree.size()>0){
for(TreeNode node:materialCategoryTree){
String str=JSON.toJSONString(node);
......
......@@ -95,9 +95,9 @@ public class OrganizationController {
* @return com.alibaba.fastjson.JSONArray
*/
@RequestMapping(value = "/getOrganizationTree")
public JSONArray getOrganizationTree() throws Exception{
public JSONArray getOrganizationTree(@RequestParam("id") Long id) throws Exception{
JSONArray arr=new JSONArray();
List<TreeNode> organizationTree= organizationService.getOrganizationTree();
List<TreeNode> organizationTree= organizationService.getOrganizationTree(id);
if(organizationTree!=null&&organizationTree.size()>0){
for(TreeNode node:organizationTree){
String str=JSON.toJSONString(node);
......
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -10,6 +11,8 @@ import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.datasource.vo.TreeNodeEx;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.*;
import org.slf4j.Logger;
......@@ -311,5 +314,18 @@ public class UserController {
userService.batDeleteUser(ids);
return result;
}
@RequestMapping("/getOrganizationUserTree")
public JSONArray getOrganizationUserTree()throws Exception{
JSONArray arr=new JSONArray();
List<TreeNodeEx> organizationUserTree= userService.getOrganizationUserTree();
if(organizationUserTree!=null&&organizationUserTree.size()>0){
for(TreeNodeEx node:organizationUserTree){
String str=JSON.toJSONString(node);
JSONObject obj=JSON.parseObject(str);
arr.add(obj) ;
}
}
return arr;
}
}
......@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Description
......@@ -24,8 +25,8 @@ public interface MaterialCategoryMapperEx {
@Param("name") String name,
@Param("parentId") Integer parentId);
List<TreeNode> getNodeTree();
List<TreeNode> getNextNodeTree(@Param("id") Long id);
List<TreeNode> getNodeTree(@Param("currentId")Long currentId);
List<TreeNode> getNextNodeTree(Map<String, Object> parameterMap);
int addMaterialCategory(MaterialCategory mc);
......
......@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Description
......@@ -17,8 +18,8 @@ import java.util.List;
public interface OrganizationMapperEx {
List<TreeNode> getNodeTree();
List<TreeNode> getNextNodeTree(@Param("id") Long id);
List<TreeNode> getNodeTree(@Param("currentId")Long currentId);
List<TreeNode> getNextNodeTree(Map<String, Object> parameterMap);
int addOrganization(Organization org);
......
......@@ -3,6 +3,8 @@ package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.entities.UserExample;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.datasource.vo.TreeNodeEx;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
......@@ -31,4 +33,7 @@ public interface UserMapperEx {
@Param("loginame") String loginame);
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
List<TreeNodeEx> getNodeTree();
List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
}
\ No newline at end of file
package com.jsh.erp.datasource.vo;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/13 18:11
*/
public class NodeAttributes {
//编号
private String no;
//类型
private Integer type;
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
package com.jsh.erp.datasource.vo;
import java.util.List;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/13 18:10
*/
public class TreeNodeEx {
/**
* id主键
* */
private Long id;
/**
* text显示的文本
* */
private String text;
/**
*state节点状态,'open' 或 'closed',默认:'open'。如果为'closed'的时候,将不自动展开该节点。
* */
private String state="open";
/**
*iconCls 节点图标id
* */
private String iconCls;
/**
* checked 是否被选中
* */
private boolean checked;
/**
*attributes 自定义属性
* */
private NodeAttributes attributes;
/**
* children 子节点
* */
private List<TreeNode> children;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public NodeAttributes getAttributes() {
return attributes;
}
public void setAttributes(NodeAttributes attributes) {
this.attributes = attributes;
}
public List<TreeNode> getChildren() {
return children;
}
public void setChildren(List<TreeNode> children) {
this.children = children;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment