|
|
@ -31,6 +31,39 @@ export default class SummaryContainer extends React.Component<IComponentProps,IC |
|
|
|
items: [] |
|
|
|
items: [] |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static async addMainProjectPlanLastPublishedDate(toState: Array<{key: number, fieldName: string, value: any}>, prjGuid: string):
|
|
|
|
|
|
|
|
Promise<Array<{key: number, fieldName: string, value: any}>>
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const lastPublishedDateObj = { |
|
|
|
|
|
|
|
key: 200000, |
|
|
|
|
|
|
|
fieldName: 'Дата публикации основного КПП', |
|
|
|
|
|
|
|
value: undefined |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const encodedUrl = encodeURI(`http://portal.vertex.spb.ru/pwa/_api/ProjectData/Проекты(guid'${prjGuid}')`) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const response = await fetch(encodedUrl, |
|
|
|
|
|
|
|
{ headers: { |
|
|
|
|
|
|
|
'accept': 'application/json', |
|
|
|
|
|
|
|
}}) |
|
|
|
|
|
|
|
const json = await response.json() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!json) { |
|
|
|
|
|
|
|
console.error('addMainProjectPlanLastPublishedDate json is invalid =>', json) |
|
|
|
|
|
|
|
return toState |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const date = json.ProjectLastPublishedDate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!date) { |
|
|
|
|
|
|
|
console.error('addMainProjectPlanLastPublishedDate json.ProjectLastPublishedDate is invalid =>', date) |
|
|
|
|
|
|
|
return toState |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lastPublishedDateObj.value = new Date(date).toLocaleDateString() |
|
|
|
|
|
|
|
return [ ...toState, lastPublishedDateObj ] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
componentDidMount() { |
|
|
|
const { order, context } = this.props; |
|
|
|
const { order, context } = this.props; |
|
|
|
let relUrl = context.pageContext.web.serverRelativeUrl; |
|
|
|
let relUrl = context.pageContext.web.serverRelativeUrl; |
|
|
@ -69,7 +102,7 @@ export default class SummaryContainer extends React.Component<IComponentProps,IC |
|
|
|
.select(selectedFields) |
|
|
|
.select(selectedFields) |
|
|
|
.expand(lookupFields) |
|
|
|
.expand(lookupFields) |
|
|
|
.get() |
|
|
|
.get() |
|
|
|
.then(currentProject => { |
|
|
|
.then(async currentProject => { |
|
|
|
|
|
|
|
|
|
|
|
res.forEach(e=>{
|
|
|
|
res.forEach(e=>{
|
|
|
|
|
|
|
|
|
|
|
@ -89,6 +122,9 @@ export default class SummaryContainer extends React.Component<IComponentProps,IC |
|
|
|
}
|
|
|
|
}
|
|
|
|
}); |
|
|
|
}); |
|
|
|
var prjGuid = currentProject[0].MainProjectPlanGuid |
|
|
|
var prjGuid = currentProject[0].MainProjectPlanGuid |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toState = await SummaryContainer.addMainProjectPlanLastPublishedDate(toState, prjGuid) |
|
|
|
|
|
|
|
|
|
|
|
let url = 'http://portal.vertex.spb.ru/pwa/_api/ProjectData/Проекты(guid\''+prjGuid+'\')/ИДРодительскогоПроекта' |
|
|
|
let url = 'http://portal.vertex.spb.ru/pwa/_api/ProjectData/Проекты(guid\''+prjGuid+'\')/ИДРодительскогоПроекта' |
|
|
|
const encoded = encodeURI(url); |
|
|
|
const encoded = encodeURI(url); |
|
|
|
fetch(encoded,{ headers: { |
|
|
|
fetch(encoded,{ headers: { |
|
|
|