Commit 63891f96 by ethanlamzs

条件查询

1 parent bd1b433c
import { getUrlParams } from './utils';
export function schoolList(count) {
export function schoolList(count,filter) {
const list = [];
for (let i = 0; i < count; i += 1) {
var temp = new String(i);
if((!filter)|| temp.indexOf(filter)>=0){
list.push({
key: i,
id: `fake-list-${i}`,
......@@ -13,6 +15,7 @@ export function schoolList(count) {
createdAt: new Date(new Date().getTime() - (1000 * 60 * 60 * 2 * i)),
});
}
}
return list;
}
......@@ -25,12 +28,12 @@ export function getSchoolLists(req, res, u) {
const params = getUrlParams(url);
const count = (params.pageSize * 1) || 20;
const count = (params.pageSize * 1) || 40;
const result = schoolList(count);
const result = schoolList(count,params.name);
if (res && res.json) {
res.json(result);
res.json({'list':result,'pagination':1});
} else {
return result;
}
......
......@@ -13572,6 +13572,12 @@
}
}
},
"os-shim": {
"version": "0.1.3",
"resolved": "http://registry.npm.taobao.org/os-shim/download/os-shim-0.1.3.tgz",
"integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=",
"dev": true
},
"os-tmpdir": {
"version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz",
......@@ -16022,6 +16028,28 @@
}
}
},
"pre-commit": {
"version": "1.2.2",
"resolved": "http://registry.npm.taobao.org/pre-commit/download/pre-commit-1.2.2.tgz",
"integrity": "sha1-287g7p3nI15X95xW186UZBpp7sY=",
"dev": true,
"requires": {
"cross-spawn": "5.1.0",
"spawn-sync": "1.0.15",
"which": "1.2.14"
},
"dependencies": {
"which": {
"version": "1.2.14",
"resolved": "http://registry.npm.taobao.org/which/download/which-1.2.14.tgz",
"integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=",
"dev": true,
"requires": {
"isexe": "2.0.0"
}
}
}
},
"prelude-ls": {
"version": "1.1.2",
"resolved": "http://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.1.2.tgz",
......@@ -18462,6 +18490,16 @@
"source-map": "0.5.6"
}
},
"spawn-sync": {
"version": "1.0.15",
"resolved": "http://registry.npm.taobao.org/spawn-sync/download/spawn-sync-1.0.15.tgz",
"integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=",
"dev": true,
"requires": {
"concat-stream": "1.6.0",
"os-shim": "0.1.3"
}
},
"spdx-correct": {
"version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/spdx-correct/download/spdx-correct-1.0.2.tgz",
......
......@@ -7,7 +7,6 @@ const statusMap = ['default', 'processing', 'success', 'error'];
class StandardTable extends PureComponent {
state = {
selectedRowKeys: [],
totalCallNo: 0,
};
componentWillReceiveProps(nextProps) {
......@@ -15,21 +14,16 @@ class StandardTable extends PureComponent {
if (nextProps.selectedRows.length === 0) {
this.setState({
selectedRowKeys: [],
totalCallNo: 0,
});
}
}
handleRowSelectChange = (selectedRowKeys, selectedRows) => {
const totalCallNo = selectedRows.reduce((sum, val) => {
return sum + parseFloat(val.callNo, 10);
}, 0);
if (this.props.onSelectRow) {
this.props.onSelectRow(selectedRows);
}
this.setState({ selectedRowKeys, totalCallNo });
this.setState({ selectedRowKeys });
}
handleTableChange = (pagination, filters, sorter) => {
......
......@@ -4,15 +4,19 @@ export default {
namespace: 'schools',
state : {
data:{
list : [],
pagination: {},
}
},
effects:{
*fetch({payload},{call,put}){
const response = yield call(queryWXSchool,payload);
console.log(response);
yield put({
type : 'querySch',
payload: Array.isArray(response)?response:[],
payload: response,
});
},
},
......@@ -22,7 +26,7 @@ export default {
console.log('reducers');
return {
...state,
list:action.payload,
data:action.payload,
};
},
},
......
......@@ -30,7 +30,7 @@ export default class SchList extends PureComponent {
render(){
console.log('render()');
const { schools : {list},paginationProps,loading} = this.props;
const { schools : { data:{list}},paginationProps,loading} = this.props;
return <div>
<List
......
......@@ -125,7 +125,7 @@ export default class linkmanadm extends PureComponent {
render() {
const { schools: { list }, loading } = this.props;
const { schools: {data:{list}}, loading } = this.props;
const { selectedRows, modalVisible, addInputValue } = this.state;
const columns = [
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!