abp(net core)+easyui+efcore实现仓储管理系统目录

abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一)

abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二)

abp(net core)+easyui+efcore实现仓储管理系统——领域层创建实体(三)

abp(net core)+easyui+efcore实现仓储管理系统——定义仓储并实现 (四)

abp(net core)+easyui+efcore实现仓储管理系统——创建应用服务(五)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之控制器(六)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之列表视图(七)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之增删改视图(八)

abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之菜单与测试(九)

abp(net core)+easyui+efcore实现仓储管理系统——多语言(十)

abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十一)

abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十二)

abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十三)

上接(abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十三)),在这一篇文章中我们实现新增供应商的相关功能。

九、新增供应商

  (一) 创建js文件

我们先来看一下 “ABP.TPLMS.Web.Mvc”项目中的wwwroot目录下的view-resources\Users目录中的Index.js文件,然后参照此文件来写新增供应商的脚本文件。

1. 在Visual Studio 2017的“解决方案资源管理器”中,找到展现层“ABP.TPLMS.Web.Mvc”项目中的wwwroot目录下的view-resources目录。使用鼠标右键单击此目录,在弹出菜单中选择“添加” > “新建文件夹”。并重命名为“Supplier”。

2. 在Visual Studio 2017的“解决方案资源管理器”中,鼠标右键单击“Supplier”文件夹,然后选择“添加” > “新建项…”。 在“添加新项-ABP.TPLMS.Web.Mvc”对话框中,选择“javascript文件”,并将名称命名为Index.js。如下图。

3. 在Index.js文件中,我们写入如下代码。

(function() {
$(function() { var _supplierService = abp.services.app.supplier;
var _$modal = $('#SupplierCreateModal');
var _$form = _$modal.find('form'); _$form.validate({
}); $('#RefreshButton').click(function () {
refreshModuleList();
}); $('.delete-supplier').click(function () {
var userId = $(this).attr("data-supplier-id");
var userName = $(this).attr('data-supplier-name');
deleteSupplier(userId, userName);
}); $('.edit-supplier').click(function (e) {
var supplierId = $(this).attr("data-supplier-id"); e.preventDefault();
$.ajax({
url: abp.appPath + 'Supplier/EditSupplierModal?supplierId=' + supplierId, type: 'POST',
contentType: 'application/html',
success: function (content) {
$('#SupplierEditModal div.modal-content').html(content);
}, error: function (e) { }
});
}); _$form.find('button[type="submit"]').click(function (e) {
e.preventDefault(); if (!_$form.valid()) {
return;
} var supplier = _$form.serializeFormToObject(); //serializeFormToObject is defined in main.js abp.ui.setBusy(_$modal);
_supplierService.create(supplier).done(function () {
_$modal.modal('hide');
location.reload(true); //reload page to see new user! }).always(function () {
abp.ui.clearBusy(_$modal);
});
}); _$modal.on('shown.bs.modal', function () {
_$modal.find('input:not([type=hidden]):first').focus(); }); function refreshSupplierList() {
location.reload(true); //reload page to see new user! } function deleteSupplier(supplierId, supplierName) {
abp.message.confirm(
abp.utils.formatString(abp.localization.localize('AreYouSureWantToDelete', 'TPLMS'), supplierName), function (isConfirmed) {
if (isConfirmed) {
_supplierService.delete({
id: supplierId }).done(function () {
refreshSupplierList(); });
}
}
);
}
});
})();

4. 在Visual Studio 2017的“解决方案资源管理器”中,找到“ABP.TPLMS.Web.Mvc”项目中的Views目录下的Supplier目录中的Index.cshtml文件。双击打开此文件,并写入以下代码,引用脚本。

@section scripts    {  

        <script src="~/view-resources/Views/Supplier/Index.js" asp-append-version="true"></script>   }

(二)创建新增供应商视图

1. 在Visual Studio 2017的“解决方案资源管理器”中,找到“ABP.TPLMS.Web.Mvc”项目中的Views目录下的Supplier目录中的Index.cshtml文件。双击打开此文件,并写入以下代码。

<div class="modal fade" id="SupplierCreateModal" tabindex="-1" role="dialog" 
aria-labelledby="SupplierCreateModalLabel" data-backdrop="static">
<div class="modal-dialog" role="document"> <div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
<span>@L("CreateNewSupplier")</span>
</h4>
</div>
<div class="modal-body">
<form name="SupplierCreateForm" role="form" class="form-validation">
<div>
<div class="row clearfix">
<div class="col-sm-6">
<div class="form-group form-float">
<div class="form-line"> <label asp-for="@Model.Supplier.Code" class="form-label"></label>
<input type="text" name="Code" class="form-control" required maxlength="50" />
</div>
</div>
</div>
<div class="col-sm-6"> <div class="form-group form-float">
<div class="form-line">
<label asp-for="@Model.Supplier.Name" class="form-label"></label>
<input type="text" name="Name" class="form-control" required maxlength="50" />
</div>
</div>
</div>
</div>
<div class="row clearfix"> <div class="col-sm-12">
<div class="form-group form-float">
<div class="form-line">
<label asp-for="@Model.Supplier.Address" class="form-label"></label>
<input type="text" name="Address" class="form-control" required maxlength="255" />
</div>
</div>
</div>
</div>
<div class="row clearfix"> <div class="col-sm-6">
<div class="form-group form-float">
<div class="form-line">
<label asp-for="@Model.Supplier.LinkName" class="form-label"></label> <input type="text" name="LinkName" class="form-control" /> </div>
</div>
</div> <div class="col-sm-6">
<div class="form-group form-float">
<div class="form-line">
<label asp-for="@Model.Supplier.Mobile" class="form-label"></label> <input type="text" name="Mobile" class="form-control" /> </div>
</div>
</div>
</div>
<div class="row clearfix"> <div class="col-sm-6">
<div class="form-group form-float">
<div class="form-line">
<label asp-for="@Model.Supplier.Tel" class="form-label"></label>
<input type="text" name="Tel" class="form-control" required maxlength="255" />
</div>
</div>
</div>
<div class="col-sm-6"> <div class="form-group form-float">
<div class="form-line">
<label asp-for="@Model.Supplier.Status" class="form-label"></label> <input type="text" name="Status" class="form-control" /> </div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-6">
<div class="form-line">
<label asp-for="@Model.Supplier.Sex"></label>
<input name="Sex" type="text" class="form-control" /> </div>
</div> <div class="col-sm-6">
<div class="form-line">
<label asp-for="@Model.Supplier.Email"></label>
<input name="Email" type="text" class="form-control" /> </div>
</div>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default waves-effect" data-dismiss="modal">@L("Cancel")</button>
<button type="submit" class="btn btn-primary waves-effect">@L("Save")</button>
</div>
</form>
</div>
</div>
</div>
</div>

2. 在Visual Studio 2017中按F5运行应用程序。登录之后,点击“Supplier”目录,我们可以看到供应商列表页面。然后点击供应商列表页面中的新增按钮。如下图。

3. 在“Create New Supplier”页面中我们输入完信息之后,点击“Save”按钮。数据保存到数据库,应用会刷新供应商列表页面。如下图。

abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十四)的更多相关文章

  1. abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十五)

    core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+easyui+e ...

  2. abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十二)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  3. abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十三)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  4. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之五(五十四)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  5. abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十一)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  6. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之三(五十二)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  7. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之六(五十五)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  8. Abp(net core)+easyui+efcore实现仓储管理系统——出库管理之七(五十六)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  9. abp(net core)+easyui+efcore实现仓储管理系统——菜单 (十六)

    系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二) ...

随机推荐

  1. .net持续集成cake篇之cake介绍及简单示例

    cake介绍 Cake 是.net平台下的一款自动化构建工具,可以完成对.net项目的编译,打包,运行单元测试,集成测试甚至发布项目等等.如果有些特征Cake没有实现,我们还可以很容易地通过扩展Cak ...

  2. 消息中间件及IBM MQ

    MQ 消息中间件: 中间件是一种独立的系统软件或服务程序,分布式应用软件借助这种软件在不同的技术之间共享资源. 中间件位于客户机/ 服务器的操作系统之上,管理计算机资源和网络通讯.是连接两个独立应用程 ...

  3. Python 为什么要继承 object 类?

    自己搬运自己在知乎上的回答,感觉破乎吃枣药丸,哪天挂了这里就是个备份. 链接:https://www.zhihu.com/question/19754936/answer/229327803 2017 ...

  4. JAVA通过URL链接获取视频文件信息(无需下载文件)

    最近项目碰到一个大坑:APP上需要在获取视频列表时就获取视频的时长,但早期上传的时候数据库都没有保存这个数据,所以前段时间添加一个时长字段,在上传时手动输入视频时长,但是之前库中有上万条数据没这个信息 ...

  5. 百度AI之百度图像识别java版本使用

    百度AI之百度图像识别java版本使用\ 官网 http://ai.baidu.com/ 创建应用 查看 appid,appkey,sk 下载sdk https://ai.baidu.com/sdk# ...

  6. Windows 设置自启动计划任务(非登录启动)

    原因:服务器会不定期重启,且重启后无人看管,不会有人去登录系统.导致我们做的一些开机启动程序失效,进而系统瘫痪. 解决方法: 自己理解,想要达到目的有两种方式:系统服务 & 计划任务配置. 计 ...

  7. 物联网时代-跟着Thingsboard学IOT架构-MQTT设备协议

    Thingsboard的MQTT设备协议 thingsboard官网: https://thingsboard.io/ thingsboard GitHub: https://github.com/t ...

  8. 通信模型socket

    I/O的概念 操作系统的分为socket的I/O还有用户界面的输入输出,一般一个输入操作分为两个不同的阶段,1)等待数据准备好:2)从内核向进程复制数据 从理论上来讲,阻塞I/O.非阻塞I/O.复用I ...

  9. Redis(二)--- Redis的底层数据结构

    1.Redis的数据结构 Redis 的底层数据结构包含简单的动态字符串(SDS).链表.字典.压缩列表.整数集合等等:五大数据类型(数据对象)都是由一种或几种数结构构成. 在命令行中可以使用 OBJ ...

  10. halcon视频教程如何学习?怎么样才能踏入机器视觉这个行业?

    本人是工作八年的视觉工程师,主要从事Halcon和Visionpro视觉开发,谈谈个人对视觉学习看法: 1.HALCON是德国MVtec公司开发的一套完善的标准的机器视觉算法包,它节约了产品成本,缩短 ...