Переглянути джерело

添加 专利费用列表

mentoswzq 4 роки тому
батько
коміт
b2fff61a93

+ 15 - 14
js/component/manageCenter/project/task/myTask.jsx

@@ -2166,16 +2166,16 @@ const Task = React.createClass({
       message.warning('备注不能为空')
       return
     }
-    console.log(this.state.pictureUrl)
-    if (!this.state.pictureUrl && !Array.isArray(this.state.pictureUrl)) {
-      message.warning('合同扫描件不能为空')
-      return
-    }
 
-    if(this.state.pictureUrl.length === 0){
-      message.warning('合同扫描件不能为空')
-      return
-    }
+    // if (!this.state.pictureUrl && !Array.isArray(this.state.pictureUrl)) {
+    //   message.warning('合同扫描件不能为空')
+    //   return
+    // }
+
+    // if(this.state.pictureUrl.length === 0){
+    //   message.warning('合同扫描件不能为空')
+    //   return
+    // }
     let _this = this;
     confirm({
       title: startType === 0 ? '确定要发起外包吗?' : '确定要提交供应商信息吗?',
@@ -2193,9 +2193,6 @@ const Task = React.createClass({
             startType: _this.state.startType,       //支付类型  0外包 1供应商 false 0
             companyName: _this.state.companyName,
             amount: _this.state.amount,
-            pictureUrl: _this.getUrl(_this.state.pictureUrl).length
-                ? _this.getUrl(_this.state.pictureUrl)
-                : '',
             outsourceRemarks: _this.state.outsourceRemarks,
             unitNumber: _this.state.unitNumber,
             unitPrice: _this.state.unitPrice,
@@ -2210,6 +2207,12 @@ const Task = React.createClass({
             }
           }
 
+          if (this.state.pictureUrl && Array.isArray(this.state.pictureUrl) && this.state.pictureUrl.length !== 0){
+            data.pictureUrl = _this.getUrl(_this.state.pictureUrl).length
+                ? _this.getUrl(_this.state.pictureUrl)
+                : ''
+          }
+
           $.ajax({
             method: 'POST',
             dataType: 'json',
@@ -4436,7 +4439,6 @@ const Task = React.createClass({
                       wrapperCol={{ span: 18 }}
                       label={
                         <span>
-                          <strong style={{ color: '#f00' }}>*</strong>
                           合同/协议扫描件
                         </span>
                       }
@@ -5396,7 +5398,6 @@ const Task = React.createClass({
                       wrapperCol={{ span: 18 }}
                       label={
                         <span>
-                          <strong style={{ color: '#f00' }}>*</strong>
                           合同/协议扫描件
                         </span>
                       }

+ 8 - 0
js/component/manageCenter/set/content.jsx

@@ -47,6 +47,14 @@ class Content extends Component {
                     });
                 });
                 break;
+            case 'patentFees':
+                require.ensure([], () => {
+                    const PatentFees = require('./projectConfigure/patentFees').default;
+                    this.setState({
+                        component:<PatentFees />,
+                    });
+                });
+                break;
       	    case 'organization':
             require.ensure([], () => {
                 const Organization = require('./organization/organization').default;

+ 124 - 0
js/component/manageCenter/set/projectConfigure/addPatentPrice.js

@@ -0,0 +1,124 @@
+import React,{Component} from "react";
+import {Form, Input, Button, Checkbox, Select, Spin} from 'antd';
+import $ from "jquery/src/ajax";
+import {message, Modal} from "antd";
+
+class AddPatentPrice extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+            loading: false
+        }
+    }
+
+    //增加 修改
+    addSoftWritingPriceFn(e) {
+        e.preventDefault();
+        this.props.form.validateFields((err, values) => {
+            if (!err) {
+                this.setState({
+                    loading: true
+                });
+                let api ;
+                if(Object.keys(this.props.infor).length){
+                    api = '/api/admin/company/updatePatentPrice';
+                    values.id = this.props.infor.id;
+                } else {
+                    api = '/api/admin/company/addPatentPrice';
+                }
+                $.ajax({
+                    method: "post",
+                    dataType: "json",
+                    crossDomain: false,
+                    url:globalConfig.context + api,
+                    data:values,
+                }).done(function (data) {
+                    this.setState({
+                        loading: false
+                    });
+                    if (!data.error.length) {
+                        message.success(Object.keys(this.props.infor).length ? '修改成功!' : '新增成功!');
+                        this.props.successFn();
+                    } else {
+                        message.warning(data.error[0].message);
+                    }
+                }.bind(this));
+            }
+        });
+    }
+
+    render() {
+        const { getFieldDecorator } = this.props.form;
+        return (
+            <Modal
+                className="customeDetails"
+                title={Object.keys(this.props.infor).length ? "修改" : "新增"}
+                width='350px'
+                visible={this.props.visible}
+                onCancel={this.props.onCancel}
+                footer={null}
+            >
+                <Spin spinning={this.state.loading}>
+                    <Form onSubmit={(e)=>{
+                        this.addSoftWritingPriceFn(e)
+                    }}>
+                        <Form.Item  label="公司名称">
+                            {getFieldDecorator('companyName', {
+                                initialValue: this.props.infor.companyName,
+                                rules: [{ required: true, message: '请输入公司名称!' }],
+                            })(
+                                <Input placeholder="请输入公司名称" style={{width:'250px'}}/>
+                            )}
+                        </Form.Item>
+                        <Form.Item  label="实用新型(万元)">
+                            {getFieldDecorator('utilityModel', {
+                                initialValue: this.props.infor.utilityModel,
+                                rules: [{ required: true, message: '请输入实用新型的金额!' }],
+                            })(
+                                <Input placeholder="请输入实用新型的金额" type={'number'} style={{width:'250px'}}/>
+                            )}
+                        </Form.Item>
+                        <Form.Item  label="外观专利(万元)">
+                            {getFieldDecorator('appearancePatent', {
+                                initialValue: this.props.infor.appearancePatent,
+                                rules: [{ required: true, message: '请输入外观专利的金额!' }],
+                            })(
+                                <Input placeholder="请输入外观专利的金额" type={'number'} style={{width:'250px'}}/>
+                            )}
+                        </Form.Item>
+                        <Form.Item  label="发明专利(万元)">
+                            {getFieldDecorator('inventionPatent', {
+                                initialValue: this.props.infor.inventionPatent,
+                                rules: [{ required: true, message: '请输入发明专利的金额!' }],
+                            })(
+                                <Input placeholder="请输入发明专利的金额" type={'number'} style={{width:'250px'}}/>
+                            )}
+                        </Form.Item>
+                        <Form.Item  label="备注">
+                            {getFieldDecorator('remarks', {
+                                initialValue: this.props.infor.remarks,
+                                rules: [{ required: false, message: '请输入备注!' }],
+                            })(
+                                <Input placeholder="请输入备注" type={'textarea'} style={{width:'250px'}}/>
+                            )}
+                        </Form.Item>
+                        <Form.Item>
+                            <Button style={{
+                                width: '100%',
+                                marginTop: '18px',
+                            }} type="primary" htmlType="submit">
+                                {
+                                    Object.keys(this.props.infor).length ? '确定修改' : '确定添加'
+                                }
+                            </Button>
+                        </Form.Item>
+                    </Form>
+                </Spin>
+            </Modal>
+        )
+    }
+
+}
+
+const WrappedHorizontalLoginForm = Form.create()(AddPatentPrice);
+export default WrappedHorizontalLoginForm

+ 195 - 0
js/component/manageCenter/set/projectConfigure/patentFees.js

@@ -0,0 +1,195 @@
+//专利费用列表
+import React,{Component} from 'react';
+import {Button, Input, message, Select, Spin, Table, Modal, Popconfirm} from "antd";
+import AddPatentPrice from './addPatentPrice'
+import $ from "jquery/src/ajax";
+import '../content.less';
+
+class PatentFees extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+            type:'',
+            dataSource: [],
+            columns: [
+                {
+                    title: '公司名称',
+                    dataIndex: 'companyName',
+                    key: 'companyName',
+                },
+                {
+                    title: '实用新型(万元)',
+                    dataIndex: 'utilityModel',
+                    key: 'utilityModel',
+                },
+                {
+                    title: '外观专利(万元)',
+                    dataIndex: 'appearancePatent',
+                    key: 'appearancePatent',
+                },
+                {
+                    title: '发明专利(万元)',
+                    dataIndex: 'inventionPatent',
+                    key: 'inventionPatent',
+                },
+                {
+                    title: '备注',
+                    dataIndex: 'remarks',
+                    key: 'remarks',
+                },
+                {
+                    title: '操作',
+                    dataIndex: 'id',
+                    key: 'id',
+                    render: (text) => {
+                        return <div>
+                            <Popconfirm
+                                title="是否删除?"
+                                onConfirm={() => {
+                                    this.deleteOfficialFeePrice(text);
+                                }}
+                                okText="删除"
+                                cancelText="不删除"
+                            >
+                                <Button type="danger" onClick={(e) => {
+                                    e.stopPropagation()
+                                }}>
+                                    删除
+                                </Button>
+                            </Popconfirm>
+                        </div>
+                    }
+                },
+            ],
+            addSoftVisible: false,
+            infor: {},
+        }
+        this.loadData = this.loadData.bind(this);
+        this.tableRowClick = this.tableRowClick.bind(this);
+        this.reset = this.reset.bind(this);
+    }
+
+    componentDidMount() {
+        this.loadData();
+    }
+
+    //搜索功能和初始列表加载
+    loadData() {
+        this.setState({
+            loading: true,
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + '/api/admin/company/listPatentPrice',
+            data: {
+                type:this.state.type,       //名称
+            },
+            success: function (data) {
+                if (!data.data || !data.data) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                    data.data.map((v,i)=>{v.key = i})
+                    this.setState({
+                        dataSource: data.data,
+                    });
+                };
+
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    }
+
+    tableRowClick(infor) {
+        this.setState({
+            addSoftVisible : true,
+            infor: infor
+        })
+    }
+
+    reset(){
+        this.setState({
+            type:'',       //名称
+        },()=>{
+            this.loadData();
+        })
+    }
+
+    //删除
+    deleteOfficialFeePrice(id) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "post",
+            dataType: "json",
+            crossDomain: false,
+            url:globalConfig.context + '/api/admin/company/deletePatentPrice',
+            data:{
+                id: id
+            },
+        }).done(function (data) {
+            this.setState({
+                loading: false
+            });
+            if (!data.error.length) {
+                message.success('删除成功!');
+                this.loadData();
+            } else {
+                message.warning(data.error[0].message);
+            }
+        }.bind(this));
+    }
+
+    render() {
+        return(
+            <div className="user-content" >
+                <div className="content-title">
+                    <div className="user-search" style={{display:'flex',flexFlow:'row',marginBottom:'10px'}}>
+                        <span style={{marginLeft: 'auto'}}>
+                            <Button type="primary" size={'middle'} onClick={()=>{
+                                this.setState({
+                                    addSoftVisible : true
+                                })
+                            }}>
+                                增加
+                            </Button>
+                        </span>
+                    </div>
+                    <div className="patent-table">
+                        <Spin spinning={this.state.loading}>
+                            <Table columns={this.state.columns}
+                                   dataSource={this.state.dataSource}
+                                   pagination={false}
+                                   onRowClick={this.tableRowClick}/>
+                        </Spin>
+                    </div>
+                </div>
+                {this.state.addSoftVisible ? <AddPatentPrice
+                    infor={this.state.infor}
+                    visible={this.state.addSoftVisible}
+                    onCancel={()=>{
+                        this.setState({
+                            addSoftVisible : false,
+                            infor: {},
+                        })
+                    }}
+                    successFn={()=>{
+                        this.loadData();
+                        this.setState({
+                            addSoftVisible : false,
+                            infor: {}
+                        })
+                    }}/> : <div/>}
+            </div>
+        )
+    }
+}
+
+export default PatentFees