会议排座
思路
- 会议排座插件介绍
- 会议排座功能开发
- 送审功能开发
MeetingInfoDao.java
// 根据会议ID更新会议的排座图片 public int updateSeatPicById(MeetingInfo info) throws Exception { String sql="update t_oa_meeting_info set seatPic=? where id=?"; return super.executeUpdate(sql, info, new String[] {"seatPic","id"}); } // 根据会议ID查询相关用户 public List<User> queryUserByMeetingId(Long meetingId) throws Exception{ String sql="select * from t_oa_user where FIND_IN_SET(id," + "(select concat(canyuze,',',liexize,',',zhuchiren) " + "from t_oa_meeting_info where id="+meetingId+"))"; return super.executeQuery(sql, User.class, null); }
MeetingInfoAction.java
/** * 保存排座图片到服务器的指定目录,并更新相关会议信息的排座图片字段 * @param req * @param resp */ public void addArrangeSeat(HttpServletRequest req, HttpServletResponse resp) { try { String fName = UUID.randomUUID().toString().replace("-", "").concat(".jpg"); String path = "D:\\temp\\images\\seatPic\\uploads\\" + fName; String base64Image = meetinginfo.getSeatPic().replace("data:image/png;base64,", ""); //生成图片 Base64ImageUtils.GenerateImage(base64Image, path); //更新会议信息表中的排座信息,需要设置tomcat的设置增加一个扩展web模块 meetinginfo.setSeatPic("/uploads/"+fName); service.updateSeatPicById(meetinginfo); CommonUtil.sendResponse(0, "排座成功", resp); } catch (Exception e) { e.printStackTrace(); CommonUtil.sendResponse(-1, "排座失败", resp); } }
resource.properties
String path = "D:\\temp\\images\\seatPic\\uploads\\" + fName;
在tomcat中需要配置图片映射关系
myMeeting.js
<script> let table=null; let $ = null; var row = null; let formSelects = null; let form = null; let layer = null; layui.use(['table','jquery','formSelects','form','layer'], function(){ table = layui.table; $ = layui.jquery; formSelects = layui.formSelects; form = layui.form; layer = layui.layer; loadMeetingInfo(); //查询我的会议信息 $("#queryMeetingInfo").click(function() { loadMeetingInfo(); }); //对表格的功能按钮增加事件监听,如排座,送审,反馈按钮 table.on('tool(meetingInfoTable)', function(obj) { //排座 if(obj.event == 'seat') { //对于新建或驳回状态的会议可以执行排座 if(obj.data.state == 1 || obj.data.state == 3) { openSeatPic(obj.data.id); } else { layer.msg("对于审核通过,结束,取消,进行中等状态的会议不能再执行排座") } } //送审 if(obj.event == 'send') { if(obj.data.seatPic) { //对于新建或驳回状态的会议可以送审 if(obj.data.state == 1 || obj.data.state == 3) { openSendAudit(obj.data.id); } else { layer.msg("对于审核通过,结束,取消,进行中等状态的会议不能执行送审"); } } else { layer.msg("未进行排座不能送审"); } } //查看反馈 if(obj.event == 'feedback') { openFeedbackInfo(obj.data); } }); }); function openFeedbackInfo(data) { let ignore = [0,1,2,3]; if(ignore.indexOf(data.state) >= 0) { layer.msg("对于新建、驳回、取消、待审状态下的会议,不用查看反馈"); return; } debugger; layer.open({ type: 2, //layer提供了5种层类型。可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) title:'反馈详情', area: ['600px', '650px'], //宽高 skin: 'layui-layer-rim', //样式类名 content: ctx+'/jsp/meeting/meetingFeedback.jsp?meetingId=' + data.id, btn:['关闭'], yes:function(index,layero){ layer.closeAll(); } }); } // 打开送审的对话框,执行送审 function openSendAudit(id) { let index = layer.open({ type: 1, //layer提供了5种层类型。可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) title: '送审', area: ['660px', '200px'], //宽高 skin: 'layui-layer-rim', //样式类名 content: $("#auditDiv") //送审对应的div }); //初始化送审人员选择下拉列表的数据 formSelects.data('auditPerson', 'server', { url: ctx + '/meetinginfoAction.action?methodName=listMeetingMember' }); //添加送审按钮的监听事件,发送ajax请求执行送审 form.on('submit(sendAudit)', function(data) { console.log(data); data.field["id"] = id; console.log(data); $.ajax({ url: ctx + '/meetinginfoAction.action?methodName=sendAudit', data: data.field, type: 'post', dataType: 'json', success: function(resp) { layer.msg(resp.msg); layer.close(index); //送审成功,更新我的会议列表 loadMeetingInfo(); } }) }); } //会议排座 function openSeatPic(id) { row = null; layer.open({ type: 2, //layer提供了5种层类型。可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) title: '会议排座', area: ['660px', '350px'], //宽高 skin: 'layui-layer-rim', //样式类名 content: ctx+'/jsp/meeting/seatPic.jsp?id='+id }); }; //查询会议信息 function loadMeetingInfo() { table.render({ elem: '#meetingInfoTable', url: ctx + '/meetinginfoAction.action?methodName=listMeetingInfo', cols: [[ {field:'id', width:60, title: 'ID'}, {field:'title', width:180, title: '会议标题', sort: true}, {field:'location', width:180, title: '会议地点', sort: true}, {field:'startTime', width:160, title: '开始时间'}, {field:'endTime', width:160, title: '结束时间'}, {field:'meetingState', width:180, title: '会议状态'}, //显示排座图片 {field: 'seatPic', title: '会议排座', width: 180, templet:function(d){ if(null==d.seatPic) return "尚未排座"; else return "<img height='180px' src='"+d.seatPic+"'/>"; } }, {field: '', title: '操作', width: 250, toolbar:'#toolbar'} ]], page: true, request: { pageName: 'page', limitName: 'rows' }, method: 'post', where: { title: $("#title").val() }, loading: true, }); } </script>