123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- @{
- ViewBag.Title = "Index";
- Layout = "~/Views/Shared/_Index.cshtml";
- }
- <script>
- $(function () {
- InitialPage();
- GetGrid();
- //表格表头居中显示
- $(".ui-th-column").css("text-align", "center");
- });
- //初始化页面
- function InitialPage() {
- //resize重设(表格、树形)宽高
- $(window).resize(function (e) {
- window.setTimeout(function () {
- $('#gridTable').setGridWidth(($('.gridPanel').width()));
- $("#gridTable").setGridHeight($(window).height() - 141);
- $("#itemTree").setTreeHeight($(window).height() - 52);
- }, 200);
- e.stopPropagation();
- });
- }
- function GetGrid() {
- var selectedRowIndex = 0;
- var $gridTable = $('#gridTable');
- $gridTable.jqGrid({
- url: "/NBManage/NBDevManufacturerCodeManage/GetNBDevManufacturerCode",
- datatype: "json",
- height: $(window).height() - 138.5,
- autowidth: true,
- rownumbers: true,
- colModel: [
- { label: "编号", name: "NBDevManufacturerCodeID", width: 100, align: "right", sortable: false },
- { label: "设备厂商ID", name: "NBDevManufacturerCodeName", width: 150, align: "left", sortable: false }
- ],
- viewrecords: true,
- rowNum: 30,
- rowList: [30, 50, 100],
- pager: "#gridPager",
- gridview: true,
- onSelectRow: function () {
- selectedRowIndex = $("#" + this.id).getGridParam('selrow');
- },
- gridComplete: function () {
- $("#" + this.id).setSelection(selectedRowIndex, false);
- }
- });
- //查询事件
- $("#btn_Search").click(function () {
- var keyword=$("#txt_Keyword").val()
- $gridTable.jqGrid('setGridParam', {
- postData: { queryJson: keyword },
- page: 1
- }).trigger('reloadGrid');
- });
- //查询回车
- $('#txt_Keyword').bind('keypress', function (event) {
- if (event.keyCode == "13") {
- $('#btn_Search').trigger("click");
- }
- });
- }
- //新增
- function btn_add() {
- dialogOpen({
- id: "Form",
- title: '添加表具类型',
- url: '/NBManage/NBDevManufacturerCodeManage/Form',
- width: "750px",
- height: "350px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- }
- });
- };
- //编辑
- function btn_edit() {
- var keyValue = $("#gridTable").jqGridRowValue("NBDevManufacturerCodeID");
- if (checkedRow(keyValue)) {
- dialogOpen({
- id: "Form",
- title: '修改表具类型',
- url: '/NBManage/NBDevManufacturerCodeManage/Form?keyValue=' + keyValue,
- width: "750px",
- height: "500px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- }
- });
- }
- }
- //删除
- function btn_delete() {
- var keyValue = $("#gridTable").jqGridRowValue("NBDevManufacturerCodeID");
- if (keyValue) {
- $.RemoveForm({
- url: "/NBManage/NBDevManufacturerCodeManage/DeleteForm",
- param: { keyValue: keyValue },
- success: function (data) {
- $("#gridTable").resetSelection();
- $("#gridTable").trigger("reloadGrid");
- }
- })
- } else {
- dialogMsg('请选择需要删除的数据项!', 0);
- }
- }
- </script>
- <div class="titlePanel">
- <div class="title-search">
- <table>
- <tr>
- <td>
- <div id="queryCondition" >
- <a class="btn btn-default dropdown-text" data-toggle="dropdown">类型名称</a>
- </div>
- </td>
- <td style="padding-left: 2px;">
- <input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;" />
- </td>
- <td style="padding-left: 5px;">
- <a id="btn_Search" class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
- </td>
- </tr>
- </table>
- </div>
- <div class="toolbar">
- <div class="btn-group">
- <a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i> 刷新</a>
- <a id="lr-add" class="btn btn-default" onclick="btn_add()"><i class="fa fa-plus"></i> 新增</a>
- <a id="lr-edit" class="btn btn-default" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i> 编辑</a>
- <a id="lr-delete" class="btn btn-default" onclick="btn_delete()"><i class="fa fa-trash-o"></i> 删除</a>
- </div>
- </div>
- </div>
- <div class="gridPanel">
- <table id="gridTable"></table>
- <div id="gridPager"></div>
- </div>
|