提交 582dc5db authored 作者: 钟是志's avatar 钟是志

增加 元数据管理的 导入 编辑 功能 且都是通过权限控制

上级 ce731b0a
......@@ -7,6 +7,7 @@ import { getToken } from '@/utils/authority';
import config from '@/config/config';
import QueryItem from './QueryItem';
import OrderItem from './OrderItem';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import FormdataWrapper from '@/utils/object-to-formdata-custom';
......@@ -359,8 +360,10 @@ export default class Index extends React.Component {
} = this.state;
return (
<span>
<Button shape='round' onClick={this.open}>自定义导出</Button>
<div id='downloadDiv' style={{ display: 'none' }}></div>
<ButtonDiy handleClick={this.open} name={'自定义导出'}/>
<div id='downloadDiv' style={{ display: 'none' }}>
</div>
<Modal
width={670}
maskClosable={false}
......
//.nomal{
// background: #fff;
// padding: 10px;
//}
//.title{
// display: flex;
// margin-bottom: 20px;
//}
//.info{
// text-align: center;
// font-weight: bold;
// font-size: 18px;
//}
//.detail{
// text-align: center;
// margin:30px auto;
//}
//.detail img{
// margin: auto 10px;
//}
//.button{
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -moz-flex;
// display: flex;
// -moz-box-pack: center; /*Firefox*/
// -webkit-box-pack: center; /*Safari,Opera,Chrome*/
// box-pack: center;
// -moz-justify-content: center;
// -webkit-justify-content: center;
// justify-content: center;
//}
//.operation{
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -moz-flex;
// display: flex;
// -moz-box-pack: center; /*Firefox*/
// -webkit-box-pack: center; /*Safari,Opera,Chrome*/
// box-pack: center;
// -moz-justify-content: center;
// -webkit-justify-content: center;
// justify-content: center;
//}
//.button Button{
// margin: auto 10px;
//
//}
//.titleInfo p span{
// font-weight: bold;
//}
//.import{
// color: #6ca3c9;
// font-size: 16px;
//}
//.button{
// // background: #eff3f8;
// text-align: center;
// padding:20px;
// margin-top: 20px;
//}
//.tip{
// margin:20px auto;
// padding:10px;
// border-top: 1px solid #ccc;
//}
//.tip span{
// display: block;
// margin:10px;
// font-size: 16px;
//}
//.tip::after{
// content: '';
// position: absolute;
// width: 5px;
// height: 57px;
// background: #e5eaf1;
// margin-top: -141px;
// margin-left: -13px;
//}
//.select button{
// color: #fff;
// padding:10px;
// background: #abbac3;
// border: none;
// margin: 10px;
//}
//.attentionItem{
// background: #f4f5f4;
// padding: 10px;
// box-shadow: 1px 1px 1px #ccc;
//}
//.attentionItem p:nth-child(1){
// font-size: 16px;
// margin-left: 0;
//}
//.attentionItem p{
// font-size: 14px;
// margin-left: 45px;
//}
//.submitButtons{
// margin-left: 34px;
//}
//.contentTable{
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -moz-flex;
// display: flex;
// -moz-box-pack: justify; /*Firefox*/
// -webkit-box-pack:justify; /*Safari,Opera,Chrome*/
// box-pack: justify;
// -moz-justify-content: space-between;
// -webkit-justify-content: space-between;
// justify-content: space-between;
// margin-top: 20px;
//}
//.left{
// width: 50%;
//}
//.right{
// width: 50%;
// border-left: 1px solid #317ecc;
//}
//.error p{
// color: #fff;
// background: #317ecc;
// // margin: 10px auto;
// text-align: left;
// font-size: 18px;
//}
//.download{
// background: #f5f5f5;
// padding: 5px;
// margin-top: -16px;
//}
//.download img{
// margin-top: -2px;
// margin-right: 5px;
//}
//.download button{
// border: none;
// background: #f5f5f5
//}
//.download button:nth-child(1){
// border-right: 1px solid #ccc;
//}
//.download button:nth-child(2){
// border-right: 1px solid #ccc;
//}
//.buttonDown{
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -moz-flex;
// display: flex;
// -moz-box-pack: start; /*Firefox*/
// -webkit-box-pack: start; /*Safari,Opera,Chrome*/
// box-pack: start;
// -moz-justify-content: flex-start;
// -webkit-justify-content: flex-start;
// justify-content: flex-start;
// margin-bottom: 20px;
//}
//.buttonDown>button{
// margin-left: 10px;
// background: #abbac3;
// border: none;
// color: #fff;
// padding: 5px 12px;
// border-radius: 5px;
//}
.nomal {
background: #fff;
padding: 10px;
}
.title {
display: flex;
margin-bottom: 20px;
}
.info {
text-align: center;
font-weight: bold;
font-size: 18px;
}
.detail {
text-align: center;
margin: 30px auto;
}
.detail img {
margin: auto 10px;
}
.button {
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
display: flex;
-moz-box-pack: center; /*Firefox*/
-webkit-box-pack: center; /*Safari,Opera,Chrome*/
box-pack: center;
-moz-justify-content: center;
-webkit-justify-content: center;
justify-content: center;
}
.operation {
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
display: flex;
-moz-box-pack: center; /*Firefox*/
-webkit-box-pack: center; /*Safari,Opera,Chrome*/
box-pack: center;
-moz-justify-content: center;
-webkit-justify-content: center;
justify-content: center;
}
.button Button {
margin: auto 10px;
}
.titleInfo p span {
font-weight: bold;
}
.import {
color: #6ca3c9;
font-size: 16px;
}
.button {
// background: #eff3f8;
text-align: center;
padding: 20px;
margin-top: 20px;
}
.tip {
margin: 20px auto;
padding: 10px;
border-top: 1px solid #ccc;
}
.tip span {
display: block;
margin: 10px;
font-size: 16px;
}
.tip::after {
content: '';
position: absolute;
width: 5px;
height: 57px;
background: #e5eaf1;
margin-top: -141px;
margin-left: -13px;
}
.select button {
color: #fff;
padding: 10px;
background: #abbac3;
border: none;
margin: 10px;
}
.attentionItem {
background: #f4f5f4;
padding: 10px;
box-shadow: 1px 1px 1px #ccc;
}
.attentionItem p:nth-child(1) {
font-size: 16px;
margin-left: 0;
}
.attentionItem p {
font-size: 14px;
margin-left: 45px;
}
.submitButtons {
margin-left: 34px;
}
.contentTable {
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
display: flex;
-moz-box-pack: justify; /*Firefox*/
-webkit-box-pack: justify; /*Safari,Opera,Chrome*/
box-pack: justify;
-moz-justify-content: space-between;
-webkit-justify-content: space-between;
justify-content: space-between;
margin-top: 20px;
}
.left {
width: 50%;
}
.right {
width: 50%;
border-left: 1px solid #317ecc;
}
.error p {
color: #fff;
background: #317ecc;
// margin: 10px auto;
text-align: left;
font-size: 18px;
}
.download {
background: #f5f5f5;
padding: 5px;
margin-top: -16px;
}
.download img {
margin-top: -2px;
margin-right: 5px;
}
.download button {
border: none;
background: #f5f5f5
}
.download button:nth-child(1) {
border-right: 1px solid #ccc;
}
.download button:nth-child(2) {
border-right: 1px solid #ccc;
}
.buttonDown {
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
display: flex;
-moz-box-pack: start; /*Firefox*/
-webkit-box-pack: start; /*Safari,Opera,Chrome*/
box-pack: start;
-moz-justify-content: flex-start;
-webkit-justify-content: flex-start;
justify-content: flex-start;
margin-bottom: 20px;
}
.buttonDown > button {
margin-left: 10px;
background: #abbac3;
border: none;
color: #fff;
padding: 5px 12px;
border-radius: 5px;
}
......@@ -10,7 +10,7 @@ const ExportAndImportAndDetail = (props) => {
const Authority = {
add: true, // 新增
delete: true, // 删除
detail: true, // 详情
edit: true, // 编辑
auditDetail: false, // 审核详情
exportUtil: true, // 导出
importUtil: true, // 导入
......@@ -20,4 +20,4 @@ const ExportAndImportAndDetail = (props) => {
/>;
};
export default ExportAndDetail;
export default ExportAndImportAndDetail;
......@@ -8,7 +8,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import Shell from '../Shell';
import FormArray from '../AffairPage/component/FormArray';
import Edit from '../Edit/index';
// import ImportUtil from '../ImportUtil/ImportUtil';
import ImportUtil from '../ImportUtil/ImportUtil';
import SearchDom from '@/highOrderComponent/SearchDom';
import StandardTable from '@/components/StandardTable';
import { getHead, fetchData, deleteItem, add, getDetailId } from './services';
......@@ -80,18 +80,25 @@ class FormList extends React.Component {
}
// 渲染值
componentDidMount() {
this.getTableHead();
this.getTableHead();
}
getTableHead = () => {
const { objId, Authority } = this.props;
getHead({ dataObjId: objId }, datas => {
if (!datas) return;
let findPrimaryKey = datas.find((x) => {
return x.isPrimaryKey === true;
});
if (findPrimaryKey) {
this.setState({
primaryKey: findPrimaryKey.name,
});
} else {
console.error('没有数据主键,无法执行删除操作');
}
datas = datas.filter((x) => {
return x.isHidden !== true;
});
......@@ -99,23 +106,20 @@ class FormList extends React.Component {
item.extendType = item.extendTypeId;
item.dataIndex = item.name;
item.dataType = item.type;
if (item.isPrimaryKey) {
this.setState({
primaryKey: item.name,
});
}
}
datas = handleColumns(datas);
if (Authority && Authority.auditDetail) {
if (Authority && Authority.auditDetail) { //流程审核详情 和 编辑,查看 不能 同时存在.
datas.push(
{
dataIndex: 'operation',
title: '操作',
dataIndex: 'auditProcessDetail',
title: '审核详情',
fixed: datas.length > 12 ? 'right' : false,
render: (text, record) => {
return (<a onClick={()=>{this.getIdByCode(record.process_biz_key)}}>
return (<a onClick={() => {
this.getIdByCode(record.process_biz_key);
}}>
流程审核详情
</a> );
</a>);
/*return (<Link to={
{
pathname: './Detail',
......@@ -131,24 +135,9 @@ class FormList extends React.Component {
},
);
}
this.columns = datas;
this.setState({ formItem: datas });
/* let i = 0;
for (let t in datas) {
/!* if (i < 10) {
let column = {};
column.title = datas[t].title;
column.dataIndex = datas[t].name;
if (date.includes(datas[t].type)) {
column.render = val => val && moment(val).format('YYYY-MM-DD HH:mm:ss');
}
this.columns.push(column);
i++;
}*!/
if (datas[t].isPrimaryKey) {
}
}*/
let searchConfig = [];
for (let item of datas) {
if (item.isShowQuery) {
......@@ -164,37 +153,40 @@ class FormList extends React.Component {
this.setState({
searchConfig,
});
/*let opt = {
title: '操作',
render: (text, record) => (
<Fragment>
<div>
<a onClick={this.modify.bind(this, record)}>
编辑
</a>
</div>
</Fragment>
),
};
this.columns.push(opt);*/
if (Authority && Authority.edit) { //编辑功能
datas.push(
{
dataIndex: 'operationEdit',
title: '编辑',
fixed: 'right',
width: 60,
render: (text, record) => {
return (
<a onClick={this.modify.bind(this, record)}>
编辑
</a>);
},
},
);
}
this.getPage();
});
};
getIdByCode = (code) => {
getDetailId({code},res=>{
getDetailId({ code }, res => {
router.push({
pathname: './Detail',
state: {
record: {id: res.id},
}
record: { id: res.id },
},
});
})
});
};
modify = record => {
const { formItem } = this.state;
if (formItem.length < 10) {
if (formItem.length < 10 || true) {
this.setState({
formData: { ...record },
modalVisible: true,
......@@ -293,7 +285,7 @@ class FormList extends React.Component {
add = () => {
const { formItem } = this.state;
if (formItem.length < 10) {
if (formItem.length < 10 || true) {
this.setState({
modalVisible: true,
formData: {},
......@@ -314,14 +306,23 @@ class FormList extends React.Component {
});
};
batchDelete = e => {
batchDelete = (e) => {
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(',') };
if (!selectedRows || selectedRows.length < 1) {
message.warning('请选择您要删除的数据');
return false;
}
// 找出主键
const { primaryKey } = this.state;
let Keys = selectedRows.map((x) => {
return x[primaryKey];
});
deleteItem({ keys: JSON.stringify(Keys), objId }, () => {
deleteItem({
keys: JSON.stringify({ [primaryKey]: Keys.join(',') }),
objId,
// isSelf: true,
}, () => {
this.setState({
selectedRows: [],
});
......@@ -358,6 +359,7 @@ class FormList extends React.Component {
isAdd,
changeFormData: this.changeFormData,
};
console.log(this.columns);
return (
<>
{showEdit ? (
......@@ -402,12 +404,16 @@ class FormList extends React.Component {
Authority && Authority.exportUtil === false ? null :
<ExportInfo objId={objId}/>
}
{/* <ImportUtil objId={objId} />*/}
{
Authority && Authority.importUtil === false ? null :
<ImportUtil objId={objId}
callback={this.getPage}
/>
}
</div>
<StandardTable
rowKey="row_id"
rowKey={primaryKey}
data={pageData}
columns={this.columns}
selectedRows={selectedRows}
......
......@@ -61,7 +61,7 @@ const transLateTimeTOUnix = (value, dataType) => {
const getFormArrayConfig = header => {
let config = [];
for (let item of header) {
if (item.isPrimaryKey || item.isHidden) {
if (item.isPrimaryKey || item.isHidden || item.dataIndex === 'operationEdit') {
// 主键
continue;
/* config.push(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论