channelGroupList.html 9.74 KB
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>Yoho!Buy运营平台</title>
    <script src="/union/js/include.js"></script>
    <script src="/union/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div id="search" region="north" style="height: 170px;" class="xsdvideogl">
    <div style="margin-left: 30px;margin-top: 20px;">
        <input type="text" id="name"/>
        <input id="createTimeBegin" type="text" class="easyui-datetimebox" editable="false" >
        <label>~</label>
        <input id="createTimeEnd" type="text" class="easyui-datetimebox" editable="false" >
        <input type="text" id="createUserName"/>
        <input type="text" id="smsNumber"/>
        <input type="text" id="sendUserName"/>
        <input id="sendTimeBegin" type="text" class="easyui-datetimebox" editable="false" >
        <label>~</label>
        <input id="sendTimeEnd" type="text" class="easyui-datetimebox" editable="false" >
        <a id="searchBtn" class="btn-info" style="margin-left: 30px"></a>
        <a id="searchBtnAll" class="btn-info" style="margin-left: 30px"></a>

    </div>
</div>
<div region="center" id="chanenlGroupListDiv">
    <table id="channelGroupTalbe"></table>
</div>

<script>
    $(function () {

        $("#createUserName").textbox({
            prompt: "创建人",
            width: 180
        });

        $("#name").textbox({
            prompt: "分组名称",
            width: 180
        });

        $("#smsNumber").textbox({
            prompt: "发送批次",
            width: 180
        });

        $("#sendUserName").textbox({
            prompt: "发送人",
            width: 180
        });

        $("#createTimeBegin").datetimebox({
            //showSeconds: false,
            prompt: "分组创建开始时间",
            width: 180
        });

        $("#createTimeEnd").datetimebox({
            //showSeconds: false,
            prompt: "分组创建结束时间",
            width: 180
        });

        $("#sendTimeBegin").datetimebox({
            //showSeconds: false,
            prompt: "短信发送开始时间",
            width: 180
        });

        $("#sendTimeEnd").datetimebox({
            //showSeconds: false,
            prompt: "短信发送结束时间",
            width: 180
        });

        $("#channelGroupTalbe").myDatagrid({
            fit: true,
            fitColumns: true,
            //queryParams: param,
            nowrap: false,
            url: contextPath + "/channel/queryChannelGroupList",
            method: 'POST',
            loadFilter: function (data) {
                var temp = defaultLoadFilter(data);
                temp.rows = temp.list;
                return temp;
            },
            columns: [[{
                title: "ID",
                field: "id",
                width: 70,
                align: "center"
            }, {
                title: "分组名称",
                field: "name",
                width: 170,
                align: "center"
            }, {
                title: "分组人数",
                field: "groupNumber",
                width: 170,
                align: "center"
            }, {
                title: "分组条件",
                field: "condition",
                width: 170,
                align: "center",
                formatter: function (value, rowData, rowIndex) {
                    return "条件筛选";
                }
            },{
                title: "创建时间",
                field: "createTime",
                width: 170,
                align: "center"
            },{
                title: "创建人",
                field: "createUserName",
                width: 170,
                align: "center"
            },{
                title: "发送批次",
                field: "smsNumber",
                width: 170,
                align: "center"
            },{
                title: "发送时间",
                field: "sendTime",
                width: 170,
                align: "center"
            },{
                title: "发送人",
                field: "sendUserName",
                width: 170,
                align: "center"
            },{
                title: "发送内容",
                field: "content",
                width: 170,
                align: "center"
            },{
                title: "操作",
                field: "asdf",
                width: 170,
                align: "center",
                formatter: function (value, rowData, rowIndex) {
                    if(rowData.content !=''){
                        return "-"
                    }else{
                        var str = "<a role='send' dataId='" + rowData.id + "'  style='margin-left:10px'>发送短信</a>";
                        return str;
                    }
                }
            }
            ]],
            cache: false,
            pagination: true,
            pageSize: 10,
            pageList : [10],
            idField: "id",
            singleSelect: false,
            checkOnSelect: false,
            onLoadSuccess: function (data) {
                $(this).myDatagrid("getPanel").find("a[role='send']").linkbutton({
                    iconCls: "icon-edit",
                    onClick: function () {
                        sendMessage($(this).attr("dataId"));
                    }
                });
            }
        });


        $("#searchBtn").linkbutton({
            iconCls: "icon-search",
            text: "查询",
            onClick: function () {
                var param = {};

                if ($("#name").val()!='') {
                    param.name = $("#name").val();
                }
                if ($("#createTimeBegin").datetimebox('getValue')!='') {
                    param.createTimeBegin = parseInt(new Date($("#createTimeBegin").datetimebox('getValue')).getTime() / 1000);
                }
                if ($("#createTimeEnd").datetimebox('getValue')!='') {
                    param.createTimeEnd = parseInt(new Date($("#createTimeEnd").datetimebox('getValue')).getTime() / 1000);
                }
                if ($("#createUserName").val()!='') {
                    param.createUserName = $("#createUserName").val();
                }
                if ($("#smsNumber").val()!='') {
                    param.smsNumber = $("#smsNumber").val();
                }
                if ($("#sendUserName").val()!='') {
                    param.sendUserName = $("#sendUserName").val();
                }
                if ($("#sendTimeBegin").datetimebox('getValue')!='') {
                    param.sendTimeBegin = parseInt(new Date($("#sendTimeBegin").datetimebox('getValue')).getTime() / 1000);
                }
                if ($("#sendTimeEnd").datetimebox('getValue')!='') {
                    param.sendTimeEnd = parseInt(new Date($("#sendTimeEnd").datetimebox('getValue')).getTime() / 1000);
                }
                $("#channelGroupTalbe").myDatagrid("load", param);
            }
        });


        $("#searchBtnAll").linkbutton({
            iconCls: "icon-search",
            text: "全部",
            onClick: function () {
                var param = {};

                if ($("#name").val()!='') {
                    param.name = $("#name").val();
                }
                if ($("#startTimeStr").datetimebox('getValue')!='') {
                    param.startTime = parseInt(new Date($("#startTimeStr").datetimebox('getValue')).getTime() / 1000);
                }
                if ($("#endTimeStr").datetimebox('getValue')!='') {
                    param.endTime = parseInt(new Date($("#endTimeStr").datetimebox('getValue')).getTime() / 1000);
                }
                $("#channelGroupTalbe").myDatagrid("load", param);
            }
        });

    });

    //新增或修改视频
    function sendMessage(id) {
        var div = $("<div>").appendTo($(document.body));
        var title = "发送短信";
        $(div).myDialog({
            width: "500px",
            height: "40%",
            title: title,
            href : contextPath+"/html/channel/sendMessage.html",
            queryParams: {
                id: id
            },
            modal: true,
            collapsible: true,
            cache: false,
            buttons: [{
                id : "saveBtn",
                text: "发送",
                id: "saveVideoBtn",
                iconCls: "icon-save",
                handler: function () {
                    var content = $("#content").val();
                    $.post(contextPath + "/channel/sendMessage", {groupId: id,content:content}, function (data) {
                        $.messager.progress("close");
//                        data = JSON.parse(data);
                        if (data.code == 200) {
                            $(div).dialog("close");
                            $("#channelGroupTalbe").myDatagrid("reload");
                            $.messager.show({
                                title: "提示",
                                msg: title + "成功!",
                                height:120
                            });
                        } else {
                            $.messager.alert("失败", data.message, "error");
                        }
                    }, "json");
                }
            }, {
                id : "closeBtn",
                text: " 取消",
                iconCls: "icon-cancel",
                handler: function () {
                    $(div).dialog("close");
                }
            }],
            onOpen : function() {
                window.setTimeout(function() {
                    $("#saveBtn").addClass("btn-success");
                    $("#closeBtn").addClass("btn-danger");
                }, 100);
            }
        });

    }

</script>

</body>
</html>