js找出表格最大编号并调试

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('解决方案列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>反馈Id:</label>
                                <input type="text" id="fid"  name="fid" th:value="${feedback['id']}"/>
                            </li>
                            <li>
                                <label>方案提出者:</label>
                                <input type="text" name="username"/>
                            </li>
                            <li class="select-time">
                                <label>方案修改日期:</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginSolutiondate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endSolutiondate]"/>
                            </li>
                            <li>
                                <label>问题确认人:</label>
                                <input type="text" name="confirmer"/>
                            </li>
                            <li>
                                <label>确认人电话:</label>
                                <input type="text" name="tel"/>
                            </li>
                            <li>
                                <label>确认人性别:</label>
                                <select name="sex">
                                    <option value="">所有</option>
                                    <option value="-1">代码生成请选择字典属性</option>
                                </select>
                            </li>
                            <li>
                                <label>确认人部门:</label>
                                <input type="text" name="depart"/>
                            </li>
                            <li class="select-time">
                                <label>确认日期:</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginConfirmdate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endConfirmdate]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="add()" shiro:hasPermission="crm:solution:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="crm:solution:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="crm:solution:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="crm:solution:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('crm:solution:edit')}]];
        var removeFlag = [[${@permission.hasPermi('crm:solution:remove')}]];
        var solutionFlag = [[${@permission.hasRole('solutioner')}]];
        var prefix = ctx + "crm/solution";
        debugger
        $(function() {
            var curPageMaxId = -1;
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add/{id}",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                queryParams: queryParams,
                modalName: "解决方案",
                onLoadSuccess: function(data){

                   if(curPageMaxId==-1 && data.rows.length>0){
                      data.rows.forEach(function(row){
                        if(row.id>curPageMaxId){
                           curPageMaxId=row.id

                        }
                      });
                     $.table.refresh();
                    };
                },
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id', 
                    title: '编号',
                   visible: true,
                  formatter:function(value,row,index){
                      if(curPageMaxId == row.id){
                       alert("curPageMaxId"+curPageMaxId);
                        return value + '(maxId)';
                       }
                       return value;
                   }
                },
                {
                    field: 'fid', 
                    title: '反馈Id'
                },
                {
                    field: 'solution', 
                    title: '方案内容'
                },
                {
                    field: 'username', 
                    title: '方案提出者'
                },
                {
                    field: 'solutiondate', 
                    title: '方案修改日期'
                },
                {
                    field: 'confirmer', 
                    title: '问题确认人'
                },
                {
                    field: 'tel', 
                    title: '确认人电话'
                },
                {
                    field: 'sex', 
                    title: '确认人性别'
                },
                {
                    field: 'depart', 
                    title: '确认人部门'
                },
                {
                    field: 'confirmdate', 
                    title: '确认日期'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {

                        var actions = [];
                        if(row.substate=='nosub')
                        {
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-danger btn-xs ' + solutionFlag + '" href="javascript:void(0)" onclick="subsolution(\'' + row.id + '\')"><i class="fa fa-edit"></i>提交解决</a>');

                            }
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a> ');
                        if(row.substate=='subed' &&  row.id ==curPageMaxId)
                        {
                        actions.push('<a class="btn btn-danger btn-xs ' + solutionFlag + '" href="javascript:void(0)" onclick="withdrawsolution(\'' + row.id + '\')"><i class="fa fa-edit"></i>撤销解决</a>');
                        }
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function queryParams(params) {
			var search = $.table.queryParams(params);
			search.fid = $("#fid").val();
			return search;
		}
		function add() {
		    var fid = $("#fid").val();
		    $.operate.add(fid);
		}
		 /*提交到审查*/
        function subsolution(id) {
            var url = prefix + '/subsolution/' + id;
            $.operate.post(url);
        }
        /*回退到解决*/
        function withdrawsolution(id) {
            var url = prefix + '/withdrawsolution/' + id;
            $.operate.post(url);
        }

    </script>
</body>
</html>
onLoadSuccess: function(data){

   if(curPageMaxId==-1 && data.rows.length>0){
      data.rows.forEach(function(row){
        if(row.id>curPageMaxId){
           curPageMaxId=row.id

        }
      });
     $.table.refresh();
    };
},

开始没加。length>0,浏览器发F12调试,在source标签中查看,中间的源代码中加断点,鼠标滑过变量可查看变量值。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值