Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
1edf9e12
提交
1edf9e12
authored
4月 05, 2020
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8350 活动申报-报名时间和活动时间没有限制关系
上级
76d6c137
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
1280 行增加
和
1572 行删除
+1280
-1572
index.js
FormInsertDiy/AffairPage/ApplyPage/index.js
+3
-5
ModalForm.js
FormInsertDiy/AffairPage/ButtonListDom/ModalForm.js
+1
-2
index.js
FormInsertDiy/AffairPage/ButtonListDom/index.js
+0
-31
publicApiService.js
FormInsertDiy/AffairPage/publicApiService.js
+7
-2
index.js
FormInsertDiy/Edit/index.js
+139
-139
index.js
FormInsertDiy/Export/index.js
+571
-571
ImportUtil.js
FormInsertDiy/ImportUtil/ImportUtil.js
+377
-377
ImportUtil.less
FormInsertDiy/ImportUtil/ImportUtil.less
+178
-179
index.js
FormInsertDiy/List/index.js
+4
-4
DataObj.js
FormInsertDiy/models/DataObj.js
+0
-151
FormList.js
FormInsertDiy/models/FormList.js
+0
-111
没有找到文件。
FormInsertDiy/AffairPage/ApplyPage/index.js
浏览文件 @
1edf9e12
...
@@ -9,8 +9,7 @@ import { message } from 'antd';
...
@@ -9,8 +9,7 @@ import { message } from 'antd';
import
React
,
{
Fragment
}
from
'react'
;
import
React
,
{
Fragment
}
from
'react'
;
import
*
as
service
from
'../publicApiService'
;
import
*
as
service
from
'../publicApiService'
;
import
*
as
destructionFunc
from
'../destruction'
;
import
*
as
destructionFunc
from
'../destruction'
;
import
{
Link
,
hashHistory
}
from
'dva/router'
;
import
{
Link
}
from
'dva/router'
;
import
{
getDefaultValues
}
from
'../destruction'
;
import
{
getApplyPage
}
from
'../publicApiService'
;
import
{
getApplyPage
}
from
'../publicApiService'
;
import
{
getHuanGeToken
}
from
'@/utils/authority'
;
import
{
getHuanGeToken
}
from
'@/utils/authority'
;
...
@@ -20,12 +19,11 @@ import pageSetting from './pageSetting';
...
@@ -20,12 +19,11 @@ import pageSetting from './pageSetting';
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
import
Shell
from
'@/baseComponent/Shell'
;
import
Shell
from
'@/baseComponent/Shell'
;
import
config
from
'@/config/config'
;
import
config
from
'@/config/config'
;
// import test from './2333';
export
default
class
AffairPage
extends
React
.
Component
{
export
default
class
AffairPage
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
//
const idObj = service.getId();
const
idObj
=
service
.
getId
();
if
(
!
idObj
)
{
if
(
!
idObj
)
{
message
.
error
(
'没有配置数据id,无法使用该功能'
);
message
.
error
(
'没有配置数据id,无法使用该功能'
);
}
}
...
@@ -145,7 +143,7 @@ export default class AffairPage extends React.Component {
...
@@ -145,7 +143,7 @@ export default class AffairPage extends React.Component {
this
.
ListComponent
.
getPage
();
this
.
ListComponent
.
getPage
();
});
});
}
}
if
(
event
.
data
.
indexOf
(
'iframeHeight'
)
>
-
1
)
{
if
(
event
.
data
.
indexOf
(
'iframeHeight'
)
>
-
1
)
{
let
height
=
Number
(
event
.
data
.
split
(
'-'
)[
1
]);
let
height
=
Number
(
event
.
data
.
split
(
'-'
)[
1
]);
document
.
getElementById
(
'applyIframeId'
).
height
=
height
;
document
.
getElementById
(
'applyIframeId'
).
height
=
height
;
}
}
...
...
FormInsertDiy/AffairPage/ButtonListDom/ModalForm.js
浏览文件 @
1edf9e12
...
@@ -11,11 +11,10 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
...
@@ -11,11 +11,10 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import
ModalDiy
from
'@/baseComponent/ModalDiy'
;
import
ModalDiy
from
'@/baseComponent/ModalDiy'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
import
{
deepCopy
,
}
from
'@/baseComponent/utils'
;
import
{
deepCopy
,
}
from
'@/baseComponent/utils'
;
import
{
mustHaveValue
}
from
'../../config/index'
;
import
{
mustHaveValue
,
transLateTimeTOUnix
}
from
'../../config/index'
;
import
{
message
}
from
'antd'
;
import
{
message
}
from
'antd'
;
import
PropTypes
from
'prop-types'
;
import
PropTypes
from
'prop-types'
;
import
{
startProcess
}
from
'../publicApiService'
;
import
{
startProcess
}
from
'../publicApiService'
;
import
{
transLateTimeTOUnix
}
from
'@/pages/App/FormInsertDiy/config'
;
import
FormArray
from
'../component/FormArray'
;
import
FormArray
from
'../component/FormArray'
;
export
default
class
ModalForm
extends
Component
{
export
default
class
ModalForm
extends
Component
{
...
...
FormInsertDiy/AffairPage/ButtonListDom/index.js
浏览文件 @
1edf9e12
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
/*
import ExportInfo from '@/components/App/ExportInfo';
import ImportUtil from '@/components/App/ImportUtil';
import ModalDelete from './ModalDelete';
import ModalConfirm from './ModalConfirm';
*/
import
ModalBatch
from
'./ModalBatch'
;
import
ModalBatch
from
'./ModalBatch'
;
import
ModalForm
from
'./ModalForm'
;
import
ModalForm
from
'./ModalForm'
;
...
@@ -24,31 +18,6 @@ export default class ButtonListDom extends Component {
...
@@ -24,31 +18,6 @@ export default class ButtonListDom extends Component {
getPage
=
{
getPage
}
getPage
=
{
getPage
}
selectRows
=
{
selectRows
}
selectRows
=
{
selectRows
}
/>
;
/>
;
/* case 'ModalDelete': // 删除按钮
return <ModalDelete {...item}
key={item.type}
getPage={getPage}
selectRows={selectRows}
/>;
case 'ImportUtil': // 导入
return <ImportUtil {...item.props}
key={item.type}
callback={() => getPage()}
/>;
case 'ExportInfo': // 导出
return <ExportInfo {...item.props}
key={item.type}
/>;
case 'ModalConfirm': // 一般按钮 点击后弹出是否确定的 Modal Info
return <ModalConfirm key={item.type}
{...item}
getPage={getPage}
listData={listData}
formValues={formValues}
search={search}
selectRows={selectRows}/>;
*/
case
'ModalBatch'
:
// 一般按钮 点击后弹出 填写一些类似 审核理由 意见之类的信息
case
'ModalBatch'
:
// 一般按钮 点击后弹出 填写一些类似 审核理由 意见之类的信息
return
<
ModalBatch
key
=
{
item
.
type
}
return
<
ModalBatch
key
=
{
item
.
type
}
{...
item
}
{...
item
}
...
...
FormInsertDiy/AffairPage/publicApiService.js
浏览文件 @
1edf9e12
...
@@ -43,10 +43,15 @@ const getOtherToken = () => {
...
@@ -43,10 +43,15 @@ const getOtherToken = () => {
};
};
const
getId
=
()
=>
{
// 获取流程引擎 事务workId 和表dataBaseId
const
getId
=
()
=>
{
// 获取流程引擎 事务workId 和表dataBaseId
return
{
dataBaseId
:
'1243131275393368064'
,
workId
:
'1243131275393368064'
,
};
let
path
=
window
.
location
.
href
;
let
path
=
window
.
location
.
href
;
path
=
path
.
split
(
'/'
);
path
=
path
.
split
(
'/'
);
// let idObj = config[path.pop()];
console
.
log
(
path
.
pop
());
let
idObj
;
/// let idObj = config[path.pop()];
debugger
;
if
(
typeof
idObj
===
'undefined'
)
{
if
(
typeof
idObj
===
'undefined'
)
{
console
.
error
(
'没有找到对应的流程引擎id'
);
console
.
error
(
'没有找到对应的流程引擎id'
);
return
false
;
return
false
;
...
...
FormInsertDiy/Edit/index.js
浏览文件 @
1edf9e12
import
React
,
{
Fragment
}
from
'react'
;
//
import React, { Fragment } from 'react';
import
{
//
import {
Button
,
//
Button,
Card
,
Col
,
//
Card, Col,
Form
,
message
,
Row
,
//
Form, message, Row,
}
from
'antd'
;
//
} from 'antd';
import
{
connect
}
from
'dva'
;
//
import { connect } from 'dva';
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
//
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import
moment
from
'moment'
;
//
import moment from 'moment';
import
router
from
'umi/router'
;
//
import router from 'umi/router';
import
{
text
,
number
,
date
,
getFormArrayConfig
}
from
'../config/index'
;
//
import { text, number, date, getFormArrayConfig } from '../config/index';
import
FormArray
from
'../AffairPage/component/FormArray'
;
//
import FormArray from '../AffairPage/component/FormArray';
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
//
import ButtonDiy from '@/baseComponent/ButtonDiy';
import
Shell
from
'../Shell'
;
//
import Shell from '../Shell';
//
//
@
connect
(({
formList
,
loading
})
=>
({
//
@connect(({ formList, loading }) => ({
formList
,
//
formList,
}))
//
}))
@
Form
.
create
()
//
@Form.create()
class
Edit
extends
React
.
Component
{
//
class Edit extends React.Component {
//
state
=
{
//
state = {
modalVisible
:
false
,
//
modalVisible: false,
formData
:
{},
//
formData: {},
formItem
:
[],
//
formItem: [],
isAdd
:
false
,
//
isAdd: false,
objId
:
this
.
props
.
id
,
//
objId: this.props.id,
recordId
:
this
.
props
.
recordId
,
//
recordId: this.props.recordId,
recordKey
:
this
.
props
.
recordKey
,
//
recordKey: this.props.recordKey,
};
//
};
columns
=
[];
//
columns = [];
//
//渲染值
//
//渲染值
componentDidMount
()
{
//
componentDidMount() {
const
{
dispatch
}
=
this
.
props
;
//
const { dispatch } = this.props;
const
{
objId
,
recordKey
,
recordId
}
=
this
.
state
;
//
const { objId, recordKey, recordId } = this.state;
dispatch
({
//
dispatch({
type
:
'formList/getHead'
,
//
type: 'formList/getHead',
payload
:
{
dataObjId
:
objId
},
//
payload: { dataObjId: objId },
callback
:
(
dates
)
=>
{
//
callback: (dates) => {
if
(
dates
)
{
//
if (dates) {
this
.
setState
({
//
this.setState({
formItem
:
dates
,
//
formItem: dates,
});
//
});
}
//
}
},
//
},
});
//
});
//渲染表单字段
//
//渲染表单字段
if
(
recordId
!=
null
)
{
//
if (recordId != null) {
dispatch
({
//
dispatch({
type
:
'formList/getDetail'
,
//
type: 'formList/getDetail',
payload
:
{
//
payload: {
dataObjId
:
objId
,
//
dataObjId: objId,
key
:
recordKey
,
//
key: recordKey,
value
:
recordId
,
//
value: recordId,
},
//
},
callback
:
(
res
)
=>
{
//
callback: (res) => {
if
(
res
)
{
//
if (res) {
this
.
setState
({
//
this.setState({
formData
:
res
,
//
formData: res,
});
//
});
}
//
}
},
//
},
});
//
});
this
.
setState
({
//
this.setState({
isAdd
:
false
,
//
isAdd: false,
})
//
})
}
else
{
//
}else{
this
.
setState
({
//
this.setState({
isAdd
:
true
,
//
isAdd: true,
})
//
})
}
//
}
}
//
}
//
onSubmit
=
()
=>
{
//
onSubmit = () => {
//router.goBack();
//
//router.goBack();
const
{
isAdd
,
objId
,
formData
}
=
this
.
state
;
//
const { isAdd, objId, formData } = this.state;
let
payload
=
{
//
let payload = {
params
:
{...
formData
},
//
params: {...formData},
objId
,
//
objId,
isAdd
,
//
isAdd,
};
//
};
this
.
props
.
dispatch
({
//
this.props.dispatch({
type
:
'formList/add'
,
//
type: 'formList/add',
payload
,
//
payload,
callback
:
()
=>
{
//
callback: () => {
message
.
success
(
'操作成功'
);
//
message.success('操作成功');
this
.
props
.
returnThis
();
//
this.props.returnThis();
},
//
},
});
//
});
};
//
};
//
goBack
=
()
=>
{
//
goBack = () => {
this
.
props
.
returnThis
();
//
this.props.returnThis();
};
//
};
//
changeFormData
=
(
value
,
key
)
=>
{
//
changeFormData = (value, key) => {
let
oldValue
=
this
.
state
.
formData
;
//
let oldValue = this.state.formData;
oldValue
[
key
]
=
value
;
//
oldValue[key] = value;
this
.
setState
({
//
this.setState({
formData
:
oldValue
,
//
formData: oldValue,
});
//
});
};
//
};
//
render
()
{
//
render() {
let
{
formItem
,
formData
}
=
this
.
state
;
//
let { formItem, formData } = this.state;
let
formConfig
=
getFormArrayConfig
(
formItem
);
//
let formConfig = getFormArrayConfig(formItem);
return
(
//
return (
<
Shell
>
//
<Shell>
<
Row
>
//
<Row>
<
FormArray
//
<FormArray
config
=
{
formConfig
}
//
config={formConfig}
nameSpan
=
{{
big
:
10
,
small
:
12
}}
//
nameSpan={{ big: 10, small: 12 }}
fileSpan
=
{{
big
:
4
,
small
:
3
}}
//
fileSpan={{ big: 4, small: 3 }}
value
=
{
formData
}
//
value={formData}
changeValue
=
{
this
.
changeFormData
}
//
changeValue={this.changeFormData}
/
>
//
/>
<
Col
span
=
{
24
}
//
<Col span={24}
style
=
{{
textAlign
:
'center'
,
paddingTop
:
'200px'
,
paddingBottom
:
'50px'
}}
>
//
style={{ textAlign: 'center', paddingTop: '200px', paddingBottom: '50px' }}>
//
<
ButtonDiy
//
<ButtonDiy
className
=
{
'primaryBlue'
}
//
className={'primaryBlue'}
handleClick
=
{
this
.
onSubmit
}
//
handleClick={this.onSubmit}
name
=
{
'保存'
}
//
name={'保存'}
/
>
//
/>
<
ButtonDiy
//
<ButtonDiy
className
=
{
'defaultRed'
}
//
className={'defaultRed'}
handleClick
=
{
this
.
goBack
}
//
handleClick={this.goBack}
name
=
{
'返回'
}
//
name={'返回'}
/
>
//
/>
<
/Col
>
//
</Col>
<
/Row
>
//
</Row>
<
/Shell
>
//
</Shell>
);
//
);
}
//
}
}
//
}
//
export
default
Edit
;
//
export default Edit;
FormInsertDiy/Export/index.js
浏览文件 @
1edf9e12
import
fetch
from
'dva/fetch'
;
//
import fetch from 'dva/fetch';
import
React
from
'react'
;
//
import React from 'react';
import
ReactDOM
from
'react-dom'
;
//
import ReactDOM from 'react-dom';
import
{
Select
,
Button
,
Modal
,
Input
,
Transfer
,
Row
,
Col
,
Form
,
message
,
notification
}
from
'antd'
;
//
import { Select, Button, Modal, Input, Transfer, Row, Col, Form, message, notification } from 'antd';
import
{
connect
}
from
'dva'
;
//
import { connect } from 'dva';
import
{
getToken
}
from
'@/utils/authority'
;
//
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
FormdataWrapper
from
'@/utils/object-to-formdata-custom'
;
//
import FormdataWrapper from '@/utils/object-to-formdata-custom';
//
const
Option
=
Select
.
Option
;
//
const Option = Select.Option;
let
keyX
=
1
;
//
let keyX = 1;
function
swapArray
(
arr
,
index1
,
index2
)
{
//
function swapArray(arr, index1, index2) {
arr
[
index1
]
=
arr
.
splice
(
index2
,
1
,
arr
[
index1
])[
0
];
//
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
return
arr
;
//
return arr;
}
//
}
const
FormItem
=
Form
.
Item
;
//
const FormItem = Form.Item;
//
@
connect
(({
DataObj
,
loading
})
=>
({
//
@connect(({ DataObj, loading }) => ({
DataObj
,
//
DataObj,
loading
:
loading
.
models
.
DataObj
,
//
loading: loading.models.DataObj,
}))
//
}))
@
Form
.
create
()
//
@Form.create()
export
default
class
Index
extends
React
.
Component
{
//
export default class Index extends React.Component {
constructor
(
props
)
{
//
constructor(props) {
super
(
props
);
//
super(props);
this
.
state
=
{
//
this.state = {
visiable
:
false
,
//
visiable: false,
//
queryVisiable
:
false
,
//
queryVisiable: false,
groupVisiable
:
false
,
//
groupVisiable: false,
sortVisiable
:
false
,
//
sortVisiable: false,
currentQueryKey
:
null
,
//
currentQueryKey: null,
currentGroupKey
:
null
,
//
currentGroupKey: null,
orderVisiable
:
false
,
//
orderVisiable: false,
currentOrderKey
:
null
,
//
currentOrderKey: null,
querys
:
[],
//
querys: [],
orders
:
[],
//
orders: [],
groups
:
[],
//
groups: [],
gs
:
[],
//
gs: [],
os
:
[],
//
os: [],
qs
:
[],
//
qs: [],
mockData
:
[],
//
mockData: [],
targetKeys
:
[],
//
targetKeys: [],
sourceSelectedKeys
:
[],
//
sourceSelectedKeys: [],
targetSelectedKeys
:
[],
//
targetSelectedKeys: [],
infos
:
{},
//
infos: {},
confirmLoading
:
false
,
//
confirmLoading: false,
};
//
};
}
//
}
//
onSelectChange
=
(
sourceSelectedKeys
,
targetSelectedKeys
)
=>
{
//
onSelectChange = (sourceSelectedKeys, targetSelectedKeys) => {
this
.
setState
({
sourceSelectedKeys
,
targetSelectedKeys
});
//
this.setState({ sourceSelectedKeys, targetSelectedKeys });
};
//
};
deleteQuery
=
(
i
)
=>
{
//
deleteQuery = (i) => {
const
querys
=
this
.
state
.
querys
;
//
const querys = this.state.querys;
querys
.
splice
(
i
,
1
);
//
querys.splice(i, 1);
this
.
setState
({
querys
});
//
this.setState({ querys });
};
//
};
deleteOrder
=
(
i
)
=>
{
//
deleteOrder = (i) => {
const
orders
=
this
.
state
.
orders
;
//
const orders = this.state.orders;
orders
.
splice
(
i
,
1
);
//
orders.splice(i, 1);
this
.
setState
({
orders
});
//
this.setState({ orders });
};
//
};
deleteGroup
=
(
i
)
=>
{
//
deleteGroup = (i) => {
const
groups
=
this
.
state
.
groups
;
//
const groups = this.state.groups;
groups
.
splice
(
i
,
1
);
//
groups.splice(i, 1);
this
.
setState
({
groups
});
//
this.setState({ groups });
};
//
};
open
=
()
=>
{
//
open = () => {
const
{
dispatch
}
=
this
.
props
;
//
const { dispatch } = this.props;
dispatch
({
//
dispatch({
type
:
'DataObj/getExportInfo'
,
//
type: 'DataObj/getExportInfo',
payload
:
{
//
payload: {
objId
:
this
.
props
.
objId
,
//
objId: this.props.objId,
},
//
},
callback
:
(
infos
)
=>
{
//
callback: (infos) => {
//
const
mockData
=
[];
//
const mockData = [];
const
qs
=
[];
//
const qs = [];
const
gs
=
[];
//
const gs = [];
const
os
=
[];
//
const os = [];
for
(
var
key
in
infos
)
{
//
for (var key in infos) {
const
x
=
infos
[
key
];
//
const x = infos[key];
mockData
.
push
({
//
mockData.push({
key
:
x
.
field
,
//
key: x.field,
title
:
x
.
name
,
//
title: x.name,
chosen
:
false
,
//
chosen: false,
});
//
});
if
(
x
.
canQuery
)
{
//
if (x.canQuery) {
qs
.
push
(
x
);
//
qs.push(x);
}
//
}
if
(
x
.
canGroup
)
{
//
if (x.canGroup) {
gs
.
push
(
x
);
//
gs.push(x);
}
//
}
if
(
x
.
canOrder
)
{
//
if (x.canOrder) {
os
.
push
(
x
);
//
os.push(x);
}
//
}
}
//
}
//
this
.
setState
({
//
this.setState({
mockData
,
infos
,
visiable
:
true
,
qs
,
gs
,
os
,
//
mockData, infos, visiable: true, qs, gs, os,
});
//
});
//
},
//
},
});
//
});
};
//
};
onCancle
=
()
=>
{
//
onCancle = () => {
this
.
setState
({
visiable
:
false
});
//
this.setState({ visiable: false });
};
//
};
handleChange
=
(
targetKeys
,
direction
,
moveKeys
)
=>
{
//
handleChange = (targetKeys, direction, moveKeys) => {
//
this
.
setState
({
targetKeys
});
//
this.setState({ targetKeys });
};
//
};
//
up
=
()
=>
{
//
up = () => {
keyX
=
keyX
+
1
;
//
keyX = keyX + 1;
var
{
targetKeys
,
targetSelectedKeys
}
=
this
.
state
;
//
var { targetKeys, targetSelectedKeys } = this.state;
for
(
var
i
=
0
;
i
<
targetKeys
.
length
;
i
++
)
{
//
for (var i = 0; i < targetKeys.length; i++) {
if
(
targetKeys
[
i
]
===
targetSelectedKeys
[
0
])
{
//
if (targetKeys[i] === targetSelectedKeys[0]) {
if
(
i
===
0
)
return
;
//
if (i === 0) return;
targetKeys
=
swapArray
(
targetKeys
,
i
,
i
-
1
);
//
targetKeys = swapArray(targetKeys, i, i - 1);
//
break
;
//
break;
}
//
}
}
//
}
//
this
.
setState
({
targetKeys
});
//
this.setState({ targetKeys });
};
//
};
down
=
()
=>
{
//
down = () => {
keyX
=
keyX
+
1
;
//
keyX = keyX + 1;
var
{
targetKeys
,
targetSelectedKeys
}
=
this
.
state
;
//
var { targetKeys, targetSelectedKeys } = this.state;
for
(
var
i
=
0
;
i
<
targetKeys
.
length
;
i
++
)
{
//
for (var i = 0; i < targetKeys.length; i++) {
if
(
targetKeys
[
i
]
===
targetSelectedKeys
[
0
])
{
//
if (targetKeys[i] === targetSelectedKeys[0]) {
if
(
i
===
targetKeys
.
length
-
1
)
return
;
//
if (i === targetKeys.length - 1) return;
targetKeys
=
swapArray
(
targetKeys
,
i
,
i
+
1
);
//
targetKeys = swapArray(targetKeys, i, i + 1);
//
break
;
//
break;
}
//
}
}
//
}
//
this
.
setState
({
targetKeys
});
//
this.setState({ targetKeys });
};
//
};
bottom
=
()
=>
{
//
bottom = () => {
keyX
=
keyX
+
1
;
//
keyX = keyX + 1;
const
{
targetKeys
,
targetSelectedKeys
}
=
this
.
state
;
//
const { targetKeys, targetSelectedKeys } = this.state;
var
x
=
[];
//
var x = [];
for
(
var
i
=
0
;
i
<
targetKeys
.
length
;
i
++
)
{
//
for (var i = 0; i < targetKeys.length; i++) {
if
(
!
targetSelectedKeys
.
includes
(
targetKeys
[
i
]))
{
//
if (!targetSelectedKeys.includes(targetKeys[i])) {
x
.
push
(
targetKeys
[
i
]);
//
x.push(targetKeys[i]);
}
//
}
}
//
}
x
=
[...
x
,
...
targetSelectedKeys
];
//
x = [...x, ...targetSelectedKeys];
this
.
setState
({
targetKeys
:
x
});
//
this.setState({ targetKeys: x });
};
//
};
top
=
()
=>
{
//
top = () => {
keyX
=
keyX
+
1
;
//
keyX = keyX + 1;
const
{
targetKeys
,
targetSelectedKeys
}
=
this
.
state
;
//
const { targetKeys, targetSelectedKeys } = this.state;
const
x
=
[...
targetSelectedKeys
];
//
const x = [...targetSelectedKeys];
for
(
var
i
=
0
;
i
<
targetKeys
.
length
;
i
++
)
{
//
for (var i = 0; i < targetKeys.length; i++) {
if
(
!
targetSelectedKeys
.
includes
(
targetKeys
[
i
]))
{
//
if (!targetSelectedKeys.includes(targetKeys[i])) {
x
.
push
(
targetKeys
[
i
]);
//
x.push(targetKeys[i]);
}
//
}
}
//
}
//
//
this
.
setState
({
targetKeys
:
x
});
//
this.setState({ targetKeys: x });
};
//
};
renderItem
=
(
item
)
=>
{
//
renderItem = (item) => {
if
(
this
.
state
.
targetKeys
.
includes
(
item
.
key
))
{
//
if (this.state.targetKeys.includes(item.key)) {
const
customLabel
=
(
//
const customLabel = (
<
span
className
=
"custom-item"
key
=
{
item
.
key
}
>
//
<span className="custom-item" key={item.key}>
{
item
.
title
}
//
{item.title}
//
<
/span
>
//
</span>
);
//
);
return
{
//
return {
label
:
customLabel
,
// for displayed item
//
label: customLabel, // for displayed item
value
:
item
.
title
,
// for title and filter matching
//
value: item.title, // for title and filter matching
};
//
};
//
}
else
{
//
} else {
const
customLabel
=
(
//
const customLabel = (
<
span
className
=
"custom-item"
key
=
{
item
.
key
}
>
//
<span className="custom-item" key={item.key}>
{
item
.
title
}
//
{item.title}
<
/span
>
//
</span>
);
//
);
return
{
//
return {
label
:
customLabel
,
// for displayed item
//
label: customLabel, // for displayed item
value
:
item
.
title
,
// for title and filter matching
//
value: item.title, // for title and filter matching
};
//
};
}
//
}
};
//
};
addOrder
=
()
=>
{
//
addOrder = () => {
//
this
.
setState
({
orderVisiable
:
true
});
//
this.setState({ orderVisiable: true });
//
};
//
};
okOrder
=
()
=>
{
//
okOrder = () => {
const
orders
=
this
.
state
.
orders
;
//
const orders = this.state.orders;
orders
.
push
(
this
.
state
.
infos
[
this
.
state
.
currentOrderKey
]);
//
orders.push(this.state.infos[this.state.currentOrderKey]);
this
.
setState
({
orders
,
orderVisiable
:
false
,
currentOrderKey
:
null
});
//
this.setState({ orders, orderVisiable: false, currentOrderKey: null });
//
};
//
};
okGroup
=
()
=>
{
//
okGroup = () => {
const
groups
=
this
.
state
.
groups
;
//
const groups = this.state.groups;
groups
.
push
(
this
.
state
.
infos
[
this
.
state
.
currentGroupKey
]);
//
groups.push(this.state.infos[this.state.currentGroupKey]);
this
.
setState
({
groups
,
groupVisiable
:
false
,
currentGroupKey
:
null
});
//
this.setState({ groups, groupVisiable: false, currentGroupKey: null });
};
//
};
addGroup
=
()
=>
{
//
addGroup = () => {
this
.
setState
({
groupVisiable
:
true
});
//
this.setState({ groupVisiable: true });
};
//
};
//
addQuery
=
()
=>
{
//
addQuery = () => {
this
.
setState
({
queryVisiable
:
true
});
//
this.setState({ queryVisiable: true });
};
//
};
okQuery
=
()
=>
{
//
okQuery = () => {
const
querys
=
this
.
state
.
querys
;
//
const querys = this.state.querys;
querys
.
push
(
this
.
state
.
infos
[
this
.
state
.
currentQueryKey
]);
//
querys.push(this.state.infos[this.state.currentQueryKey]);
this
.
setState
({
querys
,
queryVisiable
:
false
,
currentQueryKey
:
null
});
//
this.setState({ querys, queryVisiable: false, currentQueryKey: null });
//
};
//
};
export
=
()
=>
{
//
export = () => {
this
.
props
.
form
.
validateFields
((
err
,
fieldsValue
)
=>
{
//
this.props.form.validateFields((err, fieldsValue) => {
if
(
err
)
return
;
//
if (err) return;
//form.resetFields();
//
//form.resetFields();
var
qqs
;
//
var qqs;
if
(
this
.
props
.
mustQuerys
!=
null
)
{
//
if (this.props.mustQuerys != null) {
qqs
=
[...
this
.
props
.
mustQuerys
];
//
qqs = [...this.props.mustQuerys];
}
else
{
//
} else {
qqs
=
[];
//
qqs = [];
}
//
}
//
const
oos
=
[];
//
const oos = [];
const
ggs
=
[];
//
const ggs = [];
for
(
let
key
in
fieldsValue
)
{
//
for (let key in fieldsValue) {
var
x
=
key
.
indexOf
(
'__'
);
//
var x = key.indexOf('__');
let
kk
=
key
.
substr
(
x
+
2
);
//
let kk = key.substr(x + 2);
if
(
key
.
indexOf
(
'q__'
)
>
-
1
)
{
//
if (key.indexOf('q__') > -1) {
qqs
.
push
({
//
qqs.push({
notes
:
this
.
state
.
infos
[
kk
].
notes
,
//
notes: this.state.infos[kk].notes,
hql
:
this
.
state
.
infos
[
kk
].
hql
,
//
hql: this.state.infos[kk].hql,
c
:
this
.
state
.
infos
[
kk
].
type
,
//
c: this.state.infos[kk].type,
x
:
fieldsValue
[
key
].
stringX
,
//
x: fieldsValue[key].stringX,
v
:
fieldsValue
[
key
].
string
,
//
v: fieldsValue[key].string,
});
//
});
//
}
else
if
(
key
.
indexOf
(
'o__'
)
>
-
1
)
{
//
} else if (key.indexOf('o__') > -1) {
oos
.
push
({
hql
:
this
.
state
.
infos
[
kk
].
hql
,
x
:
fieldsValue
[
key
].
stringX
});
//
oos.push({ hql: this.state.infos[kk].hql, x: fieldsValue[key].stringX });
}
else
if
(
key
.
indexOf
(
'g__'
)
>
-
1
)
{
//
} else if (key.indexOf('g__') > -1) {
ggs
.
push
({
hql
:
this
.
state
.
infos
[
kk
].
hql
});
//
ggs.push({ hql: this.state.infos[kk].hql });
}
//
}
}
//
}
//
if
(
this
.
props
.
voClass
&&
ggs
.
length
===
0
)
{
//
if (this.props.voClass && ggs.length === 0) {
message
.
error
(
'请至少选择一个聚合条件'
);
//
message.error('请至少选择一个聚合条件');
return
;
//
return;
}
//
}
if
(
this
.
state
.
targetKeys
.
length
===
0
)
{
//
if (this.state.targetKeys.length === 0) {
message
.
error
(
'请至少选择一个导出字段'
);
//
message.error('请至少选择一个导出字段');
return
;
//
return;
}
//
}
const
names
=
[];
//
const names = [];
for
(
let
i
=
0
;
i
<
this
.
state
.
targetKeys
.
length
;
i
++
)
{
//
for (let i = 0; i < this.state.targetKeys.length; i++) {
names
.
push
(
this
.
state
.
infos
[
this
.
state
.
targetKeys
[
i
]].
name
);
//
names.push(this.state.infos[this.state.targetKeys[i]].name);
}
//
}
let
divElement
=
document
.
getElementById
(
'downloadDiv'
);
//
let divElement = document.getElementById('downloadDiv');
console
.
log
(
config
.
sqlFormsServer
);
//
console.log(config.sqlFormsServer);
let
downloadUrl
=
config
.
sqlFormsServer
+
'/DataObjApi/exportFormData?'
;
//
let downloadUrl = config.sqlFormsServer + '/DataObjApi/exportFormData?';
const
token
=
getToken
()
!=
null
&&
getToken
()
!=
'null'
?
getToken
()
:
'0000'
;
//
const token = getToken() != null && getToken() != 'null' ? getToken() : '0000';
downloadUrl
=
`
${
downloadUrl
}
token=
${
token
}
`
;
//
downloadUrl = `${downloadUrl}token=${token}`;
let
param
=
{
//
let param = {
fields
:
this
.
state
.
targetKeys
,
//
fields: this.state.targetKeys,
names
:
names
,
//
names: names,
beanName
:
this
.
props
.
beanName
,
//
beanName: this.props.beanName,
querys
:
JSON
.
stringify
(
qqs
),
//
querys: JSON.stringify(qqs),
orders
:
JSON
.
stringify
(
oos
),
//
orders: JSON.stringify(oos),
groups
:
JSON
.
stringify
(
ggs
),
//
groups: JSON.stringify(ggs),
voClass
:
this
.
props
.
voClass
,
//
voClass: this.props.voClass,
objId
:
this
.
props
.
objId
,
//
objId:this.props.objId,
modelClass
:
this
.
props
.
modelClass
,
//
modelClass: this.props.modelClass,
preHandleClass
:
this
.
props
.
preHandleClass
,
//
preHandleClass: this.props.preHandleClass,
hqlHandleClass
:
this
.
props
.
hqlHandleClass
,
//
hqlHandleClass: this.props.hqlHandleClass,
//
};
//
};
param
=
{...
param
,
...
this
.
props
.
params
||
{}}
//
param = {...param, ...this.props.params || {}}
this
.
downloadFile
(
downloadUrl
,
param
);
//
this.downloadFile(downloadUrl, param);
});
//
});
//
};
//
};
//
downloadFile
(
url
,
params
)
{
//
downloadFile(url, params) {
this
.
setState
({
confirmLoading
:
true
});
//
this.setState({ confirmLoading: true });
//
fetch
(
url
,
{
//
fetch(url, {
method
:
'POST'
,
//
method: 'POST',
body
:
FormdataWrapper
(
params
),
//
body: FormdataWrapper(params),
}).
then
(
res
=>
{
//
}).then(res => {
if
(
res
.
status
!=
'200'
)
{
//
if (res.status != '200') {
return
res
.
json
();
//
return res.json();
}
else
{
//
} else {
return
res
.
blob
();
//
return res.blob();
}
//
}
}).
then
(
data
=>
{
//
}).then(data => {
if
(
data
instanceof
Blob
)
{
//
if (data instanceof Blob) {
let
a
=
document
.
createElement
(
'a'
);
//
let a = document.createElement('a');
let
url
=
window
.
URL
.
createObjectURL
(
data
);
//
let url = window.URL.createObjectURL(data);
let
filename
=
(
this
.
props
.
fileName
?
this
.
props
.
fileName
:
'导出文件'
)
+
'.xlsx'
;
//
let filename = (this.props.fileName ? this.props.fileName : '导出文件') + '.xlsx';
a
.
href
=
url
;
//
a.href = url;
a
.
download
=
filename
;
//
a.download = filename;
a
.
click
();
//
a.click();
window
.
URL
.
revokeObjectURL
(
url
);
//
window.URL.revokeObjectURL(url);
a
=
null
;
//
a = null;
}
else
{
//
} else {
notification
.
error
({
//
notification.error({
message
:
`文件导出错误`
,
//
message: `文件导出错误`,
description
:
data
.
errMsg
,
//
description: data.errMsg,
});
//
});
}
//
}
//
}).
catch
(
err
=>
{
//
}).catch(err => {
notification
.
error
({
//
notification.error({
message
:
`网络请求超时`
,
//
message: `网络请求超时`,
});
//
});
}).
finally
(()
=>
{
//
}).finally(() => {
this
.
setState
({
confirmLoading
:
false
});
//
this.setState({ confirmLoading: false });
});
//
});
}
//
}
//
cancelGroup
=
()
=>
{
//
cancelGroup = () => {
this
.
setState
({
currentGroupKey
:
null
,
groupVisiable
:
false
});
//
this.setState({ currentGroupKey: null, groupVisiable: false });
};
//
};
cancelQuery
=
()
=>
{
//
cancelQuery = () => {
this
.
setState
({
currentQueryKey
:
null
,
queryVisiable
:
false
});
//
this.setState({ currentQueryKey: null, queryVisiable: false });
};
//
};
cancelOrder
=
()
=>
{
//
cancelOrder = () => {
this
.
setState
({
currentOrderKey
:
null
,
orderVisiable
:
false
});
//
this.setState({ currentOrderKey: null, orderVisiable: false });
};
//
};
selectOrder
=
(
e
)
=>
{
//
selectOrder = (e) => {
//
this
.
setState
({
currentOrderKey
:
e
});
//
this.setState({ currentOrderKey: e });
};
//
};
selectQuery
=
(
e
)
=>
{
//
selectQuery = (e) => {
//
this
.
setState
({
currentQueryKey
:
e
});
//
this.setState({ currentQueryKey: e });
};
//
};
selectGroup
=
(
e
)
=>
{
//
selectGroup = (e) => {
//
this
.
setState
({
currentGroupKey
:
e
});
//
this.setState({ currentGroupKey: e });
};
//
};
//
render
()
{
//
render() {
const
{
form
}
=
this
.
props
;
//
const { form } = this.props;
const
{
//
const {
visiable
,
targetKeys
,
sourceSelectedKeys
,
queryVisiable
,
querys
,
orders
,
groups
,
confirmLoading
,
//
visiable, targetKeys, sourceSelectedKeys, queryVisiable, querys, orders, groups, confirmLoading,
targetSelectedKeys
,
mockData
,
qs
,
os
,
gs
,
currentQueryKey
,
currentOrderKey
,
orderVisiable
,
currentGroupKey
,
groupVisiable
,
//
targetSelectedKeys, mockData, qs, os, gs, currentQueryKey, currentOrderKey, orderVisiable, currentGroupKey, groupVisiable,
}
=
this
.
state
;
//
} = this.state;
return
(
//
return (
<
span
>
//
<span>
<
Button
shape
=
'round'
onClick
=
{
this
.
open
}
>
自定义导出
<
/Button
>
//
<Button shape='round' onClick={this.open}>自定义导出</Button>
<
div
id
=
'downloadDiv'
style
=
{{
display
:
'none'
}}
><
/div
>
//
<div id='downloadDiv' style={{ display: 'none' }}></div>
<
Modal
//
<Modal
width
=
{
670
}
//
width={670}
maskClosable
=
{
false
}
//
maskClosable={false}
destroyOnClose
//
destroyOnClose
title
=
"自定义查询、排序、导出"
//
title="自定义查询、排序、导出"
style
=
{{
textAlign
:
'center'
}}
//
style={{ textAlign: 'center' }}
visible
=
{
visiable
}
//
visible={visiable}
//
onOk
=
{
this
.
export
}
//
onOk={this.export}
onCancel
=
{
this
.
onCancle
}
//
onCancel={this.onCancle}
confirmLoading
=
{
confirmLoading
}
//
confirmLoading={confirmLoading}
>
//
>
<
div
style
=
{{
overflowY
:
'auto'
,
maxHeight
:
'500px'
,
height
:
'500px'
}}
>
//
<div style={{ overflowY: 'auto', maxHeight: '500px', height: '500px' }}>
<
div
style
=
{{
textAlign
:
'left'
}}
>
//
<div style={{ textAlign: 'left' }}>
<
Button
type
=
"primary"
>
新增查询条件
<
/Button
>
//
<Button type="primary">新增查询条件</Button>
//
//
<
Select
style
=
{{
width
:
200
,
paddingRight
:
'10px'
}}
//
<Select style={{ width: 200, paddingRight: '10px' }}
value
=
{
currentQueryKey
}
//
value={currentQueryKey}
onChange
=
{
this
.
selectQuery
}
>
//
onChange={this.selectQuery}>
{
qs
.
map
((
r
)
=>
{
//
{qs.map((r) => {
return
<
Option
key
=
{
r
.
field
}
//
return <Option key={r.field}
value
=
{
r
.
field
}
>
//
value={r.field}>
{
r
.
name
}
//
{r.name}
<
/Option>
;
//
</Option>;
},
//
},
)}
//
)}
//
<
/Select
>
//
</Select>
{
currentQueryKey
?
//
{currentQueryKey ?
<
span
style
=
{{
paddingLeft
:
'0'
}}
>
//
<span style={{ paddingLeft: '0' }}>
<
Button
type
=
"primary"
onClick
=
{
this
.
okQuery
}
>
确定
<
/Button
>
//
<Button type="primary" onClick={this.okQuery}>确定</Button>
<
/span
>
//
</span>
:
''
}
//
: ''}
<
div
style
=
{{
height
:
'12px'
}}
>
//
<div style={{ height: '12px' }}>
//
<
/div
>
//
</div>
{
querys
.
map
((
r
,
i
)
=>
//
{querys.map((r, i) =>
<
FormItem
key
=
{
r
.
name
+
i
}
//
<FormItem key={r.name + i}
labelCol
=
{{
span
:
4
}}
//
labelCol={{ span: 4 }}
wrapperCol
=
{{
span
:
20
}}
//
wrapperCol={{ span: 20 }}
colon
=
{
false
}
//
colon={false}
label
=
{
r
.
name
}
>
//
label={r.name}>
{
form
.
getFieldDecorator
(
i
+
'q__'
+
r
.
field
,
{
//
{form.getFieldDecorator(i + 'q__' + r.field, {
initialValue
:
{
stringX
:
'='
},
//
initialValue: { stringX: '=' },
rules
:
[{
//
rules: [{
validator
:
(
rule
,
value
,
callback
)
=>
{
//
validator: (rule, value, callback) => {
var
errors
=
[];
//
var errors = [];
if
(
value
==
null
)
{
//
if (value == null) {
errors
.
push
(
new
Error
(
'请输入查询值!'
,
rule
.
field
));
//
errors.push(new Error('请输入查询值!', rule.field));
//
}
else
{
//
} else {
if
(
value
.
stringX
!=
'IS NOT NULL'
&&
value
.
stringX
!=
'IS NULL'
&&
value
.
string
==
null
)
{
//
if (value.stringX != 'IS NOT NULL' && value.stringX != 'IS NULL' && value.string == null) {
errors
.
push
(
new
Error
(
'请输入查询值!'
,
rule
.
field
));
//
errors.push(new Error('请输入查询值!', rule.field));
}
//
}
}
//
}
callback
(
errors
);
//
callback(errors);
//
},
//
},
}],
//
}],
})(
//
})(
<
QueryItem
obj
=
{
r
}
//
<QueryItem obj={r}
key
=
{
r
.
name
+
i
}
//
key={r.name + i}
deleteQuery
=
{
this
.
deleteQuery
.
bind
(
this
,
i
)}
/>
)
}
//
deleteQuery={this.deleteQuery.bind(this, i)}/>)}
<
/FormItem>
)
//
</FormItem>)
}
//
}
<
/div
>
//
</div>
<
div
style
=
{{
textAlign
:
'left'
,
paddingTop
:
'15px'
}}
>
//
<div style={{ textAlign: 'left', paddingTop: '15px' }}>
<
Button
type
=
"primary"
>
新增排序条件
<
/Button
>
//
<Button type="primary">新增排序条件</Button>
<
Select
style
=
{{
width
:
200
,
paddingRight
:
'10px'
}}
//
<Select style={{ width: 200, paddingRight: '10px' }}
value
=
{
currentOrderKey
}
//
value={currentOrderKey}
onChange
=
{
this
.
selectOrder
}
>
//
onChange={this.selectOrder}>
{
os
.
map
((
r
)
=>
{
//
{os.map((r) => {
for
(
let
j
=
0
;
j
<
orders
.
length
;
j
++
)
{
//
for (let j = 0; j < orders.length; j++) {
if
(
orders
[
j
].
field
===
r
.
field
)
return
;
//
if (orders[j].field === r.field) return;
//
}
//
}
return
<
Option
key
=
{
r
.
field
}
value
=
{
r
.
field
}
>
{
r
.
name
}
<
/Option>
;
//
return <Option key={r.field} value={r.field}>{r.name}</Option>;
},
//
},
)}
//
)}
//
<
/Select
>
//
</Select>
{
currentOrderKey
?
//
{currentOrderKey ?
<
span
style
=
{{
paddingLeft
:
'0'
}}
>
//
<span style={{ paddingLeft: '0' }}>
<
Button
type
=
"primary"
onClick
=
{
this
.
okOrder
}
>
确定
<
/Button
>
//
<Button type="primary" onClick={this.okOrder}>确定</Button>
//
<
/span
>
//
</span>
:
''
}
//
: ''}
<
div
style
=
{{
height
:
'12px'
}}
>
//
<div style={{ height: '12px' }}>
//
<
/div
>
//
</div>
{
orders
.
map
((
r
,
i
)
=>
//
{orders.map((r, i) =>
<
FormItem
key
=
{
r
.
name
+
i
}
//
<FormItem key={r.name + i}
labelCol
=
{{
span
:
4
}}
//
labelCol={{ span: 4 }}
wrapperCol
=
{{
span
:
20
}}
//
wrapperCol={{ span: 20 }}
colon
=
{
false
}
//
colon={false}
label
=
{
'按'
+
r
.
name
}
>
//
label={'按' + r.name}>
{
form
.
getFieldDecorator
(
i
+
'o__'
+
r
.
field
,
{
//
{form.getFieldDecorator(i + 'o__' + r.field, {
initialValue
:
{
stringX
:
'desc'
},
//
initialValue: { stringX: 'desc' },
})(
//
})(
<
OrderItem
deleteOrder
=
{
this
.
deleteOrder
.
bind
(
this
,
i
)}
/>
)
}
//
<OrderItem deleteOrder={this.deleteOrder.bind(this, i)}/>)}
<
/FormItem>
)
}
//
</FormItem>)}
<
/div
>
//
</div>
{
this
.
props
.
voClass
?
//
{this.props.voClass ?
<
div
style
=
{{
textAlign
:
'left'
,
paddingTop
:
'15px'
}}
>
//
<div style={{ textAlign: 'left', paddingTop: '15px' }}>
<
span
style
=
{{
paddingRight
:
'10px'
}}
>
聚合条件
:
<
/span
>
//
<span style={{ paddingRight: '10px' }}>聚合条件:</span>
{
!
groupVisiable
?
//
{!groupVisiable ?
<
Button
type
=
"primary"
onClick
=
{
this
.
addGroup
}
>
新增
<
/Button
>
//
<Button type="primary" onClick={this.addGroup}>新增</Button>
//
:
//
:
<
span
>
//
<span>
<
Select
style
=
{{
width
:
100
}}
//
<Select style={{ width: 100 }}
value
=
{
currentGroupKey
}
//
value={currentGroupKey}
onChange
=
{
this
.
selectGroup
}
>
//
onChange={this.selectGroup}>
{
gs
.
map
((
r
)
=>
{
//
{gs.map((r) => {
for
(
var
j
=
0
;
j
<
groups
.
length
;
j
++
)
{
//
for (var j = 0; j < groups.length; j++) {
if
(
groups
[
j
].
field
==
r
.
field
)
return
;
//
if (groups[j].field == r.field) return;
//
}
//
}
return
<
Option
key
=
{
r
.
field
}
//
return <Option key={r.field}
value
=
{
r
.
field
}
>
//
value={r.field}>
{
r
.
name
}
//
{r.name}
<
/Option>
;
//
</Option>;
},
//
},
)}
//
)}
<
/Select
>
//
</Select>
{
currentGroupKey
?
//
{currentGroupKey ?
<
Button
type
=
"primary"
onClick
=
{
this
.
okGroup
}
>
确定
<
/Button
>
//
<Button type="primary" onClick={this.okGroup}>确定</Button>
//
//
:
''
}
//
: ''}
<
Button
type
=
"primary"
onClick
=
{
this
.
cancelGroup
}
>
取消
<
/Button
>
//
<Button type="primary" onClick={this.cancelGroup}>取消</Button>
//
<
/span>
}
//
</span>}
{
groups
.
map
((
r
,
i
)
=>
//
{groups.map((r, i) =>
<
FormItem
key
=
{
i
+
r
.
name
}
//
<FormItem key={i + r.name}
labelCol
=
{{
span
:
5
}}
//
labelCol={{ span: 5 }}
wrapperCol
=
{{
span
:
15
}}
//
wrapperCol={{ span: 15 }}
label
=
{
'按'
+
r
.
name
+
'聚合'
}
>
//
label={'按' + r.name + '聚合'}>
{
form
.
getFieldDecorator
(
i
+
'g__'
+
r
.
field
)(
//
{form.getFieldDecorator(i + 'g__' + r.field)(
<
Input
style
=
{{
display
:
'none'
}}
//
<Input style={{ display: 'none' }}
value
=
""
/>
)}
//
value=""/>)}
<
Button
type
=
"danger"
onClick
=
{
this
.
deleteGroup
.
bind
(
this
,
i
)}
>
删除
<
/Button
>
//
<Button type="danger" onClick={this.deleteGroup.bind(this, i)}>删除</Button>
//
//
<
/FormItem>
)
}
//
</FormItem>)}
<
/div> : ''
}
//
</div> : ''}
<
Row
>
//
<Row>
<
Col
span
=
{
24
}
//
<Col span={24}
style
=
{{
textAlign
:
'left'
,
paddingTop
:
'15px'
}}
>
//
style={{ textAlign: 'left', paddingTop: '15px' }}>
<
span
style
=
{{
paddingRight
:
'10px'
}}
>
导出项
:
<
/span
>
//
<span style={{ paddingRight: '10px' }}>导出项:</span>
{
/*<Select>*/
}
//
{/*<Select>*/}
{
/*{*/
}
//
{/*{*/}
//
{
/*}*/
}
//
{/*}*/}
{
/*</Select>*/
}
//
{/*</Select>*/}
<
/Col
>
//
</Col>
<
Col
span
=
{
18
}
>
//
<Col span={18}>
<
Transfer
key
=
{
keyX
}
//
<Transfer key={keyX}
style
=
{{
textAlign
:
'left'
}}
//
style={{ textAlign: 'left' }}
dataSource
=
{
mockData
}
//
dataSource={mockData}
listStyle
=
{{
//
listStyle={{
width
:
200
,
//
width: 200,
height
:
300
,
//
height: 300,
}}
//
}}
onSelectChange
=
{
this
.
onSelectChange
}
//
onSelectChange={this.onSelectChange}
selectedKeys
=
{[...
sourceSelectedKeys
,
...
targetSelectedKeys
]}
//
selectedKeys={[...sourceSelectedKeys, ...targetSelectedKeys]}
rowKey
=
{
record
=>
record
.
key
}
//
rowKey={record => record.key}
targetKeys
=
{
targetKeys
}
//
targetKeys={targetKeys}
onChange
=
{
this
.
handleChange
}
//
onChange={this.handleChange}
render
=
{
this
.
renderItem
}
//
render={this.renderItem}
/
>
//
/>
<
/Col
>
//
</Col>
<
Col
span
=
{
2
}
>
//
<Col span={2}>
<
div
style
=
{{
marginTop
:
100
}}
>
//
<div style={{ marginTop: 100 }}>
<
Button
size
=
"small"
//
<Button size="small"
disabled
=
{
targetSelectedKeys
.
length
===
0
}
//
disabled={targetSelectedKeys.length === 0}
onClick
=
{
this
.
top
}
>
//
onClick={this.top}>
批量置顶
//
批量置顶
<
/Button
>
//
</Button>
<
Button
size
=
"small"
//
<Button size="small"
style
=
{{
marginTop
:
10
}}
//
style={{ marginTop: 10 }}
disabled
=
{
targetSelectedKeys
.
length
!==
1
}
//
disabled={targetSelectedKeys.length !== 1}
onClick
=
{
this
.
up
}
>
//
onClick={this.up}>
单项上移
//
单项上移
<
/Button
>
//
</Button>
<
Button
size
=
"small"
//
<Button size="small"
style
=
{{
marginTop
:
10
}}
//
style={{ marginTop: 10 }}
disabled
=
{
targetSelectedKeys
.
length
!==
1
}
//
disabled={targetSelectedKeys.length !== 1}
onClick
=
{
this
.
down
}
>
//
onClick={this.down}>
单项下移
//
单项下移
<
/Button
>
//
</Button>
<
Button
size
=
"small"
//
<Button size="small"
style
=
{{
marginTop
:
10
}}
//
style={{ marginTop: 10 }}
disabled
=
{
targetSelectedKeys
.
length
===
0
}
//
disabled={targetSelectedKeys.length === 0}
onClick
=
{
this
.
bottom
}
>
//
onClick={this.bottom}>
批量置底
//
批量置底
<
/Button
>
//
</Button>
<
/div
>
//
</div>
<
/Col
>
//
</Col>
//
<
/Row
>
//
</Row>
<
/div
>
//
</div>
<
/Modal
>
//
</Modal>
<
/span
>
//
</span>
);
//
);
}
//
}
}
//
}
FormInsertDiy/ImportUtil/ImportUtil.js
浏览文件 @
1edf9e12
import
React
,
{
Fragment
}
from
'react'
;
//
import React, { Fragment } from 'react';
import
{
//
import {
Button
,
//
Button,
Modal
,
//
Modal,
Steps
,
//
Steps,
Upload
,
//
Upload,
Icon
,
//
Icon,
message
,
//
message,
Tabs
,
//
Tabs,
Table
,
//
Table,
}
from
'antd'
;
//
} from 'antd';
import
styles
from
'./ImportUtil.less'
;
//
import styles from './ImportUtil.less';
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
//
import ButtonDiy from '@/baseComponent/ButtonDiy';
import
{
exportExcel
}
from
'xlsx-oc'
//
import { exportExcel } from 'xlsx-oc'
import
config
from
'@/config/config'
;
//
import config from '@/config/config';
import
{
connect
}
from
'dva'
;
//
import { connect } from 'dva';
const
Step
=
Steps
.
Step
;
//
const Step = Steps.Step;
//
//
const
TabPane
=
Tabs
.
TabPane
;
//
const TabPane = Tabs.TabPane;
//
//
@
connect
(({
DataObj
,
loading
})
=>
({
//
@connect(({ DataObj, loading }) => ({
DataObj
,
//
DataObj,
loading
:
loading
.
models
.
DataObj
,
//
loading: loading.models.DataObj,
}))
//
}))
export
default
class
ImportUtil
extends
React
.
PureComponent
{
//
export default class ImportUtil extends React.PureComponent {
constructor
(
props
)
{
//
constructor(props) {
super
(
props
);
//
super(props);
//
const
exportTemplateUrl
=
encodeURI
(
`
${
config
.
sqlFormsServer
}
/DataObjApi/importTemplateDownload?objId=
${
this
.
props
.
objId
}
&name=
${
props
.
fileName
}
`
);
//
const exportTemplateUrl= encodeURI(`${config.sqlFormsServer}/DataObjApi/importTemplateDownload?objId=${this.props.objId}&name=${props.fileName}`);
//
this
.
state
=
{
//
this.state = {
ch
:
false
,
//
ch:false,
currentKey
:
"1"
,
//
currentKey:"1",
visible
:
false
,
//
visible: false,
current
:
0
,
//
current: 0,
isShow
:
true
,
//
isShow: true,
filekey
:
''
,
//
filekey: '',
sucData
:
[],
//
sucData: [],
errData
:
[],
//
errData: [],
column
:
[],
//
column: [],
//
exportTemplateUrl
,
//
exportTemplateUrl,
//
isNextDisabled
:
false
,
//
isNextDisabled:false,
};
//
};
}
//
}
//
showModal
=
()
=>
{
//
showModal = () => {
//
this
.
setState
({
//
this.setState({
visible
:
true
,
//
visible: true,
});
//
});
};
//
};
handleOk
=
(
e
)
=>
{
//
handleOk = (e) => {
this
.
setState
({
//
this.setState({
visible
:
false
,
//
visible: false,
});
//
});
};
//
};
handleCancel
=
(
e
)
=>
{
//
handleCancel = (e) => {
this
.
setState
({
//
this.setState({
visible
:
false
,
//
visible: false,
});
//
});
};
//
};
//
next
()
{
//
next() {
const
current
=
this
.
state
.
current
+
1
;
//
const current = this.state.current + 1;
if
(
current
===
2
)
{
//
if (current === 2) {
this
.
setState
({
//
this.setState({
current
:
current
,
//
current: current,
isShow
:
false
,
//
isShow: false,
});
//
});
if
(
this
.
state
.
errData
.
lenth
>
0
)
{
//
if (this.state.errData.lenth > 0) {
message
.
error
(
'请检查数据'
);
//
message.error('请检查数据');
return
;
//
return;
}
else
{
//
} else {
this
.
import
();
//
this.import();
}
//
}
}
//
}
if
(
current
===
3
)
{
//
if (current === 3) {
this
.
setState
({
//
this.setState({
current
:
current
,
//
current: current,
isShow
:
true
,
//
isShow: true,
});
//
});
if
(
this
.
props
.
callback
)
{
//
if (this.props.callback) {
this
.
props
.
callback
();
//
this.props.callback();
}
//
}
}
//
}
//
}
//
}
//
prev
()
{
//
prev() {
const
current
=
this
.
state
.
current
-
1
;
//
const current = this.state.current - 1;
this
.
setState
({
current
});
//
this.setState({ current });
}
//
}
//
import
()
{
//
import() {
const
{
dispatch
,
importParams
}
=
this
.
props
;
//
const { dispatch ,importParams } = this.props;
dispatch
({
//
dispatch({
type
:
'DataObj/importExecute'
,
//
type: 'DataObj/importExecute',
payload
:
{
//
payload: {
...(
importParams
||
{}),
//
...(importParams||{}),
cacheKey
:
this
.
state
.
filekey
,
//
cacheKey:this.state.filekey,
//
objId
:
this
.
props
.
objId
,
//
objId: this.props.objId,
},
//
},
callback
:
(
res
)
=>
{
//
callback: (res) => {
//
this
.
next
();
//
this.next();
message
.
success
(
'导入成功'
);
//
message.success('导入成功');
//
this
.
setState
({
//
this.setState({
current
:
3
,
//
current: 3,
isShow
:
true
,
//
isShow: true,
visible
:
false
,
//
visible: false,
//
});
//
});
if
(
this
.
props
.
callback
){
//
if(this.props.callback){
this
.
props
.
callback
();
//
this.props.callback();
}
//
}
}
//
}
})
//
})
//
//
}
//
}
//
getCachKey
=
(
filePath
)
=>
{
//
getCachKey = (filePath) => {
const
{
dispatch
,
importParams
}
=
this
.
props
;
//
const { dispatch ,importParams } = this.props;
dispatch
({
//
dispatch({
type
:
'DataObj/importAnalyse'
,
//
type: 'DataObj/importAnalyse',
payload
:
{
//
payload: {
...(
importParams
||
{}),
//
...(importParams||{}),
isLocal
:
false
,
//
isLocal:false,
filePath
,
//
filePath,
objId
:
this
.
props
.
objId
,
//
objId: this.props.objId,
},
//
},
callback
:
(
res
)
=>
{
//
callback: (res) => {
this
.
setState
({
//
this.setState({
filekey
:
res
.
cacheKey
,
//
filekey: res.cacheKey,
//
});
//
});
this
.
queryFile
(
res
.
cacheKey
);
//
this.queryFile(res.cacheKey);
//
}
//
}
})
//
})
//
//
};
//
};
queryFile
=
(
cacheKey
)
=>
{
//
queryFile = (cacheKey) => {
const
{
dispatch
,
importParams
}
=
this
.
props
;
//
const { dispatch ,importParams } = this.props;
dispatch
({
//
dispatch({
type
:
'DataObj/importDataQuery'
,
//
type: 'DataObj/importDataQuery',
payload
:
{
//
payload: {
...(
importParams
||
{}),
//
...(importParams||{}),
cacheKey
,
//
cacheKey,
objId
:
this
.
props
.
objId
,
//
objId: this.props.objId,
},
//
},
callback
:
(
res
)
=>
{
//
callback: (res) => {
this
.
setState
({
//
this.setState({
current
:
1
,
//
current: 1,
isShow
:
false
,
//
isShow: false,
//
sucData
:
res
.
pass
,
//
sucData: res.pass,
errData
:
res
.
noPass
,
//
errData: res.noPass,
column
:
res
.
column
//
column: res.column
});
//
});
if
(
res
.
noPass
&&
res
.
noPass
.
length
==
0
){
//
if(res.noPass&&res.noPass.length==0){
//
//
if
(
res
.
pass
.
length
==
0
)
{
//
if (res.pass.length==0) {
message
.
error
(
'当前没有验证成功的数据,无法导入。'
);
//
message.error('当前没有验证成功的数据,无法导入。');
this
.
setState
({
//
this.setState({
currentKey
:
"1"
,
//
currentKey:"1",
ch
:
!
this
.
state
.
ch
,
//
ch:!this.state.ch,
isNextDisabled
:
true
//
isNextDisabled: true
});
//
});
}
else
{
//
} else {
message
.
success
(
'所有数据验证通过,请确认后点击下一步。'
);
//
message.success('所有数据验证通过,请确认后点击下一步。');
this
.
setState
({
//
this.setState({
currentKey
:
"2"
,
//
currentKey:"2",
ch
:
!
this
.
state
.
ch
,
//
ch:!this.state.ch,
isNextDisabled
:
false
//
isNextDisabled: false
});
//
});
}
//
}
}
else
{
//
}else{
message
.
error
(
'当前存在未验证通过的数据,请按错误提示检测更正导入文件'
);
//
message.error('当前存在未验证通过的数据,请按错误提示检测更正导入文件');
this
.
setState
({
//
this.setState({
currentKey
:
"1"
,
//
currentKey:"1",
ch
:
!
this
.
state
.
ch
,
//
ch:!this.state.ch,
isNextDisabled
:
true
//
isNextDisabled: true
});
//
});
}
//
}
//
}
//
}
})
//
})
};
//
};
changePane
=
(
activeKey
)
=>
{
//
changePane=(activeKey)=>{
this
.
setState
({
currentKey
:
activeKey
})
//
this.setState({currentKey:activeKey})
}
//
}
exportError
=
(
column
,
dataSource
)
=>
{
//
exportError=(column,dataSource)=>{
//
//
var
_headers
=
[]
//
var _headers = []
for
(
var
i
=
0
;
i
<
column
.
length
;
i
++
){
//
for(var i=0;i<column.length;i++){
_headers
.
push
({
k
:
column
[
i
].
dataIndex
,
v
:
column
[
i
].
title
})
//
_headers.push({k:column[i].dataIndex,v:column[i].title})
}
//
}
for
(
var
j
=
0
;
j
<
dataSource
.
length
;
j
++
){
//
for(var j=0;j<dataSource.length;j++){
dataSource
[
j
].
index
=
j
+
1
//
dataSource[j].index=j+1
}
//
}
exportExcel
(
_headers
,
dataSource
);
//
exportExcel(_headers, dataSource);
//
//
}
//
}
render
()
{
//
render() {
//
const
props
=
{
//
const props = {
name
:
'file'
,
//
name: 'file',
action
:
config
.
uploadUrl
,
//
action: config.uploadUrl,
//
headers
:
{
//
headers: {
authorization
:
'authorization-text'
,
//
authorization: 'authorization-text',
},
//
},
accept
:
'.xlsx'
,
//
accept:'.xlsx',
showUploadList
:
false
,
//
showUploadList: false,
onChange
:
(
info
)
=>
{
//
onChange: (info) => {
if
(
info
.
file
.
status
!==
'uploading'
)
{
//
if (info.file.status !== 'uploading') {
//
}
//
}
if
(
info
.
file
.
status
===
'done'
)
{
//
if (info.file.status === 'done') {
message
.
success
(
`
${
info
.
file
.
name
}
上传成功`
);
//
message.success(`${info.file.name} 上传成功`);
let
x
=
info
.
file
.
response
;
//
let x = info.file.response;
//
//
//
this
.
getCachKey
(
x
);
//
this.getCachKey(x);
//
}
else
if
(
info
.
file
.
status
===
'error'
)
{
//
} else if (info.file.status === 'error') {
message
.
error
(
`
${
info
.
file
.
name
}
file upload failed.`
);
//
message.error(`${info.file.name} file upload failed.`);
}
//
}
},
//
},
};
//
};
const
steps
=
[{
//
const steps = [{
title
:
'上传Excel'
,
//
title: '上传Excel',
},
{
//
}, {
title
:
'验证数据'
,
//
title: '验证数据',
},
{
//
}, {
title
:
'数据导入'
,
//
title: '数据导入',
},
//
},
{
//
{
title
:
'导入完成'
,
//
title: '导入完成',
}];
//
}];
//
const
{
current
}
=
this
.
state
;
//
const { current } = this.state;
const
{
name
,
loading
}
=
this
.
props
//
const {name, loading} = this.props
const
column1
=
this
.
state
.
column
?[{
title
:
"序号"
,
dataIndex
:
"index"
,
fixed
:
"left"
,
width
:
50
,
render
:(
v
,
r
,
i
)
=>
i
+
1
},...
this
.
state
.
column
]:[]
//
const column1=this.state.column?[{title:"序号",dataIndex:"index",fixed:"left",width:50, render:(v,r,i)=>i+1},...this.state.column]:[]
var
column2
=
this
.
state
.
column
?[...
this
.
state
.
column
]:[]
//
var column2=this.state.column?[...this.state.column]:[]
if
(
column1
.
length
>
1
)
column1
[
1
].
render
=
(
val
)
=><
span
style
=
{{
color
:
"red"
}}
>
{
val
}
<
/span
>
//
if(column1.length>1) column1[1].render=(val)=><span style={{color:"red"}}>{val}</span>
//
column2
.
splice
(
0
,
1
)
//
column2.splice(0,1)
column2
=
[{
title
:
"序号"
,
fixed
:
"left"
,
width
:
50
,
render
:(
v
,
r
,
i
)
=>
i
+
1
},...
column2
]
//
column2=[{title:"序号",fixed:"left",width:50, render:(v,r,i)=>i+1},...column2]
//
return
(
//
return (
<
span
>
//
<span>
<
ButtonDiy
name
=
{
name
||
'批量导入'
}
//
<ButtonDiy name={name||'批量导入'}
type
=
'default'
//
type='default'
className
=
'defaultBlue'
//
className='defaultBlue'
handleClick
=
{
this
.
showModal
}
/
>
//
handleClick={this.showModal}/>
<
Modal
//
<Modal
visible
=
{
this
.
state
.
visible
}
//
visible={this.state.visible}
onOk
=
{
this
.
handleOk
}
//
onOk={this.handleOk}
maskClosable
=
{
false
}
//
maskClosable={false}
destroyOnClose
//
destroyOnClose
onCancel
=
{
this
.
handleCancel
}
//
onCancel={this.handleCancel}
title
=
{
null
}
//
title={null}
footer
=
{
null
}
//
footer={null}
width
=
{
"80%"
}
//
width={"80%"}
>
//
>
//
<
div
className
=
{
styles
.
nomal
}
>
//
<div className={styles.nomal}>
<
p
className
=
{
styles
.
import
}
>
//
<p className={styles.import}>
EXCEL
导入向导
//
EXCEL导入向导
<
/p
>
//
</p>
<
div
style
=
{{
margin
:
'auto 23px'
}}
>
//
<div style={{ margin: 'auto 23px' }}>
<
Steps
current
=
{
current
}
>
//
<Steps current={current}>
{
steps
.
map
(
item
=>
//
{steps.map(item =>
<
Step
key
=
{
item
.
title
}
//
<Step key={item.title}
title
=
{
item
.
title
}
/>
)
}
//
title={item.title}/>)}
<
/Steps
>
//
</Steps>
<
div
className
=
"steps-content"
>
//
<div className="steps-content">
{
steps
[
this
.
state
.
current
].
content
}
//
{steps[this.state.current].content}
<
/div
>
//
</div>
<
div
className
=
{
styles
.
button
}
>
//
<div className={styles.button}>
{
//
{
(
this
.
state
.
current
<
steps
.
length
-
1
&&
this
.
state
.
current
!==
0
)
//
(this.state.current < steps.length - 1 && this.state.current !== 0)
&&
//
&&
<
ButtonDiy
name
=
{
this
.
state
.
current
==
3
?
"确认导入"
:
"下一步"
}
type
=
"primary"
disabled
=
{
this
.
state
.
current
!=
3
&&
this
.
state
.
isNextDisabled
}
className
=
'primaryBlue'
handleClick
=
{()
=>
this
.
next
()}
/
>
//
<ButtonDiy name={this.state.current==3?"确认导入":"下一步"} type="primary" disabled={this.state.current!=3 && this.state.isNextDisabled} className='primaryBlue' handleClick={() => this.next()}/>
//
}
//
}
//
{
//
{
this
.
state
.
current
>
0
//
this.state.current > 0
&&
//
&&
<
ButtonDiy
style
=
{{
marginLeft
:
8
}}
name
=
"上一步"
className
=
'defaultBlue'
handleClick
=
{()
=>
this
.
prev
()}
/
>
//
<ButtonDiy style={{ marginLeft: 8 }} name="上一步" className='defaultBlue' handleClick={() => this.prev()}/>
//
}
//
}
<
/div
>
//
</div>
<
/div
>
//
</div>
//
<
div
className
=
{
styles
.
tip
}
>
//
<div className={styles.tip}>
<
p
className
=
{
styles
.
tipContent
}
>
//
<p className={styles.tipContent}>
<
span
>
欢迎使用
EXCEL
导入向导,首先请您上传需要导入的
EXCEL
文件。
<
/span
>
//
<span>欢迎使用EXCEL导入向导,首先请您上传需要导入的EXCEL文件。</span>
<
span
>
点击“选择文件”选择您要导入的
EXCEL
文件,点击“开始上传”将其上传到服务器上,点击“清空队列”清空当前上传文件队列。
<
/span
>
//
<span>点击“选择文件”选择您要导入的EXCEL文件,点击“开始上传”将其上传到服务器上,点击“清空队列”清空当前上传文件队列。</span>
<
/p
>
//
</p>
//
<
/div
>
//
</div>
{
//
{
this
.
state
.
isShow
?
//
this.state.isShow ?
<
div
className
=
{
styles
.
buttonDown
}
>
//
<div className={styles.buttonDown}>
<
Upload
{...
props
}
>
//
<Upload {...props}>
<
Button
>
//
<Button>
<
Icon
type
=
"upload"
/>
点击上传
//
<Icon type="upload"/>点击上传
<
/Button
>
//
</Button>
<
/Upload
>
//
</Upload>
<
Button
href
=
{
this
.
state
.
exportTemplateUrl
}
//
<Button href={this.state.exportTemplateUrl }
target
=
"_blank"
//
target="_blank"
type
=
"danger"
>
//
type="danger">
下载模板
//
下载模板
<
/Button
>
//
</Button>
<
/div>
:
//
</div> :
<
Upload
{...
props
}
>
//
<Upload {...props}>
<
Button
>
//
<Button>
<
Icon
type
=
"upload"
/>
//
<Icon type="upload"/>
重新上传
//
重新上传
<
/Button
>
//
</Button>
<
/Upload
>
//
</Upload>
}
//
}
//
{
//
{
this
.
state
.
isShow
?
<
div
className
=
{
styles
.
attentionItem
}
>
//
this.state.isShow ? <div className={styles.attentionItem}>
<
p
>
导入事项
<
/p
>
//
<p>导入事项</p>
<
p
>
1
.
导入操作一次只能上传
1
个
EXCEL
文件。
<
/p
>
//
<p>1. 导入操作一次只能上传 1 个EXCEL文件。</p>
<
p
>
2
.
导入文件最大文件大小上传
1
GB
。
<
/p
>
//
<p>2. 导入文件最大文件大小上传 1 GB。</p>
<
p
>
3
.
只能上传
EXCEL
文件
(
XLS
,
XLSX
)
默认支持
EXCEL
2003
和
EXCEL
2007
。
<
/p
>
//
<p>3. 只能上传EXCEL文件(XLS, XLSX) 默认支持EXCEL 2003和EXCEL 2007。</p>
<
p
>
4
.
请将
EXCEL
文件的所有单元格格式设置为“文本”格式
<
/p
>
//
<p>4. 请将EXCEL文件的所有单元格格式设置为“文本”格式</p>
<
/div>
:
//
</div> :
<
div
className
=
{
styles
.
error
}
style
=
{{
marginTop
:
20
}}
>
//
<div className={styles.error} style={{marginTop:20}}>
//
<
Tabs
activeKey
=
{
this
.
state
.
currentKey
}
key
=
{
this
.
state
.
ch
}
onChange
=
{
this
.
changePane
}
type
=
"card"
>
//
<Tabs activeKey={this.state.currentKey} key={this.state.ch} onChange={this.changePane} type="card">
{
this
.
state
.
errData
&&
this
.
state
.
errData
.
length
==
0
?
""
:
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"red"
}}
>
验证错误列表
<
/span>} key="1"
>
//
{this.state.errData&&this.state.errData.length==0?"":<TabPane tab={<span style={{color:"red"}}>验证错误列表</span>} key="1">
<
Button
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
type
=
"danger"
onClick
=
{
this
.
exportError
.
bind
(
this
,
column1
,
this
.
state
.
errData
)}
>
导出错误信息
<
/Button
>
//
<Button style={{marginTop:5,marginBottom:5}} type="danger" onClick={this.exportError.bind(this,column1,this.state.errData)}>导出错误信息</Button>
//
<
Table
columns
=
{
column1
}
size
=
"small"
// <Table columns={column1} size="small"
style
=
{{
overflow
:
'auto'
}}
//
style={{overflow: 'auto'}}
dataSource
=
{
this
.
state
.
errData
}
//
dataSource={this.state.errData}
bordered
=
{
true
}
/></
TabPane
>
}
//
bordered={true}/></TabPane>}
<
TabPane
tab
=
{
<
span
style
=
{{
color
:
"green"
}}
>
验证成功列表
<
/span>} key="2">
// <TabPane tab={<span style={{color:"green"}}>验证成功列表</span>} key="2">
//
<
Button
style
=
{{
marginTop
:
5
,
marginBottom
:
5
}}
type
=
"primary"
onClick
=
{
this
.
exportError
.
bind
(
this
,
column2
,
this
.
state
.
sucData
)}
>
导出正确信息
<
/Button
>
//
<Button style={{marginTop:5,marginBottom:5}} type="primary" onClick={this.exportError.bind(this,column2,this.state.sucData)}>导出正确信息</Button>
//
<
Table
columns
=
{
column2
}
size
=
"small"
// <Table columns={column2} size="small"
style
=
{{
overflow
:
'auto'
}}
//
style={{overflow: 'auto'}}
dataSource
=
{
this
.
state
.
sucData
}
//
dataSource={this.state.sucData}
bordered
=
{
true
}
/></
TabPane
>
//
bordered={true}/></TabPane>
//
<
/Tabs
>
//
</Tabs>
//
//
<
/div
>
//
</div>
}
//
}
<
/div
>
//
</div>
//
<
/Modal
>
//
</Modal>
<
/span
>
//
</span>
);
//
);
}
//
}
}
//
}
FormInsertDiy/ImportUtil/ImportUtil.less
浏览文件 @
1edf9e12
.nomal{
//.nomal{
background: #fff;
// background: #fff;
padding: 10px;
// padding: 10px;
}
//}
.title{
//.title{
display: flex;
// display: flex;
margin-bottom: 20px;
// margin-bottom: 20px;
}
//}
.info{
//.info{
text-align: center;
// text-align: center;
font-weight: bold;
// font-weight: bold;
font-size: 18px;
// font-size: 18px;
}
//}
.detail{
//.detail{
text-align: center;
// text-align: center;
margin:30px auto;
// margin:30px auto;
}
//}
.detail img{
//.detail img{
margin: auto 10px;
// margin: auto 10px;
}
//}
.button{
//.button{
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
// display: -moz-flex;
display: flex;
// display: flex;
-moz-box-pack: center; /*Firefox*/
// -moz-box-pack: center; /*Firefox*/
-webkit-box-pack: center; /*Safari,Opera,Chrome*/
// -webkit-box-pack: center; /*Safari,Opera,Chrome*/
box-pack: center;
// box-pack: center;
-moz-justify-content: center;
// -moz-justify-content: center;
-webkit-justify-content: center;
// -webkit-justify-content: center;
justify-content: center;
// justify-content: center;
}
//}
.operation{
//.operation{
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
// display: -moz-flex;
display: flex;
// display: flex;
-moz-box-pack: center; /*Firefox*/
// -moz-box-pack: center; /*Firefox*/
-webkit-box-pack: center; /*Safari,Opera,Chrome*/
// -webkit-box-pack: center; /*Safari,Opera,Chrome*/
box-pack: center;
// box-pack: center;
-moz-justify-content: center;
// -moz-justify-content: center;
-webkit-justify-content: center;
// -webkit-justify-content: center;
justify-content: center;
// justify-content: center;
}
//}
.button Button{
//.button Button{
margin: auto 10px;
// margin: auto 10px;
//
}
//}
.titleInfo p span{
//.titleInfo p span{
font-weight: bold;
// font-weight: bold;
}
//}
.import{
//.import{
color: #6ca3c9;
// color: #6ca3c9;
font-size: 16px;
// font-size: 16px;
}
//}
.button{
//.button{
// background: #eff3f8;
// // background: #eff3f8;
text-align: center;
// text-align: center;
padding:20px;
// padding:20px;
margin-top: 20px;
// margin-top: 20px;
}
//}
.tip{
//.tip{
margin:20px auto;
// margin:20px auto;
padding:10px;
// padding:10px;
border-top: 1px solid #ccc;
// border-top: 1px solid #ccc;
}
//}
.tip span{
//.tip span{
display: block;
// display: block;
margin:10px;
// margin:10px;
font-size: 16px;
// font-size: 16px;
}
//}
.tip::after{
//.tip::after{
content: '';
// content: '';
position: absolute;
// position: absolute;
width: 5px;
// width: 5px;
height: 57px;
// height: 57px;
background: #e5eaf1;
// background: #e5eaf1;
margin-top: -141px;
// margin-top: -141px;
margin-left: -13px;
// margin-left: -13px;
}
//}
.select button{
//.select button{
color: #fff;
// color: #fff;
padding:10px;
// padding:10px;
background: #abbac3;
// background: #abbac3;
border: none;
// border: none;
margin: 10px;
// margin: 10px;
}
//}
.attentionItem{
//.attentionItem{
background: #f4f5f4;
// background: #f4f5f4;
padding: 10px;
// padding: 10px;
box-shadow: 1px 1px 1px #ccc;
// box-shadow: 1px 1px 1px #ccc;
}
//}
.attentionItem p:nth-child(1){
//.attentionItem p:nth-child(1){
font-size: 16px;
// font-size: 16px;
margin-left: 0;
// margin-left: 0;
}
//}
.attentionItem p{
//.attentionItem p{
font-size: 14px;
// font-size: 14px;
margin-left: 45px;
// margin-left: 45px;
}
//}
.submitButtons{
//.submitButtons{
margin-left: 34px;
// margin-left: 34px;
}
//}
.contentTable{
//.contentTable{
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
// display: -moz-flex;
display: flex;
// display: flex;
-moz-box-pack: justify; /*Firefox*/
// -moz-box-pack: justify; /*Firefox*/
-webkit-box-pack:justify; /*Safari,Opera,Chrome*/
// -webkit-box-pack:justify; /*Safari,Opera,Chrome*/
box-pack: justify;
// box-pack: justify;
-moz-justify-content: space-between;
// -moz-justify-content: space-between;
-webkit-justify-content: space-between;
// -webkit-justify-content: space-between;
justify-content: space-between;
// justify-content: space-between;
margin-top: 20px;
// margin-top: 20px;
}
//}
.left{
//.left{
width: 50%;
// width: 50%;
}
//}
.right{
//.right{
width: 50%;
// width: 50%;
border-left: 1px solid #317ecc;
// border-left: 1px solid #317ecc;
}
//}
.error p{
//.error p{
color: #fff;
// color: #fff;
background: #317ecc;
// background: #317ecc;
// margin: 10px auto;
// // margin: 10px auto;
text-align: left;
// text-align: left;
font-size: 18px;
// font-size: 18px;
}
//}
.download{
//.download{
background: #f5f5f5;
// background: #f5f5f5;
padding: 5px;
// padding: 5px;
margin-top: -16px;
// margin-top: -16px;
}
//}
.download img{
//.download img{
margin-top: -2px;
// margin-top: -2px;
margin-right: 5px;
// margin-right: 5px;
}
//}
.download button{
//.download button{
border: none;
// border: none;
background: #f5f5f5
// background: #f5f5f5
}
//}
.download button:nth-child(1){
//.download button:nth-child(1){
border-right: 1px solid #ccc;
// border-right: 1px solid #ccc;
}
//}
.download button:nth-child(2){
//.download button:nth-child(2){
border-right: 1px solid #ccc;
// border-right: 1px solid #ccc;
}
//}
.buttonDown{
//.buttonDown{
display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
// display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
// display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
// display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
// display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: -moz-flex;
// display: -moz-flex;
display: flex;
// display: flex;
-moz-box-pack: start; /*Firefox*/
// -moz-box-pack: start; /*Firefox*/
-webkit-box-pack: start; /*Safari,Opera,Chrome*/
// -webkit-box-pack: start; /*Safari,Opera,Chrome*/
box-pack: start;
// box-pack: start;
-moz-justify-content: flex-start;
// -moz-justify-content: flex-start;
-webkit-justify-content: flex-start;
// -webkit-justify-content: flex-start;
justify-content: flex-start;
// justify-content: flex-start;
margin-bottom: 20px;
// margin-bottom: 20px;
}
//}
.buttonDown>button{
//.buttonDown>button{
margin-left: 10px;
// margin-left: 10px;
background: #abbac3;
// background: #abbac3;
border: none;
// border: none;
color: #fff;
// color: #fff;
padding: 5px 12px;
// padding: 5px 12px;
border-radius: 5px;
// border-radius: 5px;
}
//}
\ No newline at end of file
FormInsertDiy/List/index.js
浏览文件 @
1edf9e12
...
@@ -2,13 +2,13 @@ import React, { Fragment } from 'react';
...
@@ -2,13 +2,13 @@ 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'
;
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
}
from
'./services'
;
import
{
getHead
,
fetchData
,
deleteItem
,
add
}
from
'./services'
;
...
@@ -344,8 +344,8 @@ class FormList extends React.Component {
...
@@ -344,8 +344,8 @@ class FormList extends React.Component {
<
Shell
>
<
Shell
>
<
div
style
=
{{
paddingLeft
:
'10px'
,
marginTop
:
'20px'
}}
>
<
div
style
=
{{
paddingLeft
:
'10px'
,
marginTop
:
'20px'
}}
>
<
ButtonDiy
icon
=
"plus"
className
=
"primaryBlue"
handleClick
=
{
this
.
add
}
name
=
"新建"
/>
<
ButtonDiy
icon
=
"plus"
className
=
"primaryBlue"
handleClick
=
{
this
.
add
}
name
=
"新建"
/>
{
hasImport
&&
<
ImportUtil
objId
=
{
objId
}
/>
}
{
/*
{hasImport && <ImportUtil objId={objId} />}
{
hasExport
&&
<
ExportInfo
objId
=
{
objId
}
/>
}
{hasExport && <ExportInfo objId={objId} />}
*/
}
<
ButtonDiy
handleClick
=
{
this
.
batchDelete
}
name
=
"批量删除"
/>
<
ButtonDiy
handleClick
=
{
this
.
batchDelete
}
name
=
"批量删除"
/>
<
/div
>
<
/div
>
<
StandardTable
<
StandardTable
...
...
FormInsertDiy/models/DataObj.js
deleted
100644 → 0
浏览文件 @
76d6c137
import
{
apiRequest
}
from
'../request'
;
const
api
=
"/DataObjApi"
;
export
default
{
namespace
:
'DataObj'
,
state
:
{
list
:
[],
data
:{
list
:
[],
pagination
:
{},
},
code
:{
list
:
[],
pagination
:
{},
}
},
effects
:
{
*
getExportInfo
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
"/getExportInfo"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
)
callback
(
response
);
},
*
changeCatalogue
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
"/changeCatalogue"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
)
callback
(
response
);
},
*
find
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
"/find"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
)
callback
(
response
);
},
*
add
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
"/add"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
)
callback
(
response
);
},
*
fetch
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
"/getPage"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'page'
,
payload
:
{...
response
,
isMain
:
payload
.
isMain
},
});
},
*
remove
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
"/remove"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
){
callback
()
}
},
*
open
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
"/open"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
){
callback
()
}
},
*
createTabel
({
payload
,
callback
},{
call
,
put
}){
const
response
=
yield
call
(
apiRequest
,
api
+
"/createTable"
,
payload
);
if
(
!
response
){
yield
put
({
type
:
'nom'
});
return
}
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
){
callback
()
}
}
},
reducers
:
{
list
(
state
,
action
)
{
return
{
...
state
,
list
:
action
.
payload
,
};
},
page
(
state
,
{
payload
})
{
if
(
payload
.
isMain
){
return
{
...
state
,
data
:{
list
:
payload
.
rows
,
pagination
:
{
current
:
payload
.
pageNo
,
pageSize
:
payload
.
pageSize
,
total
:
payload
.
total
,
},
}
};
}
else
{
return
{
...
state
,
code
:{
list
:
payload
.
rows
,
pagination
:
{
current
:
payload
.
pageNo
,
pageSize
:
payload
.
pageSize
,
total
:
payload
.
total
,
},
}
};
}
},
nom
(
state
,
action
)
{
return
{...
state
};
},
},
};
FormInsertDiy/models/FormList.js
deleted
100644 → 0
浏览文件 @
76d6c137
import
{
uaaRequest
}
from
'../../one_stop_public/utils/request'
;
const
api
=
'/DataObjApi'
;
export
default
{
namespace
:
'formList'
,
state
:
{
list
:
[],
data
:
{
list
:
[],
pagination
:
{},
},
},
effects
:
{
*
clear
({
payload
,
callback
},
{
call
,
put
})
{
yield
put
({
type
:
'clearAll'
,
payload
:
{},
});
},
*
getHead
({
payload
,
callback
},
{
call
,
put
})
{
console
.
log
(
'getHead'
,);
const
response
=
yield
call
(
uaaRequest
,
'/DataColumnApi/getHeaderList'
,
payload
);
console
.
log
(
' header response'
,
response
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
return
;
}
if
(
callback
)
callback
(
response
);
},
*
fetch
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
uaaRequest
,
'/DataObjApi/getFormDataPage'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
return
;
}
/* yield put({
type: 'page',
payload: {
...response,
},
});*/
if
(
callback
)
callback
(
response
);
},
*
add
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/addFormData'
,
{
data
:
JSON
.
stringify
(
payload
.
params
),
isAdd
:
payload
.
isAdd
,
objId
:
payload
.
objId
,
});
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
return
;
}
if
(
callback
)
callback
(
response
);
},
*
delete
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/deleteFormData'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
return
;
}
if
(
callback
)
callback
(
response
);
},
*
getDetail
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/getFormData'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
return
;
}
if
(
callback
)
callback
(
response
);
},
},
reducers
:
{
clearAll
(
state
,
action
)
{
return
{
...
state
,
data
:
{
list
:
[],
pagination
:
{},
},
};
},
list
(
state
,
action
)
{
return
{
...
state
,
list
:
action
.
payload
,
};
},
page
(
state
,
{
payload
})
{
return
{
...
state
,
data
:
{
list
:
payload
.
rows
,
pagination
:
{
current
:
payload
.
pageNo
,
pageSize
:
payload
.
pageSize
,
total
:
Number
(
payload
.
total
),
},
},
};
},
nom
(
state
,
action
)
{
return
{
...
state
};
},
},
};
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论