Browse Source

修改塔吊的告警配置

simplify_dependencies
巴林闲侠 2 years ago
parent
commit
ac1e9887ae
  1. 2
      console/client/assets/env.js
  2. 8
      console/client/src/sections/console/containers/index.js
  3. 76
      console/client/src/sections/console/containers/setUp.js
  4. 2
      console/package.json

2
console/client/assets/env.js

@ -1 +1 @@
window.FS_API_ROOT = 'http://10.8.30.183:4100' window.FS_API_ROOT = 'http://127.0.0.1:4100'

8
console/client/src/sections/console/containers/index.js

@ -573,6 +573,7 @@ function Index (props) {
if ( if (
res.success res.success
) { ) {
try {
setVideo(res.payload.data) setVideo(res.payload.data)
const container = document.getElementById('video-play'); const container = document.getElementById('video-play');
console.log(`准备播放`); console.log(`准备播放`);
@ -620,7 +621,7 @@ function Index (props) {
flv.load(); flv.load();
// 初始化 _remuxer // 初始化 _remuxer
let controller = flv._transmuxer._controller let controller = flv?._transmuxer?._controller
controller._remuxer = { controller._remuxer = {
flushStashedSamples: function () { flushStashedSamples: function () {
console.log("flushStashedSamples") console.log("flushStashedSamples")
@ -629,6 +630,9 @@ function Index (props) {
flv.play(); flv.play();
flvPlayer.current = flv flvPlayer.current = flv
} catch (error) {
console.error(error);
}
} }
}) })
@ -819,7 +823,7 @@ function Index (props) {
{ {
s.dataFrom === 'live' ? s.dataFrom === 'live' ?
( (
craneParams[s.v]?.Value || '-' craneParams[s.v]?.Value || craneParams[s.v]?.Value == 0 ? craneParams[s.v]?.Value : '-'
) + ( ) + (
craneParams[s.v] && s.unit ? s.unit : '' craneParams[s.v] && s.unit ? s.unit : ''
) )

76
console/client/src/sections/console/containers/setUp.js

@ -2,14 +2,14 @@ import React, { useEffect, useState, useRef } from 'react'
import { push } from 'react-router-redux'; import { push } from 'react-router-redux';
import request from 'superagent'; import request from 'superagent';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { editCrane } from '../actions' import { editCrane, getCrane } from '../actions'
import { import {
BorderlessTableOutlined, BlockOutlined, RollbackOutlined, SaveOutlined BorderlessTableOutlined, BlockOutlined, RollbackOutlined, SaveOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { Col, Row, Button, Modal, Form, Input, InputNumber, message } from 'antd'; import { Col, Row, Button, Modal, Form, Input, InputNumber, message, Switch } from 'antd';
import '../style.less' import '../style.less'
function SetUp ({ dispatch }) { function SetUp ({ dispatch, craneData }) {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [renderMenu, setRenderMenu] = useState([]) const [renderMenu, setRenderMenu] = useState([])
const [renderForm, setRenderForm] = useState(false) const [renderForm, setRenderForm] = useState(false)
@ -24,7 +24,40 @@ function SetUp ({ dispatch }) {
} }
}, { }, {
n: '限位告警参数', n: '限位告警参数',
ic: <BorderlessTableOutlined className='setup-icon' /> ic: <BorderlessTableOutlined className='setup-icon' />,
click: () => {
setRenderForm(true)
setFormIndex(1)
setFormItems([
{
label: '设备编号',
name: 'device_no',
type: 'string',
disabled: true,
},
{
label: '1级碰撞距离',
name: 'dis_level_1',
type: 'number',
},
{
label: '3级碰撞距离',
name: 'dis_level_3',
type: 'number',
},
{
label: '是否静音',
name: 'mute',
type: 'boolean',
},
{
label: '2级碰撞距离',
name: 'dis_level_2',
type: 'number',
},
])
initData()
}
}, { }, {
n: '返回', n: '返回',
ic: <RollbackOutlined className='setup-icon' />, ic: <RollbackOutlined className='setup-icon' />,
@ -48,6 +81,7 @@ function SetUp ({ dispatch }) {
label: '设备编号', label: '设备编号',
name: 'device_no', name: 'device_no',
type: 'string', type: 'string',
disabled: true,
}, },
{ {
label: '经度', label: '经度',
@ -115,6 +149,7 @@ function SetUp ({ dispatch }) {
type: 'number', type: 'number',
}, },
]) ])
initData()
} }
}, { }, {
n: '返回', n: '返回',
@ -141,6 +176,19 @@ function SetUp ({ dispatch }) {
) )
} }
const initData = () => {
console.log(craneData);
setTimeout(() => {
form.setFieldsValue({
...craneData
})
}, 0)
}
useEffect(() => {
initData()
}, [craneData])
return ( return (
<div style={{ height: '100vh', background: '#000' }}> <div style={{ height: '100vh', background: '#000' }}>
{ {
@ -162,7 +210,7 @@ function SetUp ({ dispatch }) {
wrapperCol: { wrapperCol: {
span: 18, span: 18,
}, },
}} name="control-hooks" size='large'> }} name="control-hooks" size='large' style={{ display: 'flex', flexDirection: 'column', height: '95%', justifyContent: 'space-between', }}>
<Row style={{ padding: '8% 12% 0' }}> <Row style={{ padding: '8% 12% 0' }}>
{ {
(() => { (() => {
@ -183,8 +231,12 @@ function SetUp ({ dispatch }) {
> >
{ {
item.type === 'number' ? item.type === 'number' ?
<InputNumber style={{ width: '100%' }} /> : <InputNumber style={{ width: '100%' }} disabled={item.disabled} />
<Input /> :
item.type == 'boolean' ?
<Switch checkedChildren="开启" unCheckedChildren="关闭" defaultChecked size={'large'} disabled={item.disabled} />
:
<Input disabled={item.disabled} />
} }
</Form.Item> </Form.Item>
@ -210,10 +262,11 @@ function SetUp ({ dispatch }) {
ic: <SaveOutlined className='setup-icon' />, ic: <SaveOutlined className='setup-icon' />,
click: () => { click: () => {
if (formIndex == 1) { if (formIndex == 1) {
const values = form.getFieldsValue() let values = form.getFieldsValue()
dispatch(editCrane(values)).then(res => { dispatch(editCrane({ ...craneData, ...values })).then(res => {
if (res.success) { if (res.success) {
message.success('修改配置信息成功') message.success('修改配置信息成功')
dispatch(getCrane())
} else { } else {
message.error('修改配置信息失败') message.error('修改配置信息失败')
} }
@ -238,15 +291,14 @@ function SetUp ({ dispatch }) {
<div> <div>
</div> </div>
</div> </div>
) )
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth } = state; const { crane } = state;
return { return {
craneData: crane.data || {}
} }
} }

2
console/package.json

@ -8,7 +8,7 @@
"test": "mocha", "test": "mocha",
"start-elctr-forge": "electron-forge start", "start-elctr-forge": "electron-forge start",
"start": "cross-env NODE_ENV=development npm run start-params", "start": "cross-env NODE_ENV=development npm run start-params",
"start-params": "node server -p 5400 -u http://10.8.30.183:4100", "start-params": "node server -p 5400 -u http://127.0.0.1:4100",
"deploy": "export NODE_ENV=production && npm run build && node server", "deploy": "export NODE_ENV=production && npm run build && node server",
"build-dev": "set NODE_ENV=development&&webpack --config webpack.config.js", "build-dev": "set NODE_ENV=development&&webpack --config webpack.config.js",
"build": "set NODE_ENV=production&&webpack --config webpack.config.prod.js", "build": "set NODE_ENV=production&&webpack --config webpack.config.prod.js",

Loading…
Cancel
Save