From c8530039eb70bc171c096a7f33392ebdb3f086ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?=
<188633308@qq.com>
Date: Fri, 21 May 2021 16:10:08 +0800
Subject: [PATCH] =?UTF-8?q?update=20=E6=96=B0=E5=A2=9E=E6=9C=BA=E6=9E=84?=
=?UTF-8?q?=E7=B1=BB=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Api/Ewide.Core/Entity/SysOrg.cs | 6 +++
Api/Ewide.Core/Ewide.Core.xml | 10 +++++
Api/Ewide.Core/Extension/PageExtensions.cs | 2 +-
.../Service/Dict/SysDictTypeService.cs | 16 +++----
Api/Ewide.Core/Service/Org/Dto/OrgInput.cs | 5 +++
Web/src/pages/system/org/form.vue | 31 +++++++++++++-
Web/src/pages/system/org/index.vue | 42 +++++++++++--------
7 files changed, 83 insertions(+), 29 deletions(-)
diff --git a/Api/Ewide.Core/Entity/SysOrg.cs b/Api/Ewide.Core/Entity/SysOrg.cs
index 3004216..078bc89 100644
--- a/Api/Ewide.Core/Entity/SysOrg.cs
+++ b/Api/Ewide.Core/Entity/SysOrg.cs
@@ -37,6 +37,12 @@ namespace Ewide.Core
[Comment("编码")]
public string Code { get; set; }
+ ///
+ /// 机构类型
+ ///
+ [Comment("机构类型")]
+ public int Type { get; set; }
+
///
/// 联系人
///
diff --git a/Api/Ewide.Core/Ewide.Core.xml b/Api/Ewide.Core/Ewide.Core.xml
index e7d4520..794dbb8 100644
--- a/Api/Ewide.Core/Ewide.Core.xml
+++ b/Api/Ewide.Core/Ewide.Core.xml
@@ -1338,6 +1338,11 @@
编码
+
+
+ 机构类型
+
+
联系人
@@ -5520,6 +5525,11 @@
编码
+
+
+ 机构类型
+
+
电话
diff --git a/Api/Ewide.Core/Extension/PageExtensions.cs b/Api/Ewide.Core/Extension/PageExtensions.cs
index 1fb8905..dd99564 100644
--- a/Api/Ewide.Core/Extension/PageExtensions.cs
+++ b/Api/Ewide.Core/Extension/PageExtensions.cs
@@ -22,7 +22,7 @@ namespace Ewide.Core.Extension
return orderStr;
}
- private static string OrderBuilder(PageInputBase pageInput, bool descSort = true)
+ private static string OrderBuilder(PageInputBase pageInput, bool descSort = false)
{
var type = typeof(T);
var hasId = type.GetProperty("Id") != null;
diff --git a/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs b/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs
index 0adc3af..ed9653a 100644
--- a/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs
+++ b/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs
@@ -99,7 +99,7 @@ namespace Ewide.Core.Service
{
var isExist = await _sysDictTypeRep.AnyAsync(u => u.Name == input.Name, false);
if (isExist) throw Oops.Oh(ErrorCode.D3001);
- var dictTypeEntity = _sysDictTypeRep.Where(s => s.Pid == input.Pid).FirstOrDefault();
+ var dictTypeEntity = _sysDictTypeRep.Where(s => s.Id == input.Pid).FirstOrDefault();
if (dictTypeEntity != null && dictTypeEntity.Code != null) throw new Exception("此类型下不能添加子类型");
var dictType = input.Adapt();
dictType.Pids = await CreateNewPids(input.Pid);
@@ -132,14 +132,14 @@ namespace Ewide.Core.Service
[HttpPost("/sysDictType/edit"),]
public async Task UpdateDictType(UpdateDictTypeInput input)
{
+ var isExist = await _sysDictTypeRep.AnyAsync(u => u.Id == input.Id, false);
+ if (!isExist) throw Oops.Oh(ErrorCode.D3000);
+
if (input.Id == input.Pid) throw Oops.Oh(ErrorCode.D4006);
- var result = _sysDictTypeRep.Where(u => u.Id == input.Id).Select(s => new { s.Name, s.Id, s.Code }).ToList().First();
- if (result == null) throw Oops.Oh(ErrorCode.D3000);
- if (result.Name == input.Name) throw Oops.Oh(ErrorCode.D3001);
- // 如果是编辑,父id不能为自己的子节点
- //var childIdList = await _sysDictTypeRep.DetachedEntities.Where(u => u.Pids.Contains(input.Id.ToString()))
- // .Select(u => u.Id).ToListAsync();
- //if (childIdList.Contains(input.Pid)) throw Oops.Oh(ErrorCode.D4006);
+
+ // 排除自己并且判断与其他是否相同
+ isExist = await _sysDictTypeRep.AnyAsync(u => (u.Name == input.Name || u.Code == input.Code) && u.Id != input.Id, false);
+ if (isExist) throw Oops.Oh(ErrorCode.D3001);
var dictType = input.Adapt();
dictType.Pids = await CreateNewPids(input.Pid);
diff --git a/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs b/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs
index 00d7b11..d58a595 100644
--- a/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs
+++ b/Api/Ewide.Core/Service/Org/Dto/OrgInput.cs
@@ -27,6 +27,11 @@ namespace Ewide.Core.Service
///
public virtual string Code { get; set; }
+ ///
+ /// 机构类型
+ ///
+ public virtual int Type { get; set; }
+
///
/// 电话
///
diff --git a/Web/src/pages/system/org/form.vue b/Web/src/pages/system/org/form.vue
index c018736..2a596cd 100644
--- a/Web/src/pages/system/org/form.vue
+++ b/Web/src/pages/system/org/form.vue
@@ -17,6 +17,15 @@
+
+
+ {{ item.value }}
+
+
{
+ this.codes.type = org_type.data;
+ /* ... */
+ });
+ },
onLoadOrgData() {
return this.$api.getOrgTree().then(({ data }) => {
this.orgData = [
diff --git a/Web/src/pages/system/org/index.vue b/Web/src/pages/system/org/index.vue
index e6238c9..88e6295 100644
--- a/Web/src/pages/system/org/index.vue
+++ b/Web/src/pages/system/org/index.vue
@@ -33,6 +33,9 @@
+
+ {{ bindCodeValue(text, 'type') }}
+
@@ -109,6 +112,12 @@ export default {
dataIndex: 'code',
sorter: true,
},
+ {
+ title: '机构类型',
+ dataIndex: 'type',
+ sorter: true,
+ scopedSlots: { customRender: 'type' },
+ },
{
title: '排序',
width: '80px',
@@ -123,15 +132,14 @@ export default {
],
/* 字典编码储存格式 */
- // codes: {
- // code1: [],
- // code2: [],
- // },
+ codes: {
+ type: [],
+ },
};
},
created() {
/** 按需加载字典编码 */
- //this.onLoadCodes();
+ this.onLoadCodes();
/** 根据权限添加操作列 */
const flag = this.$auth(/* ... */);
@@ -193,19 +201,17 @@ export default {
* 加载字典数据
* 如果不需要获取相应的字典数据,此方法内容可空
*/
- //onLoadCodes() {
- // this.$api
- // .$queue([
- // this.$api.sysDictTypeDropDownAwait({ code: 'code1' }),
- // this.$api.sysDictTypeDropDownAwait({ code: 'code2' }),
- // /* ... */
- // ])
- // .then(([code1, code2]) => {
- // this.codes.code1 = code1.data;
- // this.codes.code2 = code2.data;
- // /* ... */
- // });
- // },
+ onLoadCodes() {
+ this.$api
+ .$queue([
+ this.$api.sysDictTypeDropDownAwait({ code: 'org_type' }),
+ /* ... */
+ ])
+ .then(([org_type]) => {
+ this.codes.type = org_type.data;
+ /* ... */
+ });
+ },
/**
* 必要方法