|
@@ -30,7 +30,7 @@ class TabelContent extends Component{
|
|
return "共" + total + "条数据";
|
|
return "共" + total + "条数据";
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- searchValues:{},
|
|
|
|
|
|
+ searchValues:this.props.searchConfig || {},
|
|
contactsOption:[]
|
|
contactsOption:[]
|
|
}
|
|
}
|
|
this.loadData= this.loadData.bind(this);
|
|
this.loadData= this.loadData.bind(this);
|
|
@@ -43,28 +43,29 @@ class TabelContent extends Component{
|
|
this.setState({
|
|
this.setState({
|
|
loading:true
|
|
loading:true
|
|
})
|
|
})
|
|
- let data = {
|
|
|
|
|
|
+ let searchInfor = {
|
|
pageNo: pageNo || 1,
|
|
pageNo: pageNo || 1,
|
|
pageSize: this.state.pagination.pageSize,
|
|
pageSize: this.state.pagination.pageSize,
|
|
}
|
|
}
|
|
if(this.props.query){
|
|
if(this.props.query){
|
|
- data = Object.assign(data,this.props.query);
|
|
|
|
|
|
+ searchInfor = Object.assign(searchInfor,this.props.query);
|
|
}
|
|
}
|
|
if(Object.keys(this.state.searchValues).length > 0){
|
|
if(Object.keys(this.state.searchValues).length > 0){
|
|
- data = Object.assign(data,this.state.searchValues);
|
|
|
|
|
|
+ searchInfor = Object.assign(searchInfor,this.state.searchValues);
|
|
}
|
|
}
|
|
$.ajax({
|
|
$.ajax({
|
|
method: "get",
|
|
method: "get",
|
|
dataType: "json",
|
|
dataType: "json",
|
|
crossDomain: false,
|
|
crossDomain: false,
|
|
url: globalConfig.context + this.props.tabelApi,
|
|
url: globalConfig.context + this.props.tabelApi,
|
|
- data,
|
|
|
|
|
|
+ data:searchInfor,
|
|
success: function(data) {
|
|
success: function(data) {
|
|
ShowModal(this);
|
|
ShowModal(this);
|
|
this.setState({
|
|
this.setState({
|
|
loading:false
|
|
loading:false
|
|
})
|
|
})
|
|
if (data.error && data.error.length === 0) {
|
|
if (data.error && data.error.length === 0) {
|
|
|
|
+ this.props.searchOperation && this.props.searchOperation(searchInfor);
|
|
if(data.data.list){
|
|
if(data.data.list){
|
|
this.state.pagination.current = data.data.pageNo;
|
|
this.state.pagination.current = data.data.pageNo;
|
|
this.state.pagination.total = data.data.totalCount;
|
|
this.state.pagination.total = data.data.totalCount;
|
|
@@ -206,106 +207,109 @@ class TabelContent extends Component{
|
|
<div className="user-search" style={{paddingTop:'10px'}}>
|
|
<div className="user-search" style={{paddingTop:'10px'}}>
|
|
<Form layout="inline">
|
|
<Form layout="inline">
|
|
{
|
|
{
|
|
- (this.props.searchList || []).map((v,k)=>(
|
|
|
|
- v.type === 'text' ?
|
|
|
|
- <FormItem label={v.title}>
|
|
|
|
- <Input
|
|
|
|
- key={k}
|
|
|
|
- placeholder={v.placeholder}
|
|
|
|
- value={searchValues[v.dataKey] ? searchValues[v.dataKey] : (v.defaultValue || undefined)}
|
|
|
|
- style={v.style ? v.style : { width: 150, marginRight: 10}}
|
|
|
|
- onChange={(e) => {
|
|
|
|
- searchValues[v.dataKey] = e.target.value
|
|
|
|
- this.setState({
|
|
|
|
- searchValues: searchValues
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- />
|
|
|
|
- </FormItem> :
|
|
|
|
- v.type === 'autoComplete' ?
|
|
|
|
- <AutoCompleteSearch
|
|
|
|
- onSelect={(value)=>{
|
|
|
|
- searchValues[v.dataKey] = value
|
|
|
|
- this.setState({
|
|
|
|
- searchValues: searchValues
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- config={v}
|
|
|
|
- />
|
|
|
|
- :
|
|
|
|
- v.type === 'select' || v.type === 'departmentSelect' ?
|
|
|
|
- <FormItem label={v.title} style={{marginTop:'-8px'}}>
|
|
|
|
- <Spin spinning={this.state.departmentLoading}>
|
|
|
|
- {
|
|
|
|
- <Select
|
|
|
|
- key={k}
|
|
|
|
- placeholder={v.placeholder}
|
|
|
|
- style={v.style ? v.style : { width:200,marginRight: 10}}
|
|
|
|
- value={searchValues[v.dataKey] ? searchValues[v.dataKey] : (v.defaultValue || undefined)}
|
|
|
|
- onChange={(e) => {
|
|
|
|
- searchValues[v.dataKey] = String(e);
|
|
|
|
- if(v.type === 'departmentSelect'){
|
|
|
|
- let arr = this.state.contactsOption.filter(v=>String(v.value) === String(e))
|
|
|
|
- searchValues['depName'] = arr[0].label;
|
|
|
|
- }
|
|
|
|
- this.setState({
|
|
|
|
- searchValues: searchValues
|
|
|
|
- });
|
|
|
|
- }}>
|
|
|
|
|
|
+ (this.props.searchList || []).map((v,k)=>{
|
|
|
|
+ return (
|
|
|
|
+ v.type === 'text' ?
|
|
|
|
+ <FormItem label={v.title}>
|
|
|
|
+ <Input
|
|
|
|
+ key={k}
|
|
|
|
+ placeholder={v.placeholder}
|
|
|
|
+ value={searchValues[v.dataKey] ? searchValues[v.dataKey] : (v.defaultValue || undefined)}
|
|
|
|
+ style={v.style ? v.style : { width: 150, marginRight: 10}}
|
|
|
|
+ onChange={(e) => {
|
|
|
|
+ searchValues[v.dataKey] = e.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ searchValues: searchValues
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ </FormItem> :
|
|
|
|
+ v.type === 'autoComplete' ?
|
|
|
|
+ <AutoCompleteSearch
|
|
|
|
+ onSelect={(value,title)=>{
|
|
|
|
+ searchValues[v.dataKey] = value
|
|
|
|
+ if(v.dataTitle){searchValues[v.dataTitle] = title}
|
|
|
|
+ this.setState({
|
|
|
|
+ searchValues: searchValues
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ config={v}
|
|
|
|
+ />
|
|
|
|
+ :
|
|
|
|
+ v.type === 'select' || v.type === 'departmentSelect' ?
|
|
|
|
+ <FormItem label={v.title} style={{marginTop:'-8px'}}>
|
|
|
|
+ <Spin spinning={this.state.departmentLoading}>
|
|
{
|
|
{
|
|
- v.selectOptionList ?
|
|
|
|
- v.selectOptionList():
|
|
|
|
- (
|
|
|
|
- v.type === 'departmentSelect' ?
|
|
|
|
- this.state.contactsOption :
|
|
|
|
- (v.selectList || [])
|
|
|
|
- ).map((v)=>(
|
|
|
|
- <Select.Option
|
|
|
|
- key={v.value}
|
|
|
|
- value={v.value}
|
|
|
|
- >
|
|
|
|
- {v.label}
|
|
|
|
- </Select.Option>
|
|
|
|
- ))
|
|
|
|
|
|
+ <Select
|
|
|
|
+ key={k}
|
|
|
|
+ placeholder={v.placeholder}
|
|
|
|
+ style={v.style ? v.style : { width:200,marginRight: 10}}
|
|
|
|
+ value={searchValues[v.dataKey] ? searchValues[v.dataKey] : (v.defaultValue || undefined)}
|
|
|
|
+ onChange={(e) => {
|
|
|
|
+ searchValues[v.dataKey] = String(e);
|
|
|
|
+ if(v.type === 'departmentSelect'){
|
|
|
|
+ let arr = this.state.contactsOption.filter(v=>String(v.value) === String(e))
|
|
|
|
+ searchValues['depName'] = arr[0].label;
|
|
|
|
+ }
|
|
|
|
+ this.setState({
|
|
|
|
+ searchValues: searchValues
|
|
|
|
+ });
|
|
|
|
+ }}>
|
|
|
|
+ {
|
|
|
|
+ v.selectOptionList ?
|
|
|
|
+ v.selectOptionList():
|
|
|
|
+ (
|
|
|
|
+ v.type === 'departmentSelect' ?
|
|
|
|
+ this.state.contactsOption :
|
|
|
|
+ (v.selectList || [])
|
|
|
|
+ ).map((v)=>(
|
|
|
|
+ <Select.Option
|
|
|
|
+ key={v.value}
|
|
|
|
+ value={v.value}
|
|
|
|
+ >
|
|
|
|
+ {v.label}
|
|
|
|
+ </Select.Option>
|
|
|
|
+ ))
|
|
|
|
+ }
|
|
|
|
+ </Select>
|
|
}
|
|
}
|
|
- </Select>
|
|
|
|
- }
|
|
|
|
- </Spin>
|
|
|
|
- </FormItem>: v.type === 'times' ?
|
|
|
|
- <FormItem label={v.title}>
|
|
|
|
- {
|
|
|
|
- v.format === 'YYYY/MM' ?
|
|
|
|
- <MonthPicker
|
|
|
|
- value={searchValues[v.dataKey] ? moment(searchValues[v.dataKey]) : null}
|
|
|
|
- style={{marginRight:'10px',marginTop: '2px'}}
|
|
|
|
- onChange={(data, dataString) => {
|
|
|
|
- searchValues[v.dataKey] = String(dataString);
|
|
|
|
- this.setState({
|
|
|
|
- searchValues: searchValues
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- />:
|
|
|
|
- <RangePicker
|
|
|
|
- style={{marginRight:'10px',marginTop: '2px'}}
|
|
|
|
- value={[
|
|
|
|
- searchValues[v.dataKey[0]]
|
|
|
|
- ? moment(searchValues[v.dataKey[0]])
|
|
|
|
- : null,
|
|
|
|
- searchValues[v.dataKey[1]]
|
|
|
|
- ? moment(searchValues[v.dataKey[1]])
|
|
|
|
- : null,
|
|
|
|
- ]}
|
|
|
|
- onChange={(data, dataString) => {
|
|
|
|
- searchValues[v.dataKey[0]] = String(dataString[0]);
|
|
|
|
- searchValues[v.dataKey[1]] = String(dataString[1]);
|
|
|
|
- this.setState({
|
|
|
|
- searchValues: searchValues
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- />
|
|
|
|
- }
|
|
|
|
- </FormItem>: null
|
|
|
|
- ))
|
|
|
|
|
|
+ </Spin>
|
|
|
|
+ </FormItem>: v.type === 'times' ?
|
|
|
|
+ <FormItem label={v.title}>
|
|
|
|
+ {
|
|
|
|
+ v.format === 'YYYY/MM' ?
|
|
|
|
+ <MonthPicker
|
|
|
|
+ value={searchValues[v.dataKey] ? moment(searchValues[v.dataKey]) : null}
|
|
|
|
+ style={{marginRight:'10px',marginTop: '2px'}}
|
|
|
|
+ onChange={(data, dataString) => {
|
|
|
|
+ searchValues[v.dataKey] = String(dataString);
|
|
|
|
+ this.setState({
|
|
|
|
+ searchValues: searchValues
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ />:
|
|
|
|
+ <RangePicker
|
|
|
|
+ style={{marginRight:'10px',marginTop: '2px'}}
|
|
|
|
+ value={[
|
|
|
|
+ searchValues[v.dataKey[0]]
|
|
|
|
+ ? moment(searchValues[v.dataKey[0]])
|
|
|
|
+ : null,
|
|
|
|
+ searchValues[v.dataKey[1]]
|
|
|
|
+ ? moment(searchValues[v.dataKey[1]])
|
|
|
|
+ : null,
|
|
|
|
+ ]}
|
|
|
|
+ onChange={(data, dataString) => {
|
|
|
|
+ searchValues[v.dataKey[0]] = String(dataString[0]);
|
|
|
|
+ searchValues[v.dataKey[1]] = String(dataString[1]);
|
|
|
|
+ this.setState({
|
|
|
|
+ searchValues: searchValues
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ }
|
|
|
|
+ </FormItem>: null
|
|
|
|
+ )
|
|
|
|
+ })
|
|
}
|
|
}
|
|
<Button type="primary" onClick={()=>{
|
|
<Button type="primary" onClick={()=>{
|
|
this.loadData();
|
|
this.loadData();
|