|
|
@ -233,7 +233,10 @@ async function strucWithPomsProject (ctx) { |
|
|
|
t_structure.id AS strucId, |
|
|
|
t_structure.name AS strucName, |
|
|
|
t_factor.id AS factorId, |
|
|
|
t_factor.name AS factorName |
|
|
|
t_factor.name AS factorName, |
|
|
|
t_factor.proto AS factorProto, |
|
|
|
t_factor_proto_item.name AS factorItemName, |
|
|
|
t_factor_proto_item.id AS factorItemId |
|
|
|
FROM |
|
|
|
t_project |
|
|
|
LEFT JOIN |
|
|
@ -260,6 +263,8 @@ async function strucWithPomsProject (ctx) { |
|
|
|
ON t_structure_factor.structure = t_structure.id |
|
|
|
LEFT JOIN t_factor |
|
|
|
ON t_structure_factor.factor = t_factor.id |
|
|
|
LEFT JOIN t_factor_proto_item |
|
|
|
ON t_factor_proto_item.proto = t_factor.proto |
|
|
|
WHERE |
|
|
|
project_state != -1 |
|
|
|
AND |
|
|
@ -273,9 +278,18 @@ async function strucWithPomsProject (ctx) { |
|
|
|
if (!corStrut) { |
|
|
|
let nextFacor = [] |
|
|
|
if (s.factorId) { |
|
|
|
let nextFactorItem = [] |
|
|
|
if (s.factorItemId) { |
|
|
|
nextFactorItem.push({ |
|
|
|
id: s.factorItemId, |
|
|
|
name: s.factorItemName, |
|
|
|
}) |
|
|
|
} |
|
|
|
nextFacor.push({ |
|
|
|
id: s.factorId, |
|
|
|
name: s.factorName |
|
|
|
name: s.factorName, |
|
|
|
proto: s.factorProto, |
|
|
|
item: nextFactorItem, |
|
|
|
}) |
|
|
|
} |
|
|
|
undelStruc.push({ |
|
|
@ -284,11 +298,30 @@ async function strucWithPomsProject (ctx) { |
|
|
|
factor: nextFacor |
|
|
|
}) |
|
|
|
} else { |
|
|
|
if (s.factorId && !corStrut.factor.some(v => v.id == s.factorId)) { |
|
|
|
corStrut.factor.push({ |
|
|
|
id: s.factorId, |
|
|
|
name: s.factorName |
|
|
|
}) |
|
|
|
if (s.factorId) { |
|
|
|
let corFactor = corStrut.factor.find(v => v.id == s.factorId) |
|
|
|
let nextFactorItem = null |
|
|
|
if (s.factorItemId) { |
|
|
|
nextFactorItem = { |
|
|
|
id: s.factorItemId, |
|
|
|
name: s.factorItemName, |
|
|
|
} |
|
|
|
} |
|
|
|
if (corFactor) { |
|
|
|
if (!corFactor.item.some(fi => fi.id == s.factorItemId) && nextFactorItem) { |
|
|
|
corFactor.item.push(nextFactorItem) |
|
|
|
} |
|
|
|
} else { |
|
|
|
corStrut.factor.push({ |
|
|
|
id: s.factorId, |
|
|
|
name: s.factorName, |
|
|
|
proto: s.factorProto, |
|
|
|
item: nextFactorItem ? [{ |
|
|
|
id: s.factorItemId, |
|
|
|
name: s.factorItemName, |
|
|
|
}] : [], |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|