添加项目文件。

This commit is contained in:
zgf committed 2023-07-25 19:20:18 +08:00
1 parent 05e131ca4e
commit 514d6f5255
1162 files changed
+81255

No files matched your search

@@ -0,0 +1,24 @@
using HHWMS.Web.Models;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web
{
public partial class ReportDesignBatchVM : BaseBatchVM<ReportDesign, ReportDesign_BatchEdit>
{
public ReportDesignBatchVM()
{
ListVM = new ReportDesignListVM();
LinkedVM = new ReportDesign_BatchEdit();
}
}
/// <summary>
/// Class to define batch edit fields
/// </summary>
public class ReportDesign_BatchEdit : BaseVM
{
protected override void InitVM()
{
}
}
}
@@ -0,0 +1,29 @@
using System.ComponentModel.DataAnnotations;
using HHWMS.Web.Models;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web
{
public partial class ReportDesignTemplateVM : BaseTemplateVM
{
[Display(Name = "ReportDesign.Name")]
public ExcelPropety Name_Excel = ExcelPropety.CreateProperty<ReportDesign>(x => x.Name);
[Display(Name = "ReportDesign.Sql")]
public ExcelPropety Sql_Excel = ExcelPropety.CreateProperty<ReportDesign>(x => x.Sql);
[Display(Name = "ReportDesign.Params")]
public ExcelPropety Params_Excel = ExcelPropety.CreateProperty<ReportDesign>(x => x.Params);
[Display(Name = "_Admin.Remark")]
public ExcelPropety Remark_Excel = ExcelPropety.CreateProperty<ReportDesign>(x => x.Remark);
protected override void InitVM()
{
}
}
public class ReportDesignImportVM : BaseImportVM<ReportDesignTemplateVM, ReportDesign>
{
}
}
@@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.Linq;
using HHWMS.Web.Models;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
namespace HHWMS.Web
{
public partial class ReportDesignListVM : BasePagedListVM<ReportDesign_View, ReportDesignSearcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"report", dialogWidth: 800),
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "report", dialogWidth: 800),
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "report", dialogWidth: 800),
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "report", dialogWidth: 800),
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "report", dialogWidth: 800),
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "report", dialogWidth: 800),
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "report", dialogWidth: 800),
this.MakeStandardAction("ReportDesign", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "report"),
};
}
protected override IEnumerable<IGridColumn<ReportDesign_View>> InitGridHeader()
{
return new List<GridColumn<ReportDesign_View>>{
this.MakeGridHeader(x => x.Name),
this.MakeGridHeader(x => x.Sql),
this.MakeGridHeader(x => x.Params),
this.MakeGridHeader(x => x.Remark),
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<ReportDesign_View> GetSearchQuery()
{
var query = DC.Set<ReportDesign>()
.CheckContain(Searcher.Name, x => x.Name)
.CheckContain(Searcher.Remark, x => x.Remark)
.Select(x => new ReportDesign_View
{
ID = x.ID,
Name = x.Name,
Sql = x.Sql,
Params = x.Params,
Remark = x.Remark,
})
.OrderBy(x => x.ID);
return query;
}
}
public class ReportDesign_View : ReportDesign
{
}
}
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
namespace HHWMS.Web
{
public partial class ReportDesignSearcher : BaseSearcher
{
[Display(Name = "ReportDesign.Name")]
public String Name { get; set; }
[Display(Name = "_Admin.Remark")]
public String Remark { get; set; }
protected override void InitVM()
{
}
}
}
@@ -0,0 +1,92 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using HHWMS.Web;
using HHWMS.Web.Models;
using Newtonsoft.Json.Linq;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
namespace HHWMS.Web
{
public partial class ReportDesignVM : BaseCRUDVM<ReportDesign>
{
private IUnitWork _unitWork { get; set; }
public List<ComboSelectListItem> ReportNames { get; set; }
public ReportDesignVM()
{
}
protected override void InitVM()
{
_unitWork = new UnitWork(Wtm);
ReportNames = _unitWork.Find<ReportDesign>(x => true).Select(x => new ComboSelectListItem
{
Text = x.Name,
Value = x.Name
}).ToList();
}
public override void DoAdd()
{
base.DoAdd();
}
public override void DoEdit(bool updateAllFields = false)
{
base.DoEdit(updateAllFields);
}
public override void DoDelete()
{
base.DoDelete();
}
public ResponseResult<dynamic> QueryData(string reportName, string filter)
{
var report = _unitWork.FindSingle<ReportDesign>(x => x.Name == reportName);
var sql = report.Sql;
var sFilter = report.Params;
// 组装查询条件
if (!string.IsNullOrEmpty(sFilter))
{
if (string.IsNullOrEmpty(filter))
{
return ResponseResult<dynamic>.Error("请填写查询条件!");
}
JObject json = JObject.Parse(filter.Replace("&quot;", "\""));
JObject jsonDefault = JObject.Parse(sFilter);
foreach (var item in jsonDefault)
{
if (!json.ContainsKey(item.Key))
{
return ResponseResult<dynamic>.Error("查询条件不正确!");
}
}
foreach (var item in json)
{
sql = sql.Replace(item.Key, item.Value.ToString());
}
}
var data = DC.RunSQL(sql);
// result 为返回到前端的值 result[0]为表头、 result[1]为值
var result = new List<dynamic>();
var colList = new List<dynamic>();
foreach (DataColumn item in data.Columns)
{
// 组装表头
colList.Add(new { field = item.ColumnName, title = item.ColumnName });
}
result.Add(colList);
// 添加列表
result.Add(data.Rows[0].Table);
return ResponseResult<dynamic>.Success(result);
}
}
}