View信息:

@using Abp.Web.Mvc.Extensions
@using MedicalSystem.Authorization
@using MedicalSystem.Web.Navigation
@{
ViewBag.CurrentPageName = PageNames.App.Common.DrugConfiguration;
}
@section Styles
{
@Html.IncludeStyle("~/Areas/Mpa/Views/DrugConfiguration/Index.min.css")
}
@section Scripts
{
@Html.IncludeScript("~/Areas/Mpa/Views/Common/_PermissionTree.js")
@*@Html.IncludeScript("~/Areas/Mpa/Views/Roles/_CreateOrEditModal.js")*@
@Html.IncludeScript("~/Areas/Mpa/Views/DrugConfiguration/Index.js")
}
<div class="row margin-bottom-5">
<div class="col-xs-6">
<div class="page-head">
<div class="page-title">
<h1>
<span>@L("DrugConfiguration")</span> <small>@L("DrugConfigurationInfo")</small>
</h1>
</div>
</div>
</div>
<div class="col-xs-6 text-right">
@if (IsGranted(AppPermissions.Pages_Administration_DrugConfiguration_Create))
{
<button id="CreateNewDrugConfigurationButton" class="btn btn-primary blue"><i class="fa fa-plus"></i> @L("CreateDrugConfiguration")</button>
}
</div>
</div> <div class="portlet light">
<div class="portlet-body">
<div id="DrugConfigurationTable"></div>
</div>
</div>

Index.Js

(function () {
$(function () { var _$dcTable = $('#DrugConfigurationTable');
var _drugConfigurationService = abp.services.app.drugConfiguration; var _permissions = {
create: abp.auth.hasPermission('Pages.Administration.DrugConfiguration.Create'),
edit: abp.auth.hasPermission('Pages.Administration.DrugConfiguration.Edit'),
'delete': abp.auth.hasPermission('Pages.Administration.DrugConfiguration.Delete')
}; var _createModal = new app.ModalManager({
viewUrl: abp.appPath + 'Mpa/DrugConfiguration/CreateModal',
scriptUrl: abp.appPath + 'Areas/Mpa/Views/DrugConfiguration/_CreateModal.js',
modalClass: 'CreateDrugConfigurationModal'
}); var _editModal = new app.ModalManager({
viewUrl: abp.appPath + 'Mpa/DrugConfiguration/EditModal',
scriptUrl: abp.appPath + 'Areas/Mpa/Views/DrugConfiguration/_EditModal.js',
modalClass: 'EditDrugConfigurationModal'
}); _$dcTable.jtable({ title: app.localize('DrugConfiguration'),
paging: true, //是否显示分页控件
actions: {
listAction: {
method: _drugConfigurationService.getAllDrugConfiguration
}
}, fields: {
id: {
key: true,
list: false
},
actions: {
title: app.localize('Actions'),
width: '30%',
display: function (data) {
var $span = $('<span></span>'); if (_permissions.edit) {
$('<button class="btn btn-default btn-xs" title="' + app.localize('Edit') + '"><i class="fa fa-edit"></i></button>')
.appendTo($span)
.click(function () {
_editModal.open({ id: data.record.id });
});
} if (_permissions.delete) {
$('<button class="btn btn-default btn-xs" title="' + app.localize('Delete') + '"><i class="fa fa-trash-o"></i></button>')
.appendTo($span)
.click(function () {
deleteRole(data.record);
});
} return $span;
}
},
groupName: {
title: app.localize('DrugConfigurationGroupName'),
width: '30%',
display: function (data) {
var $span = $('<span></span>');
$span.append(data.record.groupName + " &nbsp; ");
return $span;
}
},
code: {
title: app.localize('DrugConfigurationCode'),
width: '20%',
display: function (data) {
var $span = $('<span></span>'); $span.append(data.record.code + " &nbsp; ");
return $span;
}
},
value: {
title: app.localize('DrugConfigurationValue'),
width: '20%',
display: function (data) {
var $span = $('<span></span>');
$span.append(data.record.value + " &nbsp; ");
return $span;
}
}
}
}); function deleteRole(dc) {
abp.message.confirm(
app.localize('DrugConfigurationDeleteWarningMessage', dc.groupName, dc.code, dc.value),
function (isConfirmed) {
if (isConfirmed) {
_drugConfigurationService.deleteDrugConfiguration({
id: dc.id
}).done(function () {
getDrugConfiguration();
abp.notify.success(app.localize('SuccessfullyDeleted'));
});
}
}
);
}; $('#CreateNewDrugConfigurationButton').click(function () {
_createModal.open();
});

     //刷新
function getDrugConfiguration() {
_$dcTable.jtable('load');
} abp.event.on('app.createOrEditDrugConfigurationModalSaved', function () {
getDrugConfiguration();
}); getDrugConfiguration();
});
})();

_CreateModal.cshtml

@using Abp.Organizations
@using MedicalSystem.Web.Areas.Mpa.Models.Common.Modals
@model MedicalSystem.Web.Areas.Mpa.Models.Doctor.Common.CreateDrugConfigurationModalViewModel @Html.Partial("~/Areas/Mpa/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("CreateDrugConfiguration"))) <div class="modal-body">
<form name="DrugConfigurationForm" role="form" novalidate class="form-validation">
<input type="hidden" name="Id" value="@Model.Id" />
<div class="form-group form-md-line-input form-md-floating-label no-hint">
<input class="form-control" type="text" name="GroupName" required maxlength="@OrganizationUnit.MaxDisplayNameLength">
<label>@L("DrugConfigurationGroupName")</label>
</div>
<div class="form-group form-md-line-input form-md-floating-label no-hint">
<input class="form-control" type="text" name="Code" required maxlength="@OrganizationUnit.MaxDisplayNameLength">
<label>@L("DrugConfigurationCode")</label>
</div>
<div class="form-group form-md-line-input form-md-floating-label no-hint">
<input class="form-control" type="text" name="Value" required maxlength="@OrganizationUnit.MaxDisplayNameLength">
<label>@L("DrugConfigurationValue")</label>
</div>
</form>
</div> @Html.Partial("~/Areas/Mpa/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")

_CreateModal.js

(function() {
app.modals.CreateDrugConfigurationModal = function () { var _modalManager;
var _drugConfigurationService = abp.services.app.drugConfiguration;
var _$form = null; this.init = function(modalManager) {
_modalManager = modalManager; _$form = _modalManager.getModal().find('form[name=DrugConfigurationForm]');
_$form.validate({ ignore: "" });
}; this.save = function() {
if (!_$form.valid()) {
return;
} var drugConfiguration = _$form.serializeFormToObject(); _modalManager.setBusy(true);
_drugConfigurationService.createDrugConfiguration(
drugConfiguration
).done(function(result) {
abp.notify.info(app.localize('SavedSuccessfully'));
_modalManager.setResult(result);
_modalManager.close();
abp.event.trigger('app.createOrEditDrugConfigurationModalSaved');
}).always(function() {
_modalManager.setBusy(false);
});
};
};
})();

红色部门代表是Appliation方法,WebAPi

分页的写法:

   public async Task<PagedResultOutput<DrugConfigurationListDto>> GetAllDrugConfiguration(GetDrugConfigurationInput input)
{
var query = _drugCRepository.GetAll();
var userCount = await query.CountAsync();
var users = await query
.OrderBy(p => p.Code)
.PageBy(input)
.ToListAsync(); var userListDtos = users.MapTo<List<DrugConfigurationListDto>>();
return new PagedResultOutput<DrugConfigurationListDto>(
userCount,
userListDtos
);
}

ASP.NET ZERO 学习 JTable的使用的更多相关文章

  1. ASP.NET ZERO 学习 JTable的使用子表闭合功能

    双击子表自动判定开闭功能 //CHILD TABLE DEFINITION FOR "PHONE NUMBERS" Phones: { title: '', width: '5%' ...

  2. ASP.NET ZERO 学习 JTable的ChildTable用法

    效果图: Jtable的子表用法: _$masterTable.jtable({ title: app.localize('PharmacyInventory'), openChildAsAccord ...

  3. ASP.NET从零开始学习EF的增删改查

           ASP.NET从零开始学习EF的增删改查           最近辞职了,但是离真正的离职还有一段时间,趁着这段空档期,总想着写些东西,想来想去,也不是很明确到底想写个啥,但是闲着也是够 ...

  4. ASP.NET MVC学习之Ajax(完结)

    一.前言 通过上面的一番学习,大家一定收获不少.但是总归会有一个结束的时候,但是这个结束也意味着新的开始. 如果你是从事ASP.NET开发,并且也使用了第三方控件,那么一定会觉得ASP.NET开发aj ...

  5. ASP.NET MVC学习之视图篇(2)

    继ASP.NET MVC学习之视图(1)学习 4.HTML辅助器 虽然在ASP.NET MVC中我们已经摆脱了ASP.NET的控件,但是对于页面中需要循环标签的情况依然还是存在,可能很多人认为用for ...

  6. ASP.NET MVC学习之过滤器篇(2)

    下面我们继续之前的ASP.NET MVC学习之过滤器篇(1)进行学习. 3.动作过滤器 顾名思义,这个过滤器就是在动作方法调用前与调用后响应的.我们可以在调用前更改实际调用的动作,也可以在动作调用完成 ...

  7. ASP.NET MVC学习之控制器篇

    一.前言 许久之后终于可以继续我的ASP.NET MVC连载了,之前我们全面的讲述了路由相关的知识,下面我们将开始控制器和动作的讲解. ASP.NET MVC学习之路由篇幅(1) ASP.NET MV ...

  8. ASP.NET MVC学习系列(二)-WebAPI请求

    继续接着上文 ASP.NET MVC学习系列(一)-WebAPI初探 来看看对于一般前台页面发起的get和post请求,我们在Web API中要如何来处理. 这里我使用Jquery 来发起异步请求实现 ...

  9. [ASP.NET MVC] ASP.NET Identity学习笔记 - 原始码下载、ID型别差异

    [ASP.NET MVC] ASP.NET Identity学习笔记 - 原始码下载.ID型别差异 原始码下载 ASP.NET Identity是微软所贡献的开源项目,用来提供ASP.NET的验证.授 ...

随机推荐

  1. python 输出99乘法表

    for i in range(1,10): for j in range(1,i+1): print("%s*%s=%2s"%(i,j,i*j),end=" " ...

  2. [LeetCode] 933. Number of Recent Calls 最近的调用次数

    Write a class RecentCounter to count recent requests. It has only one method: ping(int t), where t r ...

  3. Hadoop完全高可用集群安装

    架构图(HA模型没有SNN节点) 用vm规划了8台机器,用到了7台,SNN节点没用   NN DN SN ZKFC ZK JNN RM NM node1 *     *         node2 * ...

  4. css选择器权重、样式继承、默认样式

    学过css的小伙伴都是指css选择器的权重 !important Infinity 行间样式 1000 id   100 class|属性|伪类 10 标签|伪元素 1 通配符 0 权重相同 相同cs ...

  5. 154-PHP strpos函数

    <?php $str='passwords'; //定义一个字符串 $position=strpos($str,'s'); //查找字母s第一次出现的位置 echo '字母s的位置是'.$pos ...

  6. 132-PHP子类和父类同名函数的调用

    <?php class father{ //定义father类 public function cook(){ return '烹饪'; } } class son extends father ...

  7. NumPy 数组迭代

    章节 Numpy 介绍 Numpy 安装 NumPy ndarray NumPy 数据类型 NumPy 数组创建 NumPy 基于已有数据创建数组 NumPy 基于数值区间创建数组 NumPy 数组切 ...

  8. CSS - input 美化

    input{ padding: 20px; width: 100%; height: 5vh; margin-bottom: 2vh; border-radius: 10vw; border: 0; ...

  9. 原生js完成打地鼠小游戏

    :这是首页,有简单模式和地狱模式两种模式进行选择 这是选择完模式之后的游戏界面:30秒一局游戏倒计时,每打中一只老鼠加一分,没砸中减一分,没砸不加不减 首先准备几张图片 html代码: <!-- ...

  10. tkinter组件详解之Label

    tkinter组件详解之Label Label组件用于在屏幕上显示文本或图像.最红呈现出的结果是由背景和前景叠加构成的. 函数定义:Label(master=None, cnf={}, **kw) 背 ...