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. 一条 SQL 在 Apache Spark 之旅

    转载自过往记忆大数据 https://www.iteblog.com/archives/2561.html Spark SQL 是 Spark 众多组件中技术最复杂的组件之一,它同时支持 SQL 查询 ...

  2. C++ 把数组的元素乘以2在输出

    #include<iostream> using namespace std; int main(){ ] = { , , , , }; ; ; i < ; i++) { ) { s ...

  3. JAVA - SpringBoot项目跨域访问

    JAVA - SpringBoot添加支持CORS跨域访问 CORS(Cross-Origin Resource Sharing)“跨域资源共享”,是一个W3C标准,它允许浏览器向跨域服务器发送Aja ...

  4. webpack散记--Typescript

    Typescript 1.js的超集 官网:typescriptlang.org/tslang.cn 来自:微软 安装:官方的  npm i typescript ts-loader --save-d ...

  5. JS - 使 input 失去焦点

    $(document).ready(function(){ $("body").click(function(){ if(!event.srcElement.type) {     ...

  6. PHP二维数组--去除指定列含有重复项的数组

    给定二维数组: $arr = array( '0' => array('张三',2,3,4), '1' => array('李四',2,3,4), '2' => array('张三' ...

  7. docker-compose 安装 mongodb

    1. 修改 docker-compose.yml version: "2.1" services: php7.1: build: ./php image: php7.1-ext p ...

  8. sql 常用的语句(sql 创建表结构 修改列 清空表)

    1.创建表 create Table WorkItemHyperlink ( ID bigint primary key ,--主键 WorkItemID ,) not null,--其中identi ...

  9. bugku-杂项 听首音乐

    下载文件,是个wav文件,用Audacity打开,发现有 放大后记录下来:(每一组后面加上空格) ..... -... -.-. ----. ..--- ..... -.... ....- ----. ...

  10. python可移植支持代码;用format.节省打印输出参数代码;math模块;

    1.多平台移植代码: #!/usr/bin/env python3 这一行比较特殊,称为 shebang 行,在 Python 脚本中,你应该一直将它作为第一行. 请注意行中的第一个字符是井号(#). ...