(開發筆記)layer.open彈出層的使用


function sameClassT() {
	var ids=$('#dataGrid').jqGrid('getGridParam','selarrrow');
	if (ids.length<1){
		js.alert("請選中文件")
	}else if (ids.length>1) {
		js.alert("請勿選擇多個文件")
	}else {
		layer.open({
			title:'同分類調件',
			type: 2,
			area: ['80%','80%'],
			content: '${ctx}/collect/documentv/sameClassT?archtypeid=${archtypeid}&id='+ids[0],
			btn: ['保存排序','關閉'],
			btn1:function (index,layero) {
				console.log("保存排序");
				var win=$(layero).find("iframe")[0].contentWindow;
				jQuery.support.cors=true;
				$.ajax({
					type: "POST",
					dataType: "json",
					async: false,
					url: "${ctx}/collect/documentv/sameClassT2" ,
					data: {
						"archtypeid":"${archtypeid}",
						"ids[]":ids
					},
					xhrFields: {
						withCredentials: true
					},
					crossDomain: true,
					contentType: "application/x-www-form-urlencoded;charset=utf-8",
					success: function (data) {
						layer.alert(data.message);
					},
					error : function() {
						console.log("異常!");
					}
				});
			},
			btn2:function (index,layero) {
				console.log("關閉");
				var win=$(layero).find("iframe")[0].contentWindow;
				layer.close(index);
			}
		});
	}

}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章