Browse Source

标签集、标签-删除

master
zmh 2 years ago
parent
commit
65b04f2b51
  1. 4
      web/client/src/sections/metadataManagement/components/tagSetModal.js
  2. 19
      web/client/src/sections/metadataManagement/containers/tagManagement.js

4
web/client/src/sections/metadataManagement/components/tagSetModal.js

@ -50,14 +50,14 @@ const TagSetModal = (props) => {
} }
return ( return (
<Modal title={editData.title} visible={true} destroyOnClose <Modal title={editData.title} visible={true} destroyOnClose
okText='保存' width={800} okText='确定' width={800}
onOk={() => handleOk(null)} onOk={() => handleOk(null)}
onCancel={onCancel}> onCancel={onCancel}>
<Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} initialValues={editData || {}}> <Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} initialValues={editData || {}}>
<Form.Item <Form.Item
label={editData.label} label={editData.label}
name='name' name='name'
rules={[{ required: true, message: '' }, { max: 50, message: `${editData.label}不超过50个字` }, rules={[{ required: true, message: '' }, { max: 50, message: `${editData.label}不超过50个字` },
({ getFieldValue, validateFields }) => ({ ({ getFieldValue, validateFields }) => ({
validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields) } validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields) }
})]}> })]}>

19
web/client/src/sections/metadataManagement/containers/tagManagement.js

@ -41,10 +41,12 @@ const TagManagement = (props) => {
setEditData({ setEditData: true, title: '编辑标签集', label: '标签集名称', name: ts.tagSetName, id: ts.tagSetId }); setEditData({ setEditData: true, title: '编辑标签集', label: '标签集名称', name: ts.tagSetName, id: ts.tagSetId });
setModalVisible(true); setModalVisible(true);
}} /> }} />
<Popconfirm placement="top" title={'确定删除该标签集吗?'} onConfirm={() => { }} okText="确定" cancelText="取消"> <Popconfirm placement="top" title={'确定删除该标签集吗?存在的标签将会一并删除!'} onConfirm={() => {
dispatch(metadataManagement.delTagSets(ts.tagSetId)).then(() => { initData(true); });
}} okText="确定" cancelText="取消">
<CloseOutlined style={{ marginLeft: 10 }} /> <CloseOutlined style={{ marginLeft: 10 }} />
</Popconfirm> </Popconfirm>
</div> </div >
} }
const tag = (t, tagSetId) => { const tag = (t, tagSetId) => {
if (t) if (t)
@ -53,7 +55,9 @@ const TagManagement = (props) => {
setEditData({ setEditData: false, title: '编辑标签', label: '标签名称', name: t.name, id: t.id }); setEditData({ setEditData: false, title: '编辑标签', label: '标签名称', name: t.name, id: t.id });
setModalVisible(true); setModalVisible(true);
}} /> }} />
<Popconfirm placement="top" title={'确定删除该标签吗?'} onConfirm={() => { }} okText="确定" cancelText="取消"> <Popconfirm placement="top" title={'确定删除该标签吗?'} onConfirm={() => {
dispatch(metadataManagement.delTags(t.id)).then(() => { initData(true); });
}} okText="确定" cancelText="取消">
<CloseOutlined style={{ marginLeft: 10 }} /> <CloseOutlined style={{ marginLeft: 10 }} />
</Popconfirm> </Popconfirm>
</div> </div>
@ -61,7 +65,7 @@ const TagManagement = (props) => {
return <div style={{ cursor: 'pointer' }} onClick={() => { return <div style={{ cursor: 'pointer' }} onClick={() => {
setEditData({ setEditData: false, title: '新建标签', label: '标签名称', tagSetId: tagSetId }); setEditData({ setEditData: false, title: '新建标签', label: '标签名称', tagSetId: tagSetId });
setModalVisible(true); setModalVisible(true);
}}><PlusOutlined style={{ margin: '0px 10px' }} /></div> }}><PlusOutlined style={{ margin: '0px 10px', fontSize: 16 }} /></div>
} }
const onSearch = () => { const onSearch = () => {
let data = []; let data = [];
@ -110,13 +114,12 @@ const TagManagement = (props) => {
} }
} }
return <Spin spinning={isRequesting}> return <Spin spinning={isRequesting}>
<div style={{ marginBottom: 12 }}> <div style={{ marginBottom: 16 }}>
{/* <Button type='primary' onClick={() => { }}>刷新</Button> */} <Button type='primary' onClick={() => {
<Button type='primary' style={{ marginLeft: 16 }} onClick={() => {
setEditData({ setEditData: true, title: '新建标签集', label: '标签集名称' }); setEditData({ setEditData: true, title: '新建标签集', label: '标签集名称' });
setModalVisible(true); setModalVisible(true);
}}>新建标签集</Button> }}>新建标签集</Button>
<Button type='primary' style={{ marginLeft: 16, float: 'right' }} onClick={onSearch}>查询</Button> <Button type='primary' style={{ marginLeft: 16, float: 'right' }} onClick={onSearch}>搜索</Button>
<Input style={{ width: 220, float: 'right' }} placeholder="输入标签或标签集名称" <Input style={{ width: 220, float: 'right' }} placeholder="输入标签或标签集名称"
allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} /> allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} />
</div> </div>

Loading…
Cancel
Save