diff --git a/package-lock.json b/package-lock.json index d96e036..0c066a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13565,6 +13565,11 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz", "integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==" }, + "react-moment": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/react-moment/-/react-moment-0.9.6.tgz", + "integrity": "sha512-GAnd5NRIpGjDqLoGahJCkiCEQS1d8+dIZbIfPuy/eQ0O5Rio43fEkj5G+qrKbZCQY55fiNafpHpuirVIHqPoSg==" + }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", diff --git a/package.json b/package.json index f170eed..403c9ee 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,11 @@ "@types/webpack-env": "1.13.1", "chart.js": "^2.9.2", "chartjs-plugin-datalabels": "^0.7.0", + "moment": "^2.24.0", "react": "15.6.2", "react-chartjs-2": "^2.8.0", - "react-dom": "15.6.2" + "react-dom": "15.6.2", + "react-moment": "^0.9.6" }, "resolutions": { "@types/react": "15.6.6" diff --git a/src/webparts/summaryWebPart/components/Structure/Structure.tsx b/src/webparts/summaryWebPart/components/Structure/Structure.tsx index 5588e4b..2e4e0e7 100644 --- a/src/webparts/summaryWebPart/components/Structure/Structure.tsx +++ b/src/webparts/summaryWebPart/components/Structure/Structure.tsx @@ -47,14 +47,14 @@ export default class TrafficLight extends React.Component{ + return e.value !== "" + }); - this.setState({items: rows}) + this.setState({items: rows}); } diff --git a/src/webparts/summaryWebPart/components/SummaryGlobalComponent/SummaryGlobalComponent.tsx b/src/webparts/summaryWebPart/components/SummaryGlobalComponent/SummaryGlobalComponent.tsx index 740e840..0767d5d 100644 --- a/src/webparts/summaryWebPart/components/SummaryGlobalComponent/SummaryGlobalComponent.tsx +++ b/src/webparts/summaryWebPart/components/SummaryGlobalComponent/SummaryGlobalComponent.tsx @@ -16,12 +16,13 @@ export interface IComponentProps{ export default class SummaryGlobalComponent extends React.Component { public render(): React.ReactElement { const { data } = this.props; + return (
- +
diff --git a/src/webparts/summaryWebPart/components/SummaryWebPart.tsx b/src/webparts/summaryWebPart/components/SummaryWebPart.tsx index bc98b17..6023830 100644 --- a/src/webparts/summaryWebPart/components/SummaryWebPart.tsx +++ b/src/webparts/summaryWebPart/components/SummaryWebPart.tsx @@ -20,7 +20,7 @@ export default class SummaryWebPart extends React.Component{ return response.json() }).then(result=>{ diff --git a/src/webparts/summaryWebPart/components/TaskStatusesChart/TaskStatusesChart.tsx b/src/webparts/summaryWebPart/components/TaskStatusesChart/TaskStatusesChart.tsx index 543c698..59973e9 100644 --- a/src/webparts/summaryWebPart/components/TaskStatusesChart/TaskStatusesChart.tsx +++ b/src/webparts/summaryWebPart/components/TaskStatusesChart/TaskStatusesChart.tsx @@ -12,14 +12,14 @@ export default class TaskStatusesChart extends React.Component{ const { taskStats } = this.props; return { - labels: ['Выполняемые', 'Планируемые', 'Завершенные', 'Всего задач'], + labels: ['Выполняемые', 'Планируемые', 'Завершенные'], datasets: [ { label: '', backgroundColor: '#407855', borderColor: '#407855', borderWidth: 1, - data: [taskStats.exec, taskStats.plan, taskStats.compl, taskStats.plan + taskStats.compl + taskStats.exec] + data: [taskStats.exec, taskStats.plan, taskStats.compl ]/* taskStats.plan + taskStats.compl + taskStats.exec */ } ] }; @@ -48,7 +48,7 @@ export default class TaskStatusesChart extends React.Component { public renderItemColumn = (item, index: number, column) => { @@ -24,44 +27,46 @@ export default class TrafficLight extends React.Component { } } public render(): React.ReactElement { - const { statuses, taskStats} = this.props; + const { statuses, taskStats, dateInfo} = this.props; let procent = (taskStats.compl/(taskStats.plan + taskStats.compl + taskStats.exec))* 100; + + let startDate = moment(dateInfo.dateStart).format("DD.MM.YY"); + let finDate = moment(dateInfo.dateFinish).format("DD.MM.YY"); + let totalDays = new moment.duration((new Date(dateInfo.dateFinish) as any) -(new Date(dateInfo.dateStart) as any)).asDays(); return (
{ selectionMode={SelectionMode.none} /> { selectionMode={SelectionMode.none} layoutMode={DetailsListLayoutMode.justified} /> -
{`Актуальный статус выполнения ${procent.toFixed(2)}%`}
+
{`Актуальный статус выполнения ${procent.toFixed(2)}%`}
); } diff --git a/src/webparts/summaryWebPart/interfaces/IPageData.ts b/src/webparts/summaryWebPart/interfaces/IPageData.ts index e095d2c..6557da3 100644 --- a/src/webparts/summaryWebPart/interfaces/IPageData.ts +++ b/src/webparts/summaryWebPart/interfaces/IPageData.ts @@ -5,5 +5,6 @@ export interface IPageData { PrjInfo: ISummaryProjectData; Status: {[key: string]: string;}; TaskStats: {[key: string]: number;}; - MainExec: IMainExecItem[] + MainExec: IMainExecItem[], + HighLvlPrjInfo: { dateFinish: string, dateStart:string}; }