提交 54d13dd5 authored 作者: 钟是志's avatar 钟是志

元数据管理

上级 158b70e9
import React from 'react';
import List from './index';
import GetIdByPath from './GetIdByPath';
const ExportAndDetail = (props) => {
const Authority = {
add: false, // 新增
delete: false, // 删除
detail: true, // 详情
exportUtil: true, // 导出
importUtil: false, // 导入
};
return <GetIdByPath {...props}
Authority={Authority}
/>;
};
export default ExportAndDetail;
...@@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; ...@@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
import { Divider, message, Modal, Popconfirm } from 'antd'; import { Divider, message, Modal, Popconfirm } from 'antd';
import moment from 'moment'; import moment from 'moment';
import router from 'umi/router'; import router from 'umi/router';
// import ExportInfo from '../Export/index'; import ExportInfo from '../Export/index';
import { text, number, date, getFormArrayConfig } from '../config/index'; import { text, number, date, getFormArrayConfig } from '../config/index';
import ButtonDiy from '@/baseComponent/ButtonDiy'; import ButtonDiy from '@/baseComponent/ButtonDiy';
import Shell from '../Shell'; import Shell from '../Shell';
...@@ -50,7 +50,7 @@ const CreateForm = props => { ...@@ -50,7 +50,7 @@ const CreateForm = props => {
fileSpan={{ big: 2, small: 2 }} fileSpan={{ big: 2, small: 2 }}
changeValue={changeFormData} changeValue={changeFormData}
/> />
<div style={{ clear: 'both' }} /> <div style={{ clear: 'both' }}/>
</Modal> </Modal>
); );
}; };
...@@ -79,7 +79,7 @@ class FormList extends React.Component { ...@@ -79,7 +79,7 @@ class FormList extends React.Component {
// 渲染值 // 渲染值
componentDidMount() { componentDidMount() {
const { objId } = this.props; const { objId, Authority } = this.props;
getHead({ dataObjId: objId }, datas => { getHead({ dataObjId: objId }, datas => {
if (!datas) return; if (!datas) return;
this.setState({ formItem: datas }); this.setState({ formItem: datas });
...@@ -116,26 +116,19 @@ class FormList extends React.Component { ...@@ -116,26 +116,19 @@ class FormList extends React.Component {
this.setState({ this.setState({
searchConfig, searchConfig,
}); });
let opt = { /*let opt = {
title: '操作', title: '操作',
render: (text, record) => ( render: (text, record) => (
<Fragment> <Fragment>
<div> <div>
<a onClick={this.modify.bind(this, record)}>编辑</a> <a onClick={this.modify.bind(this, record)}>
<Divider type="vertical" /> 编辑
<Popconfirm </a>
title="确定删除该数据?"
onConfirm={this.delete.bind(this, record)}
okText="确定"
cancelText="取消"
>
<a>删除</a>
</Popconfirm>
</div> </div>
</Fragment> </Fragment>
), ),
}; };
this.columns.push(opt); this.columns.push(opt);*/
this.getPage(); this.getPage();
}); });
} }
...@@ -263,13 +256,12 @@ class FormList extends React.Component { ...@@ -263,13 +256,12 @@ class FormList extends React.Component {
}; };
batchDelete = e => { batchDelete = e => {
const { selectedRows, formItem, objId } = this.state; const { objId } = this.props;
const { selectedRows, formItem } = this.state;
if (!selectedRows) return; if (!selectedRows) return;
const Keys = formItem.filter(i => i.isPrimaryKey).reduce((acc, i) => { const Keys = formItem.filter(i => i.isPrimaryKey).reduce((acc, i) => {
return { ...acc, [i.name]: selectedRows.map(row => row[i.name]).join(',') }; return { ...acc, [i.name]: selectedRows.map(row => row[i.name]).join(',') };
}); });
deleteItem({ keys: JSON.stringify(Keys), objId }, () => { deleteItem({ keys: JSON.stringify(Keys), objId }, () => {
this.setState({ this.setState({
selectedRows: [], selectedRows: [],
...@@ -294,20 +286,11 @@ class FormList extends React.Component { ...@@ -294,20 +286,11 @@ class FormList extends React.Component {
render() { render() {
const { const {
modalVisible, modalVisible, selectedRows, formItem, isAdd,
selectedRows, pageData, showEdit, formData, primaryKey,
formItem, formValues, searchConfig,
isAdd,
objId,
pageData,
showEdit,
formData,
primaryKey,
formValues,
searchConfig,
} = this.state; } = this.state;
const { hasExport, hasImport } = this.props; const { objId, Authority } = this.props;
const parentMethods = { const parentMethods = {
handleAdd: this.handleAdd, handleAdd: this.handleAdd,
handleModalVisible: this.handleModalVisible, handleModalVisible: this.handleModalVisible,
...@@ -343,10 +326,25 @@ class FormList extends React.Component { ...@@ -343,10 +326,25 @@ class FormList extends React.Component {
) : null} ) : null}
<Shell> <Shell>
<div style={{ paddingLeft: '10px', marginTop: '20px' }}> <div style={{ paddingLeft: '10px', marginTop: '20px' }}>
<ButtonDiy icon="plus" className="primaryBlue" handleClick={this.add} name="新建" /> {
{/* {hasImport && <ImportUtil objId={objId} />} Authority && Authority.add === false ? null :
{hasExport && <ExportInfo objId={objId} />}*/} <ButtonDiy icon="plus"
<ButtonDiy handleClick={this.batchDelete} name="批量删除" /> className="primaryBlue"
handleClick={this.add}
name="新建"/>
}
{
Authority && Authority.delete === false ? null :
<ButtonDiy handleClick={this.batchDelete}
name="批量删除"/>
}
{
Authority && Authority.exportUtil === false ? null :
<ExportInfo objId={objId}/>
}
{/* <ImportUtil objId={objId} />*/}
</div> </div>
<StandardTable <StandardTable
rowKey="row_id" rowKey="row_id"
...@@ -360,7 +358,7 @@ class FormList extends React.Component { ...@@ -360,7 +358,7 @@ class FormList extends React.Component {
</Fragment> </Fragment>
)} )}
<CreateForm {...parentMethods} modalVisible={modalVisible} /> <CreateForm {...parentMethods} modalVisible={modalVisible}/>
</> </>
); );
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论