|
@@ -1,8 +1,8 @@
|
|
|
import React, { Component } from 'react'
|
|
|
-import { Modal, Input, Icon, Select, Radio } from 'antd'
|
|
|
+import { Modal, Input, Icon, Select, Radio, Checkbox, Button } from 'antd'
|
|
|
import { FormItem } from 'wptpc-design'
|
|
|
import s from './index.less'
|
|
|
-import CheckBox from 'rc-checkbox'
|
|
|
+// import CheckBox from 'rc-checkbox'
|
|
|
|
|
|
export default class Index extends Component {
|
|
|
constructor (props) {
|
|
@@ -45,6 +45,16 @@ export default class Index extends Component {
|
|
|
// },
|
|
|
{
|
|
|
label: 'JSON',
|
|
|
+ formItemLayout:{
|
|
|
+ labelCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 1 },
|
|
|
+ },
|
|
|
+ wrapperCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 23 },
|
|
|
+ },
|
|
|
+ },
|
|
|
render: () => {
|
|
|
const { fieldsJson } = this.state.params
|
|
|
return <div>
|
|
@@ -60,49 +70,66 @@ export default class Index extends Component {
|
|
|
<span>* 订阅类型</span>
|
|
|
<span>* 缓存类型-天</span>
|
|
|
<span>* 缓存类型-小时</span>
|
|
|
+ <span>* 操作</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
{fieldsJson.map((f, index) => <div>
|
|
|
- <Input value={f.key} onChange={(e) => {
|
|
|
- fieldsJson[index].key = e.target.value
|
|
|
- this.onParamsChange('fieldsJson', fieldsJson)
|
|
|
- }} style={{ width: 130, marginRight: 10 }}/>
|
|
|
<Input value={f.description} onChange={(e) => {
|
|
|
fieldsJson[index].description = e.target.value
|
|
|
this.onParamsChange('fieldsJson', fieldsJson)
|
|
|
- }} style={{ width: 130, marginRight: 10 }}/>
|
|
|
+ }} style={{ width: 120, marginRight: 10 }}/>
|
|
|
<Input value={f.name} onChange={(e) => {
|
|
|
fieldsJson[index].name = e.target.value
|
|
|
this.onParamsChange('fieldsJson', fieldsJson)
|
|
|
- }} style={{ width: 130, marginRight: 10 }}/>
|
|
|
+ }} style={{ width: 120, marginRight: 10 }}/>
|
|
|
<Input value={f.uniqueId} onChange={(e) => {
|
|
|
fieldsJson[index].uniqueId = e.target.value
|
|
|
this.onParamsChange('fieldsJson', fieldsJson)
|
|
|
- }} style={{ width: 130, marginRight: 10 }}/>
|
|
|
+ }} style={{ width: 120, marginRight: 10 }}/>
|
|
|
<Input value={f.fields} onChange={(e) => {
|
|
|
fieldsJson[index].fields = e.target.value
|
|
|
this.onParamsChange('fieldsJson', fieldsJson)
|
|
|
- }} style={{ width: 130, marginRight: 10 }}/>
|
|
|
- <Select style={{width:130}}>
|
|
|
- <Select.Option value="1" selected>自增</Select.Option>
|
|
|
- <Select.Option value="1">变量增加</Select.Option>
|
|
|
+ }} style={{ width: 120, marginRight: 10 }}/>
|
|
|
+ <Select value={f.type} style={{width:120, marginRight: 10}}>
|
|
|
+ <Select.Option value={1}>自增</Select.Option>
|
|
|
+ <Select.Option value={2}>变量增加</Select.Option>
|
|
|
</Select>
|
|
|
- <Input value={f.type} onChange={(e) => {
|
|
|
- fieldsJson[index].type = e.target.value
|
|
|
- this.onParamsChange('fieldsJson', fieldsJson)
|
|
|
- }} style={{ width: 130, marginRight: 10 }}/>
|
|
|
- <CheckBox>按天缓存</CheckBox>
|
|
|
- <CheckBox>按小时缓存</CheckBox>
|
|
|
- <Icon onClick={(e) => {
|
|
|
+ <Checkbox style={{width:120, marginRight: 10}}>按天缓存</Checkbox>
|
|
|
+ <Checkbox style={{width:120, marginRight: 10}}>按小时缓存</Checkbox>
|
|
|
+ <Button type="primary" onClick={this.clickSaveJob} size="small" style={{marginRight: 5}}>保存</Button>
|
|
|
+ <Button type="danger" onClick={this.clickDeleteJob} size="small" onClick={this.deleteItem(index)}>删除</Button>
|
|
|
+ {/* <Icon onClick={(e) => {
|
|
|
fieldsJson.splice(index, 1)
|
|
|
this.onParamsChange('fieldsJson', fieldsJson)
|
|
|
- }} type="close"/></div>)}
|
|
|
+ }} type="close"/> */}
|
|
|
+ </div>)}
|
|
|
</div>
|
|
|
</div>
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
|
|
|
|
+ clickSaveJob = () => {
|
|
|
+ console.log('save');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ deleteItem = (index) => () => {
|
|
|
+ const { params } = this.state;
|
|
|
+ const { fieldsJson } = params;
|
|
|
+ fieldsJson.splice(index, 1);
|
|
|
+ this.setState({
|
|
|
+ params:{
|
|
|
+ ...params,
|
|
|
+ fieldsJson,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ clickDeleteJob = () => {
|
|
|
+ console.log('delete')
|
|
|
+ }
|
|
|
+
|
|
|
// 组件挂在的时候调用的生命周期函数
|
|
|
componentDidMount () {
|
|
|
const params = { ...this.props.params }
|
|
@@ -133,7 +160,7 @@ export default class Index extends Component {
|
|
|
onCancel={onCancel}
|
|
|
// 确认按钮点击后,发起接口会处罚loading值的变化,从而控制确认按钮的状态(disable or enable)
|
|
|
okButtonProps={{ disabled: loading }}
|
|
|
- width={1800}
|
|
|
+ width={1200}
|
|
|
>
|
|
|
<FormItem formSetting={this.formSetting} params={params} onChange={this.onParamsChange} />
|
|
|
</Modal>
|