Skip to content
receiveList.jsp 10.4 KiB
Newer Older
杨郁彬's avatar
杨郁彬 committed
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="cui" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
    pageContext.setAttribute("idSuffix", String.valueOf(System.currentTimeMillis()).substring(6));
%>

<div style="height: 100%;">
    <div class="nav2"><img src="${ctx}/static/cm/image/sjj-nav.png"/>收件夹</div>
    <div class="table-head">
        <div class="table-title">收文列表</div>
    </div>
    <cui:form id="searchForm${idSuffix}" style="padding: 0px;margin:10px 0px;vertical-align: middle;">
        <div align="center">
            <span>来文单位:</span>
            <cui:input type="text" name="deptName" id="deptName${idSuffix}" width="120" required="false"/>
            <span style="padding-left: 20px">文电标题:</span>
            <cui:input type="text" name="mailTitle" id="mailTitle${idSuffix}" width="120" required="false"/>
                <%-- <span style="padding-left: 20px">密级:</span>
                 <cui:combobox name="securityLevel" id="securityLevel${idSuffix}" readonlyInput="false"
                               width="120" data="fileSearch_sendList.securityLevelData" emptyText="请选择"/>--%>
            <span style="padding-left: 20px">发送时间:</span>
            <cui:datepicker width="120" name="sendTimeStart" dateFormat="yyyy-MM-dd"/><cui:datepicker width="120"
                                                                                                       name="sendTimeEnd"
                                                                                                       dateFormat="yyyy-MM-dd"/>
            <span class="btn-bar">
                <a onclick="mailReceive_list_sample.search('A')">查询</a>
                <a onclick="mailReceive_list_sample.search(1)">未签收</a>
                <a onclick="mailReceive_list_sample.search(2)">已签收</a>
                <a onclick="mailReceive_list_sample.batchSign()">批量签收</a>
            </span>
        </div>
    </cui:form>
    <cui:grid id="grid${idSuffix}" url="${ctx}/mail-receive/queryReceiveList2" asyncType="get"
              postData="mailReceive_list_sample.postData"
              sortorder="desc" loadonce="false" rownumbers="true" rownumName="序号" fitStyle="fill" multiselect="true"
              style="margin-left: 5px;margin-right: 5px;">
        <cui:gridCols>
            <cui:gridCol name="id" hidden="true">id</cui:gridCol>
            <cui:gridCol name="mailSendId" hidden="true">mailSendId</cui:gridCol>
            <%--<cui:gridCol name="mailSend.mailNo" width="60">发文号</cui:gridCol>--%>
Du Xingdong's avatar
Du Xingdong committed
            <cui:gridCol name="mailSend.deptName" width="60" formatter="mailReceive_list_sample.deptNameFmt">来文单位</cui:gridCol>
杨郁彬's avatar
杨郁彬 committed
            <cui:gridCol name="mailSend.mailTitle" width="120"
                         formatter="mailReceive_list_sample.titleFmt">文电标题</cui:gridCol>
            <cui:gridCol name="mailSend.mailType" width="50">类型</cui:gridCol>
            <cui:gridCol name="mailSend.emergency" width="30">紧急度</cui:gridCol>
            <cui:gridCol name="mailSend.safeLevel" width="25">密级</cui:gridCol>
            <cui:gridCol name="mailSend.mailPage" width="15">页数</cui:gridCol>
            <cui:gridCol name="mailSend.sendTime" width="80">发送时间</cui:gridCol>
            <cui:gridCol name="status" width="60"
                         formatter="mailReceive_list_sample.statusFmt">状态</cui:gridCol>
        </cui:gridCols>
        <cui:gridPager gridId="grid${idSuffix}"/>
    </cui:grid>
</div>
<cui:dialog id="dialogA${idSuffix}" modal="true" autoOpen="false" reLoadOnOpen="true"
            focusInput="false" resizable="true" autoDestroy="true" maximized="false"></cui:dialog>
<script type="text/javascript">
    var mailReceive_list_fun = (function (win, $) {
        var status = '${status}';
        var selectDepts = [];//已选单位
        function sample() {
            this.postData = {
                descs: 'SEND_TIME',
                status: status
            }
        }

        var $grid = $('#grid${idSuffix}');
        //查询
        sample.prototype.search = function (status1) {
            status = status1;
            console.log("开始查询!")
            var $form = $('#searchForm${idSuffix}');
            var formData = $form.form('formData');
            if (formData.sendTimeStart) formData.sendTimeStart = formData.sendTimeStart + ' 00:00:00';
            if (formData.sendTimeEnd) formData.sendTimeEnd = formData.sendTimeEnd + ' 23:59:59';
            formData.status = status;
            this.postData = $.extend(this.postData, formData);
            $grid.grid('reload', {page: 1});
        }

        //选择部门
        sample.prototype.jsdwPicker = function () {
            selectDepts = []
            var url = '${ctx}/auth/selectDept?initfun=mailReceive_list_sample.initfun&callback=mailReceive_list_sample.deptCallback';
            $('#dialogA${idSuffix}').dialog('option', {
                url: url,
                title: '添加单位',
                asyncType: 'get',
                width: 735,
                height: 565,
                buttons: null
            }).dialog('open');
        }
        //获取已选单位
        sample.prototype.initfun = function () {
            return selectDepts;
        }
        //选择部门回调方法
        sample.prototype.deptCallback = function (selectDeptArray) {
            selectDepts = selectDeptArray;
            var str = JSON.stringify(selectDeptArray);
            $('#receiveDept${idSuffix}').val(str);
            var dd = '';
            $.each(selectDeptArray, function (i, item) {
                if (i > 0) dd += ',';
                dd += item.deptName;
            });
            $('#deptNames${idSuffix}').textbox('setValue', dd);
        }
        //批量签收
        sample.prototype.batchSign = function () {
            console.log("批量签收!")
            var selrows = $grid.grid('option', 'selarrrow');
            if (selrows.length < 1) {
                warning('请选择要批量签收的记录!');
                return;
            }
            $.confirm('将同时批量签收收件夹的相关信息<br>确定要批量签收吗?', function (r) {
                if (r) {
                    var ids = [];
                    for (var i = 0; i < selrows.length; i++) {
                        var rowData = $grid.grid('getRowData', selrows[i]);
                        ids.push(rowData.id);
                    }
                    loading('发送中...');

                    $.ajax({
                        type: 'POST',
                        url: '${ctx}/mail-receive/batchSign',
                        traditional: true,
                        data: {
                            relevanceIds: ids,
                        },
                        dataType: 'json',
                        success: function (data) {
                            hide();
                            if (data.code == '0') {
                                message('保存成功!');
                                mailReceive_list_sample.search(status);
                            } else if (data.code == '-1') {
                                error('保存失败!');
                            }
                        },
                        error: function (e) {
                            hide();
                            error(e);
                        }
                    });
                }
            });
        }

        /*   //添加
           sample.prototype.add = function () {
               var url = '

        ${ctx}/mail-send/add';
            $('#dialogA

        ${idSuffix}').dialog('option', {
                url: url,
                title: '添加发文',
                asyncType: 'get',
                width: 900,
                height: 550,
                buttons: null
            }).dialog('open');
        }*/

        //删除
        sample.prototype.del = function () {
            alert('删除');
        }

        //刷新列表
        sample.prototype.reloadGrid = function () {
            $grid.grid('reload');
        }
        sample.prototype.statusFmt = function (cellValue, options, rowObject) {
            var result = '';
            var status = rowObject.status;
            if (status == '1') {
                result = '未签收';
            } else if (status == '2') {
                result = '已签收';
            } else {
                result = status;
            }
            return result;
        }
Du Xingdong's avatar
Du Xingdong committed
        sample.prototype.deptNameFmt = function (cellValue, options, rowObject) {
            var result = '';
            if (rowObject.mailSend.forwordDept != null && rowObject.mailSend.forwordDept != "" && rowObject.mailSend.forwordDept != rowObject.mailSend.deptName){
                result = rowObject.mailSend.forwordDept;
            }else {
                result = cellValue;
            }
            return result;
        }
杨郁彬's avatar
杨郁彬 committed
        sample.prototype.titleFmt = function (cellValue, options, rowObject) {
Du Xingdong's avatar
Du Xingdong committed
            var result = '';
            if (rowObject.mailSend.forwordDept != null && rowObject.mailSend.forwordDept != "" && rowObject.mailSend.forwordDept != rowObject.mailSend.deptName){
                result += '<a style="color:rgb(67,71,201)" onclick="mailReceive_list_sample.edit(\'' + rowObject.id + '\',\'' + rowObject.mailSendId + '\')">' + cellValue +'(由'+rowObject.mailSend.deptName+'转发)</a>';
            }else {
                result += '<a style="color:rgb(67,71,201)" onclick="mailReceive_list_sample.edit(\'' + rowObject.id + '\',\'' + rowObject.mailSendId + '\')">' + cellValue + '</a>';
            }
杨郁彬's avatar
杨郁彬 committed
            return result;
        }

        //查看
        sample.prototype.edit = function (id, mailSendId) {
            var url = '${ctx}/mail-receive/edit?id=' + id + "&mailSendId=" + mailSendId;
            $('#dialogA${idSuffix}').dialog('option', {
                url: url,
                title: '收件',
                asyncType: 'get',
                width: 1100,
                height: 520,
                buttons: null
            }).dialog('open');
        }


        return sample;
    })(window, $);

    var mailReceive_list_sample = new mailReceive_list_fun();
    window['mailReceive_list_fun'] = null;
    delete window['mailReceive_list_fun'];


</script>