wenlele 2 years ago
parent
commit
cac71fd4d1
  1. 26
      api/app/lib/controllers/project/index.js
  2. 14
      api/app/lib/controllers/push/config.js
  3. 20
      web/client/src/sections/problem/components/tableData.jsx

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

@ -231,7 +231,9 @@ async function strucWithPomsProject (ctx) {
`
SELECT
t_structure.id AS strucId,
t_structure.name AS strucName
t_structure.name AS strucName,
t_factor.id AS factorId,
t_factor.name AS factorName
FROM
t_project
LEFT JOIN
@ -254,6 +256,10 @@ async function strucWithPomsProject (ctx) {
ON t_structure.id = t_project_structure.structure
OR t_structure.id = t_structuregroup_structure.structure
OR t_structure.id = t_structure_site.structid
LEFT JOIN t_structure_factor
ON t_structure_factor.structure = t_structure.id
LEFT JOIN t_factor
ON t_structure_factor.factor = t_factor.id
WHERE
project_state != -1
AND
@ -263,11 +269,27 @@ async function strucWithPomsProject (ctx) {
).toPromise() :
[]
for (let s of undelStrucRes) {
if (!undelStruc.some(us => us.id == s.strucId)) {
let corStrut = undelStruc.find(us => us.id == s.strucId)
if (!corStrut) {
let nextFacor = []
if (s.factorId) {
nextFacor.push({
id: s.factorId,
name: s.factorName
})
}
undelStruc.push({
id: s.strucId,
name: s.strucName,
factor: nextFacor
})
} else {
if (s.factorId) {
corStrut.factor.push({
id: s.factorId,
name: s.factorName
})
}
}
}
}

14
api/app/lib/controllers/push/config.js

@ -8,23 +8,11 @@ async function list (ctx) {
const { clickHouse } = ctx.app.fs
const { utils: { anxinStrucIdRange, pomsProjectRange } } = ctx.app.fs
const { keyword, keywordTarget, alarmType, state, tactics, pomsProjectId } = ctx.query
// let projectCorrelationWhere = {
// del: false,
// }
// if (state == 'notYet') {
// projectCorrelationWhere.pepProjectId = { $ne: null }
// }
let findOption = {
where: {
del: false
},
order: [['id', 'desc']],
// includes: [{
// model: models.ProjectCorrelation,
// where: projectCorrelationWhere,
// required: true
// }]
}
let anxinStrucsRange = await anxinStrucIdRange({
@ -120,7 +108,7 @@ async function list (ctx) {
continue
}
}
} else if(state == 'notYet'){
} else if (state == 'notYet') {
continue
}
filterBinds.push(corBind)

20
web/client/src/sections/problem/components/tableData.jsx

@ -379,12 +379,23 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
placeholder={SkeletonScreen()}
>
{(() => {
// console.log(route);
console.log(tableData);
console.log(route == 'useAbnormal' || route == 'videoAbnormal' ?
tableData.slice(query.page * query.limit, (query.page + 1) * query.limit) || []
: tableData);
return <Table
columns={exhibition}
dataSource={route == 'useAbnormal' || route == 'videoAbnormal' ? tableData.slice(query.page * query.limit, (query.page + 1) * query.limit) || [] : tableData}
dataSource={
route == 'useAbnormal' || route == 'videoAbnormal' ?
tableData.slice(query.page * query.limit, (query.page + 1) * query.limit) || []
: tableData
}
bordered={false}
empty={<div><img src="/assets/images/problem/shield.png" style={{ width: 20 }} />暂无告警数据</div>}
empty={
<div>
<img src="/assets/images/problem/shield.png" style={{ width: 20 }} />暂无告警数据
</div>
}
style={{}}
pagination={false}
onRow={(record, index) => {
@ -457,7 +468,6 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
pageSizeOpts={[10, 20, 30, 40]}
onChange={(currentPage, pageSize) => {
setQuery({ limit: pageSize, page: currentPage - 1 });
}}
/>
</div> : ""}
@ -472,7 +482,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
}
function mapStateToProps(state) {
function mapStateToProps (state) {
const { auth, global, members } = state;
// console.log(global);
return {

Loading…
Cancel
Save