|
|
@@ -0,0 +1,169 @@
|
|
|
+/**
|
|
|
+ * 引入toaster方法
|
|
|
+ */
|
|
|
+document.write("<script language=javascript src='static/js/common/toastr.js'></script>");
|
|
|
+
|
|
|
+/**
|
|
|
+ * 引入分页
|
|
|
+ */
|
|
|
+document.write("<script language=javascript src='static/lib/jquery/jquery.pagination.js'></script>");
|
|
|
+
|
|
|
+/**
|
|
|
+ * 引入base方法
|
|
|
+ */
|
|
|
+document.write("<script language=javascript src='static/js/common/base.js'></script>");
|
|
|
+
|
|
|
+var inviteList = [];
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取邀请记录信息
|
|
|
+ */
|
|
|
+function getinviteList(count, page, keyword) {
|
|
|
+ $('#loadingDiv').show();
|
|
|
+ $("#inviteList-body").empty();
|
|
|
+ inviteList = [];
|
|
|
+ $.get('invite/list', {
|
|
|
+ count: count,
|
|
|
+ page: page,
|
|
|
+ keyword: keyword
|
|
|
+ }, function (data) {
|
|
|
+ $('#loadingDiv').hide();
|
|
|
+ inviteList = data.content;
|
|
|
+ var pageNumber = data.number;
|
|
|
+ var pageSize = data.size;
|
|
|
+ var total = data.totalElements;
|
|
|
+ var totalPage = data.totalPages;
|
|
|
+ var tbody = document.getElementById("inviteList-body");
|
|
|
+ var page = document.getElementById("page");
|
|
|
+ //noinspection JSAnnotator
|
|
|
+ $('#inviteList-total').val('共 ' + total + ' 条');
|
|
|
+ if (inviteList.length > 0) {
|
|
|
+ for (var i = 0; i < inviteList.length; i++) {
|
|
|
+ var trow = getDataRow(inviteList[i], i); //定义一个方法,返回tr数据
|
|
|
+ tbody.appendChild(trow);
|
|
|
+ // 查询错误详情
|
|
|
+ (function(i) {
|
|
|
+ $("#para_detail_" + inviteList[i].id ).click(function () {
|
|
|
+ getPara(inviteList[i].id, inviteList[i].enName, inviteList[i].url);
|
|
|
+ $('#loadingDiv').show();
|
|
|
+ });
|
|
|
+ })(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击搜索
|
|
|
+ $('#p_search').unbind('click').click(function () {// 每次先解除上次绑定的事件,防止重复发送请求
|
|
|
+ $("#inviteList-body").load(location.href + " #inviteList-body");
|
|
|
+ getinviteList(count, 1, $('#keyword').val());
|
|
|
+ });
|
|
|
+
|
|
|
+ // 键盘确认按钮搜索
|
|
|
+ document.onkeydown = function(event) {
|
|
|
+ var e = event || window.event;
|
|
|
+ if (e && e.keyCode == 13) { // enter 键
|
|
|
+ $("#inviteList-body").load(location.href + " #inviteList-body");
|
|
|
+ getinviteList(count, 1, $('#keyword').val());
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ $('#m-page').pagination({
|
|
|
+ pageCount: totalPage,
|
|
|
+ totalData: total,
|
|
|
+ current: pageNumber,
|
|
|
+ showData: pageSize,
|
|
|
+ coping: true,
|
|
|
+ homePage: '首页',
|
|
|
+ endPage: '末页',
|
|
|
+ prevContent: '<<',
|
|
|
+ nextContent: '>>',
|
|
|
+ jump: true,
|
|
|
+ jumpBtn: '跳转',
|
|
|
+ callback: function (api) {
|
|
|
+ $('.now').text(api.getCurrent());
|
|
|
+ $("#inviteList-body").load(location.href + " #inviteList-body");
|
|
|
+ getinviteList(count, api.getCurrent(), $('#keyword').val());
|
|
|
+ }
|
|
|
+ }, function (api) {
|
|
|
+ $('.now').text(api.getCurrent());
|
|
|
+ });
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 建立表格数据
|
|
|
+ *
|
|
|
+ * @param log 日志
|
|
|
+ * @param i 行号
|
|
|
+ * @returns {Element}
|
|
|
+ */
|
|
|
+function getDataRow(invite, i) {
|
|
|
+ //创建行
|
|
|
+ var row = document.createElement('tr');
|
|
|
+
|
|
|
+ //序号
|
|
|
+ var indexCell = document.createElement('td');
|
|
|
+ indexCell.setAttribute("class", "text-center");
|
|
|
+ indexCell.innerHTML = i + 1;
|
|
|
+ row.appendChild(indexCell);
|
|
|
+
|
|
|
+ // 邀请企业名称
|
|
|
+ var inviteEnNameCell = document.createElement('td');
|
|
|
+ inviteEnNameCell.setAttribute("class", "text-center");
|
|
|
+ inviteEnNameCell.innerHTML = invite.inviteEnName || '-';
|
|
|
+ row.appendChild(inviteEnNameCell);
|
|
|
+
|
|
|
+ // 邀请用户名称
|
|
|
+ var inviteUserNameCell = document.createElement('td');
|
|
|
+ inviteUserNameCell.setAttribute("class", "text-center");
|
|
|
+ inviteUserNameCell.innerHTML = invite.inviteUserName || '-';
|
|
|
+ row.appendChild(inviteUserNameCell);
|
|
|
+
|
|
|
+ // 邀请人联系方式
|
|
|
+ var inviteUserTelCell = document.createElement('td');
|
|
|
+ inviteUserTelCell.setAttribute("class", "text-center");
|
|
|
+ inviteUserTelCell.innerHTML = invite.inviteUserTel || '-';
|
|
|
+ row.appendChild(inviteUserTelCell);
|
|
|
+
|
|
|
+ // 注册企业名称
|
|
|
+ var enNameCell = document.createElement('td');
|
|
|
+ enNameCell.setAttribute("class", "text-center");
|
|
|
+ enNameCell.innerHTML = invite.enName;
|
|
|
+ row.appendChild(enNameCell);
|
|
|
+
|
|
|
+ // 注册时间
|
|
|
+ var enDateCell = document.createElement('td');
|
|
|
+ enDateCell.setAttribute("class", "text-center");
|
|
|
+ enDateCell.innerHTML = formatDateTime(invite.enDate);
|
|
|
+ row.appendChild(enDateCell);
|
|
|
+
|
|
|
+ // 联系人
|
|
|
+ var adminNameCell = document.createElement('td'); //detail
|
|
|
+ adminNameCell.setAttribute("class", "text-center");
|
|
|
+ adminNameCell.innerHTML = invite.adminName || '-';
|
|
|
+ row.appendChild(adminNameCell);
|
|
|
+
|
|
|
+ // 物料数
|
|
|
+ var countCell = document.createElement('td');
|
|
|
+ countCell.setAttribute("class", "text-center");
|
|
|
+ countCell.setAttribute("title", "查看参数详情");
|
|
|
+ countCell.innerHTML = invite.productCount;
|
|
|
+ row.appendChild(countCell);
|
|
|
+
|
|
|
+ return row;
|
|
|
+}
|
|
|
+
|
|
|
+$(function() {
|
|
|
+ 'use strict';
|
|
|
+
|
|
|
+ // 监听页面滚动
|
|
|
+ $(window).scroll(function() {
|
|
|
+ if($(window).scrollTop() >= 400) {
|
|
|
+ $('#nav').addClass('on');
|
|
|
+ } else {
|
|
|
+ $('#nav').removeClass('on');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 设置分页大小
|
|
|
+ var count = 20;
|
|
|
+ getinviteList(count, 1, null);
|
|
|
+});
|