Browse Source

增加项企项目在映射关系中,新增映射关系时,已被映射过的PEP项目不能再被查看的功能

dev
巴林闲侠 2 years ago
parent
commit
b25f39a02f
  1. 15
      api/app/lib/controllers/project/index.js
  2. 9
      web/client/src/sections/install/components/systemModal.jsx

15
api/app/lib/controllers/project/index.js

@ -129,11 +129,24 @@ async function projectAnxincloud (ctx) {
async function projectPManage (ctx) { async function projectPManage (ctx) {
try { try {
const models = ctx.fs.dc.models;
const { clickHouse } = ctx.app.fs const { clickHouse } = ctx.app.fs
const { includeDelete } = ctx.query const { includeDelete } = ctx.query
const projectRes = await clickHouse.projectManage.query(`SELECT id, project_name, isdelete FROM t_pim_project WHERE isdelete=0 ${includeDelete == 1 ? 'OR isdelete=1' : ''} ORDER BY id DESC`).toPromise() const projectRes = await clickHouse.projectManage.query(`SELECT id, project_name, isdelete FROM t_pim_project WHERE isdelete=0 ${includeDelete == 1 ? 'OR isdelete=1' : ''} ORDER BY id DESC`).toPromise()
const bindedPRes = await models.ProjectCorrelation.findAll({
where: {
pepProjectId: { $ne: null }
}
})
for (let p of projectRes) {
if (bindedPRes.some(bp => bp.pepProjectId == p.id)) {
p.binded = true
}
}
ctx.status = 200; ctx.status = 200;
ctx.body = projectRes ctx.body = projectRes
} catch (error) { } catch (error) {
@ -210,7 +223,7 @@ async function strucWithPomsProject (ctx) {
WHERE WHERE
project_state != -1 project_state != -1
AND AND
t_project.id IN (${ bindRes.anxinProjectId.join(',')}) t_project.id IN (${bindRes.anxinProjectId.join(',')})
ORDER BY strucId ORDER BY strucId
` `
).toPromise() : ).toPromise() :

9
web/client/src/sections/install/components/systemModal.jsx

@ -152,13 +152,16 @@ function adminModal (props) {
showClear showClear
> >
{ {
peplist.map((item, index) => { peplist.reduce((arr, item) => {
return ( if (!item.binded) {
arr.push(
<Form.Select.Option key={item.id} value={item.id}> <Form.Select.Option key={item.id} value={item.id}>
{item.project_name} {item.project_name}
</Form.Select.Option> </Form.Select.Option>
) )
}) }
return arr
}, [])
} }
</Form.Select> </Form.Select>
</div> </div>

Loading…
Cancel
Save