Commit c52926c0 authored by superman's avatar superman

报单审核列表页 下载审核成功的照片

parent 89f900c1
!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n=window.webpackJsonp;window.webpackJsonp=function(c,o){for(var i,p,s=0,l=[];s<c.length;s++)p=c[s],a[p]&&l.push.apply(l,a[p]),a[p]=0;for(i in o){var u=o[i];switch(typeof u){case"object":e[i]=function(t){var n=t.slice(1),r=t[0];return function(t,a,c){e[r].apply(this,[t,a,c].concat(n))}}(u);break;case"function":e[i]=u;break;default:e[i]=e[u]}}for(n&&n(c,o);l.length;)l.shift().call(null,t);if(o[0])return r[0]=0,t(0)};var r={},a={0:0};t.e=function(e,n){if(0===a[e])return n.call(null,t);if(void 0!==a[e])a[e].push(n);else{a[e]=[n];var r=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.src=t.p+""+({1:"index"}[e]||e)+".js",r.appendChild(c)}},t.m=e,t.c=r,t.p=""}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,a){r.apply(this,[e,t,a].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([]));
\ No newline at end of file
!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n=window.webpackJsonp;window.webpackJsonp=function(c,o){for(var i,p,s=0,l=[];s<c.length;s++)p=c[s],a[p]&&l.push.apply(l,a[p]),a[p]=0;for(i in o){var u=o[i];switch(typeof u){case"object":e[i]=function(t){var n=t.slice(1),r=t[0];return function(t,a,c){e[r].apply(this,[t,a,c].concat(n))}}(u);break;case"function":e[i]=u;break;default:e[i]=e[u]}}for(n&&n(c,o);l.length;)l.shift().call(null,t);if(o[0])return r[0]=0,t(0)};var r={},a={0:0};t.e=function(e,n){if(0===a[e])return n.call(null,t);if(void 0!==a[e])a[e].push(n);else{a[e]=[n];var r=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.src=t.p+""+({1:"index"}[e]||e)+".js",r.appendChild(c)}},t.m=e,t.c=r,t.p="/"}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,a){r.apply(this,[e,t,a].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([]));
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -25,6 +25,7 @@
"redux-actions": "0.9.x",
"redux-async-connect": "^1.0.0-rc4",
"redux-saga": "^0.10.4",
"socket.io-client": "^1.4.8",
"src": "^1.1.2"
},
"devDependencies": {
......
......@@ -88,7 +88,7 @@ export default class HeaderOperation extends Component {
delete props.icon;
delete props.link;
return (
<Tooltip title={title} key={props.key+'tooltip'}>
<Tooltip title={title} key={props.key + 'tooltip'}>
<Button type="ghost" {...props} >
<Link to={link}>
<Icon type={icon}/>
......@@ -98,7 +98,7 @@ export default class HeaderOperation extends Component {
);
}
const btn = (
<Tooltip title={title} key={props.key+'tooltip'}>
<Tooltip title={title} key={props.key + 'tooltip'}>
<Button type="ghost" {...props} />
</Tooltip>
);
......
......@@ -151,7 +151,7 @@ export default class App extends Component {
<div className={styles.content}>
<div className={styles.side}>
<header>
<img className="page-logo" src={'/'+logo} title="枢纽科技" alt="枢纽科技"/>
<img className="page-logo" src={logo} title="枢纽科技" alt="枢纽科技"/>
</header>
<section>
<Menu mode="inline" defaultOpenKeys={['sub1']}>
......
......@@ -6,6 +6,10 @@ const Home = ({location}) => {
<div style={{padding: '20px 50px 20px 100px'}}>
<h1 style={{marginBottom: 50}}>欢迎使用枢纽科技后台</h1>
<h3>2016-08-17 更新 1.3.2</h3>
<p>
1. 报单审核列表页 下载审核成功的照片
</p>
<h3>2016-08-15 更新 1.3.1</h3>
<p>
1. 增加身份认证审核
......
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {Table, Icon} from 'antd';
import {Table, Icon, message} from 'antd';
import {Link} from 'react-router';
import {serialize, formatDateTime, remittanceAuditStatusToString} from '../../utils';
import Layout from '../../components/Layout/Layout';
import MainHeader from '../../components/MainHeader/MainHeader';
import HeaderOperation from '../../components/HeaderOperation/HeaderOperation';
const columns = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
width: 70
}, {
title: '产品',
dataIndex: 'itemShortTitle',
key: 'itemShortTitle',
render: (shortTitle, record)=>(<span title={shortTitle}>{(shortTitle + '').substring(0, 20)}</span>)
}, {
title: '投资人',
dataIndex: 'buyerName',
key: 'buyerName',
width: 100,
className: 'tac',
}, {
title: '预约额度',
dataIndex: 'reservationAmount',
key: 'reservationAmount',
width: 80,
className: 'tac',
}, {
title: '报单时间',
dataIndex: 'submitReceiptTime',
key: 'submitReceiptTime',
width: 150,
className: 'tac',
render: (submitReceiptTime, record)=>(
<span>
{submitReceiptTime && formatDateTime(submitReceiptTime)}
</span>
)
}, {
title: '状态',
dataIndex: 'status',
key: 'status',
width: 120,
className: 'tac',
render: (status, record)=>(<span data-status={status}>{remittanceAuditStatusToString(status)}</span>)
}, {
title: '操作',
key: 'operation',
width: 60,
// fixed:'right',
className: 'tac',
render: (text, record)=>(
<span>
{
record.status == 1 &&
<Link to={'/remittance/audits/'+ record.id} onClick={e=>e.stopPropagation()}>审核</Link>
}
</span>
)
}
];
@connect(state=>({
items: state.remittance.audits,
......@@ -77,8 +18,10 @@ export default class List extends Component {
constructor(props, context) {
super(props, context);
this.state = {
filterVisible: false
filterVisible: false,
selectedRowKeys: []
}
}
componentDidMount() {
......@@ -96,9 +39,56 @@ export default class List extends Component {
this.props.history.push('/remittance/audits/' + id);
}
// packImages(id) {
// const {dispatch} = this.props;
// (new Promise((resolve)=> {
// require.ensure(['socket.io-client'], function (require) {
//
// const io = require('socket.io-client');
//
// const socket = io();
//
// socket.on('zip-start', function () {
// message.info('开始打包');
// });
//
// socket.on('zip-success', function (data) {
// console.log('zip-success', data);
// dispatch({
// type: 'ZIP_SUCCESS',
// data
// });
// });
//
// socket.on('zip-failed', function (err) {
// console.error('zip-failed', err);
// message.error(err && err.message || '未知错误!');
//
// });
//
// socket.on('zip-completed', function (data) {
// console.log('zip-completed', data);
// socket.close();
// if (data && data.length) {
// message.success('打包完成');
// }
// resolve();
// });
//
// socket.emit('zip', id);
//
// }, 'socket.io');
// })).then(()=> {
//
// });
// }
render() {
console.log('render');
const {total, items, loading, history:{replace}, location:{pathname, query}} = this.props;
const {selectedRowKeys} = this.state;
const pagination = {
total: total,
......@@ -106,7 +96,7 @@ export default class List extends Component {
current: parseInt(query.p, 10) || 1,
showSizeChanger: true,
showTotal: total => `共 ${total} 条`,
pageSizeOptions:['10', '30', '50', '100'],
pageSizeOptions: ['10', '30', '50', '100'],
onShowSizeChange: (current, pageSize)=> {
console.log('Current: ', current, '; PageSize: ', pageSize);
query.p = current;
......@@ -124,15 +114,117 @@ export default class List extends Component {
const operation = (
<HeaderOperation history={this.props.history} buttons={[{
key:'filter',
key: 'filter',
}, {
key: 'download',
title: '打包下载照片',
icon: 'cloud-download-o',
children: '下载照片',
onClick: (e)=> {
if (selectedRowKeys.length) {
let name = selectedRowKeys[0];
if (selectedRowKeys.length > 1) {
name += '--' + selectedRowKeys[selectedRowKeys.length - 1];
}
const iframe = document.createElement('iframe');
const ids = selectedRowKeys.join(',');
iframe.src = '/zip/' + name + '?id=' + ids;
document.body.appendChild(iframe);
setTimeout(()=> {
document.body.removeChild(iframe);
}, 1000);
}
}
}]}/>
);
const header = (<MainHeader breadcrumb={['审核管理', '报单审核']}
title="报单审核列表"
operation={operation}
/>);
const columns = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
width: 70
}, {
title: '产品',
dataIndex: 'itemShortTitle',
key: 'itemShortTitle',
width: 200,
render: (shortTitle, record)=>(<span title={shortTitle}>{(shortTitle + '').substring(0, 20)}</span>)
}, {
title: '投资人',
dataIndex: 'buyerName',
key: 'buyerName',
width: 100,
className: 'tac',
}, {
title: '预约额度',
dataIndex: 'reservationAmount',
key: 'reservationAmount',
width: 80,
className: 'tac',
}, {
title: '报单时间',
dataIndex: 'submitReceiptTime',
key: 'submitReceiptTime',
width: 150,
className: 'tac',
render: (submitReceiptTime, record)=>(
<span>
{submitReceiptTime && formatDateTime(submitReceiptTime)}
</span>
)
}, {
title: '状态',
dataIndex: 'status',
key: 'status',
width: 120,
className: 'tac',
render: (status, record)=>(<span data-status={status}>{remittanceAuditStatusToString(status)}</span>)
}, {
title: '操作',
key: 'operation',
width: 60,
className: 'tac',
render: (text, record)=>(
<div>
{
record.status == 1 &&
<Link to={'/remittance/audits/' + record.id} onClick={e=>e.stopPropagation()}>审核</Link>
}
{
record.status == 9 &&
<a href="javascript:void('下载');" onClick={e=>{
e.stopPropagation();
const iframe = document.createElement('iframe');
iframe.src = '/zip/' + record.id + '?id=' + record.id;
document.body.appendChild(iframe);
setTimeout(()=> {
document.body.removeChild(iframe);
}, 1000);
}}>下载</a>
}
</div>
)
}
];
const rowSelection = {
selectedRowKeys,
onChange: (selectedRowKeys)=> {
this.setState({selectedRowKeys})
},
getCheckboxProps: record=>({
disabled: record.status !== 9
})
};
return (
<Layout header={header}>
......@@ -140,8 +232,10 @@ export default class List extends Component {
dataSource={Array.isArray(items) ? items : []}
loading={loading}
pagination={pagination}
scroll={{ y: window.innerHeight-(this.state.filterVisible? 203 :150) }}
scroll={{y: window.innerHeight - (this.state.filterVisible ? 203 : 150)}}
onRowClick={this.handleRowClick.bind(this)}
rowSelection={rowSelection}
rowKey="id"
/>
</Layout>
);
......
......@@ -28,6 +28,20 @@ const remittance = handleActions({
},
['PASS_REMITTANCE_ITEM_FAILED'](state, action){
return {...state, loading: false, err: action.err};
},
['ZIP_SUCCESS'](state, action){
const data = action.data;
console.log('ZIP_SUCCESS', data);
if (data && state.audits) {
for (let audit of state.audits) {
if (audit.id === data.id) {
audit.zip = data.url;
console.log('更新%s的zip%s', data.id, data.url);
break;
}
}
}
return {...state, zip: data};
}
}, {
drawMoneys: [],
......
......@@ -12,6 +12,8 @@ module.exports = function (webpackConfig) {
style: 'css', // if true, use less
}]);
webpackConfig.output.publicPath = '/';
// Enable this if you have to support IE8.
// webpackConfig.module.loaders.unshift({
// test: /\.jsx?$/,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment