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.
292 lines
11 KiB
Plaintext
292 lines
11 KiB
Plaintext
1 month ago
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CountryList.aspx.cs" Inherits="TradeManage.SysManage.CountryList" %>
|
||
|
|
||
|
<!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/WindowLoad.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 WindowLoadModel = new WindowLoad();
|
||
|
|
||
|
|
||
|
$(document).ready(function () {
|
||
|
WindowLoadModel.ApplicationPath = "../";
|
||
|
WindowLoadModel.ControlID = "WindowLoad";
|
||
|
WindowLoadModel.Isbgiframe = true;
|
||
|
WindowLoadModel.Load();
|
||
|
ajaxInit(WindowLoadModel);
|
||
|
|
||
|
CreateDataGrid();
|
||
|
ReadData();
|
||
|
|
||
|
$("#cmdAdd").click(function () {
|
||
|
Model = null;
|
||
|
ShowFancybox();
|
||
|
});
|
||
|
|
||
|
$("#cmdSave").click(function () {
|
||
|
Save();
|
||
|
});
|
||
|
$("#btn_sch").click(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") {
|
||
|
ShowFancybox();
|
||
|
}
|
||
|
if (ColName == "cmdDel") {
|
||
|
Delete(Model.Id);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
//#region 弹出
|
||
|
function ShowFancybox() {
|
||
|
$.fancybox({
|
||
|
'autoScale': false,
|
||
|
'transitionIn': 'elastic',
|
||
|
'transitionOut': 'elastic',
|
||
|
'href': '#WindowAdd',
|
||
|
'onStart': function () {
|
||
|
if (Model == null) {
|
||
|
Clear();
|
||
|
} else {
|
||
|
$("#txtName").val(Model.Name);
|
||
|
$("#txtCode").val(Model.Code);
|
||
|
$("#txtEnglishName").val(Model.EnglishName);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
//#endregion
|
||
|
//#region 初始化DataGrid
|
||
|
function CreateDataGrid() {
|
||
|
|
||
|
var col = new nblf.ui.DataGridColumn();
|
||
|
col.HeaderText = "国家";
|
||
|
col.CellTemplate = "<span>{Bind Name}</span>";
|
||
|
Array.add(datagrid1.Columns, col);
|
||
|
|
||
|
col = new nblf.ui.DataGridColumn();
|
||
|
col.HeaderText = "英文简称";
|
||
|
col.CellTemplate = "<span>{Bind Code}</span>";
|
||
|
Array.add(datagrid1.Columns, col);
|
||
|
|
||
|
col = new nblf.ui.DataGridColumn();
|
||
|
col.HeaderText = "英文全称";
|
||
|
col.CellTemplate = "<span>{Bind EnglishName}</span>";
|
||
|
Array.add(datagrid1.Columns, col);
|
||
|
|
||
|
col = new nblf.ui.DataGridColumn();
|
||
|
col.HeaderText = "操作";
|
||
|
col.Width = "200px";
|
||
|
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>";
|
||
|
Array.add(datagrid1.Columns, col);
|
||
|
datagrid1.SetPageSize(30);
|
||
|
datagrid1.SetPageIndex(1);
|
||
|
datagrid1.IsFixHeader = false;
|
||
|
datagrid1.ShowIndexColumn = false;
|
||
|
datagrid1.AllowPaging = true;
|
||
|
datagrid1.Width = "100%";
|
||
|
datagrid1.SelectMode = nblf.ui.SelectMode.None;
|
||
|
datagrid1.Init();
|
||
|
datagrid1.add_PageIndexChanged(function () { ReadData(); });
|
||
|
|
||
|
}
|
||
|
//#endregion
|
||
|
//#region 读取数据
|
||
|
function ReadData() {
|
||
|
var param = new Object();
|
||
|
param.Name = $("#txt_Name").val();
|
||
|
param.PageSize = datagrid1.Get_PageSize();
|
||
|
param.PageIndex = datagrid1.Get_PageIndex();
|
||
|
WindowLoadModel.Show();
|
||
|
$.ajax({
|
||
|
url: "SysManageService.asmx/GetListJC_Country",
|
||
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
||
|
success: function (data) {
|
||
|
WindowLoadModel.Hide();
|
||
|
datagrid1.Set_RowCount(data.d.RowCount);
|
||
|
datagrid1.DataBind(data.d.DataSource);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
//#endregion
|
||
|
//#region 清空
|
||
|
function Clear() {
|
||
|
$("#txtName").val("");
|
||
|
$("#txtCode").val("");
|
||
|
}
|
||
|
//#endregion
|
||
|
//#region 删除
|
||
|
function Delete(Id) {
|
||
|
if (window.confirm("确定要删除吗?") == false) return;
|
||
|
var param = new Object();
|
||
|
param.Id = Id;
|
||
|
WindowLoadModel.Show();
|
||
|
$.ajax({
|
||
|
url: "SysManageService.asmx/Delete_JC_Country",
|
||
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
||
|
success: function (data) {
|
||
|
WindowLoadModel.Hide();
|
||
|
ReadData(); //刷新DataGrid
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
//#endregion
|
||
|
//#region 判断名称是否重复
|
||
|
function CheckName(Model) {
|
||
|
if (Model.Name == "") return true;
|
||
|
var param = new Object();
|
||
|
param.Id = Model.Id;
|
||
|
param.Name = Model.Name;
|
||
|
var bk = false;
|
||
|
$.ajax({
|
||
|
url: "SysManageService.asmx/CheckName_JC_Country",
|
||
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
||
|
async: false,
|
||
|
success: function (data) {
|
||
|
bk = data.d;
|
||
|
}
|
||
|
});
|
||
|
return bk;
|
||
|
}
|
||
|
//#endregion
|
||
|
//#region 判断代码是否重复
|
||
|
function CheckCode(Model) {
|
||
|
if (Model.Code == "") return true;
|
||
|
var param = new Object();
|
||
|
param.Id = Model.Id;
|
||
|
param.Code = Model.Code;
|
||
|
var bk = false;
|
||
|
$.ajax({
|
||
|
url: "SysManageService.asmx/CheckCode_JC_Country",
|
||
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
||
|
async: false,
|
||
|
success: function (data) {
|
||
|
bk = data.d;
|
||
|
}
|
||
|
});
|
||
|
return bk;
|
||
|
}
|
||
|
//#endregion
|
||
|
//#region 保存
|
||
|
function Save() {
|
||
|
if (Model == null) {
|
||
|
Model = new Object();
|
||
|
Model.Id = 0;
|
||
|
}
|
||
|
Model.Name = $("#txtName").val();
|
||
|
Model.Code = $("#txtCode").val();
|
||
|
Model.EnglishName = $("#txtEnglishName").val();
|
||
|
if (Model.Name == "") { alert("名称不能为空"); return; }
|
||
|
if (Model.Code == "") { alert("英文简称不能为空"); return; }
|
||
|
if (CheckName(Model) == false) { alert("名称重复"); return; }
|
||
|
if (CheckCode(Model) == false) { alert("代码重复"); return; }
|
||
|
var param = new Object();
|
||
|
param.Model = Model;
|
||
|
WindowLoadModel.Show();
|
||
|
$.ajax({
|
||
|
url: "SysManageService.asmx/Save_JC_Country",
|
||
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
||
|
success: function (data) {
|
||
|
WindowLoadModel.Hide();
|
||
|
ReadData();
|
||
|
alert("保存成功");
|
||
|
$.fancybox.close();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
//#endregion
|
||
|
</script>
|
||
|
</head>
|
||
|
|
||
|
<body class="headbody">
|
||
|
<div class="title_ico">
|
||
|
国家
|
||
|
</div>
|
||
|
<table id="tb1" class="tableAll" style="width: 100%;">
|
||
|
<tr>
|
||
|
<td class="f1" width="18%">中文名/简称/全称:
|
||
|
|
||
|
</td> <td width="25%"> <input id="txt_Name" class="editTextbox" style="width: 120px;" type="text" />
|
||
|
|
||
|
</td> <td>
|
||
|
|
||
|
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
|
||
|
</tr>
|
||
|
<tr style="display:none" >
|
||
|
<td colspan="3">
|
||
|
<input id="cmdAdd" class="btnClass btnClassAdd" type="button" value="新增" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top" colspan="3">
|
||
|
<div id="DataGrid1" class="DataGridStyle"></div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<div style="display: none;">
|
||
|
<div id="WindowAdd" title="编辑" style="width: 300px; height: auto;">
|
||
|
<table id="tb2" class="tableAll" style="width: 99%;">
|
||
|
<colgroup>
|
||
|
<col style="width: 80px;" />
|
||
|
<col />
|
||
|
</colgroup>
|
||
|
<tr>
|
||
|
<td class="f1"><span style="color: Red;">*</span>名称
|
||
|
</td>
|
||
|
<td>
|
||
|
<input id="txtName" type="text" class="editTextbox" style="width: 99%;" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="f1"><span style="color: Red;">*</span>英文简称
|
||
|
</td>
|
||
|
<td>
|
||
|
<input id="txtCode" type="text" class="editTextbox" style="width: 99%;" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="f1"><span style="color: Red;">*</span>英文全称
|
||
|
</td>
|
||
|
<td>
|
||
|
<input id="txtEnglishName" type="text" class="editTextbox" style="width: 99%;" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan="2" align="center">
|
||
|
<input id="cmdSave" class="btnClass btnClassSave" type="button" value="保存" />
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|