案例效果
将选中数据推送给指定人员
实现思路
在列表上加点击按钮
在按钮中注册点击事件,写弹出选人事件
选择完人确认后,获取到数据拼接好格式,传入后台进行业务操作,存入一张表中
在另外一个列表上可以进行撤销,把选中的数据传入后台在中间表删除即可
操作步骤
1、首先在列表上创建传递人按钮,撤销按钮
2、在传递人按钮上注册点击事件,并写弹出选人事件
3、在撤销按钮中注册点击事件
4、后端代码示例
相关代码
传递人按钮
function(btn,event,eOpts){
//弹出选人框
JE.selectWin({
title: '部门',
configInfo: 'JE_CORE_DEPTUSER,,,M',
type: 'tree',
valueType:'id',
//params: {"PDID":pdid,"FUNCCODE":funccode},
callback: (sels,oldVal,sswin) => {
//sels,选择的数据都在里面
var length = sels.length;
if(length!=0){
var array = new Array();
//遍历选择的数据,把数据主键ID放入集合中
for(var num = 0;num<length;num++){
var rows = sels[num];
array.push(rows.data.bean.ID);
}
var personIds = "";
//把集合拼接成字符串ID
Ext.each(array,function(item,index){
if(JE.isEmpty(personIds)){
personIds = "'"+item+"'";
}else{
personIds += ",'"+item+"'";
}
});
debugger;
var grid = btn.up("jegridview");
var funcCode = grid.funcData.info.funcCode; //功能编码
var tableName = grid.funcData.info.tableName; //获取表名
var pkName = grid.funcData.info.pkName; //获取当前表主键
var ids = grid.getSelectIds(); //获取选中数据ID
var array = tableName.split("_");
var table = array[array.length-1]; //获取表后缀
var bt = table + "_BT"; //拼接标题字段
var mjCode = table + "_MIJI_CODE"; //拼接密级CODE
var mjName = table + "_MIJI_NAME"; //拼接密级NAME
var paramIds = "";
Ext.each(ids,function(item,index){
if(JE.isEmpty(paramIds)){
paramIds = "'"+item+"'";
}else{
paramIds += ",'"+item+"'";
}
});
var obj = JE.ajax({
url:'/je/sendfile/sendPerson',
params:{funcCode:funcCode,tableName:tableName,pkName:pkName,ids:paramIds,bt:bt,mjCode:mjCode,mjName:mjName,personIds:personIds}
});
if(obj.success){
JE.msg('特送给指定人成功');
grid.load();
}else{
JE.alert('失败,请联系管理员');
}
}
}
})
}
撤销按钮
function(btn,event,eOpts){
var grid = btn.up("jegridview");
var ids = grid.getSelectIds(); //获取选中数据ID
var paramIds = "";
//把选中数据的ID,拼接成字符串传入后台
Ext.each(ids,function(item,index){
if(JE.isEmpty(paramIds)){
paramIds = "'"+item+"'";
}else{
paramIds += ",'"+item+"'";
}
});
var obj = JE.ajax({
url:'/je/recycle/restorePublic',
params:{ids:paramIds}
});
if(obj.success){
JE.msg('还原成功!');
grid.load();
}else{
JE.alert('失败,请联系管理员');
}
}
后端调用代码
/**
* 传递
*/
@Controller
@RequestMapping(value = "/je/sendfile")
public class SendFileController extends AbstractDynaController {
/**
* 传递给指定人
*/
@RequestMapping(
value = {"/sendPerson"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
public void sendPerson(MethodArgument param) {
HttpServletRequest request = param.getRequest();
String funcCode = request.getParameter("funcCode"); //功能编码
String tableName = request.getParameter("tableName"); //表编码
String pkName = request.getParameter("pkName"); //表主键编码
String ids = request.getParameter("ids"); //选中数据集合
String bt = request.getParameter("bt"); //标题字段编码
String mjCode = request.getParameter("mjCode"); //密级CODE
String mjName = request.getParameter("mjName"); //密级NAME
String personIds = request.getParameter("personIds"); //特送给的人userId
String[] personArray = personIds.split(","); //讲特送人分隔成数组
//查询出所有的业务数据
List<DynaBean> dynaBeanList = serviceTemplate.selectList(tableName, " and "+pkName+" in ("+ids+")");
for(DynaBean db : dynaBeanList){
//特送记录插入数据
DynaBean jlBean = new DynaBean("OA_SEND_RECORD", true);
jlBean.set("RECORD_BT", db.get(bt)); //标题
jlBean.set("RECORD_WJ", funcCode); //文件类型
jlBean.set("RECORD_MIJI_CODE", db.get(mjCode)); //密级CODE
jlBean.set("RECORD_MIJI_NAME", db.get(mjName)); //密级NAME
jlBean.set("RECORD_YWZJID", db.get(pkName)); //业务主键ID
jlBean.set("RECORD_YWZJBM", pkName); //业务主键编码
jlBean.set("RECORD_YWB", tableName); //业务表
serviceTemplate.buildModelCreateInfo(jlBean);
serviceTemplate.insert(jlBean);
for(String str : personArray){
//特送文件插入数据
DynaBean tsBean = new DynaBean("OA_SENDFILE", true);
tsBean.set("SENDFILE_BT", db.get(bt)); //标题
tsBean.set("SENDFILE_WJ", funcCode); //文件类型
tsBean.set("SENDFILE_MIJI_CODE", db.get(mjCode)); //密级CODE
tsBean.set("SENDFILE_MIJI_NAME", db.get(mjName)); //密级NAME
tsBean.set("SENDFILE_YWBZJZ", db.get(pkName)); //业务主键ID
tsBean.set("SENDFILE_YWBZJBM", pkName); //业务主键编码
tsBean.set("SENDFILE_YWB", tableName); //业务表
tsBean.set("SENDFILE_TSRID", str); //特送人ID
//查询出用户
DynaBean userDynaBean = serviceTemplate.selectOne("JE_CORE_ENDUSER", " AND USERID = "+str+"");
tsBean.set("SENDFILE_TSR", userDynaBean.get("USERNAME")); //特送人NAME
tsBean.set("OA_SEND_RECORD_ID", jlBean.get("OA_SEND_RECORD_ID")); //特送记录主键ID
serviceTemplate.buildModelCreateInfo(tsBean);
serviceTemplate.insert(tsBean);
}
}
toWrite(jsonBuilder.returnSuccessJson("\"特送给指定人成功!\""), request, param.getResponse());
}
/**
* 撤销传递
*/
@RequestMapping(
value = {"/revocationPerson"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
public void revocationPerson(MethodArgument param) {
HttpServletRequest request = param.getRequest();
String ids = request.getParameter("ids"); //选中数据集合
long l = serviceTemplate.deleteByWehreSql("OA_SENDFILE", " and OA_SENDFILE_ID in ("+ids+")");
toWrite(jsonBuilder.returnSuccessJson("\"撤销特送成功!\""), request, param.getResponse());
}
}
关键字,相关问题
- 数据推送
- 指定人员
最后编辑: admin 文档更新时间: 2024-08-21 10:58 作者:肖海杰