ASP.NET ZERO 学习 JTable的使用
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 + " ");
return $span;
}
},
code: {
title: app.localize('DrugConfigurationCode'),
width: '20%',
display: function (data) {
var $span = $('<span></span>'); $span.append(data.record.code + " ");
return $span;
}
},
value: {
title: app.localize('DrugConfigurationValue'),
width: '20%',
display: function (data) {
var $span = $('<span></span>');
$span.append(data.record.value + " ");
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的使用的更多相关文章
- ASP.NET ZERO 学习 JTable的使用子表闭合功能
双击子表自动判定开闭功能 //CHILD TABLE DEFINITION FOR "PHONE NUMBERS" Phones: { title: '', width: '5%' ...
- ASP.NET ZERO 学习 JTable的ChildTable用法
效果图: Jtable的子表用法: _$masterTable.jtable({ title: app.localize('PharmacyInventory'), openChildAsAccord ...
- ASP.NET从零开始学习EF的增删改查
ASP.NET从零开始学习EF的增删改查 最近辞职了,但是离真正的离职还有一段时间,趁着这段空档期,总想着写些东西,想来想去,也不是很明确到底想写个啥,但是闲着也是够 ...
- ASP.NET MVC学习之Ajax(完结)
一.前言 通过上面的一番学习,大家一定收获不少.但是总归会有一个结束的时候,但是这个结束也意味着新的开始. 如果你是从事ASP.NET开发,并且也使用了第三方控件,那么一定会觉得ASP.NET开发aj ...
- ASP.NET MVC学习之视图篇(2)
继ASP.NET MVC学习之视图(1)学习 4.HTML辅助器 虽然在ASP.NET MVC中我们已经摆脱了ASP.NET的控件,但是对于页面中需要循环标签的情况依然还是存在,可能很多人认为用for ...
- ASP.NET MVC学习之过滤器篇(2)
下面我们继续之前的ASP.NET MVC学习之过滤器篇(1)进行学习. 3.动作过滤器 顾名思义,这个过滤器就是在动作方法调用前与调用后响应的.我们可以在调用前更改实际调用的动作,也可以在动作调用完成 ...
- ASP.NET MVC学习之控制器篇
一.前言 许久之后终于可以继续我的ASP.NET MVC连载了,之前我们全面的讲述了路由相关的知识,下面我们将开始控制器和动作的讲解. ASP.NET MVC学习之路由篇幅(1) ASP.NET MV ...
- ASP.NET MVC学习系列(二)-WebAPI请求
继续接着上文 ASP.NET MVC学习系列(一)-WebAPI初探 来看看对于一般前台页面发起的get和post请求,我们在Web API中要如何来处理. 这里我使用Jquery 来发起异步请求实现 ...
- [ASP.NET MVC] ASP.NET Identity学习笔记 - 原始码下载、ID型别差异
[ASP.NET MVC] ASP.NET Identity学习笔记 - 原始码下载.ID型别差异 原始码下载 ASP.NET Identity是微软所贡献的开源项目,用来提供ASP.NET的验证.授 ...
随机推荐
- Spring Boot2(005):关于代码结构
spring boot 对于工程代码结构并没有特殊得要求,但以下几个有用的最佳实践建议参考参考: 1.不鼓励而且应该避免使用 default 包 没有 package 声明的类被认为是在 defaul ...
- Swift 访问权限
internal 内部的 1.默认情况下所有的类&属性&方法的访问权限都是internal 2.在本模块(项目/包/target)中可以访问 private 私有的 1.只有在本类中访 ...
- 吴裕雄--天生自然JAVA SPRING框架开发学习笔记:Spring通知类型及使用ProxyFactoryBean创建AOP代理
通知(Advice)其实就是对目标切入点进行增强的内容,Spring AOP 为通知(Advice)提供了 org.aopalliance.aop.Advice 接口. Spring 通知按照在目标类 ...
- 学习spring第五天 mybatis+spring的整合(maven多模块数据查询使用了分页和连接池),以及aop
mybatis+spring的整合: 导入的依赖:1.数据库连接:mysql-connector-java 2.连接池:druid 3.servlet:javax.servlet-api 4.jstl ...
- RecyclerView使用介绍
来源 http://jinyudong.com/2014/11/13/Introduce-RecyclerView-%E4%B8%80/ 编辑推荐:稀土掘金,这是一个针对技术开发者的一个应用,你可以在 ...
- git修改已经push的commit message
git中修改上一次提交的commit的message git commit --amend -m "你的新的注释" git push -f 多个commit https://www ...
- 使用java service wrapper将java程序注册为window服务
1.下载java service wrapper 下载地址:http://wrapper.tanukisoftware.com/doc/english/download.jsp 针对自己的需求下载相应 ...
- UVA - 10118 Free Candies(免费糖果)(dp---记忆化搜索)
题意:桌上有4堆糖果,每堆有N(N<=40)颗.佳佳有一个最多可以装5颗糖的小篮子.他每次选择一堆糖果,把最顶上的一颗拿到篮子里.如果篮子里有两颗颜色相同的糖果,佳佳就把它们从篮子里拿出来放到自 ...
- 抓DHCP客户端ip脚本
cat testnew.sh #!/bin/bash catch_ip (){Ip=`sudo nmap -sP 192.168.1.0/24 |grep -i -B2 $mac|grep Nmap ...
- CTF -攻防世界-crypto新手区(5~11)
easy_RSA 首先如果你没有密码学基础是得去恶补一下的 然后步骤是先算出欧拉函数 之后提交注意是cyberpeace{********}这样的 ,博主以为是flag{}耽误了很长时间 明明没算错 ...