activateList.html 13.1 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="tt" class="easyui-tabs" style="width:auto;height:auto;">
    <div title="激活点击统计" style="padding:20px;display:none;">
        <div id="search" region="north" style="padding-bottom: 35px; ">
            <!--<script>-->
            <!--document.write(addHead('市场管理', '分组营销管理'));-->
            <!--</script>-->
            <style>
                .div_search input {
                    margin-top: 20px;
                }

                .div_search .textbox {
                    margin-top: 20px;
                }

                .div_search .easyui-linkbutton {
                    margin-top: 20px;
                }

                .subtotal {
                    font-weight: bold;
                }

                /*合计单元格样式*/
            </style>
            <div style="margin-left: 30px;" class="div_search">
                <form id="searchForm" method="post" accept-charset="utf-8">
                    <input name="interfaceType" class="easyui-combobox" data-options="
		valueField: 'id',
		editable: false,
		textField: 'text',
		width:200,
		prompt:'选择泛激活接口',
		data: [
            { id: '', text: '全部' },
            { id: 'addUnion_ios', text: 'addUnion_ios' },
            { id: 'addUnion_android', text: 'addUnion_android' },
            { id: 'addUnion4Jump_ios', text: 'addUnion4Jump_ios' },
            { id: 'addUnion4Jump_android', text: 'addUnion4Jump_android' },
            { id: 'addMonitor_ios', text: 'addMonitor_ios' },
            { id: 'addMonitor_android', text: 'addMonitor_android' }
        ]"/>
                    <input name="unionType" type="text" class="easyui-textbox" data-options="prompt:'请输入渠道号'"
                           style="width: 200px;">
                    <input id="activateTime" name="activateTime" type="text" class="easyui-datebox" editable="false"
                           data-options="prompt:'请选择激活日期'" style="width: 200px;">
                    <a id="searchBtn" class="easyui-linkbutton btn-info" style="margin-left: 30px; "></a>
                </form>
            </div>
        </div>
        <div region="center">
            <div style="margin-left: 30px;margin-top: 20px; height:800px;">
                <table id="activateTalbe"></table>
            </div>
        </div>
    </div>
    <div title="激活点击查询" data-options="closable:true" style="overflow:auto;padding:20px;display:none;">
        <div id="search2" region="north" style="padding-bottom: 35px; ">
            <form id="searchForm2" method="post" accept-charset="utf-8">
                <input name="idfa" type="text" class="easyui-textbox" data-options="prompt:'请输入idfa'"
                       style="width: 200px;">
                <input name="imei" type="text" class="easyui-textbox" data-options="prompt:'请输入imei'"
                       style="width: 200px;">
                <a id="searchBtn2" class="easyui-linkbutton btn-info" style="margin-left: 30px; "></a>
                <div id="batchImportDiv" style="margin-left: 30px;"></div>
            </form>
        </div>
        <div region="center" style="height: 800px;">
            <div style="margin-left: 30px;margin-top: 20px; height:100px;">
                <table id="activateTalbe2"></table>
            </div>
            <div id="matchDiv" style="padding:30px;height:600px;"></div>
        </div>
    </div>
</div>


<script>
    $(function () {
        var currentDate = getNowFormatDate();
        $('#activateTime').datebox('setValue', currentDate);

        $("#activateTalbe").myDatagrid({
            fit: true,
            fitColumns: true,
            //queryParams: param,
            nowrap: false,
            url: '',
//            url: contextPath + "/ActivateUnionRest/queryActivateDeviceId",
            method: 'POST',
            queryParams: getParams(),
            loadFilter: function (data) {
                var temp = defaultLoadFilter(data);
                temp.rows = temp.list;
                return temp;
            },
            columns: [[{
                title: "渠道Id",
                field: "unionType",
                width: 200,
                align: "center"
            }, {
                title: "渠道名称",
                field: "unionName",
                width: 250,
                align: "center"
            }, {
                title: "激活IOS数",
                field: "idfaCount",
                width: 180,
                align: "center"
            }, {
                title: "点击IOS数",
                field: "idfaClick",
                width: 180,
                align: "center",
                formatter: function (value, rowData, rowIndex) {
                    var str = "<a role='idfa' dataId='" + rowData.unionType + "'   style='margin-left:10px'></a>";
                    return str;
                }
            }, {
                title: "激活安卓数",
                field: "imeiCount",
                width: 180,
                align: "center"
            }, {
                title: "点击安卓数",
                field: "imeiClick",
                width: 180,
                align: "center",
                formatter: function (value, rowData, rowIndex) {
                    var str = "<a role='imei' dataId='" + rowData.unionType + "'   style='margin-left:10px'></a>";
                    return str;
                }
            }
            ]],
            cache: false,
            pageSize: 10,
            pageList: [10],
            idField: "id",
            singleSelect: false,
            checkOnSelect: false,
            onLoadSuccess: function (data) {
                $(this).myDatagrid("getPanel").find("a[role='idfa']").linkbutton({
                    iconCls: "icon-more",
                    text: '查看',
                    onClick: function () {
//                        showIdfaClick($(this).attr("dataId"));
                        var p = $(this).parent();
                        var params = getParams();
                        params['unionType'] = $(this).attr("dataId");
                        params['isIdfa'] = 1;
                        $.post(contextPath + "/ActivateUnionRest/queryActivateCount", params, function (data) {
                            // h.text(data);
                            var sp = p.children("span");
                            sp.remove();
                            p.append("<span>  " + data + "</span>");
                        }, "json");
                    }
                });

                $(this).myDatagrid("getPanel").find("a[role='imei']").linkbutton({
                    iconCls: "icon-more",
                    text: '查看',
                    onClick: function () {
//                        showImeiClick($(this).attr("dataId"));
                        var p = $(this).parent();
                        var params = getParams();
                        params['unionType'] = $(this).attr("dataId");
                        params['isIdfa'] = 0;
                        $.post(contextPath + "/ActivateUnionRest/queryActivateCount", params, function (data) {
                            //  h.text(data);
                            var sp = p.children("span");
                            sp.remove();
                            p.append("<span>  " + data + "</span>");
                        }, "json");
                    }
                });

                $('#activateTalbe').datagrid('appendRow', {
                    unionType: '<span class="subtotal">统计</span>',
                    unionName: '<span class="subtotal"></span>',
                    idfaCount: '<span class="subtotal">' + compute("idfaCount") + '</span>',
                    idfaClick: '<span class="subtotal">0</span>',
                    imeiCount: '<span class="subtotal">' + compute("imeiCount") + '</span>',
                    imeiClick: '<span class="subtotal"></span>'
                });


                function compute(colName) {
                    var rows = $('#activateTalbe').datagrid('getRows');
                    var total = 0;
                    for (var i = 0; i < rows.length; i++) {
                        total += parseFloat(rows[i][colName]);
                    }
                    return total;
                }
            }
        });

        $("#activateTalbe2").myDatagrid({
            fit: true,
            fitColumns: true,
            nowrap: false,
            url: '',
            method: 'POST',
            queryParams: getParams2(),
            loadFilter: function (data) {
                var temp = defaultLoadFilter(data);
                temp.rows = temp.list;
                return temp;
            },
            columns: [[{
                title: "渠道Id",
                field: "unionType",
                width: 200,
                align: "center"
            }, {
                title: "渠道名称",
                field: "unionName",
                width: 250,
                align: "center"
            }, {
                title: "idfa",
                field: "idfa",
                width: 180,
                align: "center"
            }, {
                title: "imei",
                field: "imei",
                width: 180,
                align: "center"
            }, {
                title: "激活时间",
                field: "createTime",
                width: 180,
                align: "center"
            }
                , {
                    title: "激活接口",
                    field: "interfaceType",
                    width: 180,
                    align: "center"
                }
            ]],
            cache: false,
            pageSize: 10,
            pageList: [10],
            idField: "id",
            singleSelect: false,
            checkOnSelect: false
        });

        function getParams() {
            var paramsArray = $("#searchForm").serializeArray();
            var params = {};
            for (var i = 0; i < paramsArray.length; i++) {
                params[paramsArray[i].name] = paramsArray[i].value;
            }
            return params;
        }

        function getParams2() {
            var paramsArray = $("#searchForm2").serializeArray();
            var params = {};
            for (var i = 0; i < paramsArray.length; i++) {
                params[paramsArray[i].name] = paramsArray[i].value;
            }
            return params;
        }

        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            var currentdate = year + seperator1 + month + seperator1 + strDate;
            return currentdate;
        }

        $("#searchBtn").linkbutton({
            iconCls: "icon-search",
            text: "查询",
            onClick: function () {
                $("#activateTalbe").datagrid(
                        {
                            url: contextPath + "/ActivateUnionRest/queryActivateDeviceId",
                            queryParams: getParams()

                        });
            }
        });

        $("#searchBtn2").linkbutton({
            iconCls: "icon-search",
            text: "查询",
            onClick: function () {
//                var params = getParams2();
//                $.post(contextPath + "/ActivateUnionRest/queryByDeviceId", params, function (data) {
//                    var activate = data.data;
//
//                }, "json");
                $("#activateTalbe2").datagrid(
                        {
                            url: contextPath + "/ActivateUnionRest/queryByDeviceId",
                            queryParams: getParams2()

                        });
            }
        });

        $("#batchImportDiv").fileUpload({
            text: "请选择文件导入匹配",                      //按钮文字
            uploadInputName: "file",                //上传文件的控件名称
            url: contextPath + "/batch/import",     //提交到后端的url
            queryParams: {
                type: "deviceIdMatchImport"
            },                                      //提交到后端额外参数
            showFileName: false,				//上传成功后,是否显示文件名
            onLoadSuccess: function (fileName, data) {
                $.messager.show({
                    title: "提示",
                    msg: "匹配完成",
                    height: 250
                });
                var match = data.data;
                var output = "匹配的内容</br>";
                for (var i = 0; i < match.length; i++) {
                    output += match[i] + "</br>";
                }
                $("#matchDiv").append(output);
            }
        });
    });


</script>

</body>
</html>