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