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 (
res.success
) {
try {
setVideo(res.payload.data)
const container = document.getElementById('video-play');
console.log(`准备播放`);
@ -620,7 +621,7 @@ function Index (props) {
flv.load();
// 初始化 _remuxer
let controller = flv._transmuxer._controller
let controller = flv?._transmuxer?._controller
controller._remuxer = {
flushStashedSamples: function () {
console.log("flushStashedSamples")
@ -629,6 +630,9 @@ function Index (props) {
flv.play();
flvPlayer.current = flv
} catch (error) {
console.error(error);
}
}
})
@ -819,7 +823,7 @@ function Index (props) {
{
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 : ''
)

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 request from 'superagent';
import { connect } from 'react-redux';
import { editCrane } from '../actions'
import { editCrane, getCrane } from '../actions'
import {
BorderlessTableOutlined, BlockOutlined, RollbackOutlined, SaveOutlined
} 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'
function SetUp ({ dispatch }) {
function SetUp ({ dispatch, craneData }) {
const [form] = Form.useForm();
const [renderMenu, setRenderMenu] = useState([])
const [renderForm, setRenderForm] = useState(false)
@ -24,7 +24,40 @@ function SetUp ({ dispatch }) {
}
}, {
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: '返回',
ic: <RollbackOutlined className='setup-icon' />,
@ -48,6 +81,7 @@ function SetUp ({ dispatch }) {
label: '设备编号',
name: 'device_no',
type: 'string',
disabled: true,
},
{
label: '经度',
@ -115,6 +149,7 @@ function SetUp ({ dispatch }) {
type: 'number',
},
])
initData()
}
}, {
n: '返回',
@ -141,6 +176,19 @@ function SetUp ({ dispatch }) {
)
}
const initData = () => {
console.log(craneData);
setTimeout(() => {
form.setFieldsValue({
...craneData
})
}, 0)
}
useEffect(() => {
initData()
}, [craneData])
return (
<div style={{ height: '100vh', background: '#000' }}>
{
@ -162,7 +210,7 @@ function SetUp ({ dispatch }) {
wrapperCol: {
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' }}>
{
(() => {
@ -183,8 +231,12 @@ function SetUp ({ dispatch }) {
>
{
item.type === 'number' ?
<InputNumber style={{ width: '100%' }} /> :
<Input />
<InputNumber style={{ width: '100%' }} disabled={item.disabled} />
:
item.type == 'boolean' ?
<Switch checkedChildren="开启" unCheckedChildren="关闭" defaultChecked size={'large'} disabled={item.disabled} />
:
<Input disabled={item.disabled} />
}
</Form.Item>
@ -210,10 +262,11 @@ function SetUp ({ dispatch }) {
ic: <SaveOutlined className='setup-icon' />,
click: () => {
if (formIndex == 1) {
const values = form.getFieldsValue()
dispatch(editCrane(values)).then(res => {
let values = form.getFieldsValue()
dispatch(editCrane({ ...craneData, ...values })).then(res => {
if (res.success) {
message.success('修改配置信息成功')
dispatch(getCrane())
} else {
message.error('修改配置信息失败')
}
@ -238,15 +291,14 @@ function SetUp ({ dispatch }) {
<div>
</div>
</div>
)
}
function mapStateToProps (state) {
const { auth } = state;
const { crane } = state;
return {
craneData: crane.data || {}
}
}

2
console/package.json

@ -8,7 +8,7 @@
"test": "mocha",
"start-elctr-forge": "electron-forge start",
"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",
"build-dev": "set NODE_ENV=development&&webpack --config webpack.config.js",
"build": "set NODE_ENV=production&&webpack --config webpack.config.prod.js",

Loading…
Cancel
Save