Browse Source

控制台页面调整

dev
wenlele 2 years ago
parent
commit
95d1c42d1b
  1. 2
      api/.vscode/launch.json
  2. 0
      api/app/lib/controllers/control/toolLink.js
  3. 2
      api/app/lib/routes/control/index.js
  4. 4
      web/client/src/app.jsx
  5. 3
      web/client/src/layout/components/header/index.jsx
  6. 2
      web/client/src/sections/auth/containers/login.jsx
  7. 7
      web/client/src/sections/console/actions/index.js
  8. 6
      web/client/src/sections/console/containers/index.js
  9. 7
      web/client/src/sections/control/actions/control.js
  10. 8
      web/client/src/sections/control/actions/index.js
  11. 378
      web/client/src/sections/control/containers/control.jsx
  12. 6
      web/client/src/sections/control/containers/index.js
  13. 0
      web/client/src/sections/control/containers/userCenter.jsx
  14. 2
      web/client/src/sections/control/index.js
  15. 4
      web/client/src/sections/control/nav-item.jsx
  16. 0
      web/client/src/sections/control/reducers/index.js
  17. 8
      web/client/src/sections/control/routes.js
  18. 0
      web/client/src/sections/control/style.less
  19. 1
      web/client/src/sections/problem/components/tableData.jsx
  20. 2
      web/client/src/utils/webapi.js

2
api/.vscode/launch.json

@ -56,7 +56,7 @@
// "--clickHouseDataAlarm default",
//
"--clickHouseAnxincloud Anxinyun13",
"--clickHouseAnxincloud Anxinyun20",
"--clickHousePepEmis pepca8",
"--clickHouseProjectManage peppm8",
"--clickHouseVcmp video_access_dev",

0
api/app/lib/controllers/console/toolLink.js → api/app/lib/controllers/control/toolLink.js

2
api/app/lib/routes/console/index.js → api/app/lib/routes/control/index.js

@ -1,6 +1,6 @@
'use strict';
const toolLink = require('../../controllers/console/toolLink');
const toolLink = require('../../controllers/control/toolLink');
module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/console/toollink'] = { content: '获取常用工具', visible: true };

4
web/client/src/app.jsx

@ -8,7 +8,7 @@ import Analysis from './sections/analysis';
import Install from './sections/install';
import Problem from './sections/problem';
import NoMatch from './sections/noMatch';
import Console from './sections/console';
import Control from './sections/control';
import Facility from './sections/facility';
import Service from './sections/service';
import WorkOrder from './sections/workOrder';
@ -40,7 +40,7 @@ const App = props => {
title={projectName}
sections={[//Example,
Analysis, Install, Data, Facility, Service, Problem, WorkOrder,Means,
Auth, NoMatch, Console
Auth, NoMatch, Control
]}
/>
)

3
web/client/src/layout/components/header/index.jsx

@ -97,12 +97,13 @@ const Header = (props) => {
setScrollbar(!Scrollbar)
setKeyword('')
}}
clickToHide={true}
render={
<Dropdown.Menu style={{ minWidth: 270, maxWidth: 714, padding: 20, fontSize: 12 }}>
<Tabs type="button">
<TabPane tab="项目" itemKey="项目">
<div style={{ width: '100%', height: 1, background: "#d5cfcf8c", margin: "10px 0" }}></div>
<Input suffix={<IconSearch />} onChange={(v) => setKeyword(v)} showClear></Input>
<Input suffix={<IconSearch />} onChange={(v) => setKeyword(v)} showClear onClick={(e)=>e.stopPropagation()}></Input>
<div id='overall' style={{ width: '100%', height: 260, position: "relative", marginTop: 10 }}>
{pomsList?.length > 0 ?
pomsList.filter(u => u.pepProjectName?.includes(keyword))?.map(v => {

2
web/client/src/sections/auth/containers/login.jsx

@ -20,7 +20,7 @@ const Login = props => {
useEffect(() => {
if (user && user.authorized) {
dispatch(push('/console'));
dispatch(push('/control'));
localStorage.setItem('poms_open_sider', JSON.stringify([]))
localStorage.removeItem('poms_selected_sider')
}

7
web/client/src/sections/console/actions/index.js

@ -1,7 +0,0 @@
'use strict';
import * as console from './console'
export default {
...console
}

6
web/client/src/sections/console/containers/index.js

@ -1,6 +0,0 @@
'use strict';
import Console from './console';
import UserCenter from './userCenter';
export { Console, UserCenter };

7
web/client/src/sections/console/actions/console.js → web/client/src/sections/control/actions/control.js

@ -2,7 +2,7 @@
import { ApiTable ,basicAction} from '$utils'
export function ConsoleToollink () { //获取常用工具
export function getConsoleToollink () { //获取常用工具
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
@ -25,12 +25,13 @@ export function putConsoleToollink (data) { //编辑常用工具
});
}
export function deleteConsoleToollink (orgId) { //删除常用工具
console.log(orgId);
return dispatch => basicAction({
type: 'delete',
dispatch: dispatch,
actionType: 'DELETE_CONSLE_TOOLLINK',
url: `${ApiTable.consoleToollink.replace('{linkId}', orgId)}`,
url: `${ApiTable.deleteConsoleToollink.replace('{linkId}', orgId)}`,
msg: { option: '删除常用工具' },
reducer: { name: '' }
});
}
}

8
web/client/src/sections/control/actions/index.js

@ -0,0 +1,8 @@
'use strict';
import * as control from './control'
export default {
...control
}

378
web/client/src/sections/console/containers/console.jsx → web/client/src/sections/control/containers/control.jsx

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useRef } from 'react';
import { connect } from 'react-redux';
import { Timeline, Card, Button } from '@douyinfe/semi-ui';
import { Timeline, Card, Button, Modal, Form } from '@douyinfe/semi-ui';
import { push } from 'react-router-redux';
import '../style.less'
import PerfectScrollbar from "perfect-scrollbar";
@ -17,8 +17,9 @@ let problemsScrollbar;
let alarmScrollbar;
const Console = (props) => {
const Control = (props) => {
const { dispatch, actions, user, loading, socket } = props
const { control } = actions
const stationList = [
'url(/assets/images/console/lan_1.png)',
'url(/assets/images/console/lv_1.png)',
@ -36,67 +37,93 @@ const Console = (props) => {
const [problemsList, setProblemsList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''])//&
const [setup, setSetup] = useState(false); //
const [tableType, setTableType] = useState(''); //localStorage
const [tool, setTool] = useState(false); //
const [alter, setAlter] = useState(false); //
const [compile, setCompile] = useState({}); //
const [toolShow, setToolShow] = useState([]); //
const [tableSetup, setTableSetup] = useState([]); //
const [exhibition, setExhibition] = useState({ workbench: [] }); //
const FormApi = useRef()
useEffect(() => {
consoleToollink()
//
let data = ['workbench']
data.map(v => {
localStorage.getItem(v) == null
? localStorage.setItem(v, JSON.stringify(show[v]))
: "";
attribute(v)
})
}, [])
useEffect(() => {
newScrollbar = new PerfectScrollbar("#news", {
suppressScrollX: true,
});
const domProject = document.getElementById("news");
if (domProject && newScrollbar) {
newScrollbar.update();
}
overviewScrollbar = new PerfectScrollbar("#overview", {
suppressScrollY: true,
});
const domProject1 = document.getElementById("overview");
if (domProject1 && overviewScrollbar) {
overviewScrollbar.update();
}
memberScrollbar = new PerfectScrollbar("#member", {
suppressScrollX: true,
});
const domProject2 = document.getElementById("member");
if (domProject2 && memberScrollbar) {
memberScrollbar.update();
}
equipmentScrollbar = new PerfectScrollbar("#equipment", {
suppressScrollX: true,
});
const domProject3 = document.getElementById("equipment");
if (domProject3 && equipmentScrollbar) {
equipmentScrollbar.update();
}
webScrollbar = new PerfectScrollbar("#web", {
suppressScrollX: true,
});
const domProject4 = document.getElementById("web");
if (domProject4 && webScrollbar) {
webScrollbar.update();
}
problemsScrollbar = new PerfectScrollbar("#problems", {
suppressScrollX: true,
});
const domProject5 = document.getElementById("problems");
if (domProject5 && problemsScrollbar) {
problemsScrollbar.update();
}
alarmScrollbar = new PerfectScrollbar("#alarm", {
suppressScrollY: true,
});
const domProject6 = document.getElementById("alarm");
if (domProject6 && alarmScrollbar) {
alarmScrollbar.update();
}
// newScrollbar = new PerfectScrollbar("#news", {
// suppressScrollX: true,
// });
// const domProject = document.getElementById("news");
// if (domProject && newScrollbar) {
// newScrollbar.update();
// }
// overviewScrollbar = new PerfectScrollbar("#overview", {
// suppressScrollY: true,
// });
// const domProject1 = document.getElementById("overview");
// if (domProject1 && overviewScrollbar) {
// overviewScrollbar.update();
// }
// memberScrollbar = new PerfectScrollbar("#member", {
// suppressScrollX: true,
// });
// const domProject2 = document.getElementById("member");
// if (domProject2 && memberScrollbar) {
// memberScrollbar.update();
// }
// equipmentScrollbar = new PerfectScrollbar("#equipment", {
// suppressScrollX: true,
// });
// const domProject3 = document.getElementById("equipment");
// if (domProject3 && equipmentScrollbar) {
// equipmentScrollbar.update();
// }
// webScrollbar = new PerfectScrollbar("#web", {
// suppressScrollX: true,
// });
// const domProject4 = document.getElementById("web");
// if (domProject4 && webScrollbar) {
// webScrollbar.update();
// }
// problemsScrollbar = new PerfectScrollbar("#problems", {
// suppressScrollX: true,
// });
// const domProject5 = document.getElementById("problems");
// if (domProject5 && problemsScrollbar) {
// problemsScrollbar.update();
// }
// alarmScrollbar = new PerfectScrollbar("#alarm", {
// suppressScrollY: true,
// });
// const domProject6 = document.getElementById("alarm");
// if (domProject6 && alarmScrollbar) {
// alarmScrollbar.update();
// }
// ACTION
// dispatch(actions.example.getMembers(user.orgId))
})
const consoleToollink = () => {
dispatch(control.getConsoleToollink()).then(res => {
if (res.success) setToolShow(res.payload.data)
})
}
let Select = {
workbench: ['project', 'data', 'app', 'device'],
statistical: [],
@ -111,40 +138,33 @@ const Console = (props) => {
}
let listAll = [
{ name: '关注的项目', sort: 1, key: 'project', data: [], img: 'url(/assets/images/console/lan_1.png)' },
{ name: '数据告警', sort: 2, key: 'data', data: [], img: 'url(/assets/images/console/lv_1.png)' },
{ name: '应用告警', sort: 2, key: 'app', data: [], img: 'url(/assets/images/console/hong_1.png)' },
{ name: '设备告警', sort: 2, key: 'device', data: [], img: 'url(/assets/images/console/hong_1.png)' },
{ name: '关注的项目', sort: 1, key: 'project', data: 1, img: 'url(/assets/images/console/lan_1.png)' },
{ name: '数据告警', sort: 2, key: 'data', data: 2, img: 'url(/assets/images/console/lv_1.png)' },
{ name: '应用告警', sort: 2, key: 'app', data: 3, img: 'url(/assets/images/console/hong_1.png)' },
{ name: '设备告警', sort: 2, key: 'device', data: 225, img: 'url(/assets/images/console/hong_1.png)' },
]
// const attribute = (name, route) => {
// let arr = localStorage.getItem(name)
// ? JSON.parse(localStorage.getItem(name))
// : [];
// // console.log(arr);
// if (route) {
// let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value))
const attribute = (title) => {
let take = localStorage.getItem(title)
? JSON.parse(localStorage.getItem(title))
: [];
let data = Select[title].map(v => {
let dataTitle = listAll.find(vv => v == vv.key) || {}
console.log(dataTitle);
return { name: dataTitle.name, value: dataTitle.key }
})
console.log(data);
let TableDisplay = take?.map(v => listAll?.find(vv => v == vv.key))
TableDisplay.sort((a, b) => a.sort - b.sort)
setExhibition({ ...exhibition, [title]: TableDisplay })
setTableSetup([{ list: data }])
// let data = []
// data.splice(1, 0, ...arr, 'text')
// let TableDisplay = data?.map(v => {
// let datas = columnAll?.find(vv => v == vv.value)
// if (datas) {
// return { title: datas.name, sort: datas.sort, dataIndex: datas.value, rowKey: datas.value, render: datas.render }
// }
// })
// TableDisplay.sort((a, b) => a.sort - b.sort)
// setExhibition(TableDisplay)
// setTableSetup([{ list: setup }])
// }
// }
}
return (
return (11 ? <img src="/assets/images/install/watting.png" alt="" style={{ width: 'calc(100% + 16px)', position: "relative", top: -12, left: -8, }} /> :
<>
<div style={{ padding: '0px 40px', width: '100%' }} className='console'>
{/* 头部 */}
@ -215,17 +235,17 @@ const Console = (props) => {
</div>
{/* 循环类型 */}
<div id='alarm' style={{ width: 'calc(100% - 200px)', position: 'relative', whiteSpace: 'nowrap', }}>
{stationList.map((item, index) => {
{exhibition['workbench'].map((item, index) => {
return (
<div key={item} style={{ background: item, backgroundSize: "100% 100%", display: "inline-block", width: 270, height: 135, marginRight: 26 }}>
<div key={item.name} style={{ background: item.img, backgroundSize: "100% 100%", display: "inline-block", width: 270, height: 135, marginRight: 26 }}>
<div style={{ margin: '35px 0px 0px 134px' }}>
<div>
<span style={{ fontSize: 14, color: '#4A4A4A' }}>关注的项目</span>
<span style={{ fontSize: 12, color: '#4A4A4A' }}>()</span>
<span style={{ fontSize: 14, color: '#4A4A4A', fontWeight: 500, fontFamily: 'PingFangSC-Medium, PingFang SC' }}>{item.name}</span>
<span style={{ fontSize: 12, color: '#4A4A4A' }}>{item.name == '关注的项目' ? ' ( 个 )' : ' ( 条 )'}</span>
</div>
<div style={{ marginTop: 15, display: 'flex', alignItems: 'center' }}>
<div style={{ fontSize: 32, color: index == 0 ? '#0F7EFB' : index == 1 ? '#0091A1' : index == 2 ? '#FE9812' : '#FF7575', fontFamily: 'YouSheBiaoTiHei' }}>112</div>
<div style={{ fontSize: 12, color: '#969799', marginLeft: 4 }}>进行中</div>
<div style={{ fontSize: 32, color: index == 0 ? '#0F7EFB' : index == 1 ? '#0091A1' : index == 2 ? '#FE9812' : '#FF7575', fontFamily: 'YouSheBiaoTiHei' }}>{item.data}</div>
{item.name == '关注的项目' ? '' : <div style={{ fontSize: 12, color: '#969799', marginLeft: 4 }}>待处理</div>}
</div>
</div>
</div>
@ -461,7 +481,7 @@ const Console = (props) => {
</div>
</div>
{/* 我常用的工具 */}
<div style={{ marginTop: 20, background: '#FFFFFF', boxShadow: '0px 0px 12px 2px rgba(220,222,224,0.2)', borderRadius: 2, paddingTop: 20, paddingLeft: 21, height: 303 }}>
<div style={{ marginTop: 20, background: '#FFFFFF', boxShadow: '0px 0px 12px 2px rgba(220,222,224,0.2)', borderRadius: 2, padding: 20 }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 0, height: 20, borderLeft: '3px solid #005ABD', borderTop: '3px solid transparent', borderBottom: '3px solid transparent' }}></div>
@ -469,66 +489,140 @@ const Console = (props) => {
<div style={{ marginLeft: 6, fontSize: 12, color: '#969799', fontFamily: "DINExp", }}>MY USUAL TOOLS</div>
</div>
</div>
<div
onMouseLeave={() => {
console.log(111111);
document.getElementById('aa').style.display = 'none'
}}
style={{ marginTop: 24, position: 'relative', display: "inline-block" }}>
<Button
theme="solid"
type="primary"
style={{
width: 94, height: 29, borderRadius: 2, marginRight: 10, marginBottom: 15,
background: '#0F7EFB', color: '#FFFFFF', border: '1px solid #0F7EFB',
}}
onContextMenu={(e) => {
e.preventDefault();
document.getElementById('aa').style.display = 'block'
}}
onClick={(e) => {
// console.log(e);
}}
>
工单管理
</Button>
<div id='aa'
style={{
position: 'absolute', top: 12, right: -10, background: 'rgb(208 208 223 / 100%)', fontSize: 13,
width: 50, textAlign: "center", borderRadius: 4, padding: '0 10px', display: "none"
}}>
<div style={{ lineHeight: '30px' }}
onClick={() => {
{toolShow.length > 0 ?
toolShow?.map(v =>
<div
onMouseLeave={() => {
document.getElementById(v.id + 'name').style.display = 'none'
}}
>编辑</div>
<div style={{ lineHeight: '30px' }}
onClick={() => {
id={v.id + v.name}
style={{ marginTop: 24, position: 'relative', display: "inline-block", cursor: 'pointer' }}>
<a href={v.link} target="_blank">
<Button
theme="solid"
type="primary"
style={{
height: 29, borderRadius: 2, marginRight: 10, marginBottom: 15,
background: '#0F7EFB', color: '#FFFFFF', border: '1px solid #0F7EFB',
}}
onContextMenu={(e) => {
e.preventDefault();
document.getElementById(v.id + 'name').style.display = 'block'
}}
>
{v.name}
</Button>
</a>
<div id={v.id + 'name'}
style={{
position: 'absolute', top: 12, right: -10, background: 'rgb(208 208 223 / 100%)', fontSize: 13,
width: 50, textAlign: "center", borderRadius: 4, padding: '0 10px', display: "none"
}}>
<div style={{ lineHeight: '30px' }}
onClick={() => {
setTool(true)
setAlter(true)
setCompile({ id: v.id, name: v.name, link: v.link, })
}}
>编辑</div>
<div style={{ lineHeight: '30px' }}
onClick={() => {
dispatch(control.deleteConsoleToollink(v.id)).then(res => {
if (res.success) consoleToollink()
})
}}
>删除</div>
</div>
</div>) : ""}
}}
>删除</div>
</div>
</div>
<Button
theme="solid"
type="primary"
style={{
width: '100%',
height: 40,
borderRadius: 2,
marginTop: 20,
background: '#F2F3F5',
color: '#0F7EFB',
border: '1px solid #F2F3F5'
}}
onClick={() => {
setTool(true)
}}
>
添加
</Button>
</div>
</div>75
</div>
</div>
</div>
{setup ? (
<Setup
tableType={tableType}
tableList={tableSetup}
close={() => {
setSetup(false);
attribute(tableType[route], route);
setTableType('')
}}
/>
) : (
""
)}
{/* 页面各个设置弹窗 */}
{
setup ? (
<Setup
tableType={tableType}
tableList={tableSetup}
close={() => {
setSetup(false);
attribute(tableType);
setTableType('')
}}
/>
) : (
""
)
}
{/* 工具添加修改弹窗 */}
{tool ? <Modal
title={alter ? '编辑' : "添加"}
visible={true}
width={600}
onCancel={() => {
setTool(false)
setAlter(false)
setCompile({})
}}
onOk={() => {
FormApi.current.validate().then((v) => {
console.log(v);
dispatch(control.putConsoleToollink({ id: compile?.id, name: v.name, link: v.link })).then(res => {
if (res.success) {
setTool(false)
setAlter(false)
setCompile({})
consoleToollink()
}
})
})
}}
>
<div style={{ paddingLeft: 20 }}>
<Form
onSubmit={(values) => console.log(values)}
getFormApi={(formApi) => (FormApi.current = formApi)}
>
<Form.Input
label='工具名称'
labelPosition="left"
rules={[{ required: true, message: "请输入工具名称,1~10个字符,支持中英文,数字及常见符号-_ /." }]}
field='name'
initValue={compile?.name || ''}
placeholder='请输入工具名称'
/>
<Form.TextArea maxCount={50} showClear
label='地址链接'
labelPosition="left"
placeholder='请输入URL'
initValue={compile?.link || ''}
rules={[{ required: true, message: "请输入地址链接" }]}
field='link'
/>
</Form>
</div>
</Modal> : ""
}
</>
)
}
@ -538,10 +632,10 @@ function mapStateToProps (state) {
return {
// loading: members.isRequesting,
user: auth.user,
// actions: global.actions,
actions: global.actions,
// members: members.data,
// socket: webSocket.socket
};
}
export default connect(mapStateToProps)(Console);
export default connect(mapStateToProps)(Control);

6
web/client/src/sections/control/containers/index.js

@ -0,0 +1,6 @@
'use strict';
import Control from './control';
import UserCenter from './userCenter';
export { Control, UserCenter };

0
web/client/src/sections/console/containers/userCenter.jsx → web/client/src/sections/control/containers/userCenter.jsx

2
web/client/src/sections/console/index.js → web/client/src/sections/control/index.js

@ -6,7 +6,7 @@ import actions from './actions';
import { getNavItem } from './nav-item';
export default {
key: 'console',
key: 'control',
name: '控制台',
reducers: reducers,
routes: routes,

4
web/client/src/sections/console/nav-item.jsx → web/client/src/sections/control/nav-item.jsx

@ -5,9 +5,9 @@ export function getNavItem (user, dispatch) {
return (
[
{
itemKey: 'console',
itemKey: 'control',
text: '控制台',
to: '/console',
to: '/control',
// icon: <IconCode />,
},
]

0
web/client/src/sections/console/reducers/index.js → web/client/src/sections/control/reducers/index.js

8
web/client/src/sections/console/routes.js → web/client/src/sections/control/routes.js

@ -1,13 +1,13 @@
'use strict';
import { Console,UserCenter } from './containers';
import { Control,UserCenter } from './containers';
export default [{
type: 'inner',
route: {
path: '/console',
key: 'console',
path: '/control',
key: 'control',
breadcrumb: '控制台',
component: Console,
component: Control,
// 不设置 component 则面包屑禁止跳转
}
}, {

0
web/client/src/sections/console/style.less → web/client/src/sections/control/style.less

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

@ -187,6 +187,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
labelPosition="left"
field={v.field}
key={v.field}
maxLength="10"
style={{ width: 116, marginRight: 16, color: "#F9F9F9", }}
placeholder="全部"
filter

2
web/client/src/utils/webapi.js

@ -53,7 +53,7 @@ export const ApiTable = {
//控制台
consoleToollink: 'console/toollink', //常用工具
deleteConsoleToollink: 'console/toollink/{linkId}', //删除常用工具
};
export const RouteTable = {

Loading…
Cancel
Save