diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs index f2d878d35..39703c081 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Datas/ValueType.cs @@ -7,7 +7,7 @@ Boolean = 2, Date = 3, DateTime = 4, - Array = 5 - + Array = 5, + Object = 6 } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs index 7730c8656..0ec149f99 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItem.cs @@ -78,6 +78,9 @@ namespace LINGYUN.Platform.Datas case ValueType.Numeic: DefaultValue = "0"; break; + case ValueType.Object: + DefaultValue = "{}"; + break; default: case ValueType.String: DefaultValue = ""; diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs index 64749afe3..c7d80cbee 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using Volo.Abp; @@ -90,6 +91,15 @@ namespace LINGYUN.Platform.Datas } return value.ToString(); }); + SetMapping(ValueType.Object, value => + { + if (value == null) + { + return "{}"; + } + + return JsonConvert.SerializeObject(value); + }); } public void SetMapping(ValueType valueType, Func func) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs index 46d257581..53a44e2e8 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs @@ -19,6 +19,16 @@ namespace LINGYUN.Platform.EntityFrameworkCore return queryable; } + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) + { + if (!include) + { + return queryable; + } + + return queryable; + } + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) { if (!include) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs index f934545e5..50186cbb2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -234,5 +234,10 @@ namespace LINGYUN.Platform.Menus DbContext.Set().RemoveRange(membersQuery); } + + public override IQueryable WithDetails() + { + return GetQueryable().IncludeDetails(); + } } } diff --git a/vueJs/src/api/data-dictionary.ts b/vueJs/src/api/data-dictionary.ts index de6fb6b2a..45134ce7f 100644 --- a/vueJs/src/api/data-dictionary.ts +++ b/vueJs/src/api/data-dictionary.ts @@ -59,7 +59,8 @@ export enum ValueType { Boolean = 2, Date = 3, DateTime = 4, - Array = 5 + Array = 5, + Object = 6 } export class DataItem { diff --git a/vueJs/src/components/InputObject/index.vue b/vueJs/src/components/InputObject/index.vue new file mode 100644 index 000000000..e458fcecb --- /dev/null +++ b/vueJs/src/components/InputObject/index.vue @@ -0,0 +1,102 @@ + + + diff --git a/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue b/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue index 0044e7622..eaffcbde8 100644 --- a/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue +++ b/vueJs/src/views/admin/data-dictionary/components/CreateOrUpdateDataItemDialog.vue @@ -26,6 +26,7 @@ > + {{ $t('AppPlatform.Data:AddNew') }} @@ -99,7 +99,7 @@ export default class DataDictionaryTree extends Vue { icon: 'el-icon-edit', disabled: !checkPermission(['Platform.DataDictionary.Update']), onClick: () => { - this.handleEditData(data) + this.handleEditData(data.id) } }, { @@ -107,7 +107,7 @@ export default class DataDictionaryTree extends Vue { icon: 'ivu-icon ivu-icon-md-add', disabled: !checkPermission(['Platform.DataDictionary.Create']), onClick: () => { - this.handleEditData() + this.handleEditData('') } }, { @@ -152,11 +152,11 @@ export default class DataDictionaryTree extends Vue { } } - private handleEditData(data?: Data) { + private handleEditData(dataId: string) { this.editDataTitle = this.l('AppPlatform.Data:AddNew') this.isEditData = false - if (data) { - this.editDataId = data.id + if (dataId) { + this.editDataId = dataId this.isEditData = true this.editDataTitle = this.l('AppPlatform.Data:Edit') } else { diff --git a/vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue b/vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue index 591da5647..f08298083 100644 --- a/vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue +++ b/vueJs/src/views/admin/data-dictionary/components/DataItemTable.vue @@ -141,6 +141,8 @@ import CreateOrUpdateDataItemDialog from './CreateOrUpdateDataItemDialog.vue' return 'DateTime' case ValueType.Array: return 'Array' + case ValueType.Object: + return 'Object' default: case ValueType.String: return 'String' diff --git a/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue b/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue index 3aa84600b..c21fa4580 100644 --- a/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue +++ b/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue @@ -126,7 +126,7 @@ :label="$t(('AppPlatform.DisplayName:Meta'))" > - {{ dataItem.displayName }} + >{{ dataItem.displayName }} --> { + return pre.valueType < next.valueType ? -1 : 0 + }) + return items + } + private activedTab = 'basic' private menu = new Menu() private bindData = new Data() @@ -282,6 +289,9 @@ export default class CreateOrUpdateMenuDialog extends Vue { private onLayoutChanged() { const layout = this.layouts.find(x => x.id === this.layoutId) if (layout) { + if (!this.isEdit) { + this.menu.meta = {} + } if (!this.parentId) { // 对于根菜单,自动设置组件路径为布局路径 this.menu.component = layout.path diff --git a/vueJs/src/views/container/menus/components/MenuMetaInput.vue b/vueJs/src/views/container/menus/components/MenuMetaInput.vue index e11f31720..bf79918c0 100644 --- a/vueJs/src/views/container/menus/components/MenuMetaInput.vue +++ b/vueJs/src/views/container/menus/components/MenuMetaInput.vue @@ -32,6 +32,11 @@ :value="inputArrayValue(value)" @input="onInputMetaChanged" /> + @@ -40,12 +45,14 @@ import { Component, Vue, Prop } from 'vue-property-decorator' import { DataItem } from '@/api/data-dictionary' import { isBoolean } from 'lodash' import ElInputTag from '@/components/InputTag/index.vue' +import InputObject from '@/components/InputObject/index.vue' import { isArray } from '@/utils/validate' @Component({ name: 'MenuMetaInput', components: { - ElInputTag + ElInputTag, + InputObject } }) export default class MenuMetaInput extends Vue { @@ -87,6 +94,16 @@ export default class MenuMetaInput extends Vue { this.value = String(value).split(',') } + get inputObjectValue() { + if (typeof this.value === 'object') { + return this.value + } + if (typeof this.value === 'string') { + return JSON.parse(this.value) + } + return JSON.parse(String(this.value)) + } + onInputMetaChanged(value: any) { this.$emit('input', value) }