获取流程详情 API
parent
0ab3d24fc7
commit
37dbe77fe6
|
@ -324,10 +324,14 @@ public class ProcessController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ProjectProcessDetail get(@PathVariable int id) {
|
public ProjectProcessDetail get(@PathVariable int id) {
|
||||||
|
ProjectProcess process = processService.getById(id);
|
||||||
|
if (process == null) {
|
||||||
|
throw new RuntimeException("流程不存在");
|
||||||
|
}
|
||||||
|
|
||||||
ProjectProcessDetail detail = new ProjectProcessDetail();
|
ProjectProcessDetail detail = new ProjectProcessDetail();
|
||||||
detail.setProcessId(id);
|
detail.setProcessId(id);
|
||||||
|
|
||||||
ProjectProcess process = processService.getById(id);
|
|
||||||
detail.setProcess(process);
|
detail.setProcess(process);
|
||||||
|
|
||||||
Project project = projectRepository.findById(process.getProjectId());
|
Project project = projectRepository.findById(process.getProjectId());
|
||||||
|
|
|
@ -558,12 +558,6 @@
|
||||||
})
|
})
|
||||||
console.log(emptyRows)
|
console.log(emptyRows)
|
||||||
if (isNotEmpty(emptyRows)) {
|
if (isNotEmpty(emptyRows)) {
|
||||||
this.procurementDetails.filter(detail => {
|
|
||||||
const properties = procurementDetailProperties.filter(property => isBlank(detail[property]))
|
|
||||||
console.log(properties)
|
|
||||||
return isNotEmpty(properties)
|
|
||||||
})
|
|
||||||
|
|
||||||
const row = emptyRows[0]
|
const row = emptyRows[0]
|
||||||
this.$message.error("合同清单明细 费用项目为:'" + row.feeType + "' 采购类别为:'" + row.category + "' 的数据未填写")
|
this.$message.error("合同清单明细 费用项目为:'" + row.feeType + "' 采购类别为:'" + row.category + "' 的数据未填写")
|
||||||
return false
|
return false
|
||||||
|
@ -637,7 +631,7 @@
|
||||||
}
|
}
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
const applyDeptId = process.applyDeptId?.split(',')
|
const applyDeptId = process?.applyDeptId?.split(',')
|
||||||
this.initForm({ ...form, ...process, ...contract, applyDeptId })
|
this.initForm({ ...form, ...process, ...contract, applyDeptId })
|
||||||
this.projectSelected = true
|
this.projectSelected = true
|
||||||
this.processType = process.processType
|
this.processType = process.processType
|
||||||
|
@ -654,32 +648,34 @@
|
||||||
const convertCommon = detail => {
|
const convertCommon = detail => {
|
||||||
return {
|
return {
|
||||||
rowKey: rowKey++, feeType: computeFeeType(detail.type),
|
rowKey: rowKey++, feeType: computeFeeType(detail.type),
|
||||||
totalTaxInclude_: detail.totalTaxInclude, totalTaxInclude: undefined, // 存在相同字段转换一下
|
totalTaxInclude_: detail.totalTaxInclude, // 存在相同字段转换一下
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const computeProcurementDetails = procurementDetails => {
|
const computeProcurementDetails = procurementDetails => {
|
||||||
const ret = []
|
const ret = []
|
||||||
for (let detail of procurementDetails || []) {
|
for (let detail of procurementDetails || []) {
|
||||||
const newDetail = {
|
|
||||||
|
//父级数据
|
||||||
|
const parent = {
|
||||||
...detail, ...convertCommon(detail),
|
...detail, ...convertCommon(detail),
|
||||||
}
|
}
|
||||||
// mapChildren
|
// mapChildren
|
||||||
let { purchaseDetails } = newDetail
|
let { purchaseDetails } = parent
|
||||||
if (isNotEmpty(purchaseDetails)) {
|
if (isNotEmpty(purchaseDetails)) {
|
||||||
purchaseDetails = purchaseDetails.map(purchase => ({
|
purchaseDetails = purchaseDetails.map(purchase => ({
|
||||||
...purchase, ...detail, parent: newDetail
|
...purchase, ...convertCommon(detail), parent, newRow: true
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// 合并第一行到父级
|
// 合并第一行到父级
|
||||||
const first = purchaseDetails.shift();
|
const first = purchaseDetails.shift();
|
||||||
Object.assign(newDetail, first)
|
Object.assign(parent, first)
|
||||||
delete newDetail['parent']
|
delete parent['parent']
|
||||||
delete newDetail['purchaseDetails']
|
delete parent['purchaseDetails']
|
||||||
|
|
||||||
newDetail['children'] = purchaseDetails
|
parent['children'] = purchaseDetails
|
||||||
}
|
}
|
||||||
ret.push(newDetail)
|
ret.push(parent)
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue