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. 【LeetCode】不同二叉搜索树

    [问题] 卡特兰(Catalan)数来源于卡特兰解决凸n+2边形的剖分时得到的数列Cn,在数学竞赛.信息学竞赛.组合数学.计算机编程等方面都会有其不同侧面的介绍.卡特兰问题的解决过程应用了大量的映射方 ...

  2. CentOS 6.8 32位 安装mysql8

    1.清理掉之前安装过的mysql rpm -qa | grep mysql mysql-libs-5.1.52-1.el6_0.1.x86_64 yum remove mysql-libs-5.1.5 ...

  3. FULLTEXT INDEX全文索引

    给现有的wxinfo表的sourceUrl 字段创建全文索引 ALTER TABLE wxinfo ADD FULLTEXT INDEX sourceUrl (sourceUrl) 创建全文索引前: ...

  4. P 1017

    转跳点:

  5. 51nod 1287: 加农炮 好题啊好题

    1287 加农炮 题目来源: Codility 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题  收藏  关注 一个长度为M的正整数数组A,表示从左向右的地形高度. ...

  6. C++ createprocess 打开word

    #define FileName _TEXT("E:\\DuplicateHandle伪句柄与实句柄的应用.docx") void CMFCApplication1Dlg::OnB ...

  7. Pycharm2020最新激活码|永久激活(附最新激活码和插件)

    最近很多人的Pycharm激活时间又过期了,后台很多人索要激活码,我就再把激活的方法汇和工具再梳理一次给大家. 最主要有两种激活方式(两种方式需要的激活码不同): 一.激活码激活: 一般一年多需要激活 ...

  8. vs密匙

    Visual Studio 2019(VS2019) 企业版 Enterprise 激活码:BF8Y8-GN2QH-T84XB-QVY3B-RC4DF Visual Studio 2017(VS201 ...

  9. POJ-3629 模拟

    A - Card Stacking Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u S ...

  10. OI常用模板

    long long qpow(long long a,long long b,int mod) { ; while (b) { ) res=res*a%mod; a=a*a%mod; b>> ...