Devexpress Report Designer
This commit is contained in:
parent
132887d2a9
commit
2dcf714ab4
7 changed files with 112 additions and 3 deletions
|
|
@ -20,6 +20,10 @@ COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/Erp.
|
|||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/Erp.SqlQueryManager.Domain.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/Erp.SqlQueryManager.Domain.Shared.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/Erp.SqlQueryManager.EntityFrameworkCore.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.Application.Contracts/Erp.Reports.Application.Contracts.csproj" "modules/Erp.Reports/Erp.Reports.Application.Contracts/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.Domain/Erp.Reports.Domain.csproj" "modules/Erp.Reports/Erp.Reports.Domain/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.Domain.Shared/Erp.Reports.Domain.Shared.csproj" "modules/Erp.Reports/Erp.Reports.Domain.Shared/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/Erp.Reports.EntityFrameworkCore.csproj" "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/"
|
||||
COPY "src/Erp.Platform.Application.Contracts/Erp.Platform.Application.Contracts.csproj" "src/Erp.Platform.Application.Contracts/"
|
||||
COPY "src/Erp.Platform.DbMigrator/Erp.Platform.DbMigrator.csproj" "src/Erp.Platform.DbMigrator/"
|
||||
COPY "src/Erp.Platform.Domain/Erp.Platform.Domain.csproj" "src/Erp.Platform.Domain/"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/Erp.
|
|||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/Erp.SqlQueryManager.Domain.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/Erp.SqlQueryManager.Domain.Shared.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/Erp.SqlQueryManager.EntityFrameworkCore.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.Application/Erp.Reports.Application.csproj" "modules/Erp.Reports/Erp.Reports.Application/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.Application.Contracts/Erp.Reports.Application.Contracts.csproj" "modules/Erp.Reports/Erp.Reports.Application.Contracts/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.Domain/Erp.Reports.Domain.csproj" "modules/Erp.Reports/Erp.Reports.Domain/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.Domain.Shared/Erp.Reports.Domain.Shared.csproj" "modules/Erp.Reports/Erp.Reports.Domain.Shared/"
|
||||
COPY "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/Erp.Reports.EntityFrameworkCore.csproj" "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/"
|
||||
COPY "src/Erp.Platform.Application/Erp.Platform.Application.csproj" "src/Erp.Platform.Application/"
|
||||
COPY "src/Erp.Platform.Application.Contracts/Erp.Platform.Application.Contracts.csproj" "src/Erp.Platform.Application.Contracts/"
|
||||
COPY "src/Erp.Platform.Domain/Erp.Platform.Domain.csproj" "src/Erp.Platform.Domain/"
|
||||
|
|
|
|||
|
|
@ -461,6 +461,13 @@
|
|||
"componentPath": "@/views/report/DevexpressReportViewer",
|
||||
"routeType": "protected",
|
||||
"authority": []
|
||||
},
|
||||
{
|
||||
"key": "admin.devexpressReportDesigner",
|
||||
"path": "/admin/reports/reportdesigner",
|
||||
"componentPath": "@/views/report/DevexpressReportDesigner",
|
||||
"routeType": "protected",
|
||||
"authority": []
|
||||
}
|
||||
],
|
||||
"Menus": [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
using DevExpress.AspNetCore.Reporting.ReportDesigner;
|
||||
using DevExpress.AspNetCore.Reporting.ReportDesigner.Native.Services;
|
||||
using DevExpress.DataAccess.Sql;
|
||||
using DevExpress.XtraReports.Web.ReportDesigner;
|
||||
using DevExpress.XtraReports.Web.ReportDesigner.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Erp.Platform.Controllers;
|
||||
|
||||
public class CustomReportDesignerController : ReportDesignerController
|
||||
{
|
||||
public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService)
|
||||
: base(controllerService)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpPost("[action]")]
|
||||
public IActionResult GetDesignerModel(
|
||||
[FromForm] string reportUrl,
|
||||
[FromServices] IReportDesignerModelBuilder designerModelBuilder,
|
||||
[FromForm] ReportDesignerSettingsBase designerModelSettings)
|
||||
{
|
||||
var ds = new SqlDataSource("SqlServer");
|
||||
|
||||
SelectQuery query = SelectQueryFluentBuilder
|
||||
.AddTable("Sas_T_Sector")
|
||||
.SelectAllColumnsFromTable()
|
||||
.Build("Sas_T_Sector");
|
||||
ds.Queries.Add(query);
|
||||
ds.RebuildResultSchema();
|
||||
|
||||
var designerModel = designerModelBuilder.Report(reportUrl)
|
||||
.DataSources(dataSources =>
|
||||
{
|
||||
dataSources.Add("SqlServer", ds);
|
||||
})
|
||||
.BuildModel();
|
||||
|
||||
designerModel.Assign(designerModelSettings);
|
||||
|
||||
return DesignerModel(designerModel);
|
||||
}
|
||||
}
|
||||
|
|
@ -280,7 +280,20 @@ public class PlatformHttpApiHostModule : AbpModule
|
|||
options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Erp Platform Api", Version = "v1" });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.DocInclusionPredicate((docName, description) =>
|
||||
{
|
||||
// DevExpress reporting controller'larını Swagger'dan hariç tut
|
||||
if (description.ActionDescriptor.RouteValues.TryGetValue("controller", out var controllerName))
|
||||
{
|
||||
if (controllerName == "CustomReportDesigner" ||
|
||||
controllerName == "CustomWebDocumentViewer" ||
|
||||
controllerName == "QueryBuilder")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
35
ui/src/views/report/DevexpressReportDesigner.tsx
Normal file
35
ui/src/views/report/DevexpressReportDesigner.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import React from 'react'
|
||||
import { Container } from '@/components/shared'
|
||||
import { Helmet } from 'react-helmet'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import ReportDesigner, { RequestOptions } from 'devexpress-reporting-react/dx-report-designer'
|
||||
import '@devexpress/analytics-core/dist/css/dx-analytics.common.css'
|
||||
import '@devexpress/analytics-core/dist/css/dx-analytics.light.css'
|
||||
import '@devexpress/analytics-core/dist/css/dx-querybuilder.css'
|
||||
import 'devexpress-reporting/dist/css/dx-webdocumentviewer.css'
|
||||
import 'devexpress-reporting/dist/css/dx-reportdesigner.css'
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
const DevexpressReportDesigner: React.FC = () => {
|
||||
const { translate } = useLocalization()
|
||||
const params = useParams()
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Helmet
|
||||
titleTemplate="%s | Erp Platform"
|
||||
title={translate('::' + 'App.Reports')}
|
||||
defaultTitle="Erp Platform"
|
||||
></Helmet>
|
||||
|
||||
<ReportDesigner reportUrl={params?.id ?? ''}>
|
||||
<RequestOptions
|
||||
host={import.meta.env.VITE_API_URL + '/'}
|
||||
getDesignerModelAction="DXXRD/GetDesignerModel"
|
||||
/>
|
||||
</ReportDesigner>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
export default DevexpressReportDesigner
|
||||
|
|
@ -7,9 +7,11 @@ import 'devextreme/dist/css/dx.light.css'
|
|||
import '@devexpress/analytics-core/dist/css/dx-analytics.common.css'
|
||||
import '@devexpress/analytics-core/dist/css/dx-analytics.light.css'
|
||||
import 'devexpress-reporting/dist/css/dx-webdocumentviewer.css'
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
const DevexpressReportViewer: React.FC = () => {
|
||||
const { translate } = useLocalization()
|
||||
const params = useParams()
|
||||
|
||||
return (
|
||||
<Container>
|
||||
|
|
@ -19,8 +21,8 @@ const DevexpressReportViewer: React.FC = () => {
|
|||
defaultTitle="Erp Platform"
|
||||
></Helmet>
|
||||
|
||||
<ReportViewer reportUrl="TestReport">
|
||||
<RequestOptions host="https://localhost:44344/" invokeAction="DXXRDV" />
|
||||
<ReportViewer reportUrl={params?.id ?? ''}>
|
||||
<RequestOptions host={import.meta.env.VITE_API_URL + '/'} invokeAction="DXXRDV" />
|
||||
</ReportViewer>
|
||||
</Container>
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue