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实现仓储管理系统——使用 WEBAPI实现CURD (十一)

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

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI前端页面框架 (十八)

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理一 (十九)

 

一.前言

通过前面的文章abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理一 (十九)abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理八(二十六)的学习,我们已经有实现了传统的ASP.NET Core MVC+EasyUI的增删改查功能。本篇文章我们要实现了使用ABP提供的WebAPI方式+EasyUI来实现增删改查的功能。本文中我们将不在使用DataGrid表格控件,而是使用树形表格(TreeGrid)控件。

二、树形表格(TreeGrid)介绍

我先上图,让我们来看一下功能完成之后的组织管理信息列表页面。如下图。

这个组织管理列表页面使用TreeGrid来实现的。我们接下来介绍一下TreeGrid。

首先、在定义TreeGrid时有两个属性必须要有一个是idField,这个要唯一;另一个是treeField的定义,这是树节点的值,必须要有。

其次、easyui加载treegrid的json数据格式有三种,我就介绍我常用的这种。其他两种方式,请查看easyui的相关文档。

  {"total":7,"rows":[

           {"id":1,"name":"All Tasks","begin":"3/4/2010","end":"3/20/2010","progress":60,"iconCls":"icon-ok"},      
{"id":2,"name":"Designing","begin":"3/4/2010","end":"3/10/2010","progress":100,"_parentId":1,"state":"closed"},
{"id":21,"name":"Database","persons":2,"begin":"3/4/2010","end":"3/6/2010","progress":100,"_parentId":2},
{"id":22,"name":"UML","persons":1,"begin":"3/7/2010","end":"3/8/2010","progress":100,"_parentId":2}, {"id":23,"name":"Export Document","persons":1,"begin":"3/9/2010","end":"3/10/2010","progress":100,"_parentId":2},
{"id":3,"name":"Coding","persons":2,"begin":"3/11/2010","end":"3/18/2010","progress":80},
{"id":4,"name":"Testing","persons":1,"begin":"3/19/2010","end":"3/20/2010","progress":20} ],"footer":[ {"name":"Total Persons:","persons":7,"iconCls":"icon-sum"} ]}

下面介绍一下上面数据中的几个重要属性:

1)  _parentId :字段_parentId必不可少,且名称唯一。记得前面有“_” ,他是用来记录父级节点,没有这个属性,是没法展示父级节点 其次就是这个父级节点必须存在,不然信息也是展示不出来,在后台遍历组合的时候,如果父级节点不存在或为0时,此时 _parentId 应该不赋值,或设为“”。如果赋值 “0” 则在表格中不显示数据。

2) state:是否展开

3) checked:是否选中(用于复选框)

4) iconCls:选项前面的图标,如果自己不设定,父级节点默认为文件夹图标,子级节点为文件图标

下面我们来开始实现组织管理页面的相关功能。首先我们要创建一个组织信息实体。

三、创建Org实体

1. 在Visual Studio 2017的“解决方案资源管理器”中,右键单击“ABP.TPLMS.Core”项目的“Entitys”文件夹,在弹出菜单中选择“添加” >

> “类”。 将类命名为 Org,然后选择“添加”。

2.创建Org类继承自Entity<int>,通过实现审计模块中的IHasCreationTime来实现保存创建时间。根据TreeGrid所需要的数据格式的要求。代码如下:

using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text; namespace ABP.TPLMS.Entitys
{ public partial class Org : Entity<int>, IHasCreationTime
{
int m_parentId = ;
public Org()
{ this.Id = ;
this.Name = string.Empty;
this.HotKey = string.Empty;
this.ParentId = ;
this.ParentName = string.Empty; this.IconName = string.Empty; this.Status = ; this.Type = ; this.BizCode = string.Empty;
this.CustomCode = string.Empty;
this.CreationTime = DateTime.Now;
this.UpdateTime = DateTime.Now;
this.CreateId = ; this.SortNo = ; } [Required]
[StringLength()]
public string Name { get; set; } [StringLength()]
public string HotKey { get; set; } public int ParentId { get { return m_parentId; } set { m_parentId = value; } } [Required]
[StringLength()]
public string ParentName { get; set; } public bool IsLeaf { get; set; } public bool IsAutoExpand { get; set; } [StringLength()]
public string IconName { get; set; } public int Status { get; set; } public int Type { get; set; } [StringLength()]
public string BizCode { get; set; } [StringLength()]
public string CustomCode { get; set; } public DateTime CreationTime { get; set; }
public DateTime UpdateTime { get; set; }
public int CreateId { get; set; } public int SortNo { get; set; }
public int? _parentId {
get {
if (m_parentId == ) {
return null;
} return m_parentId;
} }
}
}

3.定义好实体之后,我们去“ABP.TPLMS.EntityFrameworkCore”项目中的“TPLMSDbContext”类中定义实体对应的DbSet,以应用Code First 数据迁移。添加以下代码

using Microsoft.EntityFrameworkCore;
using Abp.Zero.EntityFrameworkCore;
using ABP.TPLMS.Authorization.Roles;
using ABP.TPLMS.Authorization.Users;
using ABP.TPLMS.MultiTenancy;
using ABP.TPLMS.Entitys; namespace ABP.TPLMS.EntityFrameworkCore
{ public class TPLMSDbContext : AbpZeroDbContext<Tenant, Role, User, TPLMSDbContext>
{ /* Define a DbSet for each entity of the application */ public TPLMSDbContext(DbContextOptions<TPLMSDbContext> options)
: base(options) {
} public DbSet<Module> Modules { get; set; }
public DbSet<Supplier> Suppliers { get; set; }
public DbSet<Cargo> Cargos { get; set; }
public DbSet<Org> Orgs { get; set; } }
}

4.从菜单中选择“工具->NuGet包管理器器—>程序包管理器控制台”菜单。

5. 在PMC中,默认项目选择EntityframeworkCore对应的项目后。输入以下命令:Add-Migration AddEntityOrg,创建迁移。如下图。

6. 在上面的命令执行完毕之后,创建成功后,会在Migrations文件夹下创建时间_AddEntityOrg格式的类文件,这些代码是基于DbContext指定的模型。如下图。

7.在程序包管理器控制台,输入Update-Database,回车执行迁移。执行成功后,如下图。

8. 在SQL Server Management Studio中查看数据库,Orgs表创建成功。

abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之一(二十七)的更多相关文章

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

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

  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实现仓储管理系统——使用 WEBAPI实现CURD (十四)

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

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

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

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

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

  7. 2019年7月16日 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总体介绍(一) abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二) ...

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

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

随机推荐

  1. 渗透测试-基于白名单执行payload--Cmstp

    0x01 Cmstp简介 Cmstp安装或删除“连接管理器”服务配置文件.如果不含可选参数的情况下使用,则 cmstp 会使用对应于操作系统和用户的权限的默认设置来安装服务配置文件. 微软官方文档: ...

  2. PHP array_product

    1.函数的作用:计算数组元素的乘积 2.函数的参数: @params array 3.例子: <?php $input = [false,true]; print_r(array_product ...

  3. 【Redis】Could not get a resource from the pool 实乃集群配置问题

    先说些题外话~自上次确诊为鼻窦炎+过敏性鼻炎到现在已经一个月了,最初那会,从下午到晚上头疼难忍.大概是积劳成疾,以前流鼻涕.打喷嚏的时候从来没有注意过,结果病根一下爆发. 关键在于锁定问题,开始治疗一 ...

  4. MakeDownPad2基本使用

    一.安装 1.1.MakeDownPad2下载安装 MakeDownPad2从官网下载安装包直接安装即可 1.2.依赖安装 MakeDownPad2支持html代码,如果要使用预览功能就需要安装awe ...

  5. Python开发【第三篇】数据类型

    1.数字类型 int 整数 1 2 3 float 浮点数 1.1 0.9 0.99 complex 复数 (2+0j) str 字符串 'hello world' "hello world ...

  6. 03 Node.js学习笔记之根据http请求路径返回不同数据

    在Nodejs中,当客户端请求的路径不同时,NodeJS处理返回不同的数据 步骤: //1.载入http模块 var http=require('http'); //2.创建一个http服务 var ...

  7. 关于Java 项目的思考总结

    Java 项目思考总结 前言 今天是2017年3月25日,笔者已经毕业半年,工作经验一年. 正好有心思写这个总结. 持续开发 对于Java项目,我所接触的一般就是JavaWeb项目和 Java Jar ...

  8. 判断是否存在UI被触摸

    ) || (Input.touchCount > && Input.GetTouch().phase == TouchPhase.Began)) { #if UNITY_ANDR ...

  9. SpringBoot接管SpringMvc

    SpringBoot接管SpringMvc Spring Web MVC framework(通常简称为“Spring MVC”)是一个丰富的“model 视图控制器”web framework. S ...

  10. Unity5-ABSystem(三):AssetBundle加载

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/lodypig/article/detai ...