<%@ page contentType="text/html;charset=UTF-8" %>
<script>
$(document).ready(function() {
	$('#basicTable').bootstrapTable({
		  //请求方法
               method: 'post',
               //类型json
               dataType: "json",
               contentType: "application/x-www-form-urlencoded",
               //显示检索按钮
	       showSearch: true,
               //显示刷新按钮
               showRefresh: true,
               //显示切换手机试图按钮
               showToggle: true,
               //显示 内容列下拉框
    	       showColumns: true,
    	       //显示到处按钮
    	       showExport: true,
    	       //显示切换分页按钮
    	       showPaginationSwitch: true,
    	       //显示详情按钮
    	       detailView: true,
    	       	//显示详细内容函数
	           // detailFormatter: "detailFormatter",
    	       //最低显示2行
    	       minimumCountColumns: 2,
               //是否显示行间隔色
               striped: true,
               //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
               cache: false,
               //是否显示分页（*）
               pagination: true,
                //排序方式
               sortOrder: "asc",
               //初始化加载第一页，默认第一页
               pageNumber:1,
               //每页的记录行数（*）
               pageSize: 10,
               //可供选择的每页的行数（*）
               pageList: [10, 25, 50, 100],
               //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
               url: "${ctx}/filing/earlyEngineering/data",
               //默认值为 'limit',传给服务端的参数为：limit, offset, search, sort, order Else
               //queryParamsType:'',
               ////查询参数,每次调用是会带上这个参数，可自定义
               queryParams : function(params) {
               	var searchParam = $("#searchForm").serializeJSON();
               	searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
               	searchParam.pageSize = params.limit === undefined? -1 : params.limit;
               	searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+  params.order;
                   return searchParam;
               },
               //分页方式：client客户端分页，server服务端分页（*）
               sidePagination: "server",
               contextMenuTrigger:"right",//pc端 按右键弹出菜单
               contextMenuTriggerMobile:"press",//手机端 弹出菜单，click：单击， press：长按。
               contextMenu: '#context-menu',
               onContextMenuItem: function(row, $el){
                   if($el.data("item") == "edit"){
                   		edit(row.id);
                   }else if($el.data("item") == "view"){
                       view(row.id);
                   } else if($el.data("item") == "delete"){
                        jp.confirm('确认要删除该初设阶段记录吗？', function(){
                       	jp.loading();
                       	jp.get("${ctx}/filing/earlyEngineering/delete?id="+row.id, function(data){
                   	  		if(data.success){
                   	  			$('#basicTable').bootstrapTable('refresh');
                   	  			jp.success(data.msg);
                   	  		}else{
                   	  			jp.error(data.msg);
                   	  		}
                   	  	})

                   	});

                   }
               },
		/*		onPostBody:function(){
					window.rowProps = undefined;
					_table_rowspan("#basicTable" , 1);
					_table_rowspan("#basicTable" , 2);
					_table_rowspan("#basicTable" , 3);
					_table_rowspan("#basicTable" , 4);
					_table_rowspan("#basicTable" , 5);
					return true;
				},*/
               onClickRow: function(row, $el){
               },
               	onShowSearch: function () {
			$("#search-collapse").slideToggle();
		},
               columns: [{
		        checkbox: true

		    }
			,{
		        field: 'projectCode',
		        title: '项目编码',
			    width: 100,
		        sortable: true,
		        sortName: 'projectCode'
		        ,formatter:function(value, row , index){
			   if(value == null || value ==""){
				   value = "-";
			   }
			   <c:choose>
				   <c:when test="${fns:hasPermission('test:filing:earlyEngineering:edit')}">
				      return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
			      </c:when>
				  <c:when test="${fns:hasPermission('test:filing:earlyEngineering:view')}">
				      return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
			      </c:when>
				  <c:otherwise>
				      return value;
			      </c:otherwise>
			   </c:choose>

		        }
		    }
			,{
		        field: 'monomerCode',
		        title: '单体编码',
		        sortable: true,
			   width: 100,
		        sortName: 'monomerCode'

		    }
			,{
		        field: 'entryName',
		        title: '项目名称',
					   width: 100,
		        sortable: true,
		        sortName: 'entryName'

		    }
			,{
		        field: 'preDesignNo',
		        title: '初设批复文号',
					   width: 100,
		        sortable: true,
		        sortName: 'preDesignNo'
		    }
			, {
			   field: 'initialDesignDate',
			   title: '初设批复日期',
			   width: 100,
			   sortable: true,
			   sortName: 'initialDesignDate'
		   },{
			   field: 'batchOverview',
			   title: '批概动态',
			   width: 100,
			   sortable: true,
			   sortName: 'batchOverview'
		   }
		   ,{
			   field: 'batchStatistics',
			   title: '批概静态',
			   width: 100,
			   sortable: true,
			   sortName: 'batchStatistics'
		   }
		   , {
			   field: 'estimateCode',
			   title: '批概场地清理费',
			   width: 100,
			   sortable: true,
			   sortName: 'estimateCode'

		   }, {
			   field: 'designCost',
			   title: '设计费批概',
			   width: 100,
			   sortable: true,
			   sortName: 'designCost'

		   }, {
			   field: 'supervisionFeeCode',
			   title: '监理费批概',
			   width: 100,
			   sortable: true,
			   sortName: 'supervisionFeeCode'

		   }, {
			   field: 'managementFeeCode',
			   title: '批概法人管理费',
			   width: 100,
			   sortable: true,
			   sortName: 'managementFeeCode'

		   }, {
			   field: 'dataCode',
			   title: '其他概算中需要的数据',
			   width: 100,
			   sortable: true,
			   sortName: 'dataCode'

		   },{
					   field: 'threeDepartment',
					   title: '三个项目部关键人员信息',
					   width: 100,
					   sortable: true,
					   sortName: 'threeDepartment'
				   },{
					   field: 'landNo',
					   title: '用地预审意见（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'landNo'
				   },{
					   field: 'landDate',
					   title: '用地预审意见（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'landDate'
				   },{
					   field: 'eiaNo',
					   title: '环评批复（变电站、线路） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'eiaNo'
				   },{
					   field: 'eiaDate',
					   title: '环评批复（变电站、线路） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'eiaDate'
				   },{
					   field: 'acceptanceNo',
					   title: '环评验收文号及日期 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'acceptanceNo'
				   },{
					   field: 'acceptanceDate',
					   title: '环评验收文号及日期 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'acceptanceDate'
				   },{
					   field: 'replyNo',
					   title: '水保批复（变电站、线路） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'replyNo'
				   },{
					   field: 'replyDate',
					   title: '水保批复（变电站、线路） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'replyDate'
				   },{
					   field: 'soilNo',
					   title: '水保验收文号及日期 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'soilNo'
				   },{
					   field: 'soilDate',
					   title: '水保验收文号及日期 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'soilDate'
				   },{
					   field: 'depositNo',
					   title: '压覆矿藏复函（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'depositNo'
				   },{
					   field: 'depositDate',
					   title: '压覆矿藏复函（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'depositDate'
				   },{
					   field: 'recordNo',
					   title: '地灾评估备案表（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'recordNo'
				   },{
					   field: 'recordDate',
					   title: '地灾评估备案表（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'recordDate'
				   },{
					   field: 'siteProposalNo',
					   title: '选址意见书（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'siteProposalNo'
				   },{
					   field: 'siteProposalDate',
					   title: '选址意见书（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'siteProposalDate'
				   },{
					   field: 'planningNo',
					   title: '线路路径规划意见 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'planningNo'
				   },{
					   field: 'planningDate',
					   title: '线路路径规划意见 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'planningDate'
				   },{
					   field: 'usePlanNo',
					   title: '用地规划许可证 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'usePlanNo'
				   },{
					   field: 'usePlanDate',
					   title: '用地规划许可证 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'usePlanDate'
				   },{
					   field: 'requisitonNo',
					   title: '征地补偿批复 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'requisitonNo'
				   },{
					   field: 'requisitonDate',
					   title: '征地补偿批复 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'requisitonDate'
				   },{
					   field: 'conLandNo',
					   title: '建设用地批准书 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'conLandNo'
				   },{
					   field: 'conLandDate',
					   title: '建设用地批准书 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'conLandDate'
				   },{
					   field: 'transferNo',
					   title: '划拨决定书 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'transferNo'
				   },{
					   field: 'transferDate',
					   title: '划拨决定书 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'transferDate'
				   },{
					   field: 'certificateNo',
					   title: '土地证（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'certificateNo'
				   },{
					   field: 'certificateDate',
					   title: '土地证（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'certificateDate'
				   },{
					   field: 'permitNo',
					   title: '建设工程规划许可证（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'permitNo'
				   },{
					   field: 'permitDate',
					   title: '建设工程规划许可证（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'permitDate'
				   },{
					   field: 'fireProNo',
					   title: '消防设计审查/备案意见（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'fireProNo'
				   },{
					   field: 'fireProdate',
					   title: '消防设计审查/备案意见（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'fireProdate'
				   },{
					   field: 'fireAccNo',
					   title: '消防验收/备案意见（变电站） 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'fireAccNo'
				   },{
					   field: 'fireAccDate',
					   title: '消防验收/备案意见（变电站） 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'fireAccDate'
				   },{
					   field: 'estateNo',
					   title: '不动产权证 文号',
					   width: 100,
					   sortable: true,
					   sortName: 'estateNo'
				   },{
					   field: 'estateDate',
					   title: '不动产权证 日期',
					   width: 100,
					   sortable: true,
					   sortName: 'estateDate'
				   },{
					   field: 'planningLevel',
					   title: '规划总平（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'planningLevel'
				   }
				   , {
					   field: 'surveyReport',
					   title: '勘察定界报告（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'surveyReport'

				   }, {
					   field: 'redLineMap',
					   title: '征地红线图（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'redLineMap'

				   }, {
					   field: 'redLineLand',
					   title: '用地红线图（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'redLineLand'

				   }, {
					   field: 'zongMap',
					   title: '宗地图',
					   width: 100,
					   sortable: true,
					   sortName: 'zongMap'

				   }, {
					   field: 'recordSurvey',
					   title: '勘察合同备案表（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'recordSurvey'

				   }, {
					   field: 'recordDesign',
					   title: '设计合同备案表（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'recordDesign'

				   }, {
					   field: 'recordContract',
					   title: '施工合同备案表（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'recordContract'

				   }, {
					   field: 'supervisionRecord',
					   title: '监理合同备案表（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'supervisionRecord'

				   }, {
					   field: 'qulifiedOpinions',
					   title: '岩土勘察报告审查合格意见（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'qulifiedOpinions'

				   }, {
					   field: 'constructionComments',
					   title: '施工图审查合格意见（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'constructionComments'

				   }, {
					   field: 'constructionDrawing',
					   title: '施工图审查合格证（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'constructionDrawing'

				   }, {
					   field: 'seismicReview',
					   title: '抗震设防审查证书（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'seismicReview'

				   }, {
					   field: 'planningSetting',
					   title: '规划放线报告（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'planningSetting'

				   }, {
					   field: 'safetyRecord',
					   title: '安监申报书、备案表（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'safetyRecord'

				   }, {
					   field: 'qualityRecord',
					   title: '质监申报书、备案表（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'qualityRecord'

				   }, {
					   field: 'constructionPermit',
					   title: '施工许可证',
					   width: 100,
					   sortable: true,
					   sortName: 'constructionPermit'

				   }, {
					   field: 'planBuiltMapping',
					   title: '规划竣工测绘现状图及管线、绿化、比较图（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'planBuiltMapping'

				   }, {
					   field: 'qualityAcceptance',
					   title: '质监竣工验收意见（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'qualityAcceptance'

				   }, {
					   field: 'urbanArchives',
					   title: '城建档案接收合格证明（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'urbanArchives'

				   }, {
					   field: 'completionRecord',
					   title: '竣工备案表（变电站）',
					   width: 100,
					   sortable: true,
					   sortName: 'completionRecord'

				   }, {
					   field: 'realEstate',
					   title: '房产测绘报告',
					   width: 100,
					   sortable: true,
					   sortName: 'realEstate'

				   }, {
					   field: 'reportOnLang',
					   title: '宗地复测报告',
					   width: 100,
					   sortable: true,
					   sortName: 'reportOnLang'

				   }
		     ],
		onExpandRow: function (index, row, $detail) {
			initSubTable(index, row, $detail);
		}
		});

	//初始化子表格(无线循环)
	initSubTable = function (index, row, $detail) {
		var parentid = row.projectCode;
		var cur_table = $detail.html('<table></table>').find('table');
		$(cur_table).bootstrapTable({
			url: '${ctx}/filing/earlyEngineering/detail',
			method: 'post',
			//类型json
			dataType: "json",
			contentType: "application/x-www-form-urlencoded",
			queryParams : function(params) {
				var searchParam = $("#searchForm").serializeJSON();
				searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
				searchParam.pageSize = params.limit === undefined? -1 : params.limit;
				searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+  params.order;
				searchParam.projectCode = parentid;
				return searchParam;
			},
			striped: true, //是否显示行间隔色
			pagination: false,//显示分页
			sidePagination: "server",
			pageNumber:1,
			pageSize: 10,
			pageList: [10, 25],
			columns: [{
				width: 62
			},{
				field: 'projectCode',
				title: '项目编码',
				width: 100,
				sortable: true,
				sortName: 'projectCode'
				,formatter:function(value, row , index){
					if(value == null || value ==""){
						value = "-";
					}
				<c:choose>
					<c:when test="${fns:hasPermission('test:filing:earlyEngineering:edit')}">
					return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
				</c:when>
					<c:otherwise>
					return value;
				</c:otherwise>
					</c:choose>
				}
			}, {
				field: 'monomerCode',
				width: 100
			}, {
				field: 'entryName',
				width: 100,
			},{
				field: 'preDesignNo',
				width: 100,
			},{
				field: 'initialDesignDate',
				width: 100,
			},{
				field: 'batchOverview',
				width: 100,
			},{
					field: 'batchStatistics',
					width: 100,
				}
				, {
					field: 'estimateCode',
					width: 100,
				}, {
					field: 'designCost',
					width: 100,
				}, {
					field: 'supervisionFeeCode',
					width: 100,
				}, {
					field: 'managementFeeCode',
					width: 100,
				}, {
					field: 'dataCode',
					width: 100,
				},{
					field: 'threeDepartment',
					width: 100,
				},{
					field: 'landNo',
					width: 100,
				},{
					field: 'landDate',
					width: 100,
				},{
					field: 'eiaNo',
					width: 100,
				},{
					field: 'eiaDate',
					width: 100,
				},{
					field: 'acceptanceNo',
					width: 100,
				},{
					field: 'acceptanceDate',
					width: 100,
				},{
					field: 'replyNo',
					width: 100,
				},{
					field: 'replyDate',
					width: 100,
				},{
					field: 'soilNo',
					width: 100,
				},{
					field: 'soilDate',
					width: 100,
				},{
					field: 'depositNo',
					width: 100,
				},{
					field: 'depositDate',
					width: 100,
				},{
					field: 'recordNo',
					width: 100,
				},{
					field: 'recordDate',
					width: 100,
				},{
					field: 'siteProposalNo',
					width: 100,
				},{
					field: 'siteProposalDate',
					width: 100,
				},{
					field: 'planningNo',
					width: 100,
				},{
					field: 'planningDate',
					width: 100,
				},{
					field: 'usePlanNo',
					width: 100,
				},{
					field: 'usePlanDate',
					width: 100,
				},{
					field: 'requisitonNo',
					width: 100,
				},{
					field: 'requisitonDate',
					width: 100,
				},{
					field: 'conLandNo',
					width: 100,
				},{
					field: 'conLandDate',
					width: 100,
				},{
					field: 'transferNo',
					width: 100,
				},{
					field: 'transferDate',
					width: 100,
				},{
					field: 'certificateNo',
					width: 100,
				},{
					field: 'certificateDate',
					width: 100,
				},{
					field: 'permitNo',
					width: 100,
				},{
					field: 'permitDate',
					width: 100,
				},{
					field: 'fireProNo',
					width: 100,
				},{
					field: 'fireProdate',
					width: 100,
				},{
					field: 'fireAccNo',
					width: 100,
				},{
					field: 'fireAccDate',
					width: 100,
				},{
					field: 'estateNo',
					width: 100,
				},{
					field: 'estateDate',
					width: 100,
				},{
					field: 'planningLevel',
					width: 100,
				}
				, {
					field: 'surveyReport',
					width: 100,
				}, {
					field: 'redLineMap',
					width: 100,
				}, {
					field: 'redLineLand',
					width: 100,
				}, {
					field: 'zongMap',
					width: 100,
				}, {
					field: 'recordSurvey',
					width: 100,
				}, {
					field: 'recordDesign',
					width: 100,
				}, {
					field: 'recordContract',
					width: 100,
				}, {
					field: 'supervisionRecord',
					width: 100,
				}, {
					field: 'qulifiedOpinions',
					width: 100,
				}, {
					field: 'constructionComments',
					width: 100,
				}, {
					field: 'constructionDrawing',
					width: 100,
				}, {
					field: 'seismicReview',
					width: 100,
				}, {
					field: 'planningSetting',
					width: 100,
				}, {
					field: 'safetyRecord',
					width: 100,
				}, {
					field: 'qualityRecord',
					width: 100,
				}, {
					field: 'constructionPermit',
					width: 100,
				}, {
					field: 'planBuiltMapping',
					width: 100,
				}, {
					field: 'qualityAcceptance',
					width: 100,
				}, {
					field: 'urbanArchives',
					width: 100,
				}, {
					field: 'completionRecord',
					width: 100,
				}, {
					field: 'realEstate',
					width: 100,
				}, {
					field: 'reportOnLang',
					width: 100,
				}
				]
		});
	};

		  
	  if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端

		 
		  $('#basicTable').bootstrapTable("toggleView");
		}
	  
	  $('#basicTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
                'check-all.bs.table uncheck-all.bs.table', function () {
            $('#remove').prop('disabled', ! $('#basicTable').bootstrapTable('getSelections').length);
            $('#view,#edit').prop('disabled', $('#basicTable').bootstrapTable('getSelections').length!=1);
        });
		  
		$("#btnImport").click(function(){
			jp.open({
			    type: 2,
                area: [500, 200],
                auto: true,
			    title:"导入数据",
			    content: "${ctx}/tag/importExcel" ,
			    btn: ['下载模板','确定', '关闭'],
				btn1: function(index, layero){
					  jp.downloadFile('${ctx}/filing/earlyEngineering/import/template');
				  },
			    btn2: function(index, layero){
						var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
						iframeWin.contentWindow.importExcel('${ctx}/filing/earlyEngineering/import', function (data) {
							if(data.success){
								jp.success(data.msg);
								refresh();
							}else{
								jp.error(data.msg);
							}
                            jp.close(index);
                        });//调用保存事件
                    return false;
				  },
				 
				  btn3: function(index){ 
					  jp.close(index);
	    	       }
			}); 
		});
	  $("#export").click(function(){//导出Excel文件
			jp.downloadFile('${ctx}/filing/earlyEngineering/export');
	  });

	$("#exportFiles").bind("click", function () {
		$("#searchForm").attr("action","${ctx}/filing/filingImages/exportEarlyEngineering?ids="+ getIdSelections());
		$("#searchForm").submit();
		return true;
	});

	/*$("#exportFiles").click(function(){//导出Excel文件
		jp.downloadFile('${ctx}/filing/earlyEngineering/exportFiles?ids=' + getIdSelections());
	});*/

	  $("#search").click("click", function() {// 绑定查询按扭
		  $('#basicTable').bootstrapTable('refresh');
		});

	  $("#open").click(function () {
		  $("#basicTable").bootstrapTable('expandAllRows');
	  })

		$("#close").click(function (row) {
			$('#basicTable').bootstrapTable('refresh');
		})

	 $("#reset").click("click", function() {// 绑定查询按扭
		  $("#searchForm  input").val("");
		  $("#searchForm  select").val("");
		   $("#searchForm  .select-item").html("");
		  $('#basicTable').bootstrapTable('refresh');
		});
		
				$('#beginInDate').datetimepicker({
					 format: "YYYY-MM-DD HH:mm:ss"
				});
				$('#endInDate').datetimepicker({
					 format: "YYYY-MM-DD HH:mm:ss"
				});
		
	});
		
  function getIdSelections() {
        return $.map($("#basicTable").bootstrapTable('getSelections'), function (row) {
            return row.id
        });
    }
  
  function deleteAll(){

		jp.confirm('确认要删除该初设阶段记录吗？', function(){
			jp.loading();  	
			jp.get("${ctx}/filing/earlyEngineering/deleteAll?ids=" + getIdSelections(), function(data){
         	  		if(data.success){
         	  			$('#basicTable').bootstrapTable('refresh');
         	  			jp.success(data.msg);
         	  		}else{
         	  			jp.error(data.msg);
         	  		}
         	  	})
          	   
		})
  }
  
    //刷新列表
  function refresh() {
      $('#basicTable').bootstrapTable('refresh');
  }
  function add(){
	  jp.openSaveDialog('新增初设阶段', "${ctx}/filing/earlyEngineering/form",'1000px', '800px');
  }
  
   function edit(id){//没有权限时，不显示确定按钮
       if(id == undefined){
	      id = getIdSelections();
	}
	jp.openSaveDialog('编辑初设阶段', "${ctx}/filing/earlyEngineering/form?id=" + id, '800px', '500px');
  }

 function view(id){//没有权限时，不显示确定按钮
      if(id == undefined){
             id = getIdSelections();
      }
        jp.openViewDialog('查看初设阶段', "${ctx}/filing/earlyEngineering/form?id=" + id, '800px', '500px');
 }


	function addRow(list, idx, tpl, row){
		$(list).append(Mustache.render(tpl, {
			idx: idx, delBtn: true, row: row
		}));
	}
			
</script>


