ASP.NET MVC搭建项目后台UI框架—捌 、将View中挑选的数码行中的有的数据传入到Controller中

目录

  1. ASP.NET
    MVC搭建项目后台UI框架—壹 、后台主框架
  2. ASP.NET
    MVC搭建项目后台UI框架—② 、菜单特效
  3. ASP.NET
    MVC搭建项目后台UI框架—叁 、面板折叠和开始展览
  4. ASP.NET
    MVC搭建项目后台UI框架—肆 、tab多页签支持
  5. ASP.NET
    MVC搭建项目后台UI框架—⑤ 、Demo演示Controller和View的相互
  6. ASP.NET
    MVC搭建项目后台UI框架—⑥ 、客户管理(添加、修改、查询、分页)
  7. ASP.NET
    MVC搭建项目后台UI框架—⑦ 、总括报表
  8. ASP.NET
    MVC搭建项目后台UI框架—⑧ 、将View中甄选的数量行中的有的数据传入到Controller中
  9. ASP.NET
    MVC搭建项目后台UI框架—⑨ 、服务器端排序
  1. ASP.NET
    MVC搭建项目后台UI框架—① 、后台主框架
  2. ASP.NET
    MVC搭建项目后台UI框架—② 、菜单特效
  3. ASP.NET
    MVC搭建项目后台UI框架—③ 、面板折叠和开始展览
  4. ASP.NET
    MVC搭建项目后台UI框架—四 、tab多页签辅助
  5. ASP.NET
    MVC搭建项目后台UI框架—⑤ 、德姆o演示Controller和View的相互
  6. ASP.NET
    MVC搭建项目后台UI框架—六 、客户管理(添加、修改、查询、分页)
  7. ASP.NET
    MVC搭建项目后台UI框架—七 、总结报表
  8. ASP.NET
    MVC搭建项目后台UI框架—八 、将View中甄选的数据行中的片段数据传入到Controller中
  9. ASP.NET
    MVC搭建项目后台UI框架—⑨ 、服务器端排序

本节,我将透过多个德姆o,演示Datatables 和ASP.NET
MVC的一应俱全组合,可以那样说,若是这么的界面都能做出来,后台系统百分之九十的界面功用都足以付出出来了。

图片 1

用jquery Datatables 来开发的确是件相比较蛋疼的工作(和Jquery
EasyUI、MiniUI、ExtJs相比较),用任何的第①方UI框架来兑现平等的职能正是杰出尤其的回顾,不过使用Datatables却是那么的困难,至少作者这么觉得,只怕是因为小编对那个控件使用得还不够明白。在官网,datatables暗中同意使用的是bootstraps的样式,那里自身早已把体制重写了一局部。

图片 2图片 3

眼见集团原本的系统,同样是运用ASP.NET
MVC做的,在页面随便点击个东东,整个界面就刷新了,刷得小编本人都受不了,更别指望固定表头啊什么什么的了,完全不设有用户体验啊!于是自身就和好写了UI框架(也能够说是组装,不过本身重写了过多事物)。

当今,有多少个急需,小编须要将表格中选中央银行的数据中的一片段传间接传到控制器中,然后保留到其余一张表中。一初始,小编就悟出在前台使用ajax构造json数据,然后控制器间接通过list接收。

技术点:① 、服务器端分页。贰 、查询(模糊查询)三 、界面操作刷新后照旧保留当前分页
肆 、固定表头、表尾 五 、动态控制列的藏匿和出示
⑥ 、全选、反选(数据行中复选框全部入选时,全选按钮自动选中,小编发现众多程序员这些效应一向没做,不过正是bug么?) 
⑦ 、服务器排序(效率笔者已经付出出来了,不过此地我从未写上去,那一个网上笔者还尚未见到完结的德姆o)
捌 、特殊字段标红显示 九 、滑动变色 十 、单击行选中变色 ….

入选界面中的行,然后点击“批量添加到月结表”,弹出多少个对话框,那么些对话框的月份列表为当前选用数据行中结账日期所在月份、以及前1个月和后一个月,接纳月份后,将选拔的月度,以及界面选中的行中的数据一起传到控制器中去。小编发现网上很少有那种在前台构造复杂json,传递给控制器的,愈来愈多的是从控制器调用Json方法把后台数据转换为json格式,然后浮现到前台,所以作者就把落到实处格局记录下来,希望能够给大家提供参考。

先看下效果:

控制器Reconciliation代码:

图片 4

        /// <summary>
        /// 添加月结表
        /// </summary>
        /// <param name="no"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public ActionResult AddMonthPayOff(DateTime payOffDate)
        {
            ViewBag.PreMonthStr = payOffDate.AddMonths(-1).Month + "月";
            ViewBag.MonthStr = payOffDate.Month + "月";
            ViewBag.NextMonthStr = payOffDate.AddMonths(1).Month + "月";

            ViewBag.PreYearMonth = payOffDate.AddMonths(-1);
            ViewBag.YearMonth = payOffDate;
            ViewBag.NextYearMonth = payOffDate.AddMonths(1);
            return View();
        }

        /// <summary>
        /// 添加月结表       
        /// </summary>
        /// <param name="data"></param>
        /// <param name="isNeglect">是否忽视异常</param>
        /// <returns></returns>
        [HttpPost]
        public JsonResult AddMonthPayOff(List<MonthPayOffModel> data, bool isNeglect, DateTime payOffMonth)
        {
            string message = string.Empty;
            var dealdata = data.Select(a => new MonthPayOffData()
            {
                MonthPayTime = payOffMonth,
                ReconcileTime = a.ReconcileTime,
                PreTotalCostFee = a.PreTotalCostFee,
                TotalCostFee = a.TotalCostFee,
                PreInComeFee = a.PreInComeFee,
                InComeFee = a.InComeFee,
                TotalMargin = a.TotalMargin,
                LoadBillBy = LoadBillInCome.GetByLoadBillNum(a.LoadBillNum)
            }).ToList();
            if (MonthPayOff.AddMonthPay(isNeglect, dealdata, payOffMonth, out message))
            {
                return Json(new { IsSuccess = true, Message = string.Format("共计:{0}个提单添加到月结", data.Count) });
            }
            else
            {
                return Json(new { IsSuccess = false, Message = message, IsPoint = message.Substring(0, 2) == "提醒" ? true : false });
            }
        }

点击图片,折叠或进行列

视图AddMonthPayOff:

图片 5图片 6

@{
    ViewBag.Title = "AddMonthPayOff";
    Layout = null;
}
@Html.Raw(ViewBag.Msg)
<script src="~/Scripts/jquery-1.8.3.min.js"></script>
<link href="~/Content/main.css" rel="stylesheet" />
<style type="text/css">
    table tr {
        height:24px;
    }
</style>
<script type="text/javascript">
    function selectpayMonth() {
        var list = $('input:radio[name="monthPayOff"]:checked').val();
        if (list == null) {
            return false;
        }
        else {
            frameElement.api.opener.postSelectData(list,false);
        }
    }
</script>

        @using (Html.BeginForm("AddMonthPayOff", "Reconciliation", FormMethod.Post, new { @clase = "form-inline", @role = "form", name = "from1" }))
        {
            <table style="text-align:center;width:190px;margin-top:10px;">
                <tr><td style="width:190px;"><input type="radio" name="monthPayOff"  value="@ViewBag.PreYearMonth"/>  @ViewBag.PreMonthStr</td></tr>
                <tr><td><input type="radio" name="monthPayOff" value="@ViewBag.YearMonth"/>  @ViewBag.MonthStr</td></tr>
                <tr><td><input type="radio" name="monthPayOff" value="@ViewBag.NextYearMonth"/>  @ViewBag.NextMonthStr</td></tr>
                <tr><td><input type="button" value="确定" onclick="selectpayMonth()" class="popbtn1 mg" style="text-align:center;margin:10px 0 10px 10px !important;">
                @*<input type="button" value="关闭" class="popbtn3 mg2" onclick="frameElement.api.opener.addDG.close();" />*@</td> 
              </tr>
            </table>
        }

新建Reconciliation控制器

主界面视图LoadBill:这里根本记录选中的行数据,然后将其布局成json格式,通过ajax传递给控制器,注意那里构造的json数据,和控制器中对应的接受参数是一律的。

图片 7图片 8

   //添加到月结表 提单号,结算月份、包裹数、总成本、总收入、总毛利
    function AddMonthlyBalance(id, date, ExpressCount, CostTotalFee, InComeTotalFee, GrossProfitRate) {
        if (date == '') {
            $.dialog.alert("提货单“"+id+"”数据未导入成本数据,且未清关");
            return false;
        }
        var d = { isNeglect: false, data: [{"LoadBillNum": id, "ReconcileTime": date, "PreTotalCostFee": CostTotalFee,"TotalCostFee": CostTotalFee,"PreInComeFee":
 InComeTotalFee,"InComeFee": InComeTotalFee,"TotalMargin": GrossProfitRate }] };
        selectData = JSON.stringify(d);
        addDG = $.dialog({
            id: 'AddMonthPayList',
            title: '添加到月结表',
            width: 200,
            height: 150,
            content: "url:/Reconciliation/AddMonthPayOff?payOffDate="+date,
            close: true,
            btnBar: false,
            max: false,
            min: false,
            lock: true
        })
    }
using Core.CostFlow;
using Core.Filters;
using Core.Reconciliation;
using Data.Reconciliation;
using ProjectBase.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ProjectBase.Utils.Entities;

namespace Site.Controllers
{
    public class ReconciliationController : Controller
    {
        //运单对账
        public ActionResult WayBill()
        {
            return View();
        }

        [HttpPost]
        public JsonResult WayBillList(WayBillReconciliationFilter filter)
        {
            DataTablesRequest parm = new DataTablesRequest(this.Request);    //处理对象
            int pageIndex = parm.iDisplayStart / parm.iDisplayLength;
            filter.PageIndex = pageIndex;    //页索引
            filter.PageSize = parm.iDisplayLength;    //页行数
            var DataSource = WayBillReconciliation.GetByFilter(filter) as WRPageOfList<WayBillReconciliation>;

            int i = parm.iDisplayLength * pageIndex;

            List<WayBillReconciliation> queryData = DataSource.ToList();
            var data = queryData.Select(u => new
           {
               Index = ++i, //行号
               ID = u.ID,
               CusName = u.CusName, //客户简称
               PostingTime =u.PostingTime==null?string.Empty: u.PostingTime.Value.ToStringDate(),//收寄日期
               ExpressNo = u.ExpressNo, //邮件号
               BatchNO = u.LoadBillNum, //提单号
               Weight = u.Weight==null ? 0m : u.Weight / 100, //重量
               WayBillFee = u.WayBillFee, //邮资
               ProcessingFee = u.ProcessingFee, //邮政邮件处理费
               InComeWayBillFee = u.ExpressFee, //客户运费
               InComeOprateFee = u.OperateFee, //客户操作费
               WayBillMargins = u.WayBillProfit, //运费毛利
               TotalMargins = u.ExpressFee + u.OperateFee + u.InComeOtherFee-(u.WayBillFee + u.ProcessingFee + u.CostOtherFee), //总毛利
               Margin = (u.ExpressFee + u.OperateFee + u.InComeOtherFee == 0 ? 0m : (u.ExpressFee + u.OperateFee + u.InComeOtherFee - (u.WayBillFee + u.ProcessingFee + u.CostOtherFee)) / (u.ExpressFee + u.OperateFee + u.InComeOtherFee) * 100) + "%", //毛利率 毛利率=(总收入-总的支出的成本)/总收入*100% 

               ReconcileDate=DateTime.Now.ToString("yyyy-MM"), //对账日期
               CostOtherFee = u.CostOtherFee, //成本 其他费用
               CostTotalFee = u.WayBillFee + u.ProcessingFee+u.CostOtherFee, //成本 总费用
               CostStatus = u.CostStatus.ToChinese(),  //成本 状态
               InComeOtherFee = u.InComeOtherFee, //收入 其他费用
               InComeTotalFee = u.ExpressFee + u.OperateFee+u.InComeOtherFee, //收入 总费用
               InComeStatus = u.InComeStatus.ToChinese(),  //收入 状态
               TotalStatus=""
           });
            decimal totalProfit = 0m;      //总毛利求和
            //构造成Json的格式传递
            var result = new
            {
                iTotalRecords = DataSource.Count,
                iTotalDisplayRecords = DataSource.RecordTotal,
                data = data,
                TotalWeight = DataSource.StatModelBy.TotalWeight/100,
                TotalWayBillFee = DataSource.StatModelBy.TotalWayBillFee,
                               TotalProcessingFee = DataSource.StatModelBy.TotalProcessingFee,
                               TotalExpressFee = DataSource.StatModelBy.TotalExpressFee,
                               TotalOperateFee = DataSource.StatModelBy.TotalOperateFee,
                               SumWayBillProfit = DataSource.StatModelBy.TotalWayBillProfit,
                               SumTotalProfit = totalProfit
            };
            return Json(result, JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 提单对账
        /// </summary>
        /// <returns></returns>
        public ActionResult LoadBill()
        {
            return View();
        }

        public JsonResult LoadBillList()
        {
            return Json(null, JsonRequestBehavior.AllowGet);
        }
    }
}

视图源码:

View Code

@{
    ViewBag.Title = "提货单对账";
}
<link href="~/libs/DataTables-1.10.6/media/css/jquery.dataTablesNew.css" rel="stylesheet" />
<script src="~/libs/DataTables-1.10.6/media/js/jquery.dataTables.min.js"></script>
<script src="~/Scripts/DataTablesExt.js"></script>
<script src="~/libs/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    var selectData; //选择行数据
    $(function () {
        var table = $("#table_local").dataTable({
            bProcessing: true,
            "scrollY": table_h,
            "scrollX": $(document).width(),
            "scrollCollapse": "true",
            "dom": 'tr<"bottom"lip><"clear">',
            "bServerSide": true,                    //指定从服务器端获取数据  
            "iDisplayLength": 10,
            sServerMethod: "POST",
            showRowNumber:true,
            sAjaxSource: "@Url.Action("LoadBillList", "Reconciliation")",
            //"initComplete": function (data, args) {
            //    //getTotal(args);
            //    var arr = new Array(7,8,9,10,11,14,15,16,17,18); //页面一加载隐藏的列
            //    controlColumnShow(table, arr,false);
            //},
            "fnServerParams": function (aoData) {  //查询条件
                aoData.push(
                    { "name": "CusName", "value": $("#CusName").val() },
                    { "name": "LoadBillNum", "value": $("#LoadBillNum").val() },
                    { "name": "CompletionSTime", "value": $("#CompletionSTime").val() },
                    { "name": "CompletionETime ", "value": $("#CompletionETime").val() }
                     );
            },
            //跟数组下标一样,第一列从0开始,这里表格初始化时,第四列默认降序
            "order": [[ 2, "asc" ]],
            columns: [
               {
                   "data": "ID", orderable: false,width:"60",
                   "render": function (data, type, row, meta) {
                       return " <input id='cbx" + data + "' type='checkbox' onclick='controlSelectAll(" + data + ")' class='cbx' value='" + data + "'/>  " + row.Index;
                   }
               },                                                      
                { "data": "CusName" }, //客户名称
                { "data": "LoadBillNum" },//提单号
                { "data": "FeeWeight", orderable: false }, //提单包裹重量
                { "data": "ExpressCount", orderable: false }, //提单包裹数量
                { "data": "CompletionTime" }, //清关完成时间
                { "data": "GroundHandlingFee", visible: false },//邮政地勤费
                { "data": "CostStoreFee", visible: false },//邮政仓租
                {
                    "data": "CostExpressFee", orderable: false, visible: false, "render": function (data, type, row, meta) {
                        var css = "";
                        if (row.IsReal==0) {
                            css = " class='preColor'";
                        }
                        var re = "<div" + css + ">" + data + "</div>";
                        return re;
                    }
                },//邮政邮资
                {
                    "data": "CostOperateFee", orderable: false, visible: false, "render": function (data, type, row, meta) {
                        var css = "";
                        if (row.IsReal == 0) {
                            css = " class='preColor'";
                        }
                        var re = "<div" + css + ">" + data + "</div>";
                        return re;
                    }
                },//邮件处理费
                { "data": "CostOtherFee", visible: false },//邮政其他费用
                { "data": "CostTotalFee" },//邮政总成本
                { "data": "CostStatus" },//邮政结算状态
                { "data": "InComeLoadFee", visible: false },//客户提货费
                { "data": "InComeStoreFee", visible: false },//客户仓租
                { "data": "InComeExpressFee", visible: false },//客户运费
                { "data": "InComeOperateFee", visible: false },//客户操作费
                { "data": "InComeOtherFee", visible: false },//其他费用
                { "data": "InComeTotalFee" },//总收入
                { "data": "InComeStatus",orderable: false ,width:"90"},//结算状态
                {
                    "data": "TotalGrossProfit", orderable: false, "render": function (data, type, row, meta) {
                        var css = "";
                        if (data < 0) {
                            css=" class='numberColor'";
                        }
                        var re = "<div"+css+">"+data+"</div>";
                        return re;
                    }
                },//总毛利
                {
                    "data": "GrossProfitRate", orderable: false, "render": function (data, type, row, meta) {
                        var css = "";
                        if (data < 0) {
                            css = " class='numberColor'";
                        }
                        var re = "<div" + css + ">" + data + "%</div>";
                        return re;
                    }
                },//毛利率
                { "data": "Status",width: "120", orderable: false },//对账单状态
                {
                    "data": "LoadBillNum", orderable: false, width: "160", "render": function (data, type, row, meta) {
                        var re = "<div style='text-align:center'><a style='visibility:visible' onclick='openDetail(" + data + ")'>明细</a>&nbsp;&nbsp;";
                        if (row.IsAddMonthPayOff == 0) {
                            var reconcileDate = row.ReconcileDate == '' ? row.CompletionTime : row.ReconcileDate;
                            re += "<a style='visibility:visible' name='addMonthPayOff' onclick='AddMonthlyBalance(\"" + data + "\",\"" + reconcileDate + "\","
                                + row.ExpressCount + "," + row.CostTotalFee + "," + row.InComeTotalFee + "," + row.TotalGrossProfit + ")'>添加到月结表</a>";
                        }
                        return re+"</div>";
                    }
                }//操作
            ],
            paging: true,//分页
            ordering: true,//是否启用排序
            searching: true,//搜索
            language: {
                "sProcessing": "处理中...",
                lengthMenu: '每页显示:<select class="form-control input-xsmall">' + '<option value="10">10</option>' + '<option value="20">20</option>' + '<option value="30">30</option>'
                    + '<option value="50">50</option>' + '<option value="100">100</option>' + '<option value="150">150</option>' + '<option value="200">200</option>' 
+ '<option value="250">250</option>',//左上角的分页大小显示。
                search: '搜索:',//右上角的搜索文本,可以写html标签

                paginate: {//分页的样式内容。
                    previous: "上一页",
                    next: "下一页",
                    first: "",
                    last: ""
                },

                zeroRecords: "暂无记录",//table tbody内容为空时,tbody的内容。
                //下面三者构成了总体的左下角的内容。
                info: "总共 (_PAGES_) 页,显示 _START_ -- _END_ ,共 (_TOTAL_) 条",//左下角的信息显示,大写的词为关键字。初始_MAX_ 条 
                infoEmpty: "0条记录",//筛选为空时左下角的显示。
                infoFiltered: ""//筛选之后的左下角筛选提示,
            },
            pagingType: "full_numbers"//分页样式的类型
        });
        //new $.fn.dataTable.FixedColumns(table);
        //设置选中行样式
        $('#table_local tbody').on('click', 'tr', function () {
            if ($(this).hasClass('selected')) {
                $(this).removeClass('selected');
            }
            else {
                table.$('tr.selected').removeClass('selected');
                $(this).addClass('selected');
            }
        });
        //展开折叠列
        $("#imgIncome").click(function () {
            var url = $("#imgIncome").attr("src");
            var arr = new Array(8, 9, 10, 6,7);
            if (url == "icon_9.png") {
                controlColumnShow(table, arr, true);
                $("#imgIncome").attr("src", "icon_10.png");
            }
            else {
                controlColumnShow(table, arr, false);
                $("#imgIncome").attr("src", "icon_9.png");
            }

        });
        //收入展开折叠
        $("#imgCost").click(function () {
            var url = $("#imgCost").attr("src");
            var arr = new Array(14,15,16, 17, 13);
            if (url == "icon_9.png") {
                controlColumnShow(table, arr, true);
                $("#imgCost").attr("src", "icon_10.png");
            }
            else {
                controlColumnShow(table, arr, false);
                $("#imgCost").attr("src", "icon_9.png");
            }
        });
        //获取批量选择行
        $("#btnAddMonthPayOffList").click(function () {
            var nTrs = table.fnGetNodes();//fnGetNodes获取表格所有行,nTrs[i]表示第i行tr对象
            var row;
            selectData = "{'data': [";
            var selectCounts = 0;
            var date;
            for (var i = 0; i < nTrs.length; i++) {
                if ($(nTrs[i])[0].cells[0].children[0].checked) {
                    row = table.fnGetData(nTrs[i]);//fnGetData获取一行的数据
                    selectCounts++;
                    var tempdate = row.ReconcileDate == '' ? row.CompletionTime : row.ReconcileDate;
                    if (tempdate == '') {
                        $.dialog.alert("提货单“" + row.LoadBillNum + "”数据未导入成本数据,且未清关");
                        return false;
                    }
                    //当时间不统一时,获取最大时间
                    if (date == undefined || new Date(tempdate.replace("-", "/").replace("-", "/")) > new Date(date.replace("-", "/").replace("-", "/"))) {
                        date = tempdate;
                    }
                    selectData += "{'LoadBillNum':'" + row.LoadBillNum + "','ReconcileTime':'" + tempdate + "','PreTotalCostFee':'" + row.CostTotalFee
                        +"','TotalCostFee':'"+row.CostTotalFee+ "','PreInComeFee':'" + row.InComeTotalFee +"','InComeFee':'"+row.InComeTotalFee+ "','TotalMargin':'" + row.TotalGrossProfit + "'},";
                }
            }
            selectData = selectData.substring(0, selectData.length - 1)
            selectData += "]}";
            if (selectCounts < 1) {
                $.dialog.alert("请先选择要添加的数据行!");
                return false;
            }
            AddMonthlyBalanceList(date);
        });
    });
    function reloadList() {
        var tables = $('#table_local').dataTable().api();//获取DataTables的Api,详见 http://www.datatables.net/reference/api/
        tables.ajax.reload(function () {
            //var json = tables.context[0].json;
            //getTotal(json);
        }, false);
    }
    //统计
    function getTotal(json) {
        if (json) {
            if (json.TotalWeight) {
                $("#spnTotalWeight").html(json.TotalWeight);
                $("#spnTotalWayBillFee").html(json.TotalWayBillFee);
                $("#spnTotalProcessingFee").html(json.TotalProcessingFee);
                $("#spnTotalExpressFee").html(json.TotalExpressFee);
                $("#spnTotalOperateFee").html(json.TotalOperateFee);
                $("#spnSumWayBillProfit").html(json.SumWayBillProfit);
                $("#spnSumTotalProfit").html(json.SumTotalProfit);
            }
        }
    }
    //控制指定定列的隐藏和显示(table,列索引数组,隐藏or显示:true,false)
    function controlColumnShow(table, arr,tag) {
        for (var i = 0; i < arr.length; i++) {
            table.fnSetColumnVis(arr[i],tag);
        }
    }
    var addDG;
    var payOffMonth;
    //添加到月结表 提单号,结算月份、包裹数、总成本、总收入、总毛利
    function AddMonthlyBalance(id, date, ExpressCount, CostTotalFee, InComeTotalFee, GrossProfitRate) {
        if (date == '') {
            $.dialog.alert("提货单“"+id+"”数据未导入成本数据,且未清关");
            return false;
        }
        var d = { isNeglect: false, data: [{"LoadBillNum": id, "ReconcileTime": date, "PreTotalCostFee": CostTotalFee,"TotalCostFee": CostTotalFee,"PreInComeFee": InComeTotalFee,
"InComeFee": InComeTotalFee,"TotalMargin": GrossProfitRate }] };
        selectData = JSON.stringify(d);
        addDG = $.dialog({
            id: 'AddMonthPayList',
            title: '添加到月结表',
            width: 200,
            height: 150,
            content: "url:/Reconciliation/AddMonthPayOff?payOffDate="+date,
            close: true,
            btnBar: false,
            max: false,
            min: false,
            lock: true
        })
    }
    //批量添加到月结表
    function AddMonthlyBalanceList(date) {
        addDG = $.dialog({
            id: 'AddMonthPay',
            title: '添加到月结表',
            width: 200,
            height: 150,
            content: "url:/Reconciliation/AddMonthPayOff?payOffDate=" + date,
            close: true,
            btnBar: false,
            max: false,
            min: false,
            lock: true
        })
    }
    //隐藏弹出框
    function hidePublishWin(msg, result, isStay) {
        var icon = "success.gif";
        if (result == "False") {
            icon = "error.gif";
        }
        $.dialog({
            title: "提示",
            icon: icon,
            titleIcon: 'lhgcore.gif',
            content: msg,
            lock: true,
            ok: true
        });
        if (result != "False") {
            if (addDG) {
                addDG.close();
            }
            if (isStay == 0) {
                reloadList();
            }
            else {
                reloadListNew();
            }
        }
    }
    //传递选择的行数据
    function postSelectData(payOffMonth, isNeglect) {
        //JSON.parse
        //var json = JSON.stringify(selectData);
        //var json = selectData;//JSON.parse(selectData);
        selectData = selectData.substring(0, selectData.length - 1) + ",'payOffMonth':'" + payOffMonth + "','isNeglect':"+isNeglect+"}";
        $.ajax({
            url: '/Reconciliation/AddMonthPayOff',
            type: 'POST',
            dataType: 'json',
            data: selectData,
            contentType: 'application/json; charset=utf-8',
            success: function (data) {
                if (isNeglect==false) {
                    addDG.close();
                }
                if (!data.IsSuccess && data.IsPoint) {
                    $.dialog.confirm(data.Message, function () { postSelectData(payOffMonth, true); });
                }
                else {
                    $.dialog.alert(data.Message);
                }
            }
        });
    }
</script>
<div class="areabx clear">
    @using (Html.BeginForm("List", null, FormMethod.Get, new { @clase = "form-inline", @role = "form" }))
    {
        <div id="divSearch">
        @*<div class="areabx_header">@ViewBag.Title</div>*@
        <ul class="formod mgt10">
            <li>客户名:@Html.TextBox("CusName","",new { @class = "trade-time wid153" })</li>
            <li>提单号:@Html.TextBox("LoadBillNum","", new { @class = "trade-time" })</li>
        </ul>
        <ul class="formod mgt10">
            <li>清关完成时间:@Html.TextBox("CompletionSTime", "", new { @class = "trade-time wid153", @onClick = "WdatePicker({maxDate:'#F{$dp.$D(\\'CompletionETime\\')}'})" })</li>
            <li>—  @Html.TextBox("CompletionETime", "", new { @class = "trade-time wid153", 
@onClick =  "WdatePicker({minDate:'#F{$dp.$D(\\'CompletionSTime\\')}'})"  })</li>
        </ul>
        <div class="botbtbx pdb0">
            <input type="button" value="查询" id="btnSearch" onclick="reloadList();" class="btn btn-primary" />
            <input type="button" id="btnAddMonthPayOffList" value="批量添加到月结表" class="btn btn-primary"/>
        </div>
            </div>
    }
    <div class="tob_box mgt15">
        <table id="table_local" class="display" cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
            <thead>
                <tr>
                    <th rowspan="2"><input type='checkbox' id='chkAllColl' onclick='selectAll()' />序号</th>
                    <th rowspan="2">客户简称</th>
                    <th rowspan="2">提单号</th>
                    <th rowspan="2">提单包裹重量(KG)</th>
                    <th rowspan="2">提单包裹数量</th>
                    <th rowspan="2">清关完成时间</th>
                    <th colspan="7">成本<img id="imgIncome" src="icon_9.png"  alt="收起/展开" title="收起/展开"/></th>
                    <th colspan="7">收入<img id="imgCost" src="icon_9.png" alt="收起/展开" title="收起/展开"/></th>
                    <th colspan="2">毛利</th>
                    <th rowspan="2">对账单状态</th>
                    <th rowspan="2">操作</th>
                </tr>
                <tr>
                    <th>邮政地勤费</th>
                    <th>邮政仓租</th>
                    <th>邮政邮资</th>
                    <th>邮件处理费</th>
                    <th>邮政其他费用</th>
                    <th>邮政总成本</th>
                    <th>邮政结算状态</th>
                    <th>客户提货费</th>
                    <th>客户仓租</th>
                    <th>客户运费</th>
                    <th>客户操作费</th>
                    <th>其他费用</th>
                    <th>总收入</th>
                    <th>结算状态</th>
                    <th>总毛利</th>
                    <th>毛利率</th>
                </tr>
            </thead>
            @*<tfoot>
                <tr>
                    <td>总计</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </tfoot>*@
        </table>
    </div>
</div>

新建WayBill视图

MonthPayOffModel模型类:

图片 9图片 10

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Site.Models
{
    public class MonthPayOffModel
    {
        /// <summary>
        /// 对账时间
        /// </summary>
        public DateTime ReconcileTime { get; set; }
        /// <summary>
        /// 预计总成本
        /// </summary>
        public decimal PreTotalCostFee{get;set;}
        /// <summary>
        /// 真实总成本
        /// </summary>
        public decimal TotalCostFee{get;set;}
        /// <summary>
        /// 预计总收入
        /// </summary>
        public decimal PreInComeFee{get;set;}
        /// <summary>
        /// 真实总收入
        /// </summary>
        public decimal InComeFee { get; set; }
        /// <summary>
        /// 总毛利
        /// </summary>
        public decimal TotalMargin { get; set; }
        /// <summary>
        /// 提单号
        /// </summary>
        public string LoadBillNum { get; set; }
    }
}
@{
    ViewBag.Title = "运费对账";
}
<style type="text/css">
    .numberColor {
        color:red;
    }
</style>
<link href="~/libs/DataTables-1.10.6/media/css/jquery.dataTablesNew.css" rel="stylesheet" />
<script src="~/libs/DataTables-1.10.6/media/js/jquery.dataTables.min.js"></script>
<script src="~/Scripts/DataTablesExt.js"></script>
<script src="~/libs/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $(function () {
        var h = $(document).height() - 312;
        var table = $("#table_local").dataTable({
            bProcessing: true,
            "scrollY": h,
            "scrollCollapse": "true",
            "dom": 'tr<"bottom"lip><"clear">',
            "bServerSide": true,                    //指定从服务器端获取数据  
            sServerMethod: "POST",
            showRowNumber:true,
            sAjaxSource: "@Url.Action("WayBillList", "Reconciliation")",
            "initComplete": function (data, args) {
                //getTotal(args);
                var arr = new Array(7,8,9,12,13,14);
                controlColumnShow(table, arr,false);
            },
            "fnServerParams": function (aoData) {  //查询条件
                aoData.push(
                    { "name": "CusShortName", "value": $("#CusShortName").val() },
                    { "name": "LoadBillNum", "value": $("#LoadBillNum").val() },
                    { "name": "ExpressNo", "value": $("#ExpressNo").val() },
                    { "name": "PostingTime", "value": $("#PostingTime").val() },
                    { "name": "PostingTimeTo", "value": $("#PostingTimeTo").val() }
                    // ,{ "name": "PostingTimeTo", "value": $("#sltMargin").val() }
                     );
            },
            //跟数组下标一样,第一列从0开始,这里表格初始化时,第四列默认降序
            "order": [[ 2, "asc" ]],
            columns: [
               {
                   "data": "ID", orderable: false,
                   "render": function (data, type, row, meta) {
                       return " <input id='cbx" + data + "' type='checkbox' onclick='controlSelectAll(" + data + ")' class='cbx' value='" + data + "'/>  " + row.Index;
                   }
               },                                                      
                { "data": "ReconcileDate",visible:false},//对账日期
                { "data": "CusName" }, //客户名称
                { "data": "PostingTime"},//收寄日期
                { "data": "ExpressNo", orderable: false }, //邮件号
                { "data": "BatchNO"},//提单号
                { "data": "Weight"},//重量
                { "data": "WayBillFee"},//邮政邮资
                { "data": "ProcessingFee" },//邮政邮件处理费
                { "data": "CostOtherFee"},//其它费用
                { "data": "CostTotalFee" },//总成本
                { "data": "CostStatus", orderable: false },//状态
                { "data": "InComeWayBillFee" },//客户运费
                { "data": "InComeOprateFee"},//客户操作费
                { "data": "InComeOtherFee"},//其它费用
                { "data": "InComeTotalFee" },//总收入
                { "data": "InComeStatus", orderable: false },//状态
                 {
                     "data": "WayBillMargins", orderable: false, "render": function (data, type, row, meta) { //运费毛利
                         var css = "";
                         if (data < 0) {
                             css=" class='numberColor'";
                         }
                         var re = "<div"+css+">"+data+"</div>";
                         return re;
                     }
                 },
                  {
                      "data": "TotalMargins", orderable: false, "render": function (data, type, row, meta) { //总毛利
                          var css = "";
                          if (data < 0) {
                              css = " class='numberColor'";
                          }
                          var re = "<div" + css + ">" + data + "</div>";
                          return re;
                      }
                  },
                { "data": "Margin", orderable: false },//毛利率
                { "data": "TotalStatus", orderable: false },
                 {
                     "data": "ID", orderable: false, width: "80", "render": function (data, type, row, meta) { //操作
                         var re = "<div style='text-align:center'><a style='visibility:visible' onclick='openDetail(" + data + ")'>详情</a>&nbsp;&nbsp;";
                         return re;
                     }
                 }
            ],
            paging: true,//分页
            ordering: true,//是否启用排序
            searching: true,//搜索
            language: {
                "sProcessing": "处理中...",
                lengthMenu: '每页显示:<select class="form-control input-xsmall">' + '<option value="10">10</option>' + '<option value="20">20</option>' + '<option value="30">30</option>'
                    + '<option value="50">50</option>' + '<option value="100">100</option>' + '<option value="150">150</option>' + '<option value="200">200</option>' + '<option value="250">250</option>',//左上角的分页大小显示。
                search: '搜索:',//右上角的搜索文本,可以写html标签

                paginate: {//分页的样式内容。
                    previous: "上一页",
                    next: "下一页",
                    first: "",
                    last: ""
                },

                zeroRecords: "暂无记录",//table tbody内容为空时,tbody的内容。
                //下面三者构成了总体的左下角的内容。
                info: "总共 (_PAGES_) 页,显示 _START_ -- _END_ ,共 (_TOTAL_) 条",//左下角的信息显示,大写的词为关键字。初始_MAX_ 条 
                infoEmpty: "0条记录",//筛选为空时左下角的显示。
                infoFiltered: ""//筛选之后的左下角筛选提示,
            },
            pagingType: "full_numbers"//分页样式的类型
      });
        //设置选中行样式
        $('#table_local tbody').on('click', 'tr', function () {
            if ($(this).hasClass('selected')) {
                $(this).removeClass('selected');
            }
            else {
                table.$('tr.selected').removeClass('selected');
                $(this).addClass('selected');
            }
        });
        //展开折叠列
        $("#imgIncome").click(function () {
            var url = $("#imgIncome").attr("src");
            var arr = new Array(7, 8, 9);
            if (url == "icon_9.png") {
                controlColumnShow(table, arr, true);
                $("#imgIncome").attr("src", "icon_10.png");
            }
            else {
                controlColumnShow(table, arr, false);
                $("#imgIncome").attr("src", "icon_9.png");
            }

        });
        //收入展开折叠
        $("#imgCost").click(function () {
            var url = $("#imgCost").attr("src");
            var arr = new Array(12, 13, 14);
            if (url == "icon_9.png") {
                controlColumnShow(table, arr, true);
                $("#imgCost").attr("src", "icon_10.png");
            }
            else {
                controlColumnShow(table, arr, false);
                $("#imgCost").attr("src", "icon_9.png");
            }
        });
    });
    function reloadList() {
        var tables = $('#table_local').dataTable().api();//获取DataTables的Api,详见 http://www.datatables.net/reference/api/
        tables.ajax.reload(function () {
            var json = tables.context[0].json;
            getTotal(json);
        }, false);
    }
    //统计
    function getTotal(json) {
        if (json) {
            if (json.TotalWeight) {
                $("#spnTotalWeight").html(json.TotalWeight);
                $("#spnTotalWayBillFee").html(json.TotalWayBillFee);
                $("#spnTotalProcessingFee").html(json.TotalProcessingFee);
                $("#spnTotalExpressFee").html(json.TotalExpressFee);
                $("#spnTotalOperateFee").html(json.TotalOperateFee);
                $("#spnSumWayBillProfit").html(json.SumWayBillProfit);
                $("#spnSumTotalProfit").html(json.SumTotalProfit);
            }
        }
    }
    //控制指定定列的隐藏和显示(table,列索引数组,隐藏or显示:true,false)
    function controlColumnShow(table, arr,tag) {
        for (var i = 0; i < arr.length; i++) {
            table.fnSetColumnVis(arr[i],tag);
        }
    }
</script>
<div class="areabx clear">
    @using (Html.BeginForm("List", null, FormMethod.Get, new { @clase = "form-inline", @role = "form" }))
    {
        <div class="areabx_header">@ViewBag.Title</div>
        <ul class="formod mgt10">
            <li>客户简称:@Html.TextBox("CusShortName","",new { @class = "trade-time wid153" })</li>
            <li>提单号:@Html.TextBox("LoadBillNum","", new { @class = "trade-time" })</li>
        </ul>
        <ul class="formod mgt10">
            <li>运单号:@Html.TextBox("ExpressNo","", new { @class = "trade-time wid153" })</li>
            <li>收寄日期:@Html.TextBox("PostingTime", "", new { @class = "trade-time wid153", @onClick = "WdatePicker({maxDate:'#F{$dp.$D(\\'PostingTimeTo\\')}'})" })</li>
            <li>—  @Html.TextBox("PostingTimeTo", "", new { @class = "trade-time wid153", @onClick =  "WdatePicker({minDate:'#F{$dp.$D(\\'PostingTime\\')}'})"  })</li>
            <li>毛利:<select class="trade-time" id="sltMargin"><option value="" selected="selected">全部</option><option value="+">+</option><option value="-">-</option></select></li>
        </ul>
        <div class="botbtbx pdb0">
            <input type="button" value="查询" id="btnSearch" onclick="reloadList();" class="btn btn-primary" />
        </div>
    }
    <div class="tob_box mgt15">
        <table id="table_local" class="display" cellspacing="0" cellpadding="0" border="0" style="width: 100%">
            <thead>
                <tr>
                    <th rowspan="2">
                     <input type='checkbox' id='chkAllColl' onclick='selectAll()' />序号</th>
                    <th rowspan="2">对账日期</th>
                    <th rowspan="2">客户简称</th>
                    <th rowspan="2">收寄日期</th>
                    <th rowspan="2">邮件号</th>
                    <th rowspan="2">提单号</th>
                    <th rowspan="2">重量(kg)</th>
                    <th colspan="5">成本<img id="imgIncome" src="icon_9.png"  alt="收起/展开"/></th>
                    <th colspan="5">收入<img id="imgCost" src="icon_9.png" alt="收起/展开"/></th>
                    <th colspan="3">毛利</th>
                    <th rowspan="2">状态</th>
                    <th rowspan="2">操作</th>
                </tr>
                <tr>
                    <th>邮政邮资</th>
                    <th>邮政邮件处理费</th>
                    <th>其它费用</th>
                    <th>总成本</th>
                    <th>状态</th>
                    <th>客户运费</th>
                    <th>客户操作费</th>
                    <th>其它费用</th>
                    <th>总收入</th>
                    <th>状态</th>
                    <th>运费毛利</th>
                    <th>总毛利</th>
                    <th>毛利率</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <td>总计</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </tfoot>
        </table>
    </div>
</div>

js控制全选反选

View Code

//监听每一行的复选框,控制全选、反选按钮  
function controlSelectAll(i) {
    var tblName, cbkAll; //Gridview ID ,全选框ID  
    var tblName = "table_local";
    var cbkAll = "chkAllColl";
    var id = "#cbx" + i;
    //点击复选框选中行
    //if ($(id)[0].checked == true) {
    //    $(id).parent().parent().addClass('selected');
    //    $(id).parent().parent().siblings().removeClass('selected');
    //} else {
    //    $(id).parent().parent().siblings().removeClass('selected');
    //    $(id).parent().parent().removeClass('selected');
    //}
    var chks = getCheckbox(tblName);
    var count = 0;
    for (var i = 0; i < chks.length; i++) {
        if (chks[i].checked == true) {
            count++;
        }
    }
    if (count < chks.length) {
        document.getElementById(cbkAll).checked = false;
    }
    else {
        document.getElementById(cbkAll).checked = true;
    }
}
//全选反选
function selectAll() {
    if ($("#chkAllColl").attr("checked")) {//如果全选的checkbox为选中状态时
        $("#table_local input").attr("checked", "checked");//其他的checkbox全部勾选
        //$("#table_local tbody tr").addClass('selected');
    }
    else {//如果全选的checkbox为选非中状态时
        $("#table_local input").attr('checked', false);//其他的checkbox全部取消勾选
        //$("#table_local tbody tr").removeClass('selected');
    }
}

这里面  table.fnSetColumnVis(arr[i],
tag);那行代码控制列动态隐藏和出示的时候,会重复加载数据,能够在末端加二个false参数,撤除刷新。
如: table.fnSetColumnVis(arr[i], tag,false);

 

呼吁参数封装类DataTablesRequest,那些类是从季军的博客下载的,它重要用于解析datatables的呼吁参数,由于datatables帮衬多列排序,所以比较复杂。下载的那个类有点难点,那就是赢得的排序情势直接是asc,于是本人进行了改动,修改后的代码如下:

 代码很多,不要被吓到了,其实也很简单,难题在在于怎样协会json,然后让控制器自动接收并活动分析成List<Model>格局。那里运用了js的JSON.stringify(d)方法,注意json字符串里面包车型地铁属性和值都加引号。

图片 11图片 12

/* ==============================================================================
   * 功能描述:DataTablesRequest  
   * 创 建 者:Zouqj
   * 创建日期:2015/4/21 17:47:35
   ==============================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ProjectBase.Utils
{
    // 排序的方向
    public enum SortDirection
    {
        Asc,    // 升序
        Desc    // 降序
    }

    // 排序列的定义
    public class SortColumn
    {
        public int Index { get; set; }                  // 列序号
        public SortDirection Direction { get; set; }    // 列的排序方向
    }

    // 列定义
    public class Column
    {
        public string Name { get; set; }        // 列名
        public bool Sortable { get; set; }      // 是否可排序
        public bool Searchable { get; set; }    // 是否可搜索
        public string Search { get; set; }      // 搜索串
        public bool EscapeRegex { get; set; }   // 是否正则
    }

    public class DataTablesRequest
    {
        private HttpRequestBase request;        // 内部使用的 Request 对象

        public DataTablesRequest(System.Web.HttpRequestBase request)    // 用于 MVC 模式下的构造函数
        {
            this.request = request;

            this.echo = this.ParseStringParameter(sEchoParameter);
            this.displayStart = this.ParseIntParameter(iDisplayStartParameter);
            this.displayLength = this.ParseIntParameter(iDisplayLengthParameter);
            this.sortingCols = this.ParseIntParameter(iSortingColsParameter);

            this.search = this.ParseStringParameter(sSearchParameter);
            this.regex = this.ParseStringParameter(bRegexParameter) == "true";

            // 排序的列
            int count = this.iSortingCols;
            this.sortColumns = new SortColumn[count];
            for (int i = 0; i < count; i++)
            {
                SortColumn col = new SortColumn();
                col.Index = this.ParseIntParameter(string.Format("iSortCol_{0}", i));

                if (this.ParseStringParameter(string.Format("sSortDir_{0}", i)) == "desc")
                {
                    col.Direction = SortDirection.Desc;
                }
                else
                {
                    col.Direction = SortDirection.Asc;
                }
                this.sortColumns[i] = col;
            }

            this.ColumnCount = this.ParseIntParameter(iColumnsParameter);

            count = this.ColumnCount;
            this.columns = new Column[count];

            if(this.ParseStringParameter(sColumnsParameter)==null||!this.ParseStringParameter(sColumnsParameter).Contains(','))
            {
                   return;
            }
            string[] names = this.ParseStringParameter(sColumnsParameter).Split(',');

            for (int i = 0; i < count; i++)
            {
                Column col = new Column();
                col.Name = names[i];
                col.Sortable = this.ParseStringParameter(string.Format("bSortable_{0}", i)) == "true";
                col.Searchable = this.ParseStringParameter(string.Format("bSearchable_{0}", i)) == "true";
                col.Search = this.ParseStringParameter(string.Format("sSearch_{0}", i));
                col.EscapeRegex = this.ParseStringParameter(string.Format("bRegex_{0}", i)) == "true";
                columns[i] = col;
            }
        }
        public DataTablesRequest(HttpRequest httpRequest)       // 标准的 WinForm 方式下的构造函数
            : this(new HttpRequestWrapper(httpRequest))
        { }

        #region
        private const string sEchoParameter = "sEcho";

        // 起始索引和长度
        private const string iDisplayStartParameter = "iDisplayStart";
        private const string iDisplayLengthParameter = "iDisplayLength";

        // 列数
        private const string iColumnsParameter = "iColumns";
        private const string sColumnsParameter = "sColumns";

        // 参与排序列数
        private const string iSortingColsParameter = "iSortingCols";
        private const string iSortColPrefixParameter = "iSortCol_";         // 排序列的索引
        private const string sSortDirPrefixParameter = "sSortDir_";         // 排序的方向 asc, desc

        // 每一列的可排序性
        private const string bSortablePrefixParameter = "bSortable_";

        // 全局搜索
        private const string sSearchParameter = "sSearch";
        private const string bRegexParameter = "bRegex";

        // 每一列的搜索
        private const string bSearchablePrefixParameter = "bSearchable_";
        private const string sSearchPrefixParameter = "sSearch_";
        private const string bEscapeRegexPrefixParameter = "bRegex_";
        #endregion

        private readonly string echo;
        public string sEcho
        {
            get { return echo; }
        }

        private readonly int displayStart;
        public int iDisplayStart
        {
            get { return this.displayStart; }
        }

        private readonly int displayLength;
        public int iDisplayLength
        {
            get { return this.displayLength; }
        }

        // 参与排序的列
        private readonly int sortingCols;
        public int iSortingCols
        {
            get { return this.sortingCols; }
        }

        // 排序列
        private readonly SortColumn[] sortColumns;
        public SortColumn[] SortColumns
        {
            get { return sortColumns; }
        }

        private readonly int ColumnCount;
        public int iColumns
        {
            get { return this.ColumnCount; }
        }

        private readonly Column[] columns;
        public Column[] Columns
        {
            get { return this.columns; }
        }

        private readonly string search;
        public string Search
        {
            get { return this.search; }
        }

        private readonly bool regex;
        public bool Regex
        {
            get { return this.regex; }
        }

        #region 常用的几个解析方法
        private int ParseIntParameter(string name)          // 解析为整数
        {
            int result = 0;
            string parameter = this.request[name];
            if (!string.IsNullOrEmpty(parameter))
            {
                int.TryParse(parameter, out result);
            }
            return result;
        }

        private string ParseStringParameter(string name)    // 解析为字符串
        {
            return this.request[name];
        }

        private bool ParseBooleanParameter(string name)     // 解析为布尔类型
        {
            bool result = false;
            string parameter = this.request[name];
            if (!string.IsNullOrEmpty(parameter))
            {
                bool.TryParse(parameter, out result);
            }
            return result;
        }
        #endregion
    }
}

View Code

本篇作者不想做过多的求证,作者写了要命详尽的笺注,而且代码13分通俗易懂,界面包车型地铁成效依旧尤其强劲的,笔者相信,从那么些尖锐的代码中,你一定会受益良多。