diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 2995642..e7d0a75 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -56,7 +56,7 @@ // "--clickHouseDataAlarm default", // 测试 - "--clickHouseAnxincloud Anxinyun13", + "--clickHouseAnxincloud Anxinyun20", "--clickHousePepEmis pepca8", "--clickHouseProjectManage peppm8", "--clickHouseVcmp video_access_dev", diff --git a/api/app/lib/controllers/console/toolLink.js b/api/app/lib/controllers/control/toolLink.js similarity index 100% rename from api/app/lib/controllers/console/toolLink.js rename to api/app/lib/controllers/control/toolLink.js diff --git a/api/app/lib/routes/console/index.js b/api/app/lib/routes/control/index.js similarity index 88% rename from api/app/lib/routes/console/index.js rename to api/app/lib/routes/control/index.js index a281614..e2debcc 100644 --- a/api/app/lib/routes/console/index.js +++ b/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 }; diff --git a/web/client/src/app.jsx b/web/client/src/app.jsx index ac767ea..b11c920 100644 --- a/web/client/src/app.jsx +++ b/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 ]} /> ) diff --git a/web/client/src/layout/components/header/index.jsx b/web/client/src/layout/components/header/index.jsx index b76c43d..0405efa 100644 --- a/web/client/src/layout/components/header/index.jsx +++ b/web/client/src/layout/components/header/index.jsx @@ -97,12 +97,13 @@ const Header = (props) => { setScrollbar(!Scrollbar) setKeyword('') }} + clickToHide={true} render={
- } onChange={(v) => setKeyword(v)} showClear> + } onChange={(v) => setKeyword(v)} showClear onClick={(e)=>e.stopPropagation()}>
{pomsList?.length > 0 ? pomsList.filter(u => u.pepProjectName?.includes(keyword))?.map(v => { diff --git a/web/client/src/sections/auth/containers/login.jsx b/web/client/src/sections/auth/containers/login.jsx index 4b81829..060c402 100644 --- a/web/client/src/sections/auth/containers/login.jsx +++ b/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') } diff --git a/web/client/src/sections/console/actions/index.js b/web/client/src/sections/console/actions/index.js deleted file mode 100644 index 33cdd8b..0000000 --- a/web/client/src/sections/console/actions/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -import * as console from './console' - -export default { - ...console -} \ No newline at end of file diff --git a/web/client/src/sections/console/containers/index.js b/web/client/src/sections/console/containers/index.js deleted file mode 100644 index d290d54..0000000 --- a/web/client/src/sections/console/containers/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -import Console from './console'; -import UserCenter from './userCenter'; - -export { Console, UserCenter }; \ No newline at end of file diff --git a/web/client/src/sections/console/actions/console.js b/web/client/src/sections/control/actions/control.js similarity index 85% rename from web/client/src/sections/console/actions/console.js rename to web/client/src/sections/control/actions/control.js index 8be2887..822c0a7 100644 --- a/web/client/src/sections/console/actions/console.js +++ b/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: '' } }); -} \ No newline at end of file +} diff --git a/web/client/src/sections/control/actions/index.js b/web/client/src/sections/control/actions/index.js new file mode 100644 index 0000000..df81c6c --- /dev/null +++ b/web/client/src/sections/control/actions/index.js @@ -0,0 +1,8 @@ +'use strict'; + +import * as control from './control' + +export default { + ...control + +} \ No newline at end of file diff --git a/web/client/src/sections/console/containers/console.jsx b/web/client/src/sections/control/containers/control.jsx similarity index 70% rename from web/client/src/sections/console/containers/console.jsx rename to web/client/src/sections/control/containers/control.jsx index f2a65e1..f33debc 100644 --- a/web/client/src/sections/console/containers/console.jsx +++ b/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 ? : <>
{/* 头部 */} @@ -215,17 +235,17 @@ const Console = (props) => {
{/* 循环类型 */}
- {stationList.map((item, index) => { + {exhibition['workbench'].map((item, index) => { return ( -
+
- 关注的项目 - (个) + {item.name} + {item.name == '关注的项目' ? ' ( 个 )' : ' ( 条 )'}
-
112
-
进行中
+
{item.data}
+ {item.name == '关注的项目' ? '' :
待处理
}
@@ -461,7 +481,7 @@ const Console = (props) => {
{/* 我常用的工具 */} -
+
@@ -469,66 +489,140 @@ const Console = (props) => {
MY USUAL TOOLS
-
{ - console.log(111111); - document.getElementById('aa').style.display = 'none' - }} - style={{ marginTop: 24, position: 'relative', display: "inline-block" }}> - -
-
{ - + {toolShow.length > 0 ? + toolShow?.map(v => +
{ + document.getElementById(v.id + 'name').style.display = 'none' }} - >编辑
-
{ + id={v.id + v.name} + style={{ marginTop: 24, position: 'relative', display: "inline-block", cursor: 'pointer' }}> + + + +
+
{ + setTool(true) + setAlter(true) + setCompile({ id: v.id, name: v.name, link: v.link, }) + }} + >编辑
+
{ + dispatch(control.deleteConsoleToollink(v.id)).then(res => { + if (res.success) consoleToollink() + }) + }} + >删除
+
+
) : ""} - }} - >删除
-
-
+
-
75 +
- {setup ? ( - { - setSetup(false); - attribute(tableType[route], route); - setTableType('') - }} - /> - ) : ( - "" - )} + {/* 页面各个设置弹窗 */} + { + setup ? ( + { + setSetup(false); + attribute(tableType); + setTableType('') + }} + /> + ) : ( + "" + ) + } + {/* 工具添加修改弹窗 */} + {tool ? { + 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() + } + }) + }) + }} + > +
+
console.log(values)} + getFormApi={(formApi) => (FormApi.current = formApi)} + > + + + +
+
: "" + } ) } @@ -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); diff --git a/web/client/src/sections/control/containers/index.js b/web/client/src/sections/control/containers/index.js new file mode 100644 index 0000000..cfeb914 --- /dev/null +++ b/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 }; \ No newline at end of file diff --git a/web/client/src/sections/console/containers/userCenter.jsx b/web/client/src/sections/control/containers/userCenter.jsx similarity index 100% rename from web/client/src/sections/console/containers/userCenter.jsx rename to web/client/src/sections/control/containers/userCenter.jsx diff --git a/web/client/src/sections/console/index.js b/web/client/src/sections/control/index.js similarity index 92% rename from web/client/src/sections/console/index.js rename to web/client/src/sections/control/index.js index 062b5bd..1c3db38 100644 --- a/web/client/src/sections/console/index.js +++ b/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, diff --git a/web/client/src/sections/console/nav-item.jsx b/web/client/src/sections/control/nav-item.jsx similarity index 79% rename from web/client/src/sections/console/nav-item.jsx rename to web/client/src/sections/control/nav-item.jsx index 86797e6..f3c9d19 100644 --- a/web/client/src/sections/console/nav-item.jsx +++ b/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: , }, ] diff --git a/web/client/src/sections/console/reducers/index.js b/web/client/src/sections/control/reducers/index.js similarity index 100% rename from web/client/src/sections/console/reducers/index.js rename to web/client/src/sections/control/reducers/index.js diff --git a/web/client/src/sections/console/routes.js b/web/client/src/sections/control/routes.js similarity index 71% rename from web/client/src/sections/console/routes.js rename to web/client/src/sections/control/routes.js index 7a9c027..a7904ed 100644 --- a/web/client/src/sections/console/routes.js +++ b/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 则面包屑禁止跳转 } }, { diff --git a/web/client/src/sections/console/style.less b/web/client/src/sections/control/style.less similarity index 100% rename from web/client/src/sections/console/style.less rename to web/client/src/sections/control/style.less diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index 2a1e911..d088a1c 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/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 diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 0b3595c..bafbcc3 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -53,7 +53,7 @@ export const ApiTable = { //控制台 consoleToollink: 'console/toollink', //常用工具 - + deleteConsoleToollink: 'console/toollink/{linkId}', //删除常用工具 }; export const RouteTable = {