62,025
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SmsIndex.aspx.cs" Inherits="RCPMIS_AQJKPT.ModuleSources.SMS.SmsIndex" enableEventValidation="false" %>
<!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>
<link rel="stylesheet" type="text/css" href="../../Commons/Easy-UI/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="../../Commons/Easy-UI/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="../../Commons/Easy-UI/demo.css"/>
<script type="text/javascript" src="../../Commons/Easy-UI/jquery.min.js"></script>
<script type="text/javascript" src="../../Commons/Easy-UI/jquery.easyui.min.js"></script>
<script type="text/javascript">
var xmlHttp = null; //ajax xmlhttp对象
var recordId = ""; //选中记录的ID
//初始化
window.onload = function () {
TrHover("tabList", 1);
}
//表格行单击操作
function RowClick(clickTr, rid) {
TrHover("tabList", 1);
clickTr.className = "tr_hover";
recordId = rid;
//记录唯一ID rid
}
//增加记录
function AddRecord() {
document.getElementById("div1").style.display = "block";
$("#text1").attr("disabled", false);
$("#text2").attr("disabled", false);
$("#text3").attr("disabled", false);
$("#text1").val("");
$("#text2").val("");
$("#text3").val("");
}
//修改记录
function ModifyRecord() {
if (recordId == "") {
alert(_RecordModifyInfo);
return;
}
//处理代码
}
//删除记录
function DeleteRecord() {
if (recordId == "") {
alert(_RecordDeleteInfo);
return;
}
if (confirm(_RecordDeleteConf)) {
var ajaxurl = "AjaxServer.aspx?tName=test1&tFilter=f_sqid=" + recordId;
Ajax_GET(ajaxurl, OnDeleteData);
}
}
//数据删除操作
function OnDeleteData() {
var result = "";
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
result = xmlHttp.responseText;
if (result.isInteger() && parseInt(result) > 0) {
window.parent.location.reload();
}
else {
alert(result);
}
}
}
}
function getData(){
var rows = [];
for(var i=1; i<=800; i++){
var amount = Math.floor(Math.random()*1000);
rows.push({
F_SERIAL: 'Inv No '+i,
F_MCODE: $.fn.datebox.defaults.formatter(new Date()),
F_MNAME: 'Name '+i,
F_MDESC: amount,
})
}
return rows;
}
function pagerFilter(data) {
if (typeof data.length == 'number' && typeof data.splice == 'function') { // is array
data = {
total: data.length,
rows: data
}
}
var dg = $(this);
var opts = dg.datagrid('options');
var pager = dg.datagrid('getPager');
pager.pagination({
onSelectPage: function (pageNum, pageSize) {
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh', {
pageNumber: pageNum,
pageSize: pageSize
});
dg.datagrid('loadData', data);
}
});
if (!data.originalRows) {
data.originalRows = (data.rows);
}
var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
var end = start + parseInt(opts.pageSize);
data.rows = (data.originalRows.slice(start, end));
return data;
}
$(function () {
$('#dg').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData());
});
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'center',title:'North Title',split:true" style="height:700px;">
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="AddRecord()">添加</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit'"onclick="ModifyRecord()">修改</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'"onclick="DeleteRecord()">删除</a>
<br />
<table id="dg" style="width:560px;height:340px" data-options="rownumbers:true,singleSelect:true,autoRowHeight:false,pagination:true,pageSize:10">
<thead>
<tr>
<th field="F_SERIAL" width="120">序号</th>
<th field="F_MCODE" width="160">模块编码</th>
<th field="F_MNAME" width="120">模块名称</th>
<th field="F_MDESC" width="120" align="right">模块描述</th>
</tr>
</thead>
</table>
<div id="div1"style="display:none">
<table>
<tr>
<td style="height:30px"><asp:Label ID="Label1" runat="server" Text="模块编码:"></asp:Label></td>
<td>
<input class="easyui-validatebox textbox" disabled="disabled" id="text1" style="width:400px" value=""/>
</td>
</tr>
<tr>
<td style="height:30px"><asp:Label ID="Label2" runat="server" Text="模块名称:"></asp:Label></td>
<td>
<input type="text" id="text2" value="" disabled="disabled" style="width:400px" class="easyui-validatebox textbox"/></td>
</tr>
<tr>
<td style="height:80px; text-align:center; vertical-align:middle"valign="middle" >
<asp:Label ID="Label3" runat="server" Text="模块描述:" ></asp:Label>
</td>
<td>
<input type="text" id="text3" style="width:400px;height:80px;" disabled="disabled"class="easyui-validatebox textbox"/>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<a href="#" class="easyui-linkbutton" id="save" onclick="save()">保存</a>
</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript">
$("#dg").datagrid({
onClickRow: function (index, row) {
document.getElementById("div1").style.display = "block";
var aid = row.F_MCODE; //获取选中行的id
var bid = row.F_MNAME;
var cid = row.F_MDESC;
$("#text1").attr("disabled", true);
$("#text2").attr("disabled", true);
$("#text3").attr("disabled", true);
$("#text1").val(aid);
$("#text2").val(bid);
$("#text3").val(cid);
}
});
</script>
</body>
</html>
function getData1() {
var ss;
$.ajax({
type: "post", //要用post方式
url: "SmsModelSet.aspx/SayHello", //方法所在页面和方法名
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (data) {
ss= eval('(' + data.d + ')');
},
error: function (err) {
alert(err);
}
});
return ss;
}
这个是前台的,然后是后台[WebMethod]
public static string SayHello()
{
List<dynamic> ls = new List<dynamic>();
for (var i = 1; i <= 800; i++)
{
ls.Add(new
{
F_ACODE = i,
F_ANAME = 2 * i,
F_ADESC = 3 * i,
F_MCODE = 4 * i,
F_SERIAL = DateTime.Now.ToString(),
});
}
JavaScriptSerializer jsonSerialize = new JavaScriptSerializer();
return jsonSerialize.Serialize(ls);
}
<div id="p1" class="easyui-panel mywork-panel" title="流转面积分类统计(表)" data-options="
tools:[
{
iconCls:'icon-excel',
handler:Export
}],
collapsible:false,minimizable:false,maximizable:false,closable:false">
<div id="grid" class="mini-datagrid" url="../../statistics/bourse/Area.aspx?action=GetReport"
allowalternating="true" allowresize="false" fitcolumns="false" showpager="false"
pagesize="50" showsummaryrow="true" ondrawsummarycell="onDrawSummaryCell" style="min-width: 350px; height: 230px">
<div property="columns">
<div field="name" name="name" width="100" allowsort="true" headeralign="center"
align="center">
流转面积</div>
<div field="count" name="count" width="60" allowsort="true" headeralign="center"
align="center">
宗数</div>
<div field="area" name="area" width="80" allowsort="true" headeralign="center"
align="center">
面积(亩)</div>
<div field="rent" name="rent" width="110" allowsort="true" headeralign="center"
align="center">
租金金额(万元)</div>
<div field="invest" name="invest" width="100" allowsort="true" headeralign="center"
align="center">
投资额(万元)</div>
<div field="peasant" name="peasant" width="90" allowsort="true" headeralign="center"
align="center">
涉及农户数</div>
</div>
</div>
</div>