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();
}
[HttpPost, Display(Name = "密码重置")]
public virtual IActionResult ResetPassword()
{
return null;
}
[HttpPost, Hidden]
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 Post? Post { get; set; }
[UIHint("select")]
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)]
public string? TenantId { get; set; }
[ScaffoldColumn(false)]
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)
{
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));
}
}
@ -184,7 +185,12 @@ public static class JsonSchemaExtensions
var actionContext = new ActionContext { HttpContext = serviceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext! };
var provider = 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);
rules.Add(new Dictionary<string, object> { { "required", true }, { "message", message } });
@ -234,7 +240,6 @@ public static class JsonSchemaExtensions
else if (attribute is RequiredAttribute)
{
rule.Add("required", true);
//message = string.Format(CultureInfo.InvariantCulture, localizer.GetString(nameof(RequiredAttribute)).Value, title);
}
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;
};
/*end*/
// if (props.schema.url && !props.schema.options) {
// props.schema.options = (await post(props.schema.url)).map((o) => ({ label: o.name, value: o }));
// }
return {
model,
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";
export default {
name: "formItem",
components: { AppFormInput },
template: html`
<template v-if="showItem()">
<template v-if="schema.type==='object'"></template>
<template v-else-if="schema.type==='array'"></template>
<template v-else>
<template v-if="schema.type!=='array'||(schema.items.type!=='object'&&schema.items.type!=='array')"> </template>
<el-form-item
:title="getProp(prop)"
:label="schema.title"
:prop="getProp(prop)"
: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;
Object.assign(editFormSchema, vm.schema);
Object.assign(editFormModel, vm.model);
editFormTitle.value = `${t("update")}${schema.title}`;
editFormTitle.value = `${t("create")}${schema.title}`;
dialogVisible.value = true;
} else if (item.path === "update") {
//update

Loading…
Cancel
Save