Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
582dc5db
提交
582dc5db
authored
5月 08, 2020
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加 元数据管理的 导入 编辑 功能 且都是通过权限控制
上级
ce731b0a
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
668 行增加
和
618 行删除
+668
-618
index.js
FormInsertDiy/Export/index.js
+5
-2
ImportUtil.js
FormInsertDiy/ImportUtil/ImportUtil.js
+389
-377
ImportUtil.less
FormInsertDiy/ImportUtil/ImportUtil.less
+207
-178
ExportAndImportAndDetail.js
FormInsertDiy/List/ExportAndImportAndDetail.js
+2
-2
index.js
FormInsertDiy/List/index.js
+64
-58
index.js
FormInsertDiy/config/index.js
+1
-1
没有找到文件。
FormInsertDiy/Export/index.js
浏览文件 @
582dc5db
...
@@ -7,6 +7,7 @@ import { getToken } from '@/utils/authority';
...
@@ -7,6 +7,7 @@ import { getToken } from '@/utils/authority';
import
config
from
'@/config/config'
;
import
config
from
'@/config/config'
;
import
QueryItem
from
'./QueryItem'
;
import
QueryItem
from
'./QueryItem'
;
import
OrderItem
from
'./OrderItem'
;
import
OrderItem
from
'./OrderItem'
;
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
import
FormdataWrapper
from
'@/utils/object-to-formdata-custom'
;
import
FormdataWrapper
from
'@/utils/object-to-formdata-custom'
;
...
@@ -359,8 +360,10 @@ export default class Index extends React.Component {
...
@@ -359,8 +360,10 @@ export default class Index extends React.Component {
}
=
this
.
state
;
}
=
this
.
state
;
return
(
return
(
<
span
>
<
span
>
<
Button
shape
=
'round'
onClick
=
{
this
.
open
}
>
自定义导出
<
/Button
>
<
ButtonDiy
handleClick
=
{
this
.
open
}
name
=
{
'自定义导出'
}
/
>
<
div
id
=
'downloadDiv'
style
=
{{
display
:
'none'
}}
><
/div
>
<
div
id
=
'downloadDiv'
style
=
{{
display
:
'none'
}}
>
<
/div
>
<
Modal
<
Modal
width
=
{
670
}
width
=
{
670
}
maskClosable
=
{
false
}
maskClosable
=
{
false
}
...
...
FormInsertDiy/ImportUtil/ImportUtil.js
浏览文件 @
582dc5db
// import React, { Fragment } from 'react';
import
React
,
{
Fragment
}
from
'react'
;
// import {
import
{
Button
,
Modal
,
Steps
,
Upload
,
Icon
,
message
,
Tabs
,
Table
}
from
'antd'
;
// Button,
import
styles
from
'./ImportUtil.less'
;
// Modal,
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
// Steps,
import
{
exportExcel
}
from
'xlsx-oc'
;
// Upload,
import
config
from
'@/config/config'
;
// Icon,
import
{
connect
}
from
'dva'
;
// message,
// Tabs,
const
Step
=
Steps
.
Step
;
// Table,
// } from 'antd';
const
TabPane
=
Tabs
.
TabPane
;
// import styles from './ImportUtil.less';
// import ButtonDiy from '@/baseComponent/ButtonDiy';
@
connect
(({
DataObj
,
loading
})
=>
({
// import { exportExcel } from 'xlsx-oc'
DataObj
,
// import config from '@/config/config';
loading
:
loading
.
models
.
DataObj
,
// import { connect } from 'dva';
}))
// const Step = Steps.Step;
export
default
class
ImportUtil
extends
React
.
PureComponent
{
//
constructor
(
props
)
{
//
super
(
props
);
// const TabPane = Tabs.TabPane;
//
const
exportTemplateUrl
=
encodeURI
(
//
`
${
config
.
sqlFormsServer
}
/DataObjApi/importTemplateDownload?objId=
${
this
.
props
.
objId
}
&name=
${
// @connect(({ DataObj, loading }) => ({
props
.
fileName
// DataObj,
}
`
,
// loading: loading.models.DataObj,
);
// }))
// export default class ImportUtil extends React.PureComponent {
this
.
state
=
{
// constructor(props) {
ch
:
false
,
// super(props);
currentKey
:
'1'
,
//
visible
:
false
,
// const exportTemplateUrl= encodeURI(`${config.sqlFormsServer}/DataObjApi/importTemplateDownload?objId=${this.props.objId}&name=${props.fileName}`);
current
:
0
,
//
isShow
:
true
,
// this.state = {
filekey
:
''
,
// ch:false,
sucData
:
[],
// currentKey:"1",
errData
:
[],
// visible: false,
column
:
[],
// current: 0,
// isShow: true,
exportTemplateUrl
,
// filekey: '',
// sucData: [],
isNextDisabled
:
false
,
// errData: [],
};
// column: [],
}
//
// exportTemplateUrl,
showModal
=
()
=>
{
//
this
.
setState
({
// isNextDisabled:false,
visible
:
true
,
// };
});
// }
};
//
handleOk
=
(
e
)
=>
{
// showModal = () => {
this
.
setState
({
//
visible
:
false
,
// this.setState({
});
// visible: true,
};
// });
handleCancel
=
(
e
)
=>
{
// };
this
.
setState
({
// handleOk = (e) => {
visible
:
false
,
// this.setState({
});
// visible: false,
};
// });
// };
next
()
{
// handleCancel = (e) => {
const
current
=
this
.
state
.
current
+
1
;
// this.setState({
if
(
current
===
2
)
{
// visible: false,
this
.
setState
({
// });
current
:
current
,
// };
isShow
:
false
,
//
});
// next() {
if
(
this
.
state
.
errData
.
lenth
>
0
)
{
// const current = this.state.current + 1;
message
.
error
(
'请检查数据'
);
// if (current === 2) {
return
;
// this.setState({
}
else
{
// current: current,
this
.
import
();
// isShow: false,
}
// });
}
// if (this.state.errData.lenth > 0) {
if
(
current
===
3
)
{
// message.error('请检查数据');
this
.
setState
({
// return;
current
:
current
,
// } else {
isShow
:
true
,
// this.import();
});
// }
if
(
this
.
props
.
callback
)
{
// }
this
.
props
.
callback
();
// if (current === 3) {
}
// this.setState({
}
// current: current,
}
// isShow: true,
// });
prev
()
{
// if (this.props.callback) {
const
current
=
this
.
state
.
current
-
1
;
// this.props.callback();
this
.
setState
({
current
});
// }
}
// }
//
import
()
{
// }
const
{
dispatch
,
importParams
}
=
this
.
props
;
//
dispatch
({
// prev() {
type
:
'DataObj/importExecute'
,
// const current = this.state.current - 1;
payload
:
{
// this.setState({ current });
...(
importParams
||
{}),
// }
cacheKey
:
this
.
state
.
filekey
,
//
// import() {
objId
:
this
.
props
.
objId
,
// const { dispatch ,importParams } = this.props;
},
// dispatch({
callback
:
(
res
)
=>
{
// type: 'DataObj/importExecute',
this
.
next
();
// payload: {
message
.
success
(
'导入成功'
);
// ...(importParams||{}),
// cacheKey:this.state.filekey,
this
.
setState
({
//
current
:
3
,
// objId: this.props.objId,
isShow
:
true
,
// },
visible
:
false
,
// callback: (res) => {
});
//
if
(
this
.
props
.
callback
)
{
// this.next();
this
.
props
.
callback
();
// message.success('导入成功');
}
//
},
// this.setState({
});
// current: 3,
}
// isShow: true,
// visible: false,
getCachKey
=
(
filePath
)
=>
{
//
const
{
dispatch
,
importParams
}
=
this
.
props
;
// });
dispatch
({
// if(this.props.callback){
type
:
'DataObj/importAnalyse'
,
// this.props.callback();
payload
:
{
// }
...(
importParams
||
{}),
// }
isLocal
:
false
,
// })
filePath
,
//
objId
:
this
.
props
.
objId
,
//
},
// }
callback
:
(
res
)
=>
{
//
this
.
setState
({
// getCachKey = (filePath) => {
filekey
:
res
.
cacheKey
,
// const { dispatch ,importParams } = this.props;
});
// dispatch({
this
.
queryFile
(
res
.
cacheKey
);
// type: 'DataObj/importAnalyse',
},
// payload: {
});
// ...(importParams||{}),
};
// isLocal:false,
queryFile
=
(
cacheKey
)
=>
{
// filePath,
const
{
dispatch
,
importParams
}
=
this
.
props
;
// objId: this.props.objId,
dispatch
({
// },
type
:
'DataObj/importDataQuery'
,
// callback: (res) => {
payload
:
{
// this.setState({
...(
importParams
||
{}),
// filekey: res.cacheKey,
cacheKey
,
//
objId
:
this
.
props
.
objId
,
// });
},
// this.queryFile(res.cacheKey);
callback
:
(
res
)
=>
{
//
this
.
setState
({
// }
current
:
1
,
// })
isShow
:
false
,
//
//
sucData
:
res
.
pass
,
// };
errData
:
res
.
noPass
,
// queryFile = (cacheKey) => {
column
:
res
.
column
,
// const { dispatch ,importParams } = this.props;
});
// dispatch({
if
(
res
.
noPass
&&
res
.
noPass
.
length
==
0
)
{
// type: 'DataObj/importDataQuery',
if
(
res
.
pass
.
length
==
0
)
{
// payload: {
message
.
error
(
'当前没有验证成功的数据,无法导入。'
);
// ...(importParams||{}),
this
.
setState
({
// cacheKey,
currentKey
:
'1'
,
// objId: this.props.objId,
ch
:
!
this
.
state
.
ch
,
// },
isNextDisabled
:
true
,
// callback: (res) => {
});
// this.setState({
}
else
{
// current: 1,
message
.
success
(
'所有数据验证通过,请确认后点击下一步。'
);
// isShow: false,
this
.
setState
({
//
currentKey
:
'2'
,
// sucData: res.pass,
ch
:
!
this
.
state
.
ch
,
// errData: res.noPass,
isNextDisabled
:
false
,
// column: res.column
});
// });
}
// if(res.noPass&&res.noPass.length==0){
}
else
{
//
message
.
error
(
'当前存在未验证通过的数据,请按错误提示检测更正导入文件'
);
//
this
.
setState
({
// if (res.pass.length==0) {
currentKey
:
'1'
,
// message.error('当前没有验证成功的数据,无法导入。');
ch
:
!
this
.
state
.
ch
,
// this.setState({
isNextDisabled
:
true
,
// currentKey:"1",
});
// ch:!this.state.ch,
}
// isNextDisabled: true
},
// });
});
// } else {
};
// message.success('所有数据验证通过,请确认后点击下一步。');
changePane
=
(
activeKey
)
=>
{
// this.setState({
this
.
setState
({
currentKey
:
activeKey
});
// currentKey:"2",
};
// ch:!this.state.ch,
exportError
=
(
column
,
dataSource
)
=>
{
// isNextDisabled: false
var
_headers
=
[];
// });
for
(
var
i
=
0
;
i
<
column
.
length
;
i
++
)
{
// }
_headers
.
push
({
k
:
column
[
i
].
dataIndex
,
v
:
column
[
i
].
title
});
// }else{
}
// message.error('当前存在未验证通过的数据,请按错误提示检测更正导入文件');
for
(
var
j
=
0
;
j
<
dataSource
.
length
;
j
++
)
{
// this.setState({
dataSource
[
j
].
index
=
j
+
1
;
// currentKey:"1",
}
// ch:!this.state.ch,
exportExcel
(
_headers
,
dataSource
);
// isNextDisabled: true
};
// });
// }
render
()
{
//
const
props
=
{
// }
name
:
'file'
,
// })
action
:
config
.
sqlFormsServer
+
'/upload'
,
// };
// changePane=(activeKey)=>{
headers
:
{
// this.setState({currentKey:activeKey})
authorization
:
'authorization-text'
,
// }
},
// exportError=(column,dataSource)=>{
accept
:
'.xlsx'
,
//
showUploadList
:
false
,
//
onChange
:
(
info
)
=>
{
// var _headers = []
if
(
info
.
file
.
status
!==
'uploading'
)
{
// for(var i=0;i<column.length;i++){
}
// _headers.push({k:column[i].dataIndex,v:column[i].title})
if
(
info
.
file
.
status
===
'done'
)
{
// }
message
.
success
(
`
${
info
.
file
.
name
}
上传成功`
);
// for(var j=0;j<dataSource.length;j++){
let
x
=
info
.
file
.
response
;
// dataSource[j].index=j+1
// }
this
.
getCachKey
(
x
);
// exportExcel(_headers, dataSource);
}
else
if
(
info
.
file
.
status
===
'error'
)
{
//
message
.
error
(
`
${
info
.
file
.
name
}
file upload failed.`
);
//
}
// }
},
// render() {
};
//
const
steps
=
[
// const props = {
{
// name: 'file',
title
:
'上传Excel'
,
// action: config.uploadUrl,
},
//
{
// headers: {
title
:
'验证数据'
,
// authorization: 'authorization-text',
},
// },
{
// accept:'.xlsx',
title
:
'数据导入'
,
// showUploadList: false,
},
// onChange: (info) => {
{
// if (info.file.status !== 'uploading') {
title
:
'导入完成'
,
//
},
// }
];
// if (info.file.status === 'done') {
// message.success(`${info.file.name} 上传成功`);
const
{
current
}
=
this
.
state
;
// let x = info.file.response;
const
{
name
,
loading
}
=
this
.
props
;
//
const
column1
=
this
.
state
.
column
//
?
[
//
{
// this.getCachKey(x);
title
:
'序号'
,
//
dataIndex
:
'index'
,
// } else if (info.file.status === 'error') {
fixed
:
'left'
,
// message.error(`${info.file.name} file upload failed.`);
width
:
50
,
// }
render
:
(
v
,
r
,
i
)
=>
i
+
1
,
// },
},
// };
...
this
.
state
.
column
,
// const steps = [{
]
// title: '上传Excel',
:
[];
// }, {
var
column2
=
this
.
state
.
column
?
[...
this
.
state
.
column
]
:
[];
// title: '验证数据',
if
(
column1
.
length
>
1
)
// }, {
column1
[
1
].
render
=
(
val
)
=>
<
span
style
=
{{
color
:
'red'
}}
>
{
val
}
<
/span>
;
// title: '数据导入',
// },
column2
.
splice
(
0
,
1
);
// {
column2
=
[{
title
:
'序号'
,
fixed
:
'left'
,
width
:
50
,
render
:
(
v
,
r
,
i
)
=>
i
+
1
},
...
column2
];
// title: '导入完成',
// }];
return
(
//
<
span
>
// const { current } = this.state;
<
ButtonDiy
// const {name, loading} = this.props
name
=
{
name
||
'批量导入'
}
// const column1=this.state.column?[{title:"序号",dataIndex:"index",fixed:"left",width:50, render:(v,r,i)=>i+1},...this.state.column]:[]
type
=
"default"
// var column2=this.state.column?[...this.state.column]:[]
className
=
"defaultBlue"
// if(column1.length>1) column1[1].render=(val)=><span style={{color:"red"}}>{val}</span>
handleClick
=
{
this
.
showModal
}
//
/
>
// column2.splice(0,1)
<
Modal
// column2=[{title:"序号",fixed:"left",width:50, render:(v,r,i)=>i+1},...column2]
visible
=
{
this
.
state
.
visible
}
//
onOk
=
{
this
.
handleOk
}
// return (
maskClosable
=
{
false
}
// <span>
destroyOnClose
// <ButtonDiy name={name||'批量导入'}
onCancel
=
{
this
.
handleCancel
}
// type='default'
title
=
{
null
}
// className='defaultBlue'
footer
=
{
null
}
// handleClick={this.showModal}/>
width
=
{
'80%'
}
>
// <Modal
<
div
className
=
{
styles
.
nomal
}
>
// visible={this.state.visible}
<
p
className
=
{
styles
.
import
}
>
EXCEL
导入向导
<
/p
>
// onOk={this.handleOk}
<
div
style
=
{{
margin
:
'auto 23px'
}}
>
// maskClosable={false}
<
Steps
current
=
{
current
}
>
// destroyOnClose
{
steps
.
map
((
item
)
=>
(
// onCancel={this.handleCancel}
<
Step
key
=
{
item
.
title
}
title
=
{
item
.
title
}
/
>
// title={null}
))}
// footer={null}
<
/Steps
>
// width={"80%"}
<
div
className
=
"steps-content"
>
{
steps
[
this
.
state
.
current
].
content
}
<
/div
>
// >
<
div
className
=
{
styles
.
button
}
>
//
{
this
.
state
.
current
<
steps
.
length
-
1
&&
// <div className={styles.nomal}>
this
.
state
.
current
!==
0
&&
(
// <p className={styles.import}>
<
ButtonDiy
// EXCEL导入向导
name
=
{
this
.
state
.
current
==
3
?
'确认导入'
:
'下一步'
}
// </p>
type
=
"primary"
// <div style={{ margin: 'auto 23px' }}>
disabled
=
{
this
.
state
.
current
!=
3
&&
this
.
state
.
isNextDisabled
}
// <Steps current={current}>
className
=
"primaryBlue"
// {steps.map(item =>
handleClick
=
{()
=>
this
.
next
()}
// <Step key={item.title}
/
>
// title={item.title}/>)}
)}
// </Steps>
// <div className="steps-content">
{
this
.
state
.
current
>
0
&&
(
// {steps[this.state.current].content}
<
ButtonDiy
// </div>
style
=
{{
marginLeft
:
8
}}
// <div className={styles.button}>
name
=
"上一步"
// {
className
=
"defaultBlue"
// (this.state.current < steps.length - 1 && this.state.current !== 0)
handleClick
=
{()
=>
this
.
prev
()}
// &&
/
>
// <ButtonDiy name={this.state.current==3?"确认导入":"下一步"} type="primary" disabled={this.state.current!=3 && this.state.isNextDisabled} className='primaryBlue' handleClick={() => this.next()}/>
)}
//
<
/div
>
// }
<
/div
>
//
// {
<
div
className
=
{
styles
.
tip
}
>
// this.state.current > 0
<
p
className
=
{
styles
.
tipContent
}
>
// &&
<
span
>
欢迎使用
EXCEL
导入向导,首先请您上传需要导入的
EXCEL
文件。
<
/span
>
// <ButtonDiy style={{ marginLeft: 8 }} name="上一步" className='defaultBlue' handleClick={() => this.prev()}/>
<
span
>
//
点击“选择文件”选择您要导入的
EXCEL
文件,点击“开始上传”将其上传到服务器上,点击“清空队列”清空当前上传文件队列。
// }
<
/span
>
// </div>
<
/p
>
// </div>
<
/div
>
//
{
this
.
state
.
isShow
?
(
// <div className={styles.tip}>
<
div
className
=
{
styles
.
buttonDown
}
>
// <p className={styles.tipContent}>
<
Upload
{...
props
}
>
// <span>欢迎使用EXCEL导入向导,首先请您上传需要导入的EXCEL文件。</span>
<
Button
style
=
{{
marginRight
:
'20px'
}}
>
// <span>点击“选择文件”选择您要导入的EXCEL文件,点击“开始上传”将其上传到服务器上,点击“清空队列”清空当前上传文件队列。</span>
<
Icon
type
=
"upload"
/>
// </p>
点击上传
//
<
/Button
>
// </div>
<
/Upload
>
// {
<
Button
href
=
{
this
.
state
.
exportTemplateUrl
}
target
=
"_blank"
type
=
"danger"
>
// this.state.isShow ?
下载模板
// <div className={styles.buttonDown}>
<
/Button
>
// <Upload {...props}>
<
/div
>
// <Button>
)
:
(
// <Icon type="upload"/>点击上传
<
Upload
{...
props
}
>
// </Button>
<
Button
>
// </Upload>
<
Icon
type
=
"upload"
/>
// <Button href={this.state.exportTemplateUrl }
重新上传
// target="_blank"
<
/Button
>
// type="danger">
<
/Upload
>
// 下载模板
)}
// </Button>
// </div> :
{
this
.
state
.
isShow
?
(
// <Upload {...props}>
<
div
className
=
{
styles
.
attentionItem
}
>
// <Button>
<
p
>
导入事项
<
/p
>
// <Icon type="upload"/>
<
p
>
1
.
导入操作一次只能上传
1
个
EXCEL
文件。
<
/p
>
// 重新上传
<
p
>
2
.
导入文件最大文件大小上传
1
GB
。
<
/p
>
// </Button>
<
p
>
3
.
只能上传
EXCEL
文件
(
XLS
,
XLSX
)
默认支持
EXCEL
2003
和
EXCEL
2007
。
<
/p
>
// </Upload>
<
p
>
4
.
请将
EXCEL
文件的所有单元格格式设置为“文本”格式
<
/p
>
// }
<
/div
>
//
)
:
(
// {
<
div
className
=
{
styles
.
error
}
style
=
{{
marginTop
:
20
}}
>
// this.state.isShow ? <div className={styles.attentionItem}>
<
Tabs
// <p>导入事项</p>
activeKey
=
{
this
.
state
.
currentKey
}
// <p>1. 导入操作一次只能上传 1 个EXCEL文件。</p>
key
=
{
this
.
state
.
ch
}
// <p>2. 导入文件最大文件大小上传 1 GB。</p>
onChange
=
{
this
.
changePane
}
// <p>3. 只能上传EXCEL文件(XLS, XLSX) 默认支持EXCEL 2003和EXCEL 2007。</p>
type
=
"card"
>
// <p>4. 请将EXCEL文件的所有单元格格式设置为“文本”格式</p>
{
this
.
state
.
errData
&&
this
.
state
.
errData
.
length
==
0
?
(
// </div> :
''
// <div className={styles.error} style={{marginTop:20}}>
)
:
(
//
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
'red'
}}
>
验证错误列表
<
/span>} key="1"
>
// <Tabs activeKey={this.state.currentKey} key={this.state.ch} onChange={this.changePane} type="card">
<
Button
// {this.state.errData&&this.state.errData.length==0?"":<TabPane tab={<span style={{color:"red"}}>验证错误列表</span>} key="1">
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
// <Button style={{marginTop:5,marginBottom:5}} type="danger" onClick={this.exportError.bind(this,column1,this.state.errData)}>导出错误信息</Button>
type
=
"danger"
//
onClick
=
{
this
.
exportError
.
bind
(
this
,
column1
,
this
.
state
.
errData
)}
>
// <Table columns={column1} size="small"
导出错误信息
// style={{overflow: 'auto'}}
<
/Button
>
// dataSource={this.state.errData}
// bordered={true}/></TabPane>}
<
Table
// <TabPane tab={<span style={{color:"green"}}>验证成功列表</span>} key="2">
columns
=
{
column1
}
//
size
=
"small"
// <Button style={{marginTop:5,marginBottom:5}} type="primary" onClick={this.exportError.bind(this,column2,this.state.sucData)}>导出正确信息</Button>
style
=
{{
overflow
:
'auto'
}}
//
dataSource
=
{
this
.
state
.
errData
}
// <Table columns={column2} size="small"
bordered
=
{
true
}
// style={{overflow: 'auto'}}
/
>
// dataSource={this.state.sucData}
<
/TabPane
>
// bordered={true}/></TabPane>
)}
//
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
'green'
}}
>
验证成功列表
<
/span>} key="2"
>
// </Tabs>
<
Button
//
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
//
type
=
"primary"
// </div>
onClick
=
{
this
.
exportError
.
bind
(
this
,
column2
,
this
.
state
.
sucData
)}
>
// }
导出正确信息
// </div>
<
/Button
>
//
// </Modal>
<
Table
// </span>
columns
=
{
column2
}
// );
size
=
"small"
// }
style
=
{{
overflow
:
'auto'
}}
// }
dataSource
=
{
this
.
state
.
sucData
}
bordered
=
{
true
}
/
>
<
/TabPane
>
<
/Tabs
>
<
/div
>
)}
<
/div
>
<
/Modal
>
<
/span
>
);
}
}
FormInsertDiy/ImportUtil/ImportUtil.less
浏览文件 @
582dc5db
//.nomal{
.nomal {
// background: #fff;
background: #fff;
// padding: 10px;
padding: 10px;
//}
}
//.title{
// display: flex;
.title {
// margin-bottom: 20px;
display: flex;
//}
margin-bottom: 20px;
//.info{
}
// text-align: center;
// font-weight: bold;
.info {
// font-size: 18px;
text-align: center;
//}
font-weight: bold;
//.detail{
font-size: 18px;
// text-align: center;
}
// margin:30px auto;
//}
.detail {
//.detail img{
text-align: center;
// margin: auto 10px;
margin: 30px auto;
//}
}
//.button{
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
.detail img {
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
margin: auto 10px;
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
}
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -moz-flex;
.button {
// display: flex;
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// -moz-box-pack: center; /*Firefox*/
display: -moz-box; /* 老版本语法: Firefox (buggy) */
// -webkit-box-pack: center; /*Safari,Opera,Chrome*/
display: -ms-flexbox; /* 混合版本语法: IE 10 */
// box-pack: center;
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// -moz-justify-content: center;
display: -moz-flex;
// -webkit-justify-content: center;
display: flex;
// justify-content: center;
-moz-box-pack: center; /*Firefox*/
//}
-webkit-box-pack: center; /*Safari,Opera,Chrome*/
//.operation{
box-pack: center;
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
-moz-justify-content: center;
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
-webkit-justify-content: center;
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
justify-content: center;
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
}
// display: -moz-flex;
// display: flex;
.operation {
// -moz-box-pack: center; /*Firefox*/
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// -webkit-box-pack: center; /*Safari,Opera,Chrome*/
display: -moz-box; /* 老版本语法: Firefox (buggy) */
// box-pack: center;
display: -ms-flexbox; /* 混合版本语法: IE 10 */
// -moz-justify-content: center;
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// -webkit-justify-content: center;
display: -moz-flex;
// justify-content: center;
display: flex;
//}
-moz-box-pack: center; /*Firefox*/
//.button Button{
-webkit-box-pack: center; /*Safari,Opera,Chrome*/
// margin: auto 10px;
box-pack: center;
//
-moz-justify-content: center;
//}
-webkit-justify-content: center;
//.titleInfo p span{
justify-content: center;
// font-weight: bold;
}
//}
//.import{
.button Button {
// color: #6ca3c9;
margin: auto 10px;
// font-size: 16px;
//}
}
//.button{
// // background: #eff3f8;
.titleInfo p span {
// text-align: center;
font-weight: bold;
// padding:20px;
}
// margin-top: 20px;
//}
.import {
//.tip{
color: #6ca3c9;
// margin:20px auto;
font-size: 16px;
// padding:10px;
}
// border-top: 1px solid #ccc;
//}
.button {
//.tip span{
// background: #eff3f8;
// display: block;
text-align: center;
// margin:10px;
padding: 20px;
// font-size: 16px;
margin-top: 20px;
//}
}
//.tip::after{
// content: '';
.tip {
// position: absolute;
margin: 20px auto;
// width: 5px;
padding: 10px;
// height: 57px;
border-top: 1px solid #ccc;
// background: #e5eaf1;
}
// margin-top: -141px;
// margin-left: -13px;
.tip span {
//}
display: block;
//.select button{
margin: 10px;
// color: #fff;
font-size: 16px;
// padding:10px;
}
// background: #abbac3;
// border: none;
.tip::after {
// margin: 10px;
content: '';
//}
position: absolute;
//.attentionItem{
width: 5px;
// background: #f4f5f4;
height: 57px;
// padding: 10px;
background: #e5eaf1;
// box-shadow: 1px 1px 1px #ccc;
margin-top: -141px;
//}
margin-left: -13px;
//.attentionItem p:nth-child(1){
}
// font-size: 16px;
// margin-left: 0;
.select button {
//}
color: #fff;
//.attentionItem p{
padding: 10px;
// font-size: 14px;
background: #abbac3;
// margin-left: 45px;
border: none;
//}
margin: 10px;
//.submitButtons{
}
// margin-left: 34px;
//}
.attentionItem {
//.contentTable{
background: #f4f5f4;
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
padding: 10px;
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
box-shadow: 1px 1px 1px #ccc;
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
}
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -moz-flex;
.attentionItem p:nth-child(1) {
// display: flex;
font-size: 16px;
// -moz-box-pack: justify; /*Firefox*/
margin-left: 0;
// -webkit-box-pack:justify; /*Safari,Opera,Chrome*/
}
// box-pack: justify;
// -moz-justify-content: space-between;
.attentionItem p {
// -webkit-justify-content: space-between;
font-size: 14px;
// justify-content: space-between;
margin-left: 45px;
// margin-top: 20px;
}
//}
//.left{
.submitButtons {
// width: 50%;
margin-left: 34px;
//}
}
//.right{
// width: 50%;
.contentTable {
// border-left: 1px solid #317ecc;
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
//}
display: -moz-box; /* 老版本语法: Firefox (buggy) */
//.error p{
display: -ms-flexbox; /* 混合版本语法: IE 10 */
// color: #fff;
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// background: #317ecc;
display: -moz-flex;
// // margin: 10px auto;
display: flex;
// text-align: left;
-moz-box-pack: justify; /*Firefox*/
// font-size: 18px;
-webkit-box-pack: justify; /*Safari,Opera,Chrome*/
//}
box-pack: justify;
//.download{
-moz-justify-content: space-between;
// background: #f5f5f5;
-webkit-justify-content: space-between;
// padding: 5px;
justify-content: space-between;
// margin-top: -16px;
margin-top: 20px;
//}
}
//.download img{
// margin-top: -2px;
.left {
// margin-right: 5px;
width: 50%;
//}
}
//.download button{
// border: none;
.right {
// background: #f5f5f5
width: 50%;
//}
border-left: 1px solid #317ecc;
//.download button:nth-child(1){
}
// border-right: 1px solid #ccc;
//}
.error p {
//.download button:nth-child(2){
color: #fff;
// border-right: 1px solid #ccc;
background: #317ecc;
//}
// margin: 10px auto;
//.buttonDown{
text-align: left;
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
font-size: 18px;
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
}
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
.download {
// display: -moz-flex;
background: #f5f5f5;
// display: flex;
padding: 5px;
// -moz-box-pack: start; /*Firefox*/
margin-top: -16px;
// -webkit-box-pack: start; /*Safari,Opera,Chrome*/
}
// box-pack: start;
// -moz-justify-content: flex-start;
.download img {
// -webkit-justify-content: flex-start;
margin-top: -2px;
// justify-content: flex-start;
margin-right: 5px;
// margin-bottom: 20px;
}
//}
//.buttonDown>button{
.download button {
// margin-left: 10px;
border: none;
// background: #abbac3;
background: #f5f5f5
// border: none;
}
// color: #fff;
// padding: 5px 12px;
.download button:nth-child(1) {
// border-radius: 5px;
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;
}
FormInsertDiy/List/ExportAndImportAndDetail.js
浏览文件 @
582dc5db
...
@@ -10,7 +10,7 @@ const ExportAndImportAndDetail = (props) => {
...
@@ -10,7 +10,7 @@ const ExportAndImportAndDetail = (props) => {
const
Authority
=
{
const
Authority
=
{
add
:
true
,
// 新增
add
:
true
,
// 新增
delete
:
true
,
// 删除
delete
:
true
,
// 删除
detail
:
true
,
// 详情
edit
:
true
,
// 编辑
auditDetail
:
false
,
// 审核详情
auditDetail
:
false
,
// 审核详情
exportUtil
:
true
,
// 导出
exportUtil
:
true
,
// 导出
importUtil
:
true
,
// 导入
importUtil
:
true
,
// 导入
...
@@ -20,4 +20,4 @@ const ExportAndImportAndDetail = (props) => {
...
@@ -20,4 +20,4 @@ const ExportAndImportAndDetail = (props) => {
/>
;
/>
;
};
};
export
default
ExportAndDetail
;
export
default
ExportAnd
ImportAnd
Detail
;
FormInsertDiy/List/index.js
浏览文件 @
582dc5db
...
@@ -8,7 +8,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
...
@@ -8,7 +8,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import
Shell
from
'../Shell'
;
import
Shell
from
'../Shell'
;
import
FormArray
from
'../AffairPage/component/FormArray'
;
import
FormArray
from
'../AffairPage/component/FormArray'
;
import
Edit
from
'../Edit/index'
;
import
Edit
from
'../Edit/index'
;
//
import ImportUtil from '../ImportUtil/ImportUtil';
import
ImportUtil
from
'../ImportUtil/ImportUtil'
;
import
SearchDom
from
'@/highOrderComponent/SearchDom'
;
import
SearchDom
from
'@/highOrderComponent/SearchDom'
;
import
StandardTable
from
'@/components/StandardTable'
;
import
StandardTable
from
'@/components/StandardTable'
;
import
{
getHead
,
fetchData
,
deleteItem
,
add
,
getDetailId
}
from
'./services'
;
import
{
getHead
,
fetchData
,
deleteItem
,
add
,
getDetailId
}
from
'./services'
;
...
@@ -80,18 +80,25 @@ class FormList extends React.Component {
...
@@ -80,18 +80,25 @@ class FormList extends React.Component {
}
}
// 渲染值
// 渲染值
componentDidMount
()
{
componentDidMount
()
{
this
.
getTableHead
();
this
.
getTableHead
();
}
}
getTableHead
=
()
=>
{
getTableHead
=
()
=>
{
const
{
objId
,
Authority
}
=
this
.
props
;
const
{
objId
,
Authority
}
=
this
.
props
;
getHead
({
dataObjId
:
objId
},
datas
=>
{
getHead
({
dataObjId
:
objId
},
datas
=>
{
if
(
!
datas
)
return
;
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
)
=>
{
datas
=
datas
.
filter
((
x
)
=>
{
return
x
.
isHidden
!==
true
;
return
x
.
isHidden
!==
true
;
});
});
...
@@ -99,23 +106,20 @@ class FormList extends React.Component {
...
@@ -99,23 +106,20 @@ class FormList extends React.Component {
item
.
extendType
=
item
.
extendTypeId
;
item
.
extendType
=
item
.
extendTypeId
;
item
.
dataIndex
=
item
.
name
;
item
.
dataIndex
=
item
.
name
;
item
.
dataType
=
item
.
type
;
item
.
dataType
=
item
.
type
;
if
(
item
.
isPrimaryKey
)
{
this
.
setState
({
primaryKey
:
item
.
name
,
});
}
}
}
datas
=
handleColumns
(
datas
);
datas
=
handleColumns
(
datas
);
if
(
Authority
&&
Authority
.
auditDetail
)
{
if
(
Authority
&&
Authority
.
auditDetail
)
{
//流程审核详情 和 编辑,查看 不能 同时存在.
datas
.
push
(
datas
.
push
(
{
{
dataIndex
:
'
operation
'
,
dataIndex
:
'
auditProcessDetail
'
,
title
:
'
操作
'
,
title
:
'
审核详情
'
,
fixed
:
datas
.
length
>
12
?
'right'
:
false
,
fixed
:
datas
.
length
>
12
?
'right'
:
false
,
render
:
(
text
,
record
)
=>
{
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={
/*return (<Link to={
{
{
pathname: './Detail',
pathname: './Detail',
...
@@ -131,24 +135,9 @@ class FormList extends React.Component {
...
@@ -131,24 +135,9 @@ class FormList extends React.Component {
},
},
);
);
}
}
this
.
columns
=
datas
;
this
.
columns
=
datas
;
this
.
setState
({
formItem
:
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
=
[];
let
searchConfig
=
[];
for
(
let
item
of
datas
)
{
for
(
let
item
of
datas
)
{
if
(
item
.
isShowQuery
)
{
if
(
item
.
isShowQuery
)
{
...
@@ -164,37 +153,40 @@ class FormList extends React.Component {
...
@@ -164,37 +153,40 @@ class FormList extends React.Component {
this
.
setState
({
this
.
setState
({
searchConfig
,
searchConfig
,
});
});
/*let opt = {
if
(
Authority
&&
Authority
.
edit
)
{
//编辑功能
title: '操作',
datas
.
push
(
render: (text, record) => (
{
<Fragment>
dataIndex
:
'operationEdit'
,
<div>
title
:
'编辑'
,
<a onClick={this.modify.bind(this, record)}>
fixed
:
'right'
,
编辑
width
:
60
,
</a>
render
:
(
text
,
record
)
=>
{
</div>
return
(
</Fragment>
<
a
onClick
=
{
this
.
modify
.
bind
(
this
,
record
)}
>
),
编辑
};
<
/a>
)
;
this.columns.push(opt);*/
},
},
);
}
this
.
getPage
();
this
.
getPage
();
});
});
};
};
getIdByCode
=
(
code
)
=>
{
getIdByCode
=
(
code
)
=>
{
getDetailId
({
code
},
res
=>
{
getDetailId
({
code
},
res
=>
{
router
.
push
({
router
.
push
({
pathname
:
'./Detail'
,
pathname
:
'./Detail'
,
state
:
{
state
:
{
record
:
{
id
:
res
.
id
},
record
:
{
id
:
res
.
id
},
}
}
,
});
});
})
})
;
};
};
modify
=
record
=>
{
modify
=
record
=>
{
const
{
formItem
}
=
this
.
state
;
const
{
formItem
}
=
this
.
state
;
if
(
formItem
.
length
<
10
)
{
if
(
formItem
.
length
<
10
||
true
)
{
this
.
setState
({
this
.
setState
({
formData
:
{
...
record
},
formData
:
{
...
record
},
modalVisible
:
true
,
modalVisible
:
true
,
...
@@ -293,7 +285,7 @@ class FormList extends React.Component {
...
@@ -293,7 +285,7 @@ class FormList extends React.Component {
add
=
()
=>
{
add
=
()
=>
{
const
{
formItem
}
=
this
.
state
;
const
{
formItem
}
=
this
.
state
;
if
(
formItem
.
length
<
10
)
{
if
(
formItem
.
length
<
10
||
true
)
{
this
.
setState
({
this
.
setState
({
modalVisible
:
true
,
modalVisible
:
true
,
formData
:
{},
formData
:
{},
...
@@ -314,14 +306,23 @@ class FormList extends React.Component {
...
@@ -314,14 +306,23 @@ class FormList extends React.Component {
});
});
};
};
batchDelete
=
e
=>
{
batchDelete
=
(
e
)
=>
{
const
{
objId
}
=
this
.
props
;
const
{
objId
}
=
this
.
props
;
const
{
selectedRows
,
formItem
}
=
this
.
state
;
const
{
selectedRows
,
formItem
}
=
this
.
state
;
if
(
!
selectedRows
)
return
;
if
(
!
selectedRows
||
selectedRows
.
length
<
1
)
{
const
Keys
=
formItem
.
filter
(
i
=>
i
.
isPrimaryKey
).
reduce
((
acc
,
i
)
=>
{
message
.
warning
(
'请选择您要删除的数据'
);
return
{
...
acc
,
[
i
.
name
]:
selectedRows
.
map
(
row
=>
row
[
i
.
name
]).
join
(
','
)
};
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
({
this
.
setState
({
selectedRows
:
[],
selectedRows
:
[],
});
});
...
@@ -358,6 +359,7 @@ class FormList extends React.Component {
...
@@ -358,6 +359,7 @@ class FormList extends React.Component {
isAdd
,
isAdd
,
changeFormData
:
this
.
changeFormData
,
changeFormData
:
this
.
changeFormData
,
};
};
console
.
log
(
this
.
columns
);
return
(
return
(
<>
<>
{
showEdit
?
(
{
showEdit
?
(
...
@@ -402,12 +404,16 @@ class FormList extends React.Component {
...
@@ -402,12 +404,16 @@ class FormList extends React.Component {
Authority
&&
Authority
.
exportUtil
===
false
?
null
:
Authority
&&
Authority
.
exportUtil
===
false
?
null
:
<
ExportInfo
objId
=
{
objId
}
/
>
<
ExportInfo
objId
=
{
objId
}
/
>
}
}
{
/* <ImportUtil objId={objId} />*/
}
{
Authority
&&
Authority
.
importUtil
===
false
?
null
:
<
ImportUtil
objId
=
{
objId
}
callback
=
{
this
.
getPage
}
/
>
}
<
/div
>
<
/div
>
<
StandardTable
<
StandardTable
rowKey
=
"row_id"
rowKey
=
{
primaryKey
}
data
=
{
pageData
}
data
=
{
pageData
}
columns
=
{
this
.
columns
}
columns
=
{
this
.
columns
}
selectedRows
=
{
selectedRows
}
selectedRows
=
{
selectedRows
}
...
...
FormInsertDiy/config/index.js
浏览文件 @
582dc5db
...
@@ -61,7 +61,7 @@ const transLateTimeTOUnix = (value, dataType) => {
...
@@ -61,7 +61,7 @@ const transLateTimeTOUnix = (value, dataType) => {
const
getFormArrayConfig
=
header
=>
{
const
getFormArrayConfig
=
header
=>
{
let
config
=
[];
let
config
=
[];
for
(
let
item
of
header
)
{
for
(
let
item
of
header
)
{
if
(
item
.
isPrimaryKey
||
item
.
isHidden
)
{
if
(
item
.
isPrimaryKey
||
item
.
isHidden
||
item
.
dataIndex
===
'operationEdit'
)
{
// 主键
// 主键
continue
;
continue
;
/* config.push(
/* config.push(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论