Commit b3b4931b by 陈玉兰

提交选择部门

parent 162cdb05
......@@ -14,6 +14,7 @@
<value>classpath:com/gaowj/business/procdefinitionInitlink/procdefinitionInitlinkDAO.xml</value>
<value>classpath:com/gaowj/business/procinstance/procinstanceDAO.xml</value>
<value>classpath:com/gaowj/business/procdefiChooseUser/procdefiChooseUserDAO.xml</value>
<value>classpath:com/gaowj/business/procdefiChooseDept/procdefiChooseDeptDAO.xml</value>
</list>
</property>
</bean>
......@@ -50,6 +51,10 @@
<property name="mapperInterface" value="com.gaowj.business.procdefiChooseUser.procdefiChooseUserDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<bean id="procdefiChooseDeptDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.procdefiChooseDept.procdefiChooseDeptDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-process" />
</bean>
<!-- DAO定义结束 -->
<bean id="FormtableBusiness" class="com.gaowj.business.formtable.FormtableBusinessImpl">
......@@ -105,4 +110,8 @@
<bean id="ProcdefiChooseUserBusiness" class="com.gaowj.business.procdefiChooseUser.ProcdefiChooseUserBusinessImpl">
<property name="procdefiChooseUserDAO" ref="procdefiChooseUserDAO"></property>
</bean>
<bean id="ProcdefiChooseDeptBusiness" class="com.gaowj.business.procdefiChooseDept.ProcdefiChooseDeptBusinessImpl">
<property name="procdefiChooseDeptDAO" ref="procdefiChooseDeptDAO"></property>
</bean>
</beans>
......@@ -307,3 +307,6 @@
.icon-ext-05_29{
background:url('../../../../images/icons/(05,29).png') no-repeat left center;
}
.icon-ext-02_22{
background:url('../../../../images/icons/(02,22).png') no-repeat left center;
}
\ No newline at end of file
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<style>
.departmentTab_table{
font-size:0px;
}
.departmentTab_table>div{
display: inline-block;
font-size:12px;
height:350px;
}
.departmentTab_table>div:first-child{
width:45%;
}
.departmentTab_table>div:first-child+div{
width:10%;
vertical-align: top;
padding-top:30px;
}
.departmentTab_table>div:first-child+div>div{
cursor: pointer;
text-align: center;
}
.departmentTab_table>div:first-child+div>div:hover{
color:red;
}
.departmentTab_table>div:first-child+div+div{
width:45%;
}
</style>
<div id="DepartmentTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<div class="departmentTab_table">
<div>
<table id="list1" style="width: 100%; height: 100%;"></table>
</div>
<div>
<div onclick="chooseDepartment()">--></div>
<div onclick="cancelChooseDepartment()"><--</div>
</div>
<div>
<table id="list2" style="width: 100%; height: 100%;"></table>
</div>
</div>
<div id="tb1">
</div>
<div id="tb2">
</div>
<script type="text/javascript" src="${ctx}/process/pages/procdefinition/js/departmentTab.js" charset="utf-8"></script>
\ No newline at end of file
/**
* 序号:1
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义附件关联模块ID(1:一般业务,2:测试信息,3:审批业务,999:其它数据 )
var ls_module_id='2';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW';
//列表加载完成回调
function dataOnLoadSuccess(){
}
//设置颜色和每行高度
function rowstyler(index,row){
}
$(function(){
//展示列表
/*datagridLog("list1", ls_title, gaowj.WEB_APP_NAME + "/systemdata_listSysUser", queryData, is_column, 60, 80);
datagridLog("list2", ls_title, gaowj.WEB_APP_NAME + "/systemdata_listSysUser", queryData, is_column, 60, 80);*/
var linkId=$.getUrlParam("procdef_linkId");
$('#list1').datagrid({
title:'部门',
iconCls:$.getJwWindowPic(),
url:gaowj.WEB_APP_NAME + "/systemdata_listSysRole",
queryParams : queryData,//查询参数
rownumbers : true,//显示索引号
singleSelect : false,//是否多选
fitColumns : false,//是否撑满
autoRowHeight : false,//设定高度
rowStyler :function(index,row){return rowstyler(index,row);},
pagination : true,//分页显示
pageSize : rows,//显示行数
pageList : listPageSize,//条数选择
striped : true, //是否隔行显示
remoteSort : false,//是否从服务器排序
frozenColumns : [[
{
field : 'ck',
checkbox : true
}
]],
columns : [ [
{field : 'DPT_NAME',title : '部门名称',width : 300,align : 'center'}
] ],
toolbar : '#tb1',
onLoadSuccess : function() {
dataOnLoadSuccess();
}
});
$('#list2').datagrid({
title:'部门',
iconCls:$.getJwWindowPic(),
url:gaowj.WEB_APP_NAME + "/procdefinitionData_getChooseDeparment?key_id="+linkId,
queryParams : queryData,//查询参数
rownumbers : true,//显示索引号
singleSelect : false,//是否多选
fitColumns : false,//是否撑满
autoRowHeight : false,//设定高度
rowStyler :function(index,row){return rowstyler(index,row);},
pagination : true,//分页显示
pageSize : rows,//显示行数
pageList : listPageSize,//条数选择
striped : true, //是否隔行显示
remoteSort : false,//是否从服务器排序
frozenColumns : [[
{
field : 'ck',
checkbox : true
}
]],
columns : [ [
{field : 'DPT_NAME',title : '用户名称',width : 300,align : 'center'}
] ],
toolbar : '#tb2',
onLoadSuccess : function() {
dataOnLoadSuccess();
}
});
})
function chooseDepartment(){
var is_row = $('#list1').datagrid('getSelections');
$.each(is_row,function(index,value) {
$('#list2').datagrid('appendRow',is_row[index]);
});
}
function cancelChooseDepartment(){
var is_row = $('#list2').datagrid('getSelections');
$.each(is_row,function(index,value) {
var index = $('#list2').datagrid('getRowIndex',value);
$('#list2').datagrid('deleteRow',index);
});
}
function saveDepartment(key_id){
var map={};
var arr="";
var is_row = $('#list2').datagrid('getRows');
for(var i=0;i<is_row.length;i++){
arr = arr + is_row[i].DPT_NO+",";
}
$.ajax({
url:gaowj.WEB_APP_NAME + "/procdefinitionAct_saveDepartment",
data:{
KEY_ID:key_id,
DEPT_IDS:arr
},
success:function(){
}
})
}
\ No newline at end of file
......@@ -72,14 +72,15 @@ function formatMenu(value, data,index) {
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
var returnData= "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"memberRow('"
+ index + "')\">人员</a> ";
var returnData= "<span class=\"icon-ext-02_22\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"memberRow('"
+ index + "')\">人员</a> |<span class=\"icon-ext-09_20\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"departmentRow('"
+ index + "')\">部门</a> ";
return returnData;
}
//返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){
var is_menu_count = 1;
var is_menu_count = 2;
return is_menu_count;
}
......@@ -120,3 +121,44 @@ function memberRow(index){
}
});
}
function departmentRow(index){
//systemdata_listSysRole
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'insert';
$('#people').dialog( {
title : '选择人员',
iconCls : $.getJwWindowPic(),
width : ls_width * 0.65,
height :ls_height * 0.95,
closed : false,
cache : false,
maximizable:true,
left:0,
top:0,
content : '<iframe scrolling="yes" id="chooseDepartmentIframe" frameborder="0" src="procdefinitionView_departmentTab?procdef_linkId='+is_row[0].UUID+'" style="width:100%;height:98%;"></iframe><span id="return_text"></span>',
queryParams:is_row[0],
modal : true,
buttons : [{
text : '保存',
iconCls : 'icon-save',
handler : function() {
document.getElementById("chooseDepartmentIframe").contentWindow.saveDepartment(is_row[0].UUID);
$('#people').dialog('close');
}
} ,{
text : '关闭',
iconCls : 'icon-back',
handler : function() {
$('#people').dialog('close');
}
} ],
onClose: function () {
closeCallback(is_row);
}
});
}
\ No newline at end of file
package com.gaowj.business;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface ProcdefiChooseDeptBusiness {
void insert_procdefi_chooseDept(Map<String, Object> entity) throws BusinessException;
Page<Map<String, Object>> list_procdefi_chooseDept(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_procdefi_chooseDept(Map<String, Object> entity) throws BusinessException;
void delete_procdefi_chooseDept_byKeyId(String key_id) throws BusinessException;
}
package com.gaowj.business.procdefiChooseDept;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.ProcdefiChooseDeptBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil;
public class ProcdefiChooseDeptBusinessImpl implements
ProcdefiChooseDeptBusiness {
private procdefiChooseDeptDAO procdefiChooseDeptDAO;
public procdefiChooseDeptDAO getProcdefiChooseDeptDAO() {
return procdefiChooseDeptDAO;
}
public void setProcdefiChooseDeptDAO(procdefiChooseDeptDAO procdefiChooseDeptDAO) {
this.procdefiChooseDeptDAO = procdefiChooseDeptDAO;
}
@Override
public void insert_procdefi_chooseDept(Map<String, Object> entity)
throws BusinessException {
// TODO Auto-generated method stub
if (entity.get("UUID") == null) {
entity.put("UUID", java.util.UUID.randomUUID().toString());
}
if (entity.get("CREATE_TIME") == null) {
entity.put("CREATE_TIME", new Date());
}
if (entity.get("CREATE_ID") == null) {
entity.put("CREATE_ID", SessionUtil.getCode());
}
if (entity.get("UPDATE_ID") == null) {
entity.put("UPDATE_ID", SessionUtil.getCode());
}
if (entity.get("UPDATE_TIME") == null) {
entity.put("UPDATE_TIME", new Date());
}
// 动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
}
procdefiChooseDeptDAO.insert_procdefi_chooseDept(entity);
entity.clear();
}
@Override
public Page<Map<String, Object>> list_procdefi_chooseDept(int pageNo,
int pageSize, Map<String, Object> query) throws BusinessException {
// TODO Auto-generated method stub
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
List<Map<String, Object>> items = procdefiChooseDeptDAO.list_procdefi_chooseDept(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
int count = procdefiChooseDeptDAO.listCount_procdefi_chooseDept(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_procdefi_chooseDept(
Map<String, Object> entity) throws BusinessException {
// TODO Auto-generated method stub
return procdefiChooseDeptDAO.list_procdefi_chooseDept(entity);
}
@Override
public void delete_procdefi_chooseDept_byKeyId(String key_id)
throws BusinessException {
// TODO Auto-generated method stub
procdefiChooseDeptDAO.delete_procdefi_chooseDept_byKeyId(key_id);
}
}
package com.gaowj.business.procdefiChooseDept;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface procdefiChooseDeptDAO {
void insert_procdefi_chooseDept(Map<String, Object> entity) throws BusinessException;
void update_procdefi_chooseDept(Map<String, Object> entity) throws BusinessException;
void delete_procdefi_chooseDept(List<String> list) throws BusinessException;
List<Map<String, Object>> list_procdefi_chooseDept(RowBounds rowbounds, Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_procdefi_chooseDept(Map<String, Object> query) throws BusinessException;
int listCount_procdefi_chooseDept(Map<String, Object> query) throws BusinessException;
void delete_procdefi_chooseDept_byKeyId(String key_id) throws BusinessException;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaowj.business.procdefiChooseDept.procdefiChooseDeptDAO">
<sql id="Where_Clause">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="KEY_ID != null and KEY_ID != ''">
and f.KEY_ID = #{KEY_ID}
</if>
</trim>
</sql>
<insert id="insert_procdefi_chooseDept" parameterType="map">
insert into C_T_PROC_CHOOSE_DEPT(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_procdefi_chooseDept" parameterType="map">
<![CDATA[
update C_T_PROC_CHOOSE_DEPT set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="UUID != null and UUID != ''">
and UUID = #{UUID}
</if>
</where>
</update>
<delete id="delete_procdefi_chooseDept" parameterType="list">
<![CDATA[
delete from C_T_PROC_CHOOSE_DEPT where UUID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<select id="list_procdefi_chooseDept" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.* ,
U.`DPT_NAME`,
U.`DPT_NO`
from C_T_PROC_CHOOSE_DEPT f
LEFT JOIN LCYQ_SYSTEM.C_T_SYS_DEPARTMENT U ON U.`DPT_NO`=f.`DEPT_ID`
]]>
<include refid="Where_Clause" />
order by f.CREATE_TIME DESC
</select>
<select id="listCount_procdefi_chooseDept" parameterType="map"
resultType="int">
<![CDATA[
select count(*) c from C_T_PROC_CHOOSE_DEPT f
]]>
<include refid="Where_Clause" />
</select>
<delete id="delete_procdefi_chooseDept_byKeyId" parameterType="String">
<![CDATA[
delete from C_T_PROC_CHOOSE_DEPT where KEY_ID = #{KEY_ID}
]]>
</delete>
</mapper>
\ No newline at end of file
......@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gaowj.business.ProcdefiChooseDeptBusiness;
import com.gaowj.business.ProcdefiChooseUserBusiness;
import com.gaowj.business.ProcdefinitionBusiness;
import com.gaowj.business.ProcdefinitionInitLinkBusiness;
......@@ -180,4 +181,35 @@ public class actAction extends BasicAction {
}
return "json";
}
public String saveDepartment()throws BusinessException{
ProcdefiChooseDeptBusiness business=BusinessManager.getBusiness(ProcdefiChooseDeptBusiness.class);
Map<String, Object> entity=new HashMap<String, Object>();
String KEY_ID=RequestUtils.getString(request, "KEY_ID");
String IDS=RequestUtils.getString(request, "DEPT_IDS");
List<String> ListKey = QueryParamUtil.StringToList(IDS);
entity.put("KEY_ID", KEY_ID);
List<Map<String, Object>> result=business.list_procdefi_chooseDept(entity);
if(result.size()==0&&ListKey.size()>0){
Map<String, Object> params=new HashMap<String, Object>();
for(int i=0;i<ListKey.size();i++){
params.put("KEY_ID", KEY_ID);
params.put("DEPT_ID", ListKey.get(i));
business.insert_procdefi_chooseDept(params);
}
}
if(result.size()>0&&ListKey.size()==0){
business.delete_procdefi_chooseDept_byKeyId(KEY_ID);
}
if(result.size()>0&&ListKey.size()>0){
business.delete_procdefi_chooseDept_byKeyId(KEY_ID);
Map<String, Object> params=new HashMap<String, Object>();
for(int i=0;i<ListKey.size();i++){
params.put("KEY_ID", KEY_ID);
params.put("DEPT_ID", ListKey.get(i));
business.insert_procdefi_chooseDept(params);
}
}
return "json";
}
}
......@@ -9,6 +9,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gaowj.business.ProcdefiChooseDeptBusiness;
import com.gaowj.business.ProcdefiChooseUserBusiness;
import com.gaowj.business.ProcdefinitionBusiness;
import com.gaowj.business.ProcdefinitionInitLinkBusiness;
......@@ -208,4 +209,30 @@ public class dataAction extends BasicAction{
return "json";
}
public String getChooseDeparment()throws BusinessException{
ProcdefiChooseDeptBusiness business =BusinessManager.getBusiness(ProcdefiChooseDeptBusiness.class);
Map<String, Object> query=new HashMap<String, Object>();
query.put("KEY_ID", RequestUtils.getString(request, "key_id"));
Page<Map<String, Object>> pageRows=business.list_procdefi_chooseDept(pageNo, pageSize, query );
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
try {
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
jsonObject.putAll(Status.getStatusSuccessMessage("成功"));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
jsonObject.putAll(Status.getStatusSuccessMessage("失败"));
}
return "json";
}
}
......@@ -24,4 +24,8 @@ public class viewAction extends BasicAction {
public String peopleTab() throws BusinessException{
return "peopleTab";
}
public String departmentTab() throws BusinessException{
return "departmentTab";
}
}
Markdown is supported
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