#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

@ -10,6 +10,11 @@ import {
Modal,
message,
Divider,
Icon,
DatePicker,
TimePicker,
Select,
Popover,
} from 'antd';
import StandardTable from '@/components/StandardTable';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
@ -18,6 +23,11 @@ import styles from '../../List/TableList.less';
const FormItem = Form.Item;
const { TextArea } = Input;
const fieldLabels = {
keyword_type: '关键词分类'
};
const CreateForm = Form.create()(props => {
const { modalVisible, form, handleAdd, handleModalVisible } = props;
@ -35,22 +45,29 @@ const CreateForm = Form.create()(props => {
visible={modalVisible}
width={640}
onOk={okHandle}
onCancel={() => handleModalVisible()}
>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称">
onCancel={() => handleModalVisible()}>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
{form.getFieldDecorator('name', {
rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }],
})(<Input placeholder="请输入名称" />)}
</FormItem>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板设置">
{form.getFieldDecorator('settings', {
rules: [{ required: true }],
})(<TextArea
style={{ minHeight: 24 }}
placeholder="请输入"
rows={9}
/>)}
rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
})(<Input placeholder="请输入关键词" />)}
</FormItem>
<Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label='关键词分类'>
{form.getFieldDecorator('keyword_type', {
rules: [{ required: true, message: '请选择关键词类型' }],
})(
<Select labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} placeholder="请选择关键词类型">
<Option value="keyun">敏感词</Option>
<Option value="huoyun">提示词</Option>
<Option value="xianlu1">同义词</Option>
<Option value="xianlu2">过滤词</Option>
<Option value="xianlu3">停用词</Option>
<Option value="xianlu4">保留词</Option>
<Option value="xianlu5">纠错词</Option>
<Option value="xianlu6">相关搜索</Option>
<Option value="xianlu7">热点词管理</Option>
</Select>
)}
</Form.Item>
</Modal>
);
});
@ -67,30 +84,33 @@ const UpdateForm = Form.create()(props => {
};
return (
<Modal
destroyOnClose
title="模板设置"
visible={updateModalVisible}
width={640}
onOk={okHandle}
onCancel={() => handleUpdateModalVisible()}
>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板名称">
{form.getFieldDecorator('name', {
initialValue: values.name,
rules: [{ required: true, message: '请输入至少五个字符的名称!', min: 5 }],
})(<Input placeholder="请输入名称" />)}
</FormItem>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="模板设置">
{form.getFieldDecorator('settings', {
initialValue: values.processors,
rules: [{ required: true }],
})(<TextArea
style={{ minHeight: 24 }}
placeholder="请输入"
rows={9}
/>)}
<Modal destroyOnClose title="新增关键词" visible={updateModalVisible} width={640} onOk={okHandle}
onCancel={() => handleUpdateModalVisible()}>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
{form.getFieldDecorator('keyword', {
initialValue: values.nakeywordme,
rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
})(<Input placeholder="请输入关键词" />)}
</FormItem>
<Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label={fieldLabels.keyword_type}>
{form.getFieldDecorator('keyword_type', {
rules: [{ required: true, message: '请选择关键词类型' }],
})(
<Select placeholder="请选择关键词类型">
<Option value="keyun">敏感词</Option>
<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>
</Modal>
);
});
@ -110,93 +130,48 @@ class Common extends PureComponent {
formValues: {},
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 = `
[
{
"name" : "filebeat-7.9.1",
"index_patterns" : "[filebeat-7.9.1-*]",
"order" : "1",
"version" : null,
"composed_of" : ""
"keyword" : "验收标准",
"type" : "停用词"
},
{
"name" : "apm-7.9.1-span",
"index_patterns" : "[apm-7.9.1-span*]",
"order" : "2",
"version" : null,
"composed_of" : ""
"keyword" : "桥梁施工技术规范",
"type" : "停用词"
},{
"keyword" : "路规",
"type" : "停用词"
},{
"keyword" : "遂规",
"type" : "热点词"
},
{
"name" : ".lists-default",
"index_patterns" : "[.lists-default-*]",
"order" : "0",
"version" : null,
"composed_of" : ""
"keyword" : "铁路技术管理规则",
"type" : "热点词"
},{
"keyword" : "行车组织规则",
"type" : "热点词"
},
{
"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" : ""
"keyword" : "铁路交通事故调查处理规则",
"type" : "热点词"
}]`;
columns = [
{
title: '模板名称',
dataIndex: 'name',
title: '关键词名称',
dataIndex: 'keyword',
},
{
title: '模式',
dataIndex: 'index_patterns',
},
{
title: 'order',
dataIndex: 'order'
},
{
title: '版本',
dataIndex: 'version'
title: '关键词分类',
dataIndex: 'type',
},
{
title: '操作',
render: (text, record) => (
<Fragment>
<a onClick={() => this.handleUpdateModalVisible(true, record)}>设置</a>
<a onClick={() => this.handleUpdateModalVisible(true, record)}>修改</a>
<Divider type="vertical" />
<a onClick={() => {
this.state.selectedRows.push(record);
@ -350,9 +325,28 @@ class Common extends PureComponent {
return (
<Form onSubmit={this.handleSearch} layout="inline">
<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>
<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 label="关键词">
{getFieldDecorator('name')(<Input placeholder="请输入关键词" />)}
</FormItem>
</Col>
<Col md={8} sm={24}>
@ -397,7 +391,7 @@ class Common extends PureComponent {
<div className={styles.tableListForm}>{this.renderForm()}</div>
<div className={styles.tableListOperator}>
<Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>
新建
新增关键词
</Button>
{selectedRows.length > 0 && (
<span>
@ -426,5 +420,4 @@ class Common extends PureComponent {
);
}
}
export default Common;

View File

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