#search manage keyword modify

This commit is contained in:
chenhua 2020-11-19 00:05:12 +08:00
parent 6da49c1f40
commit 5ff01f8e12
2 changed files with 417 additions and 450 deletions

View File

@ -1,15 +1,20 @@
import React, { PureComponent, Fragment } from 'react'; import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva'; import { connect } from 'dva';
import { import {
Row, Row,
Col, Col,
Card, Card,
Form, Form,
Input, Input,
Button, Button,
Modal, Modal,
message, message,
Divider, Divider,
Icon,
DatePicker,
TimePicker,
Select,
Popover,
} from 'antd'; } from 'antd';
import StandardTable from '@/components/StandardTable'; import StandardTable from '@/components/StandardTable';
import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import PageHeaderWrapper from '@/components/PageHeaderWrapper';
@ -18,413 +23,401 @@ import styles from '../../List/TableList.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const { TextArea } = Input; const { TextArea } = Input;
const fieldLabels = {
keyword_type: '关键词分类'
};
const CreateForm = Form.create()(props => { const CreateForm = Form.create()(props => {
const { modalVisible, form, handleAdd, handleModalVisible } = props; const { modalVisible, form, handleAdd, handleModalVisible } = props;
const okHandle = () => { const okHandle = () => {
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
form.resetFields(); form.resetFields();
handleAdd(fieldsValue); handleAdd(fieldsValue);
}); });
}; };
return ( return (
<Modal <Modal
destroyOnClose destroyOnClose
title="新建模板" title="新建模板"
visible={modalVisible} visible={modalVisible}
width={640} width={640}
onOk={okHandle} onOk={okHandle}
onCancel={() => handleModalVisible()} onCancel={() => handleModalVisible()}>
> <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称"> {form.getFieldDecorator('name', {
{form.getFieldDecorator('name', { rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }], })(<Input placeholder="请输入关键词" />)}
})(<Input placeholder="请输入名称" />)} </FormItem>
</FormItem> <Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label='关键词分类'>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板设置"> {form.getFieldDecorator('keyword_type', {
{form.getFieldDecorator('settings', { rules: [{ required: true, message: '请选择关键词类型' }],
rules: [{ required: true }], })(
})(<TextArea <Select labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} placeholder="请选择关键词类型">
style={{ minHeight: 24 }} <Option value="keyun">敏感词</Option>
placeholder="请输入" <Option value="huoyun">提示词</Option>
rows={9} <Option value="xianlu1">同义词</Option>
/>)} <Option value="xianlu2">过滤词</Option>
</FormItem> <Option value="xianlu3">停用词</Option>
<Option value="xianlu4">保留词</Option>
<Option value="xianlu5">纠错词</Option>
<Option value="xianlu6">相关搜索</Option>
<Option value="xianlu7">热点词管理</Option>
</Select>
)}
</Form.Item>
</Modal> </Modal>
); );
}); });
const UpdateForm = Form.create()(props => { const UpdateForm = Form.create()(props => {
const { updateModalVisible, handleUpdateModalVisible, handleUpdate,values,form } = props; const { updateModalVisible, handleUpdateModalVisible, handleUpdate,values,form } = props;
const okHandle = () => { const okHandle = () => {
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
form.resetFields(); form.resetFields();
handleUpdate(fieldsValue); handleUpdate(fieldsValue);
}); });
}; };
return ( return (
<Modal <Modal destroyOnClose title="新增关键词" visible={updateModalVisible} width={640} onOk={okHandle}
destroyOnClose onCancel={() => handleUpdateModalVisible()}>
title="模板设置"
visible={updateModalVisible} <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
width={640} {form.getFieldDecorator('keyword', {
onOk={okHandle} initialValue: values.nakeywordme,
onCancel={() => handleUpdateModalVisible()} rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
> })(<Input placeholder="请输入关键词" />)}
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称">
{form.getFieldDecorator('name', {
initialValue: values.name,
rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }],
})(<Input placeholder="请输入名称" />)}
</FormItem> </FormItem>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板设置">
{form.getFieldDecorator('settings', { <Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label={fieldLabels.keyword_type}>
initialValue: values.processors, {form.getFieldDecorator('keyword_type', {
rules: [{ required: true }], rules: [{ required: true, message: '请选择关键词类型' }],
})(<TextArea })(
style={{ minHeight: 24 }} <Select placeholder="请选择关键词类型">
placeholder="请输入" <Option value="keyun">敏感词</Option>
rows={9} <Option value="huoyun">提示词</Option>
/>)} <Option value="xianlu">同义词</Option>
</FormItem> <Option value="xianlu">过滤词</Option>
</Modal> <Option value="xianlu">停用词</Option>
); <Option value="xianlu">保留词</Option>
}); <Option value="xianlu">纠错词</Option>
<Option value="xianlu">相关搜索</Option>
<Option value="xianlu">热点词管理</Option>
</Select>
)}
</Form.Item>
</Modal>
);
});
/* eslint react/no-multi-comp:0 */ /* eslint react/no-multi-comp:0 */
@connect(({ pipeline, loading }) => ({ @connect(({ pipeline, loading }) => ({
pipeline, pipeline,
loading: loading.models.pipeline, loading: loading.models.pipeline,
})) }))
@Form.create() @Form.create()
class Common extends PureComponent { class Common extends PureComponent {
state = { state = {
modalVisible: false, modalVisible: false,
updateModalVisible: false, updateModalVisible: false,
expandForm: false, expandForm: false,
selectedRows: [], selectedRows: [],
formValues: {}, formValues: {},
updateFormValues: {}, updateFormValues: {},
}; };
//index template detail example datasource = `
// { [
// ".ml-state" : { {
// "order" : 0, "keyword" : "验收标准",
// "version" : 7090199, "type" : "停用词"
// "index_patterns" : [ },
// ".ml-state*" {
// ], "keyword" : "桥梁施工技术规范",
// "settings" : { "type" : "停用词"
// "index" : { },{
// "hidden" : "true", "keyword" : "路规",
// "lifecycle" : { "type" : "停用词"
// "name" : "ml-size-based-ilm-policy", },{
// "rollover_alias" : ".ml-state-write" "keyword" : "遂规",
// }, "type" : "热点词"
// "auto_expand_replicas" : "0-1" },
// } {
// }, "keyword" : "铁路技术管理规则",
// "mappings" : { "type" : "热点词"
// "_meta" : { },{
// "version" : "7090199" "keyword" : "行车组织规则",
// }, "type" : "热点词"
// "enabled" : false },
// }, {
// "aliases" : { } "keyword" : "铁路交通事故调查处理规则",
// } "type" : "热点词"
// } }]`;
datasource = `
[
{
"name" : "filebeat-7.9.1",
"index_patterns" : "[filebeat-7.9.1-*]",
"order" : "1",
"version" : null,
"composed_of" : ""
},
{
"name" : "apm-7.9.1-span",
"index_patterns" : "[apm-7.9.1-span*]",
"order" : "2",
"version" : null,
"composed_of" : ""
},
{
"name" : ".lists-default",
"index_patterns" : "[.lists-default-*]",
"order" : "0",
"version" : null,
"composed_of" : ""
},
{
"name" : ".monitoring-es",
"index_patterns" : "[.monitoring-es-7-*]",
"order" : "0",
"version" : "7000199",
"composed_of" : ""
},
{
"name" : ".monitoring-beats",
"index_patterns" : "[.monitoring-beats-7-*]",
"order" : "0",
"version" : "7000199",
"composed_of" : ""
}]`;
columns = [ columns = [
{ {
title: '模板名称', title: '关键词名称',
dataIndex: 'name', dataIndex: 'keyword',
}, },
{ {
title: '模式', title: '关键词分类',
dataIndex: 'index_patterns', dataIndex: 'type',
}, },
{ {
title: 'order', title: '操作',
dataIndex: 'order' render: (text, record) => (
}, <Fragment>
{ <a onClick={() => this.handleUpdateModalVisible(true, record)}>修改</a>
title: '版本', <Divider type="vertical" />
dataIndex: 'version' <a onClick={() => {
}, this.state.selectedRows.push(record);
{ this.handleDeleteClick();
title: '操作', }}>删除</a>
render: (text, record) => ( </Fragment>
<Fragment> ),
<a onClick={() => this.handleUpdateModalVisible(true, record)}>设置</a> },
<Divider type="vertical" /> ];
<a onClick={() => {
this.state.selectedRows.push(record);
this.handleDeleteClick();
}}>删除</a>
</Fragment>
),
},
];
componentDidMount() { componentDidMount() {
const { dispatch } = this.props; const { dispatch } = this.props;
// dispatch({ // dispatch({
// type: 'pipeline/fetch', // type: 'pipeline/fetch',
// }); // });
} }
handleStandardTableChange = (pagination, filtersArg, sorter) => { handleStandardTableChange = (pagination, filtersArg, sorter) => {
const { dispatch } = this.props; const { dispatch } = this.props;
const { formValues } = this.state; const { formValues } = this.state;
const filters = Object.keys(filtersArg).reduce((obj, key) => { const filters = Object.keys(filtersArg).reduce((obj, key) => {
const newObj = { ...obj }; const newObj = { ...obj };
newObj[key] = getValue(filtersArg[key]); newObj[key] = getValue(filtersArg[key]);
return newObj; return newObj;
}, {}); }, {});
const params = { const params = {
currentPage: pagination.current, currentPage: pagination.current,
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
...formValues, ...formValues,
...filters, ...filters,
}; };
if (sorter.field) { if (sorter.field) {
params.sorter = `${sorter.field}_${sorter.order}`; params.sorter = `${sorter.field}_${sorter.order}`;
} }
dispatch({ dispatch({
type: 'pipeline/fetch', type: 'pipeline/fetch',
payload: params, payload: params,
}); });
}; };
handleFormReset = () => { handleFormReset = () => {
const { form, dispatch } = this.props; const { form, dispatch } = this.props;
form.resetFields(); form.resetFields();
this.setState({ this.setState({
formValues: {}, formValues: {},
}); });
dispatch({ dispatch({
type: 'pipeline/fetch', type: 'pipeline/fetch',
payload: {}, payload: {},
}); });
}; };
handleDeleteClick = e => { handleDeleteClick = e => {
const { dispatch } = this.props; const { dispatch } = this.props;
const { selectedRows } = this.state; const { selectedRows } = this.state;
if (!selectedRows) return; if (!selectedRows) return;
dispatch({ dispatch({
type: 'pipeline/delete', type: 'pipeline/delete',
payload: { payload: {
key: selectedRows.map(row => row.name), key: selectedRows.map(row => row.name),
}, },
callback: () => { callback: () => {
this.setState({ this.setState({
selectedRows: [], selectedRows: [],
}); });
}, },
});
};
handleSelectRows = rows => {
this.setState({
selectedRows: rows,
}); });
}; };
handleSearch = e => { handleSelectRows = rows => {
this.setState({
selectedRows: rows,
});
};
handleSearch = e => {
e.preventDefault(); e.preventDefault();
const { dispatch, form } = this.props; const { dispatch, form } = this.props;
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
const values = { const values = {
...fieldsValue, ...fieldsValue,
updatedAt: fieldsValue.updatedAt && fieldsValue.updatedAt.valueOf(), updatedAt: fieldsValue.updatedAt && fieldsValue.updatedAt.valueOf(),
}; };
this.setState({ this.setState({
formValues: values, formValues: values,
}); });
dispatch({ dispatch({
type: 'rule/fetch', type: 'rule/fetch',
payload: values, payload: values,
}); });
}); });
}; };
handleModalVisible = flag => { handleModalVisible = flag => {
this.setState({ this.setState({
modalVisible: !!flag, modalVisible: !!flag,
}); });
}; };
handleUpdateModalVisible = (flag, record) => { handleUpdateModalVisible = (flag, record) => {
this.setState({ this.setState({
updateModalVisible: !!flag, updateModalVisible: !!flag,
updateFormValues: record || {}, updateFormValues: record || {},
}); });
}; };
handleAdd = fields => { handleAdd = fields => {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({ dispatch({
type: 'pipeline/add', type: 'pipeline/add',
payload: { payload: {
name: fields.name, name: fields.name,
desc: fields.desc, desc: fields.desc,
processors: fields.processors, processors: fields.processors,
}, },
}); });
message.success('添加成功'); message.success('添加成功');
this.handleModalVisible(); this.handleModalVisible();
}; };
handleUpdate = fields => { handleUpdate = fields => {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({ dispatch({
type: 'pipeline/update', type: 'pipeline/update',
payload: { payload: {
name: fields.name, name: fields.name,
desc: fields.desc, desc: fields.desc,
processors: fields.processors, processors: fields.processors,
}, },
}); });
message.success('修改成功'); message.success('修改成功');
this.handleUpdateModalVisible(); this.handleUpdateModalVisible();
}; };
renderSimpleForm() { renderSimpleForm() {
const { const {
form: { getFieldDecorator }, form: { getFieldDecorator },
} = this.props; } = this.props;
return ( return (
<Form onSubmit={this.handleSearch} layout="inline"> <Form onSubmit={this.handleSearch} layout="inline">
<Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
<Col md={8} sm={24}> <Col lg={6} md={12} sm={24}>
<FormItem label="模板名称"> <Form.Item label={fieldLabels.keyword_type}>
{getFieldDecorator('name')(<Input placeholder="请输入" />)} {getFieldDecorator('keyword_type', {
</FormItem> rules: [{ required: true, message: '请选择关键词类型' }],
</Col> })(
<Col md={8} sm={24}> <Select placeholder="请选择关键词类型">
<span className={styles.submitButtons}> <Option value="keyun">敏感词</Option>
<Button type="primary" htmlType="submit"> <Option value="huoyun">提示词</Option>
<Option value="xianlu">同义词</Option>
<Option value="xianlu">过滤词</Option>
<Option value="xianlu">停用词</Option>
<Option value="xianlu">保留词</Option>
<Option value="xianlu">纠错词</Option>
<Option value="xianlu">相关搜索</Option>
<Option value="xianlu">热点词管理</Option>
</Select>
)}
</Form.Item>
</Col>
<Col md={8} sm={24}>
<FormItem label="关键词">
{getFieldDecorator('name')(<Input placeholder="请输入关键词" />)}
</FormItem>
</Col>
<Col md={8} sm={24}>
<span className={styles.submitButtons}>
<Button type="primary" htmlType="submit">
查询 查询
</Button> </Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}> <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
重置 重置
</Button> </Button>
</span> </span>
</Col> </Col>
</Row> </Row>
</Form> </Form>
); );
} }
renderForm() { renderForm() {
return this.renderSimpleForm(); return this.renderSimpleForm();
} }
render() { render() {
const data = { const data = {
list: JSON.parse(this.datasource), list: JSON.parse(this.datasource),
pagination: { pagination: {
pageSize: 5, pageSize: 5,
}, },
}; };
const { selectedRows, modalVisible, updateModalVisible, updateFormValues } = this.state; const { selectedRows, modalVisible, updateModalVisible, updateFormValues } = this.state;
const parentMethods = { const parentMethods = {
handleAdd: this.handleAdd, handleAdd: this.handleAdd,
handleModalVisible: this.handleModalVisible, handleModalVisible: this.handleModalVisible,
}; };
const updateMethods = { const updateMethods = {
handleUpdateModalVisible: this.handleUpdateModalVisible, handleUpdateModalVisible: this.handleUpdateModalVisible,
handleUpdate: this.handleUpdate, handleUpdate: this.handleUpdate,
}; };
return ( return (
<Fragment> <Fragment>
<Card bordered={false}> <Card bordered={false}>
<div className={styles.tableList}> <div className={styles.tableList}>
<div className={styles.tableListForm}>{this.renderForm()}</div> <div className={styles.tableListForm}>{this.renderForm()}</div>
<div className={styles.tableListOperator}> <div className={styles.tableListOperator}>
<Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}> <Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>
新建 新增关键词
</Button> </Button>
{selectedRows.length > 0 && ( {selectedRows.length > 0 && (
<span> <span>
<Button onClick={() => this.handleDeleteClick()}>删除</Button> <Button onClick={() => this.handleDeleteClick()}>删除</Button>
</span> </span>
)} )}
</div> </div>
<StandardTable <StandardTable
selectedRows={selectedRows} selectedRows={selectedRows}
data={data} data={data}
columns={this.columns} columns={this.columns}
onSelectRow={this.handleSelectRows} onSelectRow={this.handleSelectRows}
onChange={this.handleStandardTableChange} onChange={this.handleStandardTableChange}
/> />
</div> </div>
</Card> </Card>
<CreateForm {...parentMethods} modalVisible={modalVisible} /> <CreateForm {...parentMethods} modalVisible={modalVisible} />
{updateFormValues && Object.keys(updateFormValues).length ? ( {updateFormValues && Object.keys(updateFormValues).length ? (
<UpdateForm <UpdateForm
{...updateMethods} {...updateMethods}
updateModalVisible={updateModalVisible} updateModalVisible={updateModalVisible}
values={updateFormValues} values={updateFormValues}
/> />
) : null} ) : null}
</Fragment> </Fragment>
); );
} }
} }
export default Common; export default Common;

View File

@ -10,6 +10,11 @@ import {
Modal, Modal,
message, message,
Divider, Divider,
Icon,
DatePicker,
TimePicker,
Select,
Popover,
} from 'antd'; } from 'antd';
import StandardTable from '@/components/StandardTable'; import StandardTable from '@/components/StandardTable';
import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import PageHeaderWrapper from '@/components/PageHeaderWrapper';
@ -18,81 +23,82 @@ import styles from '../../List/TableList.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const { TextArea } = Input; const { TextArea } = Input;
const fieldLabels = {
keyword_type: '关键词分类'
};
const CreateForm = Form.create()(props => { const CreateForm = Form.create()(props => {
const { modalVisible, form, handleAdd, handleModalVisible } = props; const { modalVisible, form, handleAdd, handleModalVisible } = props;
const okHandle = () => { const okHandle = () => {
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
form.resetFields(); form.resetFields();
handleAdd(fieldsValue); handleAdd(fieldsValue);
}); });
}; };
return ( return (
<Modal <Modal
destroyOnClose destroyOnClose
title="新建模板" title="新建模板"
visible={modalVisible} visible={modalVisible}
width={640} width={640}
onOk={okHandle} onOk={okHandle}
onCancel={() => handleModalVisible()} onCancel={() => handleModalVisible()}>
> <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称">
{form.getFieldDecorator('name', { {form.getFieldDecorator('name', {
rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }], rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
})(<Input placeholder="请输入名称" />)} })(<Input placeholder="请输入关键词" />)}
</FormItem> </FormItem>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板设置"> <Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label='关键词分类'>
{form.getFieldDecorator('settings', { {form.getFieldDecorator('keyword_type', {
rules: [{ required: true }], rules: [{ required: true, message: '请选择关键词类型' }],
})(<TextArea })(
style={{ minHeight: 24 }} <Select placeholder="请选择关键词类型">
placeholder="请输入" <Option value="keyun">客运</Option>
rows={9} <Option value="huoyun">货运</Option>
/>)} <Option value="xianlu">线路</Option>
</FormItem> </Select>
)}
</Form.Item>
</Modal> </Modal>
); );
}); });
const UpdateForm = Form.create()(props => { const UpdateForm = Form.create()(props => {
const { updateModalVisible, handleUpdateModalVisible, handleUpdate,values,form } = props; const { updateModalVisible, handleUpdateModalVisible, handleUpdate,values,form } = props;
const okHandle = () => { const okHandle = () => {
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
form.resetFields(); form.resetFields();
handleUpdate(fieldsValue); handleUpdate(fieldsValue);
}); });
}; };
return ( return (
<Modal <Modal destroyOnClose title="新增关键词" visible={updateModalVisible} width={640} onOk={okHandle}
destroyOnClose onCancel={() => handleUpdateModalVisible()}>
title="模板设置"
visible={updateModalVisible} <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
width={640} {form.getFieldDecorator('keyword', {
onOk={okHandle} initialValue: values.nakeywordme,
onCancel={() => handleUpdateModalVisible()} rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
> })(<Input placeholder="请输入关键词" />)}
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称"> </FormItem>
{form.getFieldDecorator('name', {
initialValue: values.name, <Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label={fieldLabels.keyword_type}>
rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }], {form.getFieldDecorator('keyword_type', {
})(<Input placeholder="请输入名称" />)} rules: [{ required: true, message: '请选择关键词类型' }],
</FormItem> })(
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板设置"> <Select placeholder="请选择关键词类型">
{form.getFieldDecorator('settings', { <Option value="keyun">客运</Option>
initialValue: values.processors, <Option value="huoyun">货运</Option>
rules: [{ required: true }], <Option value="xianlu">线路</Option>
})(<TextArea </Select>
style={{ minHeight: 24 }} )}
placeholder="请输入" </Form.Item>
rows={9}
/>)}
</FormItem>
</Modal> </Modal>
); );
}); });
/* eslint react/no-multi-comp:0 */ /* eslint react/no-multi-comp:0 */
@ -110,93 +116,48 @@ class Professional extends PureComponent {
formValues: {}, formValues: {},
updateFormValues: {}, updateFormValues: {},
}; };
//index template detail example
// {
// ".ml-state" : {
// "order" : 0,
// "version" : 7090199,
// "index_patterns" : [
// ".ml-state*"
// ],
// "settings" : {
// "index" : {
// "hidden" : "true",
// "lifecycle" : {
// "name" : "ml-size-based-ilm-policy",
// "rollover_alias" : ".ml-state-write"
// },
// "auto_expand_replicas" : "0-1"
// }
// },
// "mappings" : {
// "_meta" : {
// "version" : "7090199"
// },
// "enabled" : false
// },
// "aliases" : { }
// }
// }
datasource = ` datasource = `
[ [
{ {
"name" : "filebeat-7.9.1", "keyword" : "验收标准",
"index_patterns" : "[filebeat-7.9.1-*]", "type" : "客运"
"order" : "1",
"version" : null,
"composed_of" : ""
}, },
{ {
"name" : "apm-7.9.1-span", "keyword" : "桥梁施工技术规范",
"index_patterns" : "[apm-7.9.1-span*]", "type" : "客运"
"order" : "2", },{
"version" : null, "keyword" : "路规",
"composed_of" : "" "type" : "客运"
},{
"keyword" : "遂规",
"type" : "客运"
}, },
{ {
"name" : ".lists-default", "keyword" : "铁路技术管理规则",
"index_patterns" : "[.lists-default-*]", "type" : "客运"
"order" : "0", },{
"version" : null, "keyword" : "行车组织规则",
"composed_of" : "" "type" : "客运"
}, },
{ {
"name" : ".monitoring-es", "keyword" : "铁路交通事故调查处理规则",
"index_patterns" : "[.monitoring-es-7-*]", "type" : "客运"
"order" : "0",
"version" : "7000199",
"composed_of" : ""
},
{
"name" : ".monitoring-beats",
"index_patterns" : "[.monitoring-beats-7-*]",
"order" : "0",
"version" : "7000199",
"composed_of" : ""
}]`; }]`;
columns = [ columns = [
{ {
title: '模板名称', title: '关键词名称',
dataIndex: 'name', dataIndex: 'keyword',
}, },
{ {
title: '模式', title: '关键词分类',
dataIndex: 'index_patterns', dataIndex: 'type',
},
{
title: 'order',
dataIndex: 'order'
},
{
title: '版本',
dataIndex: 'version'
}, },
{ {
title: '操作', title: '操作',
render: (text, record) => ( render: (text, record) => (
<Fragment> <Fragment>
<a onClick={() => this.handleUpdateModalVisible(true, record)}>设置</a> <a onClick={() => this.handleUpdateModalVisible(true, record)}>修改</a>
<Divider type="vertical" /> <Divider type="vertical" />
<a onClick={() => { <a onClick={() => {
this.state.selectedRows.push(record); this.state.selectedRows.push(record);
@ -350,9 +311,22 @@ class Professional extends PureComponent {
return ( return (
<Form onSubmit={this.handleSearch} layout="inline"> <Form onSubmit={this.handleSearch} layout="inline">
<Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.keyword_type}>
{getFieldDecorator('keyword_type', {
rules: [{ required: true, message: '请选择关键词类型' }],
})(
<Select placeholder="请选择关键词类型">
<Option value="keyun">客运</Option>
<Option value="huoyun">货运</Option>
<Option value="xianlu">线路</Option>
</Select>
)}
</Form.Item>
</Col>
<Col md={8} sm={24}> <Col md={8} sm={24}>
<FormItem label="模板名称"> <FormItem label="关键词">
{getFieldDecorator('name')(<Input placeholder="请输入" />)} {getFieldDecorator('name')(<Input placeholder="请输入关键词" />)}
</FormItem> </FormItem>
</Col> </Col>
<Col md={8} sm={24}> <Col md={8} sm={24}>
@ -397,7 +371,7 @@ class Professional extends PureComponent {
<div className={styles.tableListForm}>{this.renderForm()}</div> <div className={styles.tableListForm}>{this.renderForm()}</div>
<div className={styles.tableListOperator}> <div className={styles.tableListOperator}>
<Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}> <Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>
增关键词
</Button> </Button>
{selectedRows.length > 0 && ( {selectedRows.length > 0 && (
<span> <span>