Browse Source

添加数据聚集模块

dev
dengyinhuan 2 years ago
parent
commit
79f445e7cd
  1. 157
      web/client/src/sections/fillion/components/datajuji.js
  2. 20
      web/client/src/sections/fillion/components/inforTable.js

157
web/client/src/sections/fillion/components/datajuji.js

@ -0,0 +1,157 @@
import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, Select, DatePicker, AutoComplete, Col, Button,Row } from 'antd';
import { MinusCircleOutlined, PlusOutlined,PlusCircleOutlined } from '@ant-design/icons';
const Search = Input.Search
const { TextArea } = Input;
import moment from 'moment';
const EditGuanlang = (props) => {
const { visible, onCancel, editData, handleSaveScore, readOnly, companys, searchCompany, applyState } = props;
const [form] = Form.useForm();
const [replyFiles, setReplyFiles] = useState([]);
const [companyOpts, setCompanyOpts] = useState([]);
const [stationItem, setStationItem] = useState(null);
const [deviceList, setDeviceList] = useState([]);
useEffect(() => {
if (!visible) {
form.resetFields()
}
}, [visible])
useEffect(() => {
if (editData) {
let revertData = Object.assign({}, editData);
Object.keys(editData).forEach(key => {
if (key == 'accidentTime') {
revertData[key] = editData[key] && moment(editData[key]);
}
if (key == 'images') {
// const list = (editData[key] || '').split(',') || []
if (editData[key]) {
revertData[key] = JSON.parse(editData[key]);
}
}
});
form.setFieldsValue({ ...revertData });
}
}, [editData])
useEffect(() => {
if (companys && companys.length) {
let list = [];
companys.forEach(item => {
list.push({ label: item.company, value: item.company })
})
setCompanyOpts(list);
}
}, [companys])
useEffect(() => {
if (editData && companys && companys.length) {
handleSelectCompany(null, { value: editData.companyName })
let list = ((editData || {}).accidentStations || []).map(item => item.stationId)
form.setFieldsValue({ stations: list })
}
}, [companys, editData])
const handleSave = () => {
const data = form.getFieldsValue(true);
console.log(data,'data')
handleSaveScore();
}
const onFileUploaded = (fileList) => {
setReplyFiles(fileList);
}
const handleSelectCompany = (v, opt) => {
const { value } = opt;
const target = companys.filter(c => c.company == value);
setDeviceList(target[0]?.deviceInfos || []);
}
const data1 = [
{label:'2021年12月',value:'2021年12月'},
{label:'2021年11月',value:'2021年11月'},
{label:'2021年10月',value:'2021年10月'},
{label:'2021年9月',value:'2021年9月'},
{label:'2021年8月',value:'2021年8月'},
{label:'2021年7月',value:'2021年7月'},
{label:'2021年6月',value:'2021年6月'},
{label:'2021年5月',value:'2021年5月'},
{label:'2021年4月',value:'2021年4月'},
{label:'2021年3月',value:'2021年3月'},
{label:'2021年2月',value:'2021年2月'},
{label:'2021年1月',value:'2021年1月'}]
const data2 = [
{label:'噪声传感器',value:'噪声传感器'},
{label:'导轮式固定测斜仪',value:'导轮式固定测斜仪'},
{label:'闭合式磁通量传感器',value:'闭合式磁通量传感器'},
{label:'扬尘监测系统',value:'扬尘监测系统'},
{label:'空气质量监测系统',value:'空气质量监测系统'},
{label:'车辆动态称重系统',value:'车辆动态称重系统'},
{label:'多通道振动采集仪',value:'多通道振动采集仪'},
{label:'应急照明控制器',value:'应急照明控制器'},
{label:'钢筋计',value:'钢筋计'},
{label:'风速风向仪',value:'风速风向仪'},
{label:'静力水准仪',value:'静力水准仪'},
{label:'表面式应变计',value:'表面式应变计'}]
return (
<Modal
title="数据汇集"
visible={visible}
destroyOnClose
width={600}
// onOk={handleSave}
onCancel={onCancel}
footer={null}
>
<Form form={form} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} onFinish={handleSave}>
<Row>
<Col span={20}>
<Form.Item
label={'历史数据'}
name={'startposition'}>
<Select options={data1} defaultValue="2021年12月" mode="multiple"></Select>
</Form.Item>
</Col>
</Row>
<Row>
<Col span={20}>
<Form.Item
label={'传感器设备'}
name={'endposition'}>
<Select options={data2} defaultValue="噪声传感器" mode="multiple"></Select>
</Form.Item>
</Col>
</Row>
<Form.Item wrapperCol={{ span: 12, offset: 6 }}>
<Col span={24} style={{ display: 'flex', justifyContent: 'space-around' }}>
<Button htmlType="submit" onClick={()=>{
onCancel()
}}>
取消
</Button>
<Button type="primary" htmlType="submit" onClick={()=>{
onCancel()
}}>
确定
</Button>
</Col>
</Form.Item>
</Form>
*汇集历史数据接入物联网监测数据实现大数据的接入解算
</Modal >
)
}
export default EditGuanlang;

20
web/client/src/sections/fillion/components/inforTable.js

@ -6,7 +6,7 @@ import './protable.less'
import moment from 'moment';
import { getPurchase, delPurchase } from "../actions/infor"
import UserModal from './infor/details';
import Datajuji from './datajuji'
const InForTable = (props) => {
const { dispatch, user, depData, depMessage, depLoading } = props
const [rowSelected, setRowSelected] = useState([])
@ -23,6 +23,7 @@ const InForTable = (props) => {
const [overrunRateUpper, setOverrunRateUpper] = useState()//超限率上限
const [overrunRateFloor, setOverrunRateFloor] = useState()//超限率下限
const [testTime, setTestTime] = useState()//超限率下限
const [datajuji , setdatajuji] = useState() //数据聚集弹窗
const ref = useRef()
useEffect(() => { ref.current.reload() }, [monitor, delet])
//打开弹窗
@ -381,6 +382,13 @@ const InForTable = (props) => {
>
新增
</Button>
<Button
type='primary'
onClick={() => { setdatajuji(true)}} style={{ marginLeft: 15 }}
>
数据汇集
</Button>
{/* <Button
type="primary"
style={{ width: "100px", marginLeft: 20 }}
@ -477,6 +485,16 @@ const InForTable = (props) => {
// sitename={sitename}
setRecortd={setRecortd}
/> : ''}
{datajuji ? <Datajuji
visible={datajuji}
onCancel={() => { setdatajuji(false) }}
// handleSaveScore={handleSaveScore}
// searchCompany={searchCompany}
// companys={companys}
// editData={modalRecord}
// readOnly={readOnly}
// applyState={applyState}
></Datajuji> : ''}
</Spin >
)
}

Loading…
Cancel
Save