update 新增机构类型
This commit is contained in:
@@ -37,6 +37,12 @@ namespace Ewide.Core
|
|||||||
[Comment("编码")]
|
[Comment("编码")]
|
||||||
public string Code { get; set; }
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机构类型
|
||||||
|
/// </summary>
|
||||||
|
[Comment("机构类型")]
|
||||||
|
public int Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 联系人
|
/// 联系人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1338,6 +1338,11 @@
|
|||||||
编码
|
编码
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:Ewide.Core.SysOrg.Type">
|
||||||
|
<summary>
|
||||||
|
机构类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:Ewide.Core.SysOrg.Contacts">
|
<member name="P:Ewide.Core.SysOrg.Contacts">
|
||||||
<summary>
|
<summary>
|
||||||
联系人
|
联系人
|
||||||
@@ -5520,6 +5525,11 @@
|
|||||||
编码
|
编码
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:Ewide.Core.Service.OrgInput.Type">
|
||||||
|
<summary>
|
||||||
|
机构类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:Ewide.Core.Service.OrgInput.Tel">
|
<member name="P:Ewide.Core.Service.OrgInput.Tel">
|
||||||
<summary>
|
<summary>
|
||||||
电话
|
电话
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Ewide.Core.Extension
|
|||||||
return orderStr;
|
return orderStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string OrderBuilder<T>(PageInputBase pageInput, bool descSort = true)
|
private static string OrderBuilder<T>(PageInputBase pageInput, bool descSort = false)
|
||||||
{
|
{
|
||||||
var type = typeof(T);
|
var type = typeof(T);
|
||||||
var hasId = type.GetProperty("Id") != null;
|
var hasId = type.GetProperty("Id") != null;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace Ewide.Core.Service
|
|||||||
{
|
{
|
||||||
var isExist = await _sysDictTypeRep.AnyAsync(u => u.Name == input.Name, false);
|
var isExist = await _sysDictTypeRep.AnyAsync(u => u.Name == input.Name, false);
|
||||||
if (isExist) throw Oops.Oh(ErrorCode.D3001);
|
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("此类型下不能添加子类型");
|
if (dictTypeEntity != null && dictTypeEntity.Code != null) throw new Exception("此类型下不能添加子类型");
|
||||||
var dictType = input.Adapt<SysDictType>();
|
var dictType = input.Adapt<SysDictType>();
|
||||||
dictType.Pids = await CreateNewPids(input.Pid);
|
dictType.Pids = await CreateNewPids(input.Pid);
|
||||||
@@ -132,14 +132,14 @@ namespace Ewide.Core.Service
|
|||||||
[HttpPost("/sysDictType/edit"),]
|
[HttpPost("/sysDictType/edit"),]
|
||||||
public async Task UpdateDictType(UpdateDictTypeInput input)
|
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);
|
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);
|
isExist = await _sysDictTypeRep.AnyAsync(u => (u.Name == input.Name || u.Code == input.Code) && u.Id != input.Id, false);
|
||||||
// 如果是编辑,父id不能为自己的子节点
|
if (isExist) throw Oops.Oh(ErrorCode.D3001);
|
||||||
//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);
|
|
||||||
|
|
||||||
var dictType = input.Adapt<SysDictType>();
|
var dictType = input.Adapt<SysDictType>();
|
||||||
dictType.Pids = await CreateNewPids(input.Pid);
|
dictType.Pids = await CreateNewPids(input.Pid);
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ namespace Ewide.Core.Service
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string Code { get; set; }
|
public virtual string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机构类型
|
||||||
|
/// </summary>
|
||||||
|
public virtual int Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 电话
|
/// 电话
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -17,6 +17,15 @@
|
|||||||
<a-form-model-item label="唯一编码" prop="code">
|
<a-form-model-item label="唯一编码" prop="code">
|
||||||
<a-input placeholder="请输入唯一编码" v-model="form.code" />
|
<a-input placeholder="请输入唯一编码" v-model="form.code" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
|
<a-form-model-item label="机构类型" prop="type">
|
||||||
|
<a-select placeholder="请选择机构类型" v-model="form.type">
|
||||||
|
<a-select-option
|
||||||
|
:key="item.code"
|
||||||
|
:value="+item.code"
|
||||||
|
v-for="item in codes.type"
|
||||||
|
>{{ item.value }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-model-item>
|
||||||
<a-form-model-item label="上级机构" prop="pid">
|
<a-form-model-item label="上级机构" prop="pid">
|
||||||
<a-tree-select
|
<a-tree-select
|
||||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||||
@@ -68,8 +77,9 @@ export default {
|
|||||||
form: {},
|
form: {},
|
||||||
/** 验证格式 */
|
/** 验证格式 */
|
||||||
rules: {
|
rules: {
|
||||||
name: [{ required: true, message: '请输入机构名称' }],
|
name: [{ required: true, message: '请输入机构名称', trigger: 'blur' }],
|
||||||
code: [{ required: true, message: '请输入唯一编码' }],
|
code: [{ required: true, message: '请输入唯一编码', trigger: 'blur' }],
|
||||||
|
type: [{ required: true, message: '请选择机构类型' }],
|
||||||
pid: [{ required: true, message: '请选择上级机构' }],
|
pid: [{ required: true, message: '请选择上级机构' }],
|
||||||
areaCode: [{ required: true, message: '请选择所属区域' }],
|
areaCode: [{ required: true, message: '请选择所属区域' }],
|
||||||
/* ... */
|
/* ... */
|
||||||
@@ -77,6 +87,11 @@ export default {
|
|||||||
|
|
||||||
/** 加载异步数据状态 */
|
/** 加载异步数据状态 */
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
|
codes: {
|
||||||
|
type: [],
|
||||||
|
},
|
||||||
|
|
||||||
orgData: [],
|
orgData: [],
|
||||||
areaData: [],
|
areaData: [],
|
||||||
/** 其他成员属性 */
|
/** 其他成员属性 */
|
||||||
@@ -176,6 +191,7 @@ export default {
|
|||||||
async onInit(params) {
|
async onInit(params) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
/** 可以在这里await获取一些异步数据 */
|
/** 可以在这里await获取一些异步数据 */
|
||||||
|
await this.onLoadCodes();
|
||||||
await this.onLoadOrgData();
|
await this.onLoadOrgData();
|
||||||
await this.onLoadAreaData();
|
await this.onLoadAreaData();
|
||||||
/* ... */
|
/* ... */
|
||||||
@@ -184,6 +200,17 @@ export default {
|
|||||||
|
|
||||||
/** 当前组件的其他方法 */
|
/** 当前组件的其他方法 */
|
||||||
/* ... */
|
/* ... */
|
||||||
|
onLoadCodes() {
|
||||||
|
this.$api
|
||||||
|
.$queue([
|
||||||
|
this.$api.sysDictTypeDropDownAwait({ code: 'org_type' }),
|
||||||
|
/* ... */
|
||||||
|
])
|
||||||
|
.then(([org_type]) => {
|
||||||
|
this.codes.type = org_type.data;
|
||||||
|
/* ... */
|
||||||
|
});
|
||||||
|
},
|
||||||
onLoadOrgData() {
|
onLoadOrgData() {
|
||||||
return this.$api.getOrgTree().then(({ data }) => {
|
return this.$api.getOrgTree().then(({ data }) => {
|
||||||
this.orgData = [
|
this.orgData = [
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
</Auth>
|
</Auth>
|
||||||
<!-- 格式化字段内容 -->
|
<!-- 格式化字段内容 -->
|
||||||
<!-- ... -->
|
<!-- ... -->
|
||||||
|
<template slot="type" slot-scope="text">
|
||||||
|
<span>{{ bindCodeValue(text, 'type') }}</span>
|
||||||
|
</template>
|
||||||
<!-- 添加操作控件 -->
|
<!-- 添加操作控件 -->
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<yo-table-actions>
|
<yo-table-actions>
|
||||||
@@ -109,6 +112,12 @@ export default {
|
|||||||
dataIndex: 'code',
|
dataIndex: 'code',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '机构类型',
|
||||||
|
dataIndex: 'type',
|
||||||
|
sorter: true,
|
||||||
|
scopedSlots: { customRender: 'type' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '排序',
|
title: '排序',
|
||||||
width: '80px',
|
width: '80px',
|
||||||
@@ -123,15 +132,14 @@ export default {
|
|||||||
],
|
],
|
||||||
|
|
||||||
/* 字典编码储存格式 */
|
/* 字典编码储存格式 */
|
||||||
// codes: {
|
codes: {
|
||||||
// code1: [],
|
type: [],
|
||||||
// code2: [],
|
},
|
||||||
// },
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
/** 按需加载字典编码 */
|
/** 按需加载字典编码 */
|
||||||
//this.onLoadCodes();
|
this.onLoadCodes();
|
||||||
|
|
||||||
/** 根据权限添加操作列 */
|
/** 根据权限添加操作列 */
|
||||||
const flag = this.$auth(/* ... */);
|
const flag = this.$auth(/* ... */);
|
||||||
@@ -193,19 +201,17 @@ export default {
|
|||||||
* 加载字典数据
|
* 加载字典数据
|
||||||
* 如果不需要获取相应的字典数据,此方法内容可空
|
* 如果不需要获取相应的字典数据,此方法内容可空
|
||||||
*/
|
*/
|
||||||
//onLoadCodes() {
|
onLoadCodes() {
|
||||||
// this.$api
|
this.$api
|
||||||
// .$queue([
|
.$queue([
|
||||||
// this.$api.sysDictTypeDropDownAwait({ code: 'code1' }),
|
this.$api.sysDictTypeDropDownAwait({ code: 'org_type' }),
|
||||||
// this.$api.sysDictTypeDropDownAwait({ code: 'code2' }),
|
/* ... */
|
||||||
// /* ... */
|
])
|
||||||
// ])
|
.then(([org_type]) => {
|
||||||
// .then(([code1, code2]) => {
|
this.codes.type = org_type.data;
|
||||||
// this.codes.code1 = code1.data;
|
/* ... */
|
||||||
// this.codes.code2 = code2.data;
|
});
|
||||||
// /* ... */
|
},
|
||||||
// });
|
|
||||||
// },
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 必要方法
|
* 必要方法
|
||||||
|
|||||||
Reference in New Issue
Block a user