动态tab页
1.前台代码
<%-- builed by manage.aspx.cmt [ver:2015.25.26] at 2015-06-26 15:25:42 --%>
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="CcrCompanyManage.aspx.cs" Inherits="HraWeb.CcrCompanyManage" %>
<%@ Register Assembly="Trirand.Web" TagPrefix="asp" Namespace="Trirand.Web.UI.WebControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="toolbar" class="datagrid-toolbar">
<span class="title">行业:</span><input type="text" id="txt_Industry_LK_" name="txt_Industry_LK_" class="input datacontrol" style="width: 150px" />
<a href="#" id="btn_search" iconcls="icon-search" class="button">选择行业</a>
<a href="#" id="btn_supperSearch" iconcls="icon-supperSearch" class="button">高级查询</a>
<a href="#" id="btn_add" iconcls="icon-add" class="button">加入清单</a>
<a href="#" id="btn_del" iconcls="icon-remove" class="button">移除清单</a>
<a href="#" id="btn_adds" iconcls="icon-adds" class="button">全部加入</a>
<a href="#" id="btn_dels" iconcls="icon-BatchDelete" class="button">全部移除</a>
<a href="#" id="btn_reload" iconcls="icon-BatchDelete" class="button">刷新选项卡</a>
</div>
<div style="text-align: center;">公司基本信息</div>
<div class='jdataGrid' id="jq1div" style="width: <%=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width*0.6%>px">
<asp:JQGrid runat="server" ID="jq" Height="400" MultiSelect="true"
DataUrl="/CCR/CcrCompanyManage.aspx?_method=search">
<Columns>
<asp:JQGridColumn DataField="CompanyName" Visible="true" HeaderText="公司名称" Frozen="True"></asp:JQGridColumn>
<asp:JQGridColumn DataField="RealationshipWithGovernment" Visible="true" SupperControlType="Combox" HeaderText="与政府关系" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode='Relationship_Type'" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="RealationshipWithGovernment">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="RegisteredCapital" Visible="true" HeaderText="注册资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="PaidupCapital" Visible="true" HeaderText="实收资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="MainBusiness" Visible="true" HeaderText="主营业务" Frozen="True"></asp:JQGridColumn>
<asp:JQGridColumn DataField="OtherBusiness" Visible="true" HeaderText="兼营业务"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Industry" Visible="true" HeaderText="行业" SupperControlType="Combox" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode='Sector_Type'" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Industry">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Scale" Visible="true" HeaderText="规模"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Ownership" Visible="true" SupperControlType="Combox" HeaderText="所有制类别" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode='Ownership_Type'" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Ownership">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Organization" Visible="true" HeaderText="组织类别" SupperControlType="Combox" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode='Organization_Type'" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Organization">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Subsidiary" Visible="true" HeaderText="全资子公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="HoldingCompany" Visible="true" HeaderText="控股公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Plant" Visible="true" HeaderText="附属厂数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="RawDataId" Visible="true" HeaderText="用于关联表的ID"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Purpose" Visible="true" HeaderText="数据用途" SupperControlType="Combox" SuperUrl="/Common/EntityJsonList.ashx?_method=entity&entityType=SysEnumDic&&where=ParentCode='CCR_Credit_Score'" SuperDataTextField="EnumName" SuperDataValueField="EnumValue" SuperFilterColumn="Purpose">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessLicenseNum" Visible="true" HeaderText="法人营业执照号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LoanCardNum" Visible="true" HeaderText="贷款卡(证)号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="QualificationLevel" Visible="true" HeaderText="资质等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityCode" Visible="true" HeaderText="法人代码证号"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityPerson" Visible="true" HeaderText="法定代表人"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BaseBankAccountNum" Visible="true" HeaderText="基本帐户行"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessStartDate" Visible="true" HeaderText="公司成立日期">
<Formatter>
<asp:CustomFormatter FormatFunction="getDate" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Region" Visible="true" HeaderText="所属区域"></asp:JQGridColumn>
<asp:JQGridColumn DataField="CreditRate" Visible="true" HeaderText="信用等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="IsDefaultClient" Visible="true" HeaderText="是否违约客户"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeNumber" Visible="true" HeaderText="职工人数"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeWageAvgLevel" Visible="true" HeaderText="职工月均工资水平 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCode" Visible="true" HeaderText="股票代码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCodeName" Visible="true" HeaderText="股票代码名称 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="Id" Visible="false" PrimaryKey="true"></asp:JQGridColumn>
</Columns>
<ClientSideEvents LoadComplete="JDataGrid.loadComplete" />
</asp:JQGrid>
</div>
<div style="text-align: center;">公司信息清单</div>
<div id="tt" class="easyui-tabs" data-options="tools:'#tab-tools'" style="width: <%=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width*0.6%>px">
</div>
<div class='jdataGrid' id="jq2div" style="width: <%=System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width*0.6%>px;">
<asp:JQGrid runat="server" ID="jq2" Height="400" MultiSelect="True" DataUrl="/CCR/CcrCompanyManage.aspx?_method=searchlist">
<Columns>
<asp:JQGridColumn DataField="CompanyName" Visible="true" HeaderText="公司名称" Frozen="True"></asp:JQGridColumn>
<%-- <asp:JQGridColumn DataField="ClientId" Visible="true" HeaderText="客户ID" ></asp:JQGridColumn>--%>
<asp:JQGridColumn DataField="RealationshipWithGovernment" Visible="true" HeaderText="与政府关系">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="RegisteredCapital" Visible="true" HeaderText="注册资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="PaidupCapital" Visible="true" HeaderText="实收资本"></asp:JQGridColumn>
<asp:JQGridColumn DataField="MainBusiness" Visible="true" HeaderText="主营业务" Frozen="True"></asp:JQGridColumn>
<asp:JQGridColumn DataField="OtherBusiness" Visible="true" HeaderText="兼营业务"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Industry" Visible="true" HeaderText="行业">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Scale" Visible="true" HeaderText="规模"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Ownership" Visible="true" HeaderText="所有制类别">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Organization" Visible="true" HeaderText="组织类别">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Subsidiary" Visible="true" HeaderText="全资子公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="HoldingCompany" Visible="true" HeaderText="控股公司数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Plant" Visible="true" HeaderText="附属厂数量"></asp:JQGridColumn>
<asp:JQGridColumn DataField="RawDataId" Visible="true" HeaderText="用于关联表的ID"></asp:JQGridColumn>
<asp:JQGridColumn DataField="Purpose" Visible="true" HeaderText="数据用途">
<Formatter>
<asp:CustomFormatter FormatFunction="ChangeType" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessLicenseNum" Visible="true" HeaderText="法人营业执照号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LoanCardNum" Visible="true" HeaderText="贷款卡(证)号码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="QualificationLevel" Visible="true" HeaderText="资质等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityCode" Visible="true" HeaderText="法人代码证号"></asp:JQGridColumn>
<asp:JQGridColumn DataField="LegalEntityPerson" Visible="true" HeaderText="法定代表人"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BaseBankAccountNum" Visible="true" HeaderText="基本帐户行"></asp:JQGridColumn>
<asp:JQGridColumn DataField="BusinessStartDate" Visible="true" HeaderText="公司成立日期">
<Formatter>
<asp:CustomFormatter FormatFunction="getDate" />
</Formatter>
</asp:JQGridColumn>
<asp:JQGridColumn DataField="Region" Visible="true" HeaderText="所属区域"></asp:JQGridColumn>
<asp:JQGridColumn DataField="CreditRate" Visible="true" HeaderText="信用等级"></asp:JQGridColumn>
<asp:JQGridColumn DataField="IsDefaultClient" Visible="true" HeaderText="是否违约客户"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeNumber" Visible="true" HeaderText="职工人数"></asp:JQGridColumn>
<asp:JQGridColumn DataField="EmployeeWageAvgLevel" Visible="true" HeaderText="职工月均工资水平 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCode" Visible="true" HeaderText="股票代码"></asp:JQGridColumn>
<asp:JQGridColumn DataField="StockCodeName" Visible="true" HeaderText="股票代码名称 "></asp:JQGridColumn>
<asp:JQGridColumn DataField="Id" Visible="false" PrimaryKey="true"></asp:JQGridColumn>
</Columns>
<ClientSideEvents LoadComplete="JDataGrid.loadComplete" />
</asp:JQGrid>
</div>
</form>
<script type="text/javascript">
var index = 0;
function getAllTab() {
$.post("CcrCompanyManage.aspx", { NngaSettingId: NngaSettingId, _method: "GetGroupIndustry" }, function (data) {
var allTabs = $("#tt").tabs("tabs");
var allTabsTitle = [];
for (var i = 0; i < allTabs.length; i++) {
var title = allTabs[i].panel("options").title;
allTabsTitle[allTabsTitle.length] = title;
}
//for (var i = 0; i < allTabsTitle.length; i++) {
// $("#tt").tabs('close', allTabsTitle[i]);
//}
try {
data = JSON.parse(data);
for (var i = 0; i < data.length; i++) {
GroupIndustryArr.push(data[i]);
if (!($('#tt').tabs('exists', data[i].IndustryName))) {
$('#tt').tabs('add', {
title: data[i].IndustryName,
closable: true
})
};
}
} catch (e) {
;
}
});
}
function addPanel() {
index++;
$('#tt').tabs('add', {
title: 'Tab' + index,
content: '<div style="padding:10px">Content' + index + '</div>',
closable: true
});
}
function removePanel() {
var tab = $('#tt').tabs('getSelected');
if (tab) {
var index = $('#tt').tabs('getTabIndex', tab);
$('#tt').tabs('close', index);
}
}
var jsonDic;
var isDelIndustry = false;
var isDelAllIndustry = false;
function ChangeType(value, indx, rec) {
while (jsonDic == undefined) {
jsonDic = UTIL.GetChangeTypeJson("SysEnumDic", "EnumValue", "EnumName");
}
return BindDictDrop(value, jsonDic, "EnumValue", "EnumName", false);
}
//行业多选
UTIL.SetEntityComboByParentCode($("#txt_Industry_LK_"), "Sector_Type", null, null, null, null, 50, null, null, true);
//多选查询
$("#btn_search").click(function () {
var queryParams = $("body").GetSearchPostData();
if (SupperSearch == false) {
var ids = UTIL.GetCombogridMutipleGetSelection($("#txt_Industry_LK_"), "EnumValue", "EnumName");
if (ids != null) {
queryParams["IndustryIds"] = ids;
}
} else {
SupperSearch = false;
}
$("#jq").jqGrid("setGridParam", { postData: queryParams, page: 1 }).trigger("reloadGrid");
JDataGrid.InitSearch();
});
var NngaSettingId;
var SupperSearch = false;
//tab的事件
$('#tt').tabs({
//选中事件
onSelect: function (title) {
if (isDelIndustry == false) {
var p = $(this).tabs('getTab', title);
for (var i = 0; i < GroupIndustryArr.length; i++) {
var IndustryName = GroupIndustryArr[i].IndustryName;
var IndustryValue = GroupIndustryArr[i].IndustryValue;
if (IndustryName == title) {
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, selIndustry: IndustryValue }, page: 1 }).trigger("reloadGrid");
}
}
} else {
isDelIndustry = false;
}
},
//删除之前的确认事件
onBeforeClose: function (title, index) {
var isExcute = true;
if (isDelAllIndustry == false) {
// $.messager.alert("操作提示", '你确认要删除' + title + '的所有样本吗?', "warning");
$.messager.confirm('删除提示', '你确认要删除' + title + '的所有样本吗?', function (r) {
if (r) {
for (var i = 0; i < GroupIndustryArr.length; i++) {
var IndustryName = GroupIndustryArr[i].IndustryName;
var IndustryValue = GroupIndustryArr[i].IndustryValue;
if (IndustryName == title) {
//$.post("CcrCompanyManage.aspx", { NngaSettingId: NngaSettingId, selIndustry: IndustryValue, _method: "removeTabPanel" });
$.ajax({
async: false,
type: "post",
url: 'CcrCompanyManage.aspx',
data: { NngaSettingId: NngaSettingId, selIndustry: IndustryValue, _method: "removeTabPanel" },
dataType: "json",
success: function (data) {
}
});
var postData = $("#jq2").jqGrid("getGridParam", "postData");
delete postData["selIndustry"];
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
//getAllTab();
break;
}
}
}
else {
UTIL.MessageBox("关闭了行业为" + title+"的选项卡,未删除记录", 'error');
}
});
}
},
//删除事件
onClose: function (title) {
//完成缓存中的对应行业的移除
}
});
var GroupIndustryArr = new Array();
function PageOnLoad() {
$("#btn_supperSearch").click(function () {
SupperSearch = true;
JDataGrid.InitSupper();
UTIL.popupDiv("pop-div", 550, 400);
});
//获取url参数神经网络结构设置id
NngaSettingId = UTIL.getUrlParam("NngaSettingId");
getAllTab();
//加入清单
$("#btn_add").on("click", function () {
var rowids = $("#jq").jqGrid('getGridParam', 'selarrrow');
//var isTabExist;
////TODO:判断tab是否存在
//if (!isTabExist) {
// //不存在,添加tab
// $('#tt').tabs('add', {
// title: 'Tab',
// //content: $("#jq2div").clone().html(),
// closable: true
// });
//} else {
// //存在,选中tab
// $("#tt").tabs("select", 2);
//}
$.ajax({
async: false,
type: "POST",
url: 'CcrCompanyManage.aspx?_method=setBatchAddRow&rowidList=' + rowids + "&NngaSettingId=" + NngaSettingId,
dataType: "text",
success: function (data) {
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
});
//移除清单
$("#btn_del").on("click", function () {
var rowids = $("#jq2").jqGrid('getGridParam', 'selarrrow');
$.ajax({
async: false,
type: "POST",
url: 'CcrCompanyManage.aspx?_method=setBatchRemoveRow&rowidList=' + rowids + "&NngaSettingId=" + NngaSettingId,
dataType: "text",
success: function (data) {
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
});
//全部加入
$("#btn_adds").on("click", function () {
var rowids = $("#jq").jqGrid('getGridParam', 'selarrrow');
var insdustryIds = UTIL.GetCombogridMutipleGetSelection($("#txt_Industry_LK_"), "EnumValue", "EnumName");
$.ajax({
async: false,
type: "POST",
url: "CcrCompanyManage.aspx?_method=setBatchAddAllRow&NngaSettingId=" + NngaSettingId + "&IndustryIds=" + insdustryIds,
dataType: "text",
success: function (data) {
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
});
//全部移除
$("#btn_dels").on("click", function () {
$.ajax({
async: false,
type: "POST",
url: "CcrCompanyManage.aspx?_method=setBatchRemoveAllRow&NngaSettingId=" + NngaSettingId,
dataType: "text",
success: function (data) {
isDelAllIndustry = false;
getAllTab();
$("#jq2").jqGrid("setGridParam", { postData: { NngaSettingId: NngaSettingId, page: 1 } }).trigger("reloadGrid");
}
});
isDelAllIndustry = true;
var rowids = $("#jq").jqGrid('getGridParam', 'selarrrow');
var allTabs = $("#tt").tabs("tabs");
var allTabsTitle = [];
for (var i = 0; i < allTabs.length; i++) {
var title = allTabs[i].panel("options").title;
allTabsTitle[allTabsTitle.length] = title;
}
for (var i = 0; i < allTabsTitle.length; i++) {
$("#tt").tabs('close', allTabsTitle[i]);
}
});
$("#btn_reload").on("click", function () {
getAllTab();
});
//控件按钮设置
$(".button").linkbutton({ plain: true });
}
</script>
</body>
</html>
2.后台代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HraWeb.Common;
using WebApp.Common;
using Contract.Domain;
using System.Collections;
using System.Runtime.Serialization.Json;
using Common;
using Elmah;
using Framework;
namespace HraWeb
{
public partial class CcrCompanyManage : JQEntityManage<Contract.Domain.CcrFundermental>
{
private Spring.Caching.ICache cache;
private Spring.Caching.ICache SpringCache
{
get
{
if (cache == null)
cache = (Spring.Caching.ICache)ctx.GetObject("AspNetCache");
return cache;
}
set { cache = value; }
}
/// <summary>
/// 加入清单
/// </summary>
public void setBatchAddRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
string CheckRowIds = Request["rowidList"];
if (string.IsNullOrEmpty(CheckRowIds)) return;
List<string> idsList = CheckRowIds.Split(',').ToList();
List<int> intIds = new List<int>();
idsList.ForEach(a => { intIds.Add(int.Parse(a)); });
info = new QueryInfo();
info.QueryObject = "CcrFundermental";
info.AddParam("ids", intIds, " and Id in (:ids)");
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
}
List<CcrFundermental> tempfundermentals = Holworth.Utility.HraUtility.ListToT<CcrFundermental>(Dao.FindList(info)).ToList();
if (tempfundermentals != null)
{
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
newfundermentals = dictionary[NngaSettingId];
NewfundermentalsAddListCheckRepert(newfundermentals, tempfundermentals);
}
else
{
dictionary.Add(NngaSettingId, tempfundermentals);
newfundermentals = tempfundermentals;
}
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
/// <summary>
/// 移除清单
/// </summary>
public void setBatchRemoveRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
string CheckRowIds = Request["rowidList"];
if (string.IsNullOrEmpty(CheckRowIds)) return;
List<string> idsList = CheckRowIds.Split(',').ToList();
List<int> intIds = new List<int>();
idsList.ForEach(a => { intIds.Add(int.Parse(a)); });
info = new QueryInfo();
info.QueryObject = "CcrFundermental";
info.AddParam("ids", intIds, " and Id in (:ids)");
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
return;
}
List<CcrFundermental> tempfundermentals = Holworth.Utility.HraUtility.ListToT<CcrFundermental>(Dao.FindList(info)).ToList();
if (tempfundermentals != null && tempfundermentals.Count > 0)
{
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
newfundermentals = dictionary[NngaSettingId];
var newfundermentalsDic = newfundermentals.ToDictionary(x => x.Id);
tempfundermentals.ForEach(a =>
{
newfundermentals.Remove(newfundermentalsDic[a.Id]);
});
}
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
/// <summary>
/// 全部加入
/// </summary>
public void setBatchAddAllRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
info = Session["jq1_setInfo"] as QueryInfo;
if (info == null)
{
info = SetInfo();
}
if (!string.IsNullOrEmpty(Request["IndustryIds"]))
{
string[] ids = Request["IndustryIds"].Split(';');
info.Parameters.Remove("IndustryIds");
info.AddParam("IndustryIds", ids, " and Industry in (:IndustryIds)");
}
info.QueryObject = "CcrFundermental";
List<CcrFundermental> newfundermentals = Holworth.Utility.HraUtility.ListToT<CcrFundermental>(Dao.FindList(info)).ToList();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
}
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
var tempfundermentals = dictionary[NngaSettingId];
NewfundermentalsAddListCheckRepert(newfundermentals, tempfundermentals);
dictionary[NngaSettingId] = newfundermentals;
}
else
{
dictionary.Add(NngaSettingId, newfundermentals);
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
/// <summary>
/// 全部移除
/// </summary>
public void setBatchRemoveAllRow()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
int i = 0;
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (dictionary != null && dictionary.ContainsKey(NngaSettingId))
{
dictionary[NngaSettingId] = new List<CcrFundermental>();
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
public void NewfundermentalsAddListCheckRepert(List<CcrFundermental> newfyFundermentals, List<CcrFundermental> tempfundermentals)
{
for (int i = 0; i < tempfundermentals.Count; i++)
{
var temp = tempfundermentals[i];
if (newfyFundermentals.Count(f => f.Id == temp.Id) <= 0)
{
newfyFundermentals.Add(temp);
}
}
}
protected override void Page_Load(object sender, EventArgs e)
{
//给基类服务接口复制,可不付
//base.svc = Psvc;
if (!IsPostBack)
{
}
switch (Request["_method"])
{
case "setBatchAddRow":
setBatchAddRow();
break;
case "searchlist":
setSearchList();
break;
case "setBatchRemoveRow":
setBatchRemoveRow();
break;
case "setBatchAddAllRow":
setBatchAddAllRow();
break;
case "setBatchRemoveAllRow":
setBatchRemoveAllRow();
break;
case "GetGroupIndustry":
GetGroupIndustry();
break;
case "removeTabPanel"://移除行业(页签时触发的事件)
removeTabPanel();
break;
}
jq.ComputHeight = string.Empty;
jq.Height = 150;
jq.Width = 1800;
jq2.ComputHeight = string.Empty;
jq2.Height = 150;
jq2.Width = 1800;
base.Page_Load(sender, e);
}
private void removeTabPanel()
{
string NngaSettingId = Request["NngaSettingId"] ?? "";
List<CcrFundermental> newfundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
SpringCache.Insert("CcrCompanyManage_jq_list", new Dictionary<string, List<CcrFundermental>>());
return;
}
var dictionary = (Dictionary<string, List<CcrFundermental>>)SpringCache.Get("CcrCompanyManage_jq_list");
if (!dictionary.ContainsKey(NngaSettingId))
{
return;
}
List<CcrFundermental> totalFunmentals = dictionary[NngaSettingId];
List<CcrFundermental> tempfundermentals = totalFunmentals;
if (!string.IsNullOrEmpty(Request["selIndustry"]))
{
tempfundermentals = tempfundermentals.Where(x => x.Industry == Request["selIndustry"]).ToList();
}
if (tempfundermentals != null && tempfundermentals.Count > 0)
{
var totalFunmentalsDic = totalFunmentals.ToDictionary(x => x.Id);
tempfundermentals.ForEach(a =>
{
totalFunmentals.Remove(totalFunmentalsDic[a.Id]);
});
}
var json = Newtonsoft.Json.JsonConvert.SerializeObject(newfundermentals);
Response.Write(json);
Response.End();
}
private void GetGroupIndustry()
{
QueryInfo info = new QueryInfo();
info.QueryObject = "SysEnumDic";
List<SysEnumDic> IndustryList = Holworth.Utility.HraUtility.ListToT<SysEnumDic>(Dao.FindList(info)).ToList();
string NngaSettingId = Request["NngaSettingId"] ?? "";
if (!string.IsNullOrEmpty(NngaSettingId))
{
if (SpringCache.Get("CcrCompanyManage_jq_list") != null)
{
Dictionary<string, List<CcrFundermental>> dictionary = SpringCache.Get("CcrCompanyManage_jq_list") as Dictionary<string, List<CcrFundermental>>;
List<CcrFundermental> funmentals = new List<CcrFundermental>();
if (dictionary.ContainsKey(NngaSettingId))
{
funmentals = dictionary[NngaSettingId].OrderBy(x => x.Industry).ToList().Distinct(new fdsDistinct()).ToList();
var fds = from f in funmentals join d in IndustryList on f.Industry equals d.EnumValue.ToString() select new { IndustryValue = f.Industry, IndustryName = d.EnumName };
var fdJson = Newtonsoft.Json.JsonConvert.SerializeObject(fds);
Response.Write(fdJson);
}
}
}
Response.End();
}
private void setSearchList()
{
try
{
int PageSize = 0;
List<CcrFundermental> fundermentals = new List<CcrFundermental>();
if (SpringCache.Get("CcrCompanyManage_jq_list") != null)
{
var dictionary = SpringCache.Get("CcrCompanyManage_jq_list") as Dictionary<string, List<CcrFundermental>>;
string NngaSettingId = Request["NngaSettingId"];
if (NngaSettingId == null)
{
NngaSettingId = Request["txt_NngaSettingId_"];
}
if (NngaSettingId != null && NngaSettingId.Contains(','))
{
NngaSettingId = Request["NngaSettingId"].Split(',')[0];
}
if (dictionary.ContainsKey(NngaSettingId))
{
fundermentals = dictionary[NngaSettingId];
}
if (!string.IsNullOrEmpty(Request["selIndustry"]))
{
//点击tab页面进行的行业过滤 由于动态为存在的行业做了tab页
fundermentals = fundermentals.Where(x => x.Industry == Request["selIndustry"]).ToList();
}
}
#region 分页信息
int pageIndex = 0;
try
{
PageSize = int.Parse(HttpContext.Current.Request["rows"]);
pageIndex = int.Parse(HttpContext.Current.Request["page"]);
if (!string.IsNullOrEmpty(Request["sidx"]))
{
info.OrderBy.Add(Request["sidx"] + " " + Request["sord"]);
}
}
catch (Exception ex)
{
}
#endregion
int totalPage = fundermentals.Count / PageSize;
if (fundermentals.Count % PageSize != 0)
{
totalPage++;
}
fundermentals = fundermentals.OrderBy(x => x.Industry).ToList();
string industry = "";
if (fundermentals.Count > 0)
{
industry = fundermentals[0].Industry;
}
//默认选取第一个行业的公司进行输出
if (fundermentals.Count > 0 && string.IsNullOrEmpty(Request["selIndustry"]))
{
fundermentals = fundermentals.Where(x => x.Industry == industry).Skip((pageIndex - 1) * PageSize).Take(PageSize).ToList();
}
else
{
fundermentals = fundermentals.Skip((pageIndex - 1) * PageSize).Take(PageSize).ToList();
}
int totalCount = fundermentals.Count;
JGridJson d = new JGridJson(totalPage, fundermentals, pageIndex, totalCount);
HttpContext.Current.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(d));
}
catch (Exception ex)
{
System.Collections.ArrayList list = new System.Collections.ArrayList();
list.Add(new
{
ErrorCode = -999,
Message = ex.Message
});
Utility.JSUtil.log(ex);
ErrorSignal.FromCurrentContext().Raise(ex);
DataGridJson d = new DataGridJson(0, list);
HttpContext.Current.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(d));
}
finally
{
HttpContext.Current.Response.End();
}
}
/// <summary>
/// 设置查询条件或者语句
/// </summary>
/// <returns></returns>
protected override Framework.QueryInfo SetInfo()
{
info = base.SetInfo();
Session["jq1_setInfo"] = info.Clone();
if (!string.IsNullOrEmpty(Request["IndustryIds"]))
{
string[] ids = Request["IndustryIds"].Split(';');
info.AddParam("IndustryIds", ids, " and Industry in (:IndustryIds)");
}
return info;
}
/// <summary>
/// 初始化页面控件
/// </summary>
protected override void InitPage()
{
if (!jq2.DataUrl.Contains("NngaSettingId"))
{
jq2.DataUrl = "/CCR/CcrCompanyManage.aspx?_method=searchlist&txt_NngaSettingId_=" + Request["NngaSettingId"];
}
base.InitPage();
// BindDrop(drp_Unit, "SPSW", true);
}
/// <summary>
/// 获取缓存的jq2清单 dictionary的key为神经网络设置id,值为该神经网络设置下配置的公司集合
/// </summary>
/// <returns></returns>
protected Dictionary<string, List<CcrFundermental>> GetJQ2ListCache()
{
if (SpringCache.Get("CcrCompanyManage_jq_list") == null)
{
return new Dictionary<string, List<CcrFundermental>>();
}
return SpringCache.Get("CcrCompanyManage_jq_list") as Dictionary<string, List<CcrFundermental>>;
}
//private Contract.IService.IAlmBankCashService psvc;
///// <summary>
///// 初始化
///// </summary>
//Contract.IService.IAlmBankCashService Psvc
//{
// get
// {
// if (psvc == null)
// {
// psvc = ctx.GetObject("AlmBankCashService") as Contract.IService.IAlmBankCashService;
// }
// return psvc;
// }
//}
}
}
动态tab页的更多相关文章
- Bootstrap 基于Bootstrap和JQuery实现动态打开和关闭tab页
基于Bootstrap和JQuery实现动态打开和关闭tab页 by:授客 QQ:1033553122 1. 测试环境 JQuery-3.2.1.min.j Bootstrap-3.3.7-d ...
- Bootstrap技术: 如何给nav导航组件的tab页增加关闭按钮以及动态的添加和关闭tab页
先给出示例html代码 <div> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tab ...
- JQuery动态添加多个tab页标签
jQuery是一个兼容多浏览器的js库,核心理念是write less,do more(写的更少,做的更多),jQuery使用户能更方便地处理HTML documents.events.实现动画效果, ...
- JS组件系列——基于Bootstrap Ace模板的菜单和Tab页效果分享(你值得拥有)
前言:最近园子里多了许多谈语言.谈环境.谈逼格(格局)的文章,看看笑笑过后,殊不知其实都是然并卵.提升自己的技术才是王道.之前博主分享过多篇bootstrap组件的文章,引起了很多园友的关注和支持,看 ...
- Android 动态Tab分页效果实现
当前项目使用的是TabHost+Activity进行分页,目前要做个报表功能,需要在一个Tab页内进行Activity的切换.比方说我有4个Tab页分别为Tab1,Tab2,Tab3,Tab4,现在的 ...
- Android 动态Tab分页效果
当前项目使用的是TabHost+Activity进行分页,目前要做个报表功能,需要在一个Tab页内进行Activity的切换.比方说我有4 个Tab页分别为Tab1,Tab2,Tab3,Tab4,现在 ...
- JS组件系列——基于Bootstrap Ace模板的菜单Tab页效果优化
前言:之前发表过一篇 JS组件系列——基于Bootstrap Ace模板的菜单和Tab页效果分享(你值得拥有) ,收到很多园友的反馈,当然也包括很多诟病,因为上篇只是将功能实现了,很多细节都没有处理 ...
- 使用Dragablz快速构建Chrome样式的可拖拽分离的Tab页程序
今天发现了一个可以快速实现类似于Chrome方式的可拖拽分离的Tab页程序Dragablz.它可以实现动态创建,删除Tab页,并支持拖拽后形成独立窗口和窗口合并. 使用起来还是非常方便的. < ...
- 值得分享的Bootstrap Ace模板实现菜单和Tab页效果(转)
Ace模板地址:http://code.google.com/p/ace-engine/wiki/AceTemplate(有时会打不开) Ace英文官网:http://wrapbootstrap.co ...
随机推荐
- 2017 年比较 Angular、React、Vue 三剑客(转载)
为 web 应用选择 JavaScript 开发框架是一件很费脑筋的事.现如今 Angular 和 React 非常流行,并且最近出现的新贵 VueJS 同样博得了很多人的关注.更重要的是,这只是一些 ...
- MySQL实战 | 02-MySQL 如何恢复到半个月内任意一秒的状态?
原文链接:MySQL是如何做到可以恢复到任意一秒状态的? 看到这个题目是不是觉得数据库再也不用担心服务器 crash 了? 那我们需要学习为什么可以这么做?以及如何做? 即为什么可以恢复到任意时间点? ...
- 洛谷 P1062 数列
题目描述 给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增的序列,例如,当k=3时,这个序列是: 1,3,4,9,10,12,13,… (该序列实际上就是 ...
- 下载安装jdk
阿里云服务器部署第一步:下载-安装jdk 1.下载路径:http://www.oracle.com/ 2.通过windows远程桌面连接上服务器:连接方式: 然后在服务器上c:/user/下创建jav ...
- Python修复图像文件后缀名
网上爬了很多图片,有很多错误. 有的不是图片文件,需要删除 有的后缀名错误,需要更正 用的的python脚本 #!/usr/bin/env python #-*- coding: utf-8 -*-# ...
- mysql下this is incompatible with sql_mode=only_full_group_by解决方案
本地测试没有问题,部署到客户服务器之后报如下错误: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 o ...
- flask之基础概念
[应用]一个 Flask 应用是一个 Flask 类的实例.可以在一个被称为应用工厂的函数内部创建 Flask实例.所有应用相关的配置.注册和其他设置都会在函数内部完成,然后返回这个应用.__init ...
- 接口方式[推荐]/动态SQL语句
MVC目录结构: Src -- com.shxt.servlet[控制层] --com.shxt.service[业务逻辑层] --com.shxt.model[实体Bean,用来承载数据] --co ...
- 蓝桥杯 历届试题 PREV-32 分糖果
历届试题 分糖果 时间限制:1.0s 内存限制:256.0MB 问题描述 有n个小朋友围坐成一圈.老师给每个小朋友随机发偶数个糖果,然后进行下面的游戏: 每个小朋友都把自己的糖果分一半给左手边 ...
- web页面导出到Excel乱码解决
引言: 前几天 在做web项目的时候 需要导出页面上的数据 到Excel里面 但有的时候出现乱码(有de时候不出现 很奇怪) 原来的代码是这样的: HttpContext.Current.Respon ...