Browse Source

update

pull/1/head
wanggang 1 year ago
parent
commit
5b48cb28d1
  1. 6
      docs/demo/src/WTA.Application/Identity/Controllers/UserController.cs
  2. 1
      docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/User.cs
  3. 1
      docs/demo/src/WTA.Shared/Domain/BaseEntity.cs
  4. 11
      docs/demo/src/WTA.Shared/Extensions/JsonSchemaExtensions.cs
  5. 3
      docs/demo/src/WTA/wwwroot/components/form/form-input.js
  6. 5
      docs/demo/src/WTA/wwwroot/components/form/form-item.js
  7. 2
      docs/demo/src/WTA/wwwroot/components/list/index.js

6
docs/demo/src/WTA.Application/Identity/Controllers/UserController.cs

@ -19,6 +19,12 @@ public class UserController : GenericController<User, User, User, User, User, Us
this.Repository.DisableTenantFilter(); this.Repository.DisableTenantFilter();
} }
[HttpPost, Display(Name = "密码重置")]
public virtual IActionResult ResetPassword()
{
return null;
}
[HttpPost, Hidden] [HttpPost, Hidden]
public AuthenticateResult Authenticate(string name, string operation) public AuthenticateResult Authenticate(string name, string operation)
{ {

1
docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/User.cs

@ -32,5 +32,6 @@ public class User : BaseEntity
public Department? Department { get; set; } public Department? Department { get; set; }
public Post? Post { get; set; } public Post? Post { get; set; }
[UIHint("select")]
public List<UserRole> UserRoles { get; set; } = new List<UserRole>(); public List<UserRole> UserRoles { get; set; } = new List<UserRole>();
} }

1
docs/demo/src/WTA.Shared/Domain/BaseEntity.cs

@ -59,5 +59,6 @@ public abstract class BaseEntity : IResource, IBaseEntity, ISoftDeleteEntity, IA
[ScaffoldColumn(false)] [ScaffoldColumn(false)]
public string? TenantId { get; set; } public string? TenantId { get; set; }
[ScaffoldColumn(false)]
public Dictionary<string, string> Properties { get; set; } = new Dictionary<string, string>(); public Dictionary<string, string> Properties { get; set; } = new Dictionary<string, string>();
} }

11
docs/demo/src/WTA.Shared/Extensions/JsonSchemaExtensions.cs

@ -66,7 +66,8 @@ public static class JsonSchemaExtensions
if (modelType != meta.ElementMetadata!.ModelType.UnderlyingSystemType) if (modelType != meta.ElementMetadata!.ModelType.UnderlyingSystemType)
{ {
schema.Add("type", "array"); schema.Add("type", "array");
//schema.Add("items", meta.ElementMetadata!.ModelType.GetMetadataForType(serviceProvider)); schema.TryAdd("multiple", true);
schema.TryAdd("url", "url");
schema.Add("items", meta.ElementMetadata.GetSchema(serviceProvider, meta)); schema.Add("items", meta.ElementMetadata.GetSchema(serviceProvider, meta));
} }
} }
@ -184,7 +185,12 @@ public static class JsonSchemaExtensions
var actionContext = new ActionContext { HttpContext = serviceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext! }; var actionContext = new ActionContext { HttpContext = serviceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext! };
var provider = new EmptyModelMetadataProvider(); var provider = new EmptyModelMetadataProvider();
var modelValidationContextBase = new ModelValidationContextBase(actionContext, meta, new EmptyModelMetadataProvider()); var modelValidationContextBase = new ModelValidationContextBase(actionContext, meta, new EmptyModelMetadataProvider());
if (pm.IsRequired && !pm.IsNullableValueType && !pm.UnderlyingOrModelType.IsValueType && !pm.Attributes.Attributes.Any(o => o.GetType() == typeof(RequiredAttribute))) if (pm.IsRequired &&
!pm.IsNullableValueType &&
!pm.UnderlyingOrModelType.IsValueType &&
!pm.IsEnumerableType &&
!pm.Attributes.Attributes.Any(o => o.GetType() == typeof(RequiredAttribute))
)
{ {
var message = string.Format(CultureInfo.InvariantCulture, localizer.GetString(nameof(RequiredAttribute)).Value, title); var message = string.Format(CultureInfo.InvariantCulture, localizer.GetString(nameof(RequiredAttribute)).Value, title);
rules.Add(new Dictionary<string, object> { { "required", true }, { "message", message } }); rules.Add(new Dictionary<string, object> { { "required", true }, { "message", message } });
@ -234,7 +240,6 @@ public static class JsonSchemaExtensions
else if (attribute is RequiredAttribute) else if (attribute is RequiredAttribute)
{ {
rule.Add("required", true); rule.Add("required", true);
//message = string.Format(CultureInfo.InvariantCulture, localizer.GetString(nameof(RequiredAttribute)).Value, title);
} }
else if (attribute is CompareAttribute compare)//?? else if (attribute is CompareAttribute compare)//??
{ {

3
docs/demo/src/WTA/wwwroot/components/form/form-input.js

@ -83,6 +83,9 @@ export default {
return schema.input ?? schema.type; return schema.input ?? schema.type;
}; };
/*end*/ /*end*/
// if (props.schema.url && !props.schema.options) {
// props.schema.options = (await post(props.schema.url)).map((o) => ({ label: o.name, value: o }));
// }
return { return {
model, model,
getDisabled, getDisabled,

5
docs/demo/src/WTA/wwwroot/components/form/form-item.js

@ -3,13 +3,14 @@ import { ref, reactive, watch } from "vue";
import AppFormInput from "./form-input.js"; import AppFormInput from "./form-input.js";
export default { export default {
name: "formItem",
components: { AppFormInput }, components: { AppFormInput },
template: html` template: html`
<template v-if="showItem()"> <template v-if="showItem()">
<template v-if="schema.type==='object'"></template> <template v-if="schema.type==='object'"></template>
<template v-else-if="schema.type==='array'"></template> <template v-if="schema.type!=='array'||(schema.items.type!=='object'&&schema.items.type!=='array')"> </template>
<template v-else>
<el-form-item <el-form-item
:title="getProp(prop)"
:label="schema.title" :label="schema.title"
:prop="getProp(prop)" :prop="getProp(prop)"
:rules="getRules(parentSchema,schema,model)" :rules="getRules(parentSchema,schema,model)"

2
docs/demo/src/WTA/wwwroot/components/list/index.js

@ -295,7 +295,7 @@ export default {
const vm = (await get(url)).data; const vm = (await get(url)).data;
Object.assign(editFormSchema, vm.schema); Object.assign(editFormSchema, vm.schema);
Object.assign(editFormModel, vm.model); Object.assign(editFormModel, vm.model);
editFormTitle.value = `${t("update")}${schema.title}`; editFormTitle.value = `${t("create")}${schema.title}`;
dialogVisible.value = true; dialogVisible.value = true;
} else if (item.path === "update") { } else if (item.path === "update") {
//update //update

Loading…
Cancel
Save