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的验证.授 ...
随机推荐
- node - 路由的使用
一,服务器文件 app.js .( 要使用路由的文件) const express = require('express') const app = express() const swig = ...
- 《学习R》笔记:科学计算器、检查变量和工作区、向量、矩阵和数组、列表和数据框
一.第二章 科学计算器 要检查两个数字是否一样,要使用 all.equal() ,不要使用 == ,== 符号仅用于比较两个整型数是否存在相同 . > all.equal(sqrt(2)^2,2 ...
- 11.json
import json # json反序列化 # json_str = '{"name":"qiyue","age":18}' # stud ...
- codeforces 594
D 给你一个长度为n的括号序列,然后你可以选择交换两个位置,你需要使得能够变成 合法括号序列的起点最多. 题解 人尽皆知的东西:合法的括号序列是,令'('为1,')'为-1,那么前缀和需要>=0 ...
- vue的computed和method的区别
(1)computed是响应式的,methods并非响应式. (2)computed是带缓存的 (3)computed中的成员可以只定义一个函数作为只读属性,也可以定义get/set变成可读写属性,这 ...
- archlinux下安装mysql
mysql的安装 这里安装的是mariadb一个mysql的开源版本,实际使用体验没有差别 1. 安装Maria DB sudo pacman -S mariadb 2. 配置目录 sudo mari ...
- Java 第一次课堂测试总结。
Java 第一次课堂测试总结. 昨天参加了JAVA的开学测试,课上没有完成计算基点的功能,以下是修改完成后的代码. 首先是ScoreInformation类来存储学生信息. //信1805-1 王正 ...
- HDU - 4112 Break the Chocolate(规律)
题意:有一块n*m*k的巧克力,最终需要切成n*m*k个1*1*1的块,问用以下两种方法最少掰多少次能达到目的: 1.用手掰:每次只能拿出一块来掰:2.用刀切:可以把很多已经分开的块摞在一起一刀切下来 ...
- dns、网关、IP地址,主要是配置resolv.conf\network\ifcfg-eth0
Ubuntu sudo vi /etc/network/interfac 添加 dns-nameservers 192.168.1.254dns-search stonebean.com cent ...
- 吴裕雄--天生自然 JAVASCRIPT开发学习:函数
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...