update 登录页背景, 组织机构code非必填, dapper查询优化

This commit is contained in:
2021-05-31 13:45:55 +08:00
parent ccd914fb81
commit 074ff51e86
12 changed files with 34 additions and 23 deletions

View File

@@ -137,7 +137,7 @@ namespace Ewide.Core
/// <summary> /// <summary>
/// 已有相同组织机构,编码或名称相同 /// 已有相同组织机构,编码或名称相同
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已有相同组织机构,编码或名称相同")] [ErrorCodeItemMetadata("已有相同编码组织机构")]
D2002, D2002,
/// <summary> /// <summary>

View File

@@ -5557,11 +5557,6 @@
名称 名称
</summary> </summary>
</member> </member>
<member name="P:Ewide.Core.Service.AddOrgInput.Code">
<summary>
编码
</summary>
</member>
<member name="P:Ewide.Core.Service.AddOrgInput.AreaCode"> <member name="P:Ewide.Core.Service.AddOrgInput.AreaCode">
<summary> <summary>
机构所在区域 机构所在区域

View File

@@ -17,13 +17,14 @@ namespace Ewide.Core.Extension.DataFilter.WebPage
protected IEnumerable<string> OtherRangeFields; protected IEnumerable<string> OtherRangeFields;
public DynamicParameters sqlParameters = new DynamicParameters(); public DynamicParameters sqlParameters = new DynamicParameters();
public SearchJsonFitlerInfoGetService(PageInputBase input, IEnumerable<string> equalsFields, IEnumerable<string> likeFields, IEnumerable<string> dateRangeFields, IEnumerable<string> otherRangeFields) public SearchJsonFitlerInfoGetService(PageInputBase input, IEnumerable<string> equalsFields, IEnumerable<string> likeFields, IEnumerable<string> dateRangeFields, IEnumerable<string> otherRangeFields, object param = null)
{ {
Input = input; Input = input;
EqualsFields = equalsFields; EqualsFields = equalsFields;
LikeFields = likeFields; LikeFields = likeFields;
DateRangeFields = dateRangeFields; DateRangeFields = dateRangeFields;
OtherRangeFields = otherRangeFields; OtherRangeFields = otherRangeFields;
sqlParameters = new DynamicParameters(param);
} }

View File

@@ -125,12 +125,12 @@ namespace Ewide.Core.Extension
} }
#region DAPPER #region DAPPER
public async static Task<PagedList> QueryPageDataDynamic(this IDapperRepository source, string baseSql, PageInputBase input, IEnumerable<string> equalsFields = null, IEnumerable<string> likeFields = null, IEnumerable<string> dateTimeRangeFields = null, IEnumerable<string> otherRangeFields = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) public async static Task<PagedList> QueryPageDataDynamic(this IDapperRepository source, string baseSql, PageInputBase input, object param = null, IEnumerable<string> equalsFields = null, IEnumerable<string> likeFields = null, IEnumerable<string> dateTimeRangeFields = null, IEnumerable<string> otherRangeFields = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{ {
SearchJsonFitlerInfoGetService searchJsonFitlerInfoGetService = new SearchJsonFitlerInfoGetService(input, equalsFields, likeFields, dateTimeRangeFields, otherRangeFields); SearchJsonFitlerInfoGetService searchJsonFitlerInfoGetService = new SearchJsonFitlerInfoGetService(input, equalsFields, likeFields, dateTimeRangeFields, otherRangeFields, param);
var sql = searchJsonFitlerInfoGetService.GetWhereSql(baseSql); var sql = searchJsonFitlerInfoGetService.GetWhereSql(baseSql);
var param = searchJsonFitlerInfoGetService.sqlParameters; var sqlParam = searchJsonFitlerInfoGetService.sqlParameters;
return await QueryPageData(source, sql, input, param, transaction, commandTimeout, commandType); return await QueryPageData(source, sql, input, sqlParam, transaction, commandTimeout, commandType);
} }
public async static Task<PagedList> QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) public async static Task<PagedList> QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)

View File

@@ -65,11 +65,6 @@ namespace Ewide.Core.Service
[Required(ErrorMessage = "机构名称不能为空")] [Required(ErrorMessage = "机构名称不能为空")]
public override string Name { get; set; } public override string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required(ErrorMessage = "机构编码不能为空")]
public override string Code { get; set; }
/// <summary> /// <summary>
/// 机构所在区域 /// 机构所在区域
/// </summary> /// </summary>

View File

@@ -125,9 +125,12 @@ namespace Ewide.Core.Service
[HttpPost("/sysOrg/add")] [HttpPost("/sysOrg/add")]
public async Task AddOrg(AddOrgInput input) public async Task AddOrg(AddOrgInput input)
{ {
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Name == input.Name || u.Code == input.Code); if (!string.IsNullOrEmpty(input.Code))
if (isExist) {
throw Oops.Oh(ErrorCode.D2002); var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Code == input.Code);
if (isExist)
throw Oops.Oh(ErrorCode.D2002);
}
if (!_userManager.SuperAdmin) if (!_userManager.SuperAdmin)
{ {
@@ -236,9 +239,12 @@ namespace Ewide.Core.Service
if (!_userManager.SuperAdmin && (dataScopes.Count < 1 || !dataScopes.Contains(sysOrg.Id))) if (!_userManager.SuperAdmin && (dataScopes.Count < 1 || !dataScopes.Contains(sysOrg.Id)))
throw Oops.Oh(ErrorCode.D2003); throw Oops.Oh(ErrorCode.D2003);
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => (u.Name == input.Name || u.Code == input.Code) && u.Id != sysOrg.Id); if (!string.IsNullOrEmpty(input.Code))
if (isExist) {
throw Oops.Oh(ErrorCode.D2002); var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Code == input.Code && u.Id != sysOrg.Id);
if (isExist)
throw Oops.Oh(ErrorCode.D2002);
}
// 如果名称有变化,则修改对应员工的机构相关信息 // 如果名称有变化,则修改对应员工的机构相关信息
if (!sysOrg.Name.Equals(input.Name)) if (!sysOrg.Name.Equals(input.Name))

View File

Before

Width:  |  Height:  |  Size: 223 KiB

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View File

@@ -6,8 +6,14 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
>img {
display: block;
background: url('~@/assets/image/login-bg.jpg') no-repeat center; width: 100%;
height: 100%;
object-fit: cover;
}
&::before { &::before {
position: absolute; position: absolute;
top: 0; top: 0;

View File

@@ -1,5 +1,6 @@
<template> <template>
<div class="yo-login"> <div class="yo-login">
<img :src="backgroundImage" />
<div class="yo-login--placeholder"> <div class="yo-login--placeholder">
<container mode="container-sm"> <container mode="container-sm">
<a-form-model :model="form" @submit="handleSubmit" @submit.native.prevent> <a-form-model :model="form" @submit="handleSubmit" @submit.native.prevent>
@@ -52,6 +53,8 @@ import { doLogin } from '@/common/login';
export default { export default {
data() { data() {
return { return {
backgroundImage: null,
loading: false, loading: false,
form: { form: {
user: '', user: '',
@@ -63,6 +66,11 @@ export default {
}, },
}; };
}, },
created() {
this.backgroundImage = require(`@/assets/image/login-bg-0${Math.floor(Math.random() * 4)}.jpg`);
},
methods: { methods: {
handleSubmit(e) { handleSubmit(e) {
this.loading = true; this.loading = true;