Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliang-wt committed Jul 28, 2023
2 parents a686856 + d95eeaf commit cffdd9b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 47 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## v6.x.x

##6.3.30(2023-7-28)
* **修改:** 修复创建默认数据库时,默认菜单Api方法的菜单显示为false
* **修改:** 修复了LayUI模式联动会覆盖初始绑定的数据的问题
* **修改:** 继承BaseApiController的控制器没有权限的时候会返回403错误

##6.3.29(2023-6-29)
* **修改:** 默认的Json序列化,数字类型仍然会被输出为字符串,这是因为很多前端控件都需要对比字符串
* **修改:** 修复了LayUI模式下导出之后搜索的问题
Expand Down Expand Up @@ -187,6 +192,12 @@

## v5.x.x

##5.10.30(2023-7-28)
* **修改:** 修复创建默认数据库时,默认菜单Api方法的菜单显示为false
* **修改:** 修复了LayUI模式联动会覆盖初始绑定的数据的问题
* **修改:** 继承BaseApiController的控制器没有权限的时候会返回403错误


##5.10.29(2023-6-29)
* **修改:** 默认的Json序列化,数字类型仍然会被输出为字符串,这是因为很多前端控件都需要对比字符串
* **修改:** 修复了LayUI模式下导出之后搜索的问题
Expand Down
1 change: 1 addition & 0 deletions src/WalkingTec.Mvvm.Core/DataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public async override Task<bool> DataInit(object allModules, bool IsSpa)
if (item != null)
{
item.ModuleName += "Api";
item.ShowOnMenu = false;
apifolder.Children.Add(item);

}
Expand Down
12 changes: 10 additions & 2 deletions src/WalkingTec.Mvvm.Mvc/Filters/PrivilegeFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ public override void OnActionExecuting(ActionExecutingContext context)
{
context.Result = ctrl.Forbid(JwtBearerDefaults.AuthenticationScheme);
}
else if(controller is BaseApiController bac)
{
context.Result = bac.Forbid();
}
else
{
ContentResult cr = new ContentResult()
Expand Down Expand Up @@ -234,8 +238,12 @@ public override void OnActionExecuting(ActionExecutingContext context)
{
context.Result = ctrl.Forbid(JwtBearerDefaults.AuthenticationScheme);
}
else
{
else if (controller is BaseApiController bac)
{
context.Result = bac.Forbid();
}
else
{
ContentResult cr = new ContentResult()
{
Content = MvcProgram._localizer["Sys.NoPrivilege"],
Expand Down
66 changes: 46 additions & 20 deletions src/WalkingTec.Mvvm.Mvc/framework_layui.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,28 +678,52 @@ window.ff = {
if (usedefaultvalue == true) {
df = eval(comboid + "defaultvalues");
}
window[comboid].update({ data: ff.getComboItems(data.Data,df) });
window[comboid].update({ data: ff.getComboItems(data.Data, df, usedefaultvalue) });
}
if (controltype === "checkbox") {
for (i = 0; i < data.Data.length; i++) {
item = data.Data[i];
if (item.Selected === true) {
target.append("<input type='checkbox' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' checked />");
}
if (usedefaultvalue == true) {
var df = [];
df = eval(comboid + "defaultvalues");
if (df.indexOf(item.Value) > -1) {
target.append("<input type='checkbox' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' checked />");
}
else {
target.append("<input type='checkbox' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' />");
}
}
else {
target.append("<input type='checkbox' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' />");
if (item.Selected === true) {
target.append("<input type='checkbox' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' checked />");
}
else {
target.append("<input type='checkbox' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' />");
}
}
}
form.render('checkbox', targetfilter);
}
if (controltype === "radio") {
for (i = 0; i < data.Data.length; i++) {
item = data.Data[i];
if (item.Selected === true) {
target.append("<input type='radio' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' checked />");
}
if (usedefaultvalue == true) {
var df = [];
df = eval(comboid + "defaultvalues");
if (df.indexOf(item.Value) > -1) {
target.append("<input type='radio' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' checked />");
}
else {
target.append("<input type='radio' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' />");
}
}
else {
target.append("<input type='radio' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' />");
if (item.Selected === true) {
target.append("<input type='radio' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' checked />");
}
else {
target.append("<input type='radio' name = '" + targetname + "' value = '" + item.Value + "' title = '" + item.Text + "' />");
}
}
}
form.render('radio', targetfilter);
Expand Down Expand Up @@ -1224,22 +1248,24 @@ window.ff = {
return rv;
},

getComboItems: function (data, svals) {
getComboItems: function (data, svals, useDefaultvalue) {
var rv = [];
if (svals == undefined || svals == null) {
svals = [];
}
for (var i = 0; i < data.length; i++) {
var item = {};
item.value = data[i].Value;
item.name = data[i].Text;
item.disabled = data[i].Disabled;
item.selected = data[i].Selected || svals.indexOf(data[i].Value) > -1;
item.icon = data[i].Icon;
if (data[i].Children != null && data[i].Children.length > 0) {
item.children = this.getTreeItems(data[i].Children, svals);
if (data != null) {
for (var i = 0; i < data.length; i++) {
var item = {};
item.value = data[i].Value;
item.name = data[i].Text;
item.disabled = data[i].Disabled;
item.selected = useDefaultvalue == true ? svals.indexOf(data[i].Value) > -1 : data[i].Selected;
item.icon = data[i].Icon;
if (data[i].Children != null && data[i].Children.length > 0) {
item.children = this.getTreeItems(data[i].Children, svals);
}
rv.push(item);
}
rv.push(item);
}
return rv;
},
Expand Down
30 changes: 6 additions & 24 deletions src/WalkingTec.Mvvm.TagHelpers.LayUI/Form/CheckBoxTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,6 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
});
}
}
try
{
List<string> checkvalue = null;
//如果是Entity.xxList[0].xxxid的格式,使用GetPropertySiblingValues方法获取Entity.xxxList.Select(x=>x.xxxid).ToList()的结果
if (Field.Name.Contains("["))
{
//默认多对多不必填
if (Required == null)
{
Required = false;
}
}
else if (Field.Model is IList == false && Field.Model != null)
{
checkvalue = new List<string> { Field.Model.ToString() };
}
else
{
}
}
catch
{
}
}
SetSelected(listItems, values);
}
Expand All @@ -181,7 +158,12 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
output.PostContent.AppendHtml($@"
<input type=""checkbox"" name=""{Field.Name}"" value=""{item.Value}"" title=""{item.Text}"" {selected} {(Disabled ? "disabled=\"\"" : string.Empty)}/>");
}
output.PostElement.AppendHtml($@"<input type=""hidden"" name=""_DONOTUSE_{Field.Name}"" value=""1"" />");
output.PostElement.AppendHtml($@"
<input type=""hidden"" name=""_DONOTUSE_{Field.Name}"" value=""1"" />
<script>
{Id}defaultvalues = {JsonSerializer.Serialize(values)};
</script>
");
base.Process(context, output);

}
Expand Down
6 changes: 5 additions & 1 deletion src/WalkingTec.Mvvm.TagHelpers.LayUI/Form/RadioTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
var item = listItems[i];
var selected = item.Selected ? " checked" : " ";
output.PostContent.AppendHtml($@"
<input type=""radio"" name=""{Field.Name}"" value=""{item.Value}"" title=""{item.Text}"" {selected} />");
<input type=""radio"" name=""{Field.Name}"" value=""{item.Value}"" title=""{item.Text}"" {selected} />
<script>
{Id}defaultvalues = {JsonSerializer.Serialize(values)};
</script>
");
}

base.Process(context, output);
Expand Down

0 comments on commit cffdd9b

Please sign in to comment.