Browse Source

团体用户保存联系人修复

yee 8 years ago
parent
commit
0c702c5bc5

+ 19 - 9
js/component/account/services/ratepay.jsx

@@ -1,7 +1,7 @@
 import React from 'react';
 import { Icon, Form, Button, Input, Spin, Table, message, Select, Modal, InputNumber, Upload } from 'antd';
 import './techProduct.less';
-import { beforeUpload } from '../../tools.js';
+import { beforeUploadFile, downloadFile } from '../../tools.js';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 
@@ -46,7 +46,7 @@ const RatepayDescFrom = Form.create()(React.createClass({
                         taxExemptIncome: values.taxExemptIncome,
                         subsidyIncome: values.subsidyIncome,
                         year: this.state.year || this.props.data.year,
-                        taxReturnUrl: this.state.ratepayUrl,
+                        taxReturnUrl: this.state.taxReturnUrl,
                         grossProfit: values.grossProfit,
                         researchCost: values.researchCost
                     }
@@ -64,6 +64,11 @@ const RatepayDescFrom = Form.create()(React.createClass({
             }
         });
     },
+    componentWillReceiveProps(nextProps) {
+        if (!this.props.visible && nextProps.visible) {
+            this.props.form.resetFields();
+        };
+    },
     render() {
         const FormItem = Form.Item;
         const { getFieldDecorator } = this.props.form;
@@ -189,8 +194,9 @@ const RatepayDescFrom = Form.create()(React.createClass({
                     <Upload
                         name="ratepay"
                         action={globalConfig.context + "/techservice/cognizance/upload"}
-                        data={{ 'sign': this.props.year + 'ratepay' }}
-                        beforeUpload={beforeUpload}
+                        data={{ 'sign': 'ratepay_' + this.state.year || theData.year }}
+                        beforeUpload={beforeUploadFile}
+                        showUploadList={false}
                         onChange={(info) => {
                             if (info.file.status !== 'uploading') {
                                 console.log(info.file, info.fileList);
@@ -202,14 +208,15 @@ const RatepayDescFrom = Form.create()(React.createClass({
                                     message.warning(info.file.response.error[0].message);
                                     return;
                                 };
-                                this.state.ratepayUrl = info.file.response.data;
+                                this.state.taxReturnUrl = info.file.response.data;
                             } else if (info.file.status === 'error') {
                                 message.error(`${info.file.name} 文件上传失败。`);
                             }
                         }}
                     >
-                        <Button><Icon type="upload" /> 上传文件 </Button>
+                        <Button><Icon type="upload" /> 上传高新技术产品台帐 </Button>
                     </Upload>
+                    <p style={{ marginTop: '10px' }}>{theData.taxReturnUrl ? <a onClick={downloadFile.bind(null, theData.taxReturnUrl, theData.taxReturnDownloadFileName)}>{theData.taxReturnDownloadFileName}</a> : <span>未上传!</span>}</p>
                 </div>
                 <FormItem style={{ marginTop: '20px' }}>
                     <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
@@ -261,8 +268,10 @@ const RatepayDesc = React.createClass({
                         width='800px'
                         footer=''
                     >
-                        <RatepayDescFrom data={this.props.data}
-                            spinState={this.spinChange} closeModal={this.handleCancel}  clickOk={this.handleOk} />
+                        <RatepayDescFrom
+                            visible={this.state.visible}
+                            data={this.props.data}
+                            spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
                     </Modal>
                 </Spin>
             </div>
@@ -306,7 +315,8 @@ const Ratepay = React.createClass({
                     grossProfit: thisdata.grossProfit,
                     researchCost: thisdata.researchCost,
                     year: thisdata.year,
-                    taxReturnUrl: thisdata.taxReturnUrl
+                    taxReturnUrl: thisdata.taxReturnUrl,
+                    taxReturnDownloadFileName: thisdata.taxReturnDownloadFileName
                 });
             };
             this.state.pagination.current = data.data.pageNo;

+ 1 - 1
js/component/account/set/group.jsx

@@ -110,7 +110,7 @@ const BaseFrom = Form.create()(React.createClass({
     },
     checkPhone(rule, value, callback) {
         const form = this.props.form;
-        if (value.length !== 0 && !(/^1[34578]\d{9}$/.test(value))) {
+        if (value && value.length !== 0 && !(/^1[34578]\d{9}$/.test(value))) {
             callback('请输入正确的手机号码!');
         } else {
             callback();

+ 13 - 5
js/component/manageCenter/servicesManage/highTech/fosterDesc/finance.jsx

@@ -70,6 +70,11 @@ const FinanceDescFrom = Form.create()(React.createClass({
             }
         });
     },
+    componentWillReceiveProps(nextProps) {
+        if (!this.props.visible && nextProps.visible) {
+            this.props.form.resetFields();
+        };
+    },
     render() {
         const FormItem = Form.Item;
         const { getFieldDecorator } = this.props.form;
@@ -214,8 +219,9 @@ const FinanceDescFrom = Form.create()(React.createClass({
                     <Upload
                         name="ratepay"
                         action={globalConfig.context + "/techservice/cognizance/upload"}
-                        data={{ 'sign': this.props.year + 'finance' }}
-                        beforeUpload={beforeUpload}
+                        data={{ 'sign': 'finance' + this.state.year || theData.year }}
+                        beforeUpload={beforeUploadFile}
+                        showUploadList={false}
                         onChange={(info) => {
                             if (info.file.status !== 'uploading') {
                                 console.log(info.file, info.fileList);
@@ -233,8 +239,9 @@ const FinanceDescFrom = Form.create()(React.createClass({
                             }
                         }}
                     >
-                        <Button><Icon type="upload" /> 上传文件 </Button>
+                        <Button><Icon type="upload" /> 上传高新技术产品台帐 </Button>
                     </Upload>
+                    <p style={{ marginTop: '10px' }}>{theData.financeUrl ? <a onClick={downloadFile.bind(null, theData.financeUrl, theData.financeDownloadFileName)}>{theData.financeDownloadFileName}</a> : <span>未上传!</span>}</p>
                 </div>
                 <FormItem style={{ marginTop: '20px' }}>
                     <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
@@ -264,7 +271,7 @@ const FinanceDesc = React.createClass({
         this.setState({
             visible: false,
         });
-        this.props.closeDesc(false,true);
+        this.props.closeDesc(false, true);
     },
     handleCancel(e) {
         this.setState({
@@ -289,7 +296,8 @@ const FinanceDesc = React.createClass({
                         <FinanceDescFrom
                             uid={this.props.uid}
                             data={this.props.data}
-                            spinState={this.spinChange} closeModal={this.handleCancel}  clickOk={this.handleOk} />
+                            visible={this.state.visible}
+                            spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
                     </Modal>
                 </Spin>
             </div>

+ 17 - 8
js/component/manageCenter/servicesManage/highTech/fosterDesc/ratepay.jsx

@@ -49,7 +49,7 @@ const RatepayDescFrom = Form.create()(React.createClass({
                         grossProfit: values.grossProfit,
                         researchCost: values.researchCost,
                         year: this.state.year || this.props.data.year,
-                        taxReturnUrl: this.state.ratepayUrl
+                        taxReturnUrl: this.state.taxReturnUrl
                     }
                 }).done(function (data) {
                     if (!data.error.length) {
@@ -65,6 +65,11 @@ const RatepayDescFrom = Form.create()(React.createClass({
             }
         });
     },
+    componentWillReceiveProps(nextProps) {
+        if (!this.props.visible && nextProps.visible) {
+            this.props.form.resetFields();
+        };
+    },
     render() {
         const FormItem = Form.Item;
         const { getFieldDecorator } = this.props.form;
@@ -190,8 +195,9 @@ const RatepayDescFrom = Form.create()(React.createClass({
                     <Upload
                         name="ratepay"
                         action={globalConfig.context + "/techservice/cognizance/upload"}
-                        data={{ 'sign': this.props.year + 'ratepay' }}
-                        beforeUpload={beforeUpload}
+                        data={{ 'sign': 'ratepay_' + this.state.year || theData.year }}
+                        beforeUpload={beforeUploadFile}
+                        showUploadList={false}
                         onChange={(info) => {
                             if (info.file.status !== 'uploading') {
                                 console.log(info.file, info.fileList);
@@ -203,14 +209,15 @@ const RatepayDescFrom = Form.create()(React.createClass({
                                     message.warning(info.file.response.error[0].message);
                                     return;
                                 };
-                                this.state.ratepayUrl = info.file.response.data;
+                                this.state.taxReturnUrl = info.file.response.data;
                             } else if (info.file.status === 'error') {
                                 message.error(`${info.file.name} 文件上传失败。`);
                             }
                         }}
                     >
-                        <Button><Icon type="upload" /> 上传文件 </Button>
+                        <Button><Icon type="upload" /> 上传高新技术产品台帐 </Button>
                     </Upload>
+                    <p style={{ marginTop: '10px' }}>{theData.taxReturnUrl ? <a onClick={downloadFile.bind(null, theData.taxReturnUrl, theData.taxReturnDownloadFileName)}>{theData.taxReturnDownloadFileName}</a> : <span>未上传!</span>}</p>
                 </div>
                 <FormItem style={{ marginTop: '20px' }}>
                     <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
@@ -240,7 +247,7 @@ const RatepayDesc = React.createClass({
         this.setState({
             visible: false,
         });
-        this.props.closeDesc(false,true);
+        this.props.closeDesc(false, true);
     },
     handleCancel(e) {
         this.setState({
@@ -265,7 +272,8 @@ const RatepayDesc = React.createClass({
                         <RatepayDescFrom
                             uid={this.props.uid}
                             data={this.props.data}
-                            spinState={this.spinChange} closeModal={this.handleCancel}  clickOk={this.handleOk} />
+                            visible={this.state.visible}
+                            spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
                     </Modal>
                 </Spin>
             </div>
@@ -310,7 +318,8 @@ const Ratepay = React.createClass({
                     researchCost: thisdata.researchCost,
                     grossProfit: thisdata.grossProfit,
                     year: thisdata.year,
-                    taxReturnUrl: thisdata.taxReturnUrl
+                    taxReturnUrl: thisdata.taxReturnUrl,
+                    taxReturnDownloadFileName: thisdata.taxReturnDownloadFileName
                 });
             };
             this.state.pagination.current = data.data.pageNo;

+ 1 - 1
js/component/manageCenter/topTab.jsx

@@ -27,7 +27,7 @@ const TopTab = React.createClass({
         return (
             <div className="account-top" >
                 <div className="acc-top-user">
-                    <span className="acc-top-user-name">欢迎您, {adminData.nickname || adminData.number || this.state.username} <a onClick={this.logOut}>[ 退出 ]</a></span>
+                    <span className="acc-top-user-name">欢迎您, {adminData.name || adminData.mobile || this.state.username} <a onClick={this.logOut}>[ 退出 ]</a></span>
                     <span className="acc-top-user-toindex"><a href={globalConfig.context + "/admin/index.html"}>返回首页</a></span>
                 </div>
                 <div className="acc-index">