addlink new func (modbus)

This commit is contained in:
Jay
2017-04-18 14:16:58 +08:00
parent 88255a1ae2
commit 1a0a4fdc4d
7 changed files with 1004 additions and 0 deletions
@@ -3,6 +3,7 @@ import {Segment, Button, Form, Input} from 'semantic-ui-react';
import UnitLeone from './UnitLeone';
import UnitDigitalOutput from './UnitDigitalOutput';
import UnitIOGroup from './UnitIOGroup';
import UnitModbus from './UnitModbus';
const stateDefault = () => ({
unit: '',
@@ -56,6 +57,14 @@ class ActionSelect extends React.Component {
toggleLoading={toggleLoading}
updateData={this.updateData} />
)
case 'modbus':
return (
<UnitModbus i18n={i18n}
data={this.state.act}
showDialog={showDialog}
toggleLoading={toggleLoading}
updateData={this.updateData} />
)
default:
return null;
}
@@ -82,6 +91,11 @@ class ActionSelect extends React.Component {
if(acts[1] < 16 || acts[1] > 30) return showDialog('冷氣溫度請介於16-30間');
}
}
if(type == 'modbus'){
let acts = act.split(',');
if(acts.length != 3) return showDialog('請把動作資料填寫完成');
if(acts[0] == '' || acts[1] == '' || acts[2] == '') return showDialog('請把動作資料填寫完成');
}
this.props.addNewAction({
dev,devName,act,actName,type
@@ -105,6 +119,7 @@ class ActionSelect extends React.Component {
<option value="leone">LeOne</option>
<option value="do">DigitalOutput</option>
<option value="iogroup">IOGroup</option>
<option value="modbus">Modbus</option>
</select>
</Form.Field>
{this.getUnitComponent()}