You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
481 lines
18 KiB
Plaintext
481 lines
18 KiB
Plaintext
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BaseCodeList.aspx.cs" Inherits="TradeManage.SysManage.BaseCodeList" %>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head runat="server">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title></title>
|
|
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
|
|
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
|
|
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
|
|
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
|
|
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css" />
|
|
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
|
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
|
|
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
|
|
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
|
|
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
|
|
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
|
|
<script src="../Scripts/Global.js" type="text/javascript"></script>
|
|
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
|
|
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
|
|
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
|
|
<script src="../Scripts/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
|
|
|
|
<script type="text/javascript">
|
|
var Model = null;
|
|
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
|
|
var datagrid2 = new nblf.ui.DataGrid("DataGrid2");
|
|
var datagrid3 = new nblf.ui.DataGrid("DataGrid3");
|
|
var WindowLoadModel = new WindowLoad();
|
|
var ModuleName = "";
|
|
|
|
|
|
$(document).ready(function () {
|
|
WindowLoadModel.ApplicationPath = "../";
|
|
WindowLoadModel.ControlID = "WindowLoad";
|
|
WindowLoadModel.Isbgiframe = true;
|
|
WindowLoadModel.Load();
|
|
ajaxInit(WindowLoadModel);
|
|
|
|
ModuleName = $.url.param("ModuleName");
|
|
if (ModuleName == undefined) { ModuleName = ""; }
|
|
|
|
|
|
CreateDataGrid();
|
|
CreateDataGrid2();
|
|
CreateDataGrid3();
|
|
BindCompany();
|
|
ReadData();
|
|
|
|
$("#cmdAdd").click(function () {
|
|
AddRow();
|
|
});
|
|
|
|
$("#cmdSave").click(function () {
|
|
Save();
|
|
});
|
|
$("#cmdSavePT").click(function () {
|
|
Save2();
|
|
});
|
|
|
|
$('#listCompany').change(function () {
|
|
ReadData();
|
|
});
|
|
|
|
|
|
$("#" + datagrid1.TableID + " input[CommandName]").live("click", function () {
|
|
var index = $(this).parentsUntil("tr").parent().attr("index");
|
|
Model = datagrid1.Get_Model(index);
|
|
var ColName = $(this).attr("CommandName");
|
|
if (ColName == "cmdEdit") {
|
|
if (Model.KeyName == "ptlx")
|
|
{
|
|
ReadData3();
|
|
ShowFancybox2();
|
|
}
|
|
else
|
|
{
|
|
ReadData2();
|
|
ShowFancybox();
|
|
return;
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
$("#" + datagrid2.TableID + " input[CommandName]").live("click", function () {
|
|
var index = $(this).parentsUntil("tr").parent().attr("index");
|
|
Array.removeAt(datagrid2.DataSource,index);
|
|
$(datagrid2.DataSource).each(function(i){
|
|
model.SortNo =i+1;
|
|
});
|
|
datagrid2.DataBind(datagrid2.DataSource);
|
|
$("#DataGrid2 input[ColName='SortNo']").MaskedTextBox();
|
|
$(datagrid2.Get_Rows()).each(function (i) {
|
|
var model = datagrid2.Get_Model(i);
|
|
if (model.CompanyId == 0) {
|
|
$(this).find("input").attr("disabled", "disabled");
|
|
}
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
|
|
//#region 读取机构
|
|
function BindCompany() {
|
|
$.ajax({
|
|
url: "../UserService.asmx/GetListCompany",
|
|
async: false,
|
|
success: function (data) {
|
|
if (data.d == null) { alert("机构不存在,请先添加机构"); return; }
|
|
var html = new Sys.StringBuilder();
|
|
//html.append("<option value='0'>全部</option>");
|
|
$(data.d).each(function () {
|
|
html.append("<option value='" + this.ID + "'>" + this.Name + "</option>");
|
|
});
|
|
$('#listCompany').html(html.toString());
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 初始化DataGrid
|
|
function CreateDataGrid() {
|
|
|
|
var col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "名称";
|
|
col.CellTemplate = "<span>{Bind BaseCodeName}</span>";
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "操作";
|
|
col.Width = "100px";
|
|
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>";
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
datagrid1.IsFixHeader = false;
|
|
datagrid1.ShowIndexColumn = false;
|
|
datagrid1.AllowPaging = false;
|
|
datagrid1.Width = "100%";
|
|
datagrid1.SelectMode = nblf.ui.SelectMode.None;
|
|
datagrid1.Init();
|
|
|
|
}
|
|
//#endregion
|
|
//#region 初始化DataGrid2
|
|
function CreateDataGrid2() {
|
|
|
|
var col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "排序号";
|
|
col.Width = "60px";
|
|
col.CellTemplate = "<input ColName='SortNo' class='editTextbox' type='text' min='1' max='99999999' precision='0' style='width:100%;text-align: center;' value='{Bind SortNo}'></input>";
|
|
Array.add(datagrid2.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "名称";
|
|
col.CellTemplate = "<input ColName='Name' class='editTextbox' type='text' style='width:100%;text-align: center;' value='{Bind Name}'></input>";
|
|
Array.add(datagrid2.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "操作";
|
|
col.Width = "70px";
|
|
col.CellTemplate = "<input onclick='DelCode(this)' CommandName='cmdDel' class='btnClass dgbtnDel' type='button' value='删除'></input>";
|
|
Array.add(datagrid2.Columns, col);
|
|
|
|
datagrid2.IsFixHeader = false;
|
|
datagrid2.ShowIndexColumn = true;
|
|
datagrid2.AllowPaging = false;
|
|
datagrid2.Width = "100%";
|
|
datagrid2.SelectMode = nblf.ui.SelectMode.None;
|
|
datagrid2.Init();
|
|
|
|
|
|
}
|
|
function CreateDataGrid3() {
|
|
|
|
var col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "编号";
|
|
col.Width = "60px";
|
|
col.CellTemplate = "<a>{Bind SortNo}</a>";
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "名称";
|
|
col.CellTemplate = "<a>{Bind Name}</a>";
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
col.HeaderText = "是否使用";
|
|
col.Width = "70px";
|
|
col.CellTemplate = "<input sno='{Bind SortNo}' sname='{Bind Name}' type='checkbox' checked='{Bind UseState}'/>";
|
|
Array.add(datagrid3.Columns, col);
|
|
|
|
datagrid3.IsFixHeader = false;
|
|
datagrid3.ShowIndexColumn = false;
|
|
datagrid3.AllowPaging = false;
|
|
datagrid3.Width = "100%";
|
|
datagrid3.SelectMode = nblf.ui.SelectMode.None;
|
|
datagrid3.Init();
|
|
|
|
|
|
}
|
|
function DelCode(obj) {
|
|
if (window.confirm('确定要删除订单吗?') == false) return;
|
|
|
|
var rowindex = $(obj).parent().parent().attr("index");
|
|
var param = new Object();
|
|
var model = datagrid2.Get_Model(rowindex);
|
|
|
|
param.Code = model.Code;
|
|
|
|
$.ajax({
|
|
url: "SysManageService.asmx/DeleteCodeDetail",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
dataType: "json",
|
|
success: function (data) {
|
|
alert("删除成功");
|
|
|
|
|
|
}
|
|
});
|
|
|
|
datagrid2.Del_Row(rowindex);
|
|
}
|
|
//#endregion
|
|
//#region 读取数据
|
|
function ReadData() {
|
|
var param = new Object();
|
|
param.CompanyID = $("#listCompany").val();
|
|
if (param.CompanyID == null) return;
|
|
param.ModuleName = ModuleName;
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "SysManageService.asmx/GetJC_BaseCode",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
datagrid1.DataBind(data.d);
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 读取明细数据
|
|
function ReadData2() {
|
|
var param = new Object();
|
|
param.CompanyID = $("#listCompany").val();
|
|
param.KeyName = Model.KeyName;
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "SysManageService.asmx/GetJC_BaseCodeDetail",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
datagrid2.DataBind(data.d);
|
|
$("#DataGrid2 input[ColName='SortNo']").MaskedTextBox();
|
|
if (Model.IsSys == true) {
|
|
$("#cmdSave").hide();
|
|
$("#cmdAdd").hide();
|
|
$("input[CommandName='cmdDel']").hide();
|
|
//$("#DataGrid2 input[CommandName]").hide();
|
|
//$("#cmdAdd").attr("disabled", "disabled");
|
|
//$("#DataGrid2 input").attr("disabled", "disabled");
|
|
} else {
|
|
$("#cmdSave").show();
|
|
$("#cmdAdd").show();
|
|
$("input[CommandName='cmdDel']").show();
|
|
//$("#cmdAdd").removeAttr("disabled");
|
|
}
|
|
|
|
//$(datagrid2.Get_Rows()).each(function (i) {
|
|
// var model = datagrid2.Get_Model(i);
|
|
// if (model.CompanyId == 0) {
|
|
// $(this).find("input").attr("disabled", "disabled");
|
|
// }
|
|
//});
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function ReadData3() {
|
|
var param = new Object();
|
|
param.CompanyID = $("#listCompany").val();
|
|
param.KeyName = Model.KeyName;
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "SysManageService.asmx/GetJC_BaseCodePTLX",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
datagrid3.DataBind(data.d);
|
|
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 新增一行
|
|
function AddRow() {
|
|
if (datagrid2.DataSource == null) datagrid2.DataSource = new Array();
|
|
var model = new Object();
|
|
model.Code = 0;
|
|
model.Name = "";
|
|
model.SortNo = datagrid2.DataSource.length + 1;
|
|
model.CompanyId = $("#listCompany").val();
|
|
model.IsUse = 1;
|
|
Array.add(datagrid2.DataSource, model);
|
|
datagrid2.DataBind(datagrid2.DataSource);
|
|
$("#DataGrid2 input[ColName='SortNo']").MaskedTextBox();
|
|
|
|
//$(datagrid2.Get_Rows()).each(function (i) {
|
|
// var model = datagrid2.Get_Model(i);
|
|
// if (model.CompanyId == 0) {
|
|
// $(this).find("input").attr("disabled", "disabled");
|
|
// }
|
|
//});
|
|
}
|
|
//#endregion
|
|
//#region 弹出
|
|
function ShowFancybox() {
|
|
$.fancybox({
|
|
'autoScale': false,
|
|
'transitionIn': 'elastic',
|
|
'transitionOut': 'elastic',
|
|
'href': '#WindowAdd',
|
|
'onStart': function () {
|
|
|
|
}
|
|
});
|
|
}
|
|
function ShowFancybox2() {
|
|
$.fancybox({
|
|
'autoScale': false,
|
|
'transitionIn': 'elastic',
|
|
'transitionOut': 'elastic',
|
|
'href': '#WindowPT',
|
|
'onStart': function () {
|
|
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 保存
|
|
function Save() {
|
|
datagrid2.UpdateDataSource();
|
|
var param = new Object();
|
|
param.CompanyID = $("#listCompany").val();
|
|
param.KeyName = Model.KeyName;
|
|
param.ListModel = datagrid2.DataSource;
|
|
|
|
var bk = false;
|
|
$(param.ListModel).each(function (i) {
|
|
if (this.SortNo == "") { alert("第" + (i + 1) + "行排序号不能为空"); bk = true;return false; }
|
|
if (this.Name == "") { alert("第" + (i + 1) + "行名称不能为空"); bk = true; return false; }
|
|
});
|
|
if (bk == true) return;
|
|
if (datagrid2.DataSource.length == 0) { alert("没有可以保存的数据"); return; }
|
|
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "SysManageService.asmx/Save_JC_BaseCodeDetail",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
alert("保存成功");
|
|
$.fancybox.close();
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
function Save2() {
|
|
|
|
var param = new Object();
|
|
|
|
param.KeyName = "ptlx";
|
|
var list = new Array();
|
|
$("input[sno]").each(function () {
|
|
if($(this).is(":checked")==true)
|
|
{
|
|
var md = new Object();
|
|
md.Code = 0;
|
|
md.SortNo = $(this).attr("sno");
|
|
md.IsUse = 1;
|
|
md.KeyName = "ptlx";
|
|
md.Name = $(this).attr("sname");
|
|
Array.add(list, md);
|
|
}
|
|
});
|
|
param.list = list;
|
|
|
|
|
|
WindowLoadModel.Show();
|
|
$.ajax({
|
|
url: "SysManageService.asmx/Save_JPLXBaseCode",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
WindowLoadModel.Hide();
|
|
alert("保存成功");
|
|
$.fancybox.close();
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body class="headbody">
|
|
<div class="title_ico">
|
|
设置
|
|
</div>
|
|
<table id="tb1" class="tableAll" style="width: 100%;">
|
|
<colgroup>
|
|
<col style="width: 80px;" />
|
|
<col />
|
|
<col style="width: 80px;" />
|
|
<col />
|
|
<col style="width: 80px;" />
|
|
<col />
|
|
</colgroup>
|
|
<tr>
|
|
<td class="f1">机构
|
|
</td>
|
|
<td colspan="5">
|
|
<select id="listCompany" class="selectClass" style="width:250px;"></select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top" colspan="6">
|
|
<div id="DataGrid1" class="DataGridStyle"></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<div style="display: none;">
|
|
<div id="WindowAdd" title="编辑">
|
|
<table width="99%" class="tableAll" style="width:400px;height:auto;">
|
|
<tr>
|
|
<td>
|
|
<input id="cmdAdd" class="btnClass btnClassAdd" type="button" value="新增" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3">
|
|
<div id="DataGrid2" class="DataGridStyle"></div>
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center">
|
|
<input id="cmdSave" class="btnClass btnClassSave" type="button" value="保存" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div id="WindowPT" title="编辑">
|
|
<table width="99%" class="tableAll" style="width:400px;height:auto;">
|
|
|
|
<tr>
|
|
<td>
|
|
<div id="DataGrid3" class="DataGridStyle"></div>
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" align="center">
|
|
<input id="cmdSavePT" class="btnClass btnClassSave" type="button" value="保存" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|