mentoswzq 5 anni fa
parent
commit
8fa85d5c7a

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

@@ -31,6 +31,22 @@ class Content extends Component {
     }
     getKey(key) {
         switch (key) {
+            case 'softwareConfigure':
+                require.ensure([], () => {
+                    const SoftwareConfigure = require('./projectConfigure/softwareConfigure').default;
+                    this.setState({
+                        component:<SoftwareConfigure />,
+                    });
+                });
+                break;
+            case 'officialFees':
+                require.ensure([], () => {
+                    const OfficialFees = require('./projectConfigure/officialFees').default;
+                    this.setState({
+                        component:<OfficialFees />,
+                    });
+                });
+                break;
       	    case 'organization':
             require.ensure([], () => {
                 const Organization = require('./organization/organization').default;

+ 118 - 0
js/component/manageCenter/set/projectConfigure/addSoftWritingPrice.js

@@ -0,0 +1,118 @@
+import React,{Component} from "react";
+import {Form, Input, Button, Checkbox, Select} from 'antd';
+import $ from "jquery/src/ajax";
+import {message, Modal} from "antd";
+
+class AddSoftWritingPrice extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+
+        }
+    }
+
+    //增加
+    addSoftWritingPriceFn(e) {
+        e.preventDefault();
+        this.props.form.validateFields((err, values) => {
+            if (!err) {
+                this.setState({
+                    loading: true
+                });
+                $.ajax({
+                    method: "post",
+                    dataType: "json",
+                    crossDomain: false,
+                    url:globalConfig.context + '/api/admin/company/addSoftWritingPrice',
+                    data:values,
+                }).done(function (data) {
+                    this.setState({
+                        loading: false
+                    });
+                    if (!data.error.length) {
+                        message.success('新增成功!');
+                        this.props.successFn();
+                    } else {
+                        message.warning(data.error[0].message);
+                    }
+                }.bind(this));
+            }
+        });
+    }
+
+    render() {
+        const { getFieldDecorator } = this.props.form;
+        return (
+            <Modal
+                className="customeDetails"
+                title="新增"
+                width='350px'
+                visible={this.props.visible}
+                onCancel={this.props.onCancel}
+                footer={null}
+            >
+                <Form onSubmit={(e)=>{
+                    this.addSoftWritingPriceFn(e)
+                }}>
+                    <Form.Item label="公司名称">
+                        {getFieldDecorator('companyName', {
+                            rules: [{ required: true, message: '请输入公司名称!' }],
+                        })(
+                            <Input placeholder="请输入公司名称" style={{width:'250px'}}/>
+                        )}
+                    </Form.Item>
+                    <Form.Item  label="单价">
+                        {getFieldDecorator('unitPrice', {
+                            rules: [{ required: true, message: '请输入单价!' }],
+                        })(
+                            <Input placeholder="请输入单价" type={'number'} style={{width:'250px'}}/>
+                        )}
+                    </Form.Item>
+                    <Form.Item  label="材料">
+                        {getFieldDecorator('material', {
+                            rules: [{ required: true, message: '请选择是否有材料!' }],
+                        })(
+                            <Select style={{ width:'200px'}}>
+                                <Select.Option value={0}>无</Select.Option>
+                                <Select.Option value={1}>有</Select.Option>
+                            </Select>
+                        )}
+                    </Form.Item>
+                    <Form.Item  label="加急天数">
+                        {getFieldDecorator('urgent', {
+                            rules: [{ required: true, message: '请选择加急天数!' }],
+                        })(
+                            <Select style={{ width:'200px'}}>
+                                <Select.Option value={0}>无加急</Select.Option>
+                                <Select.Option value={1}>加急3天</Select.Option>
+                                <Select.Option value={2}>加急4天</Select.Option>
+                                <Select.Option value={3}>加急5-10天</Select.Option>
+                                <Select.Option value={4}>加急11-15天</Select.Option>
+                                <Select.Option value={5}>加急16-20天</Select.Option>
+                                <Select.Option value={6}>加急21-25天</Select.Option>
+                                <Select.Option value={7}>加急26-30天</Select.Option>
+                            </Select>
+                        )}
+                    </Form.Item>
+                    <Form.Item  label="备注">
+                        {getFieldDecorator('remarks', {
+                            rules: [{ required: true, message: '请输入备注!' }],
+                        })(
+                            <Input placeholder="请输入备注" type={'textarea'} style={{width:'250px'}}/>
+                        )}
+                    </Form.Item>
+                    <Form.Item>
+                        <Button style={{
+                            width: '100%',
+                            marginTop: '18px',
+                        }} type="primary" htmlType="submit">确定添加</Button>
+                    </Form.Item>
+                </Form>
+            </Modal>
+            )
+    }
+
+}
+
+const WrappedHorizontalLoginForm = Form.create()(AddSoftWritingPrice);
+export default WrappedHorizontalLoginForm

+ 19 - 0
js/component/manageCenter/set/projectConfigure/officialFees.js

@@ -0,0 +1,19 @@
+import React,{Component} from 'react';
+
+class OfficialFees extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+
+        }
+    }
+
+    render() {
+        return (
+            <div>建设中...</div>
+        )
+    }
+
+}
+
+export default OfficialFees

+ 258 - 0
js/component/manageCenter/set/projectConfigure/softwareConfigure.js

@@ -0,0 +1,258 @@
+import React,{Component} from 'react';
+import {Button, Input, message, Select, Spin, Table, Modal, Popconfirm} from "antd";
+import AddSoftWritingPrice from './addSoftWritingPrice'
+import $ from "jquery/src/ajax";
+import '../content.less';
+
+class SoftwareConfigure extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+            cid:'',        //公司编号
+            urgent: '',    //加急
+            material: '',  //材料
+            pagination: {
+                defaultCurrent: 1,
+                defaultPageSize: 10,
+                showQuickJumper: true,
+                pageSize: 10,
+                onChange: function (page) {
+                    this.loadData(page);
+                }.bind(this),
+                showTotal: function (total) {
+                    return '共' + total + '条数据';
+                }
+            },
+            dataSource: [],
+            columns: [
+                {
+                    title: '供应商名称',
+                    dataIndex: 'companyName',
+                    key: 'companyName',
+                },
+                {
+                    title: '材料',
+                    dataIndex: 'material',
+                    key: 'material',
+                    render: (text) => {
+                        return text === 0 ? '无材料' : '有材料'
+                    }
+                },
+                {
+                    title: '加急天数',
+                    dataIndex: 'urgent',
+                    key: 'urgent',
+                    render: (text) => {
+                        switch (text) {
+                            case 0:
+                                return '无加急';
+                            case 1:
+                                return '加急3天';
+                            case 2:
+                                return '加急4天';
+                            case 3:
+                                return '加急5-10天';
+                            case 4:
+                                return '加急11-15天';
+                            case 5:
+                                return '加急16-20天';
+                            case 6:
+                                return '加急21-25天';
+                            case 7:
+                                return '加急26-30天';
+                        }
+                    }
+                },
+                {
+                    title: '价格万元/个',
+                    dataIndex: 'unitPrice',
+                    key: 'unitPrice',
+                },
+                {
+                    title: '备注',
+                    dataIndex: 'remarks',
+                    key: 'remarks',
+                },
+                {
+                    title: '操作',
+                    dataIndex: 'id',
+                    key: 'id',
+                    render: (text) => {
+                        return <Popconfirm
+                            title="是否删除?"
+                            onConfirm={() => {
+                                this.deleteSoftWritingPrice(text);
+                            }}
+                            okText="删除"
+                            cancelText="不删除"
+                        >
+                            <Button type="danger">
+                                删除
+                            </Button>
+                        </Popconfirm>
+                    }
+                },
+            ],
+            addSoftVisible: false
+        }
+        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/listSoftWritingPrice',
+            data: {
+                cid:this.state.cid,       //公司编号
+                urgent: this.state.urgent,    //加急
+                material: this.state.material,  //材料
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data || !data.data.list) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                    this.state.pagination.current = data.data.pageNo;
+                    this.state.pagination.total = data.data.totalCount;
+                    data.data.list.map((v,i)=>{v.key = i})
+                    this.setState({
+                        dataSource: data.data.list,
+                        pagination: this.state.pagination
+                    });
+                };
+
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    }
+
+    tableRowClick() {
+
+    }
+
+    reset(){
+        this.setState({
+            cid:'',       //公司编号
+            urgent: '',    //加急
+            material: '',  //材料
+        },()=>{
+            this.loadData();
+        })
+    }
+
+    //删除
+    deleteSoftWritingPrice(id) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "post",
+            dataType: "json",
+            crossDomain: false,
+            url:globalConfig.context + '/api/admin/company/deleteSoftWritingPrice',
+            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'}}>
+                        <Input placeholder="公司编号" style={{width:'150px',marginRight:'10px',marginBottom:'10px',marginLeft:10}}
+                               value={this.state.cid}
+                               onChange={(e) => { this.setState({ cid: e.target.value }); }} />
+                        <div style={{display:'flex',flexFlow:'row nowrap'}}>
+                            <div style={{marginLeft:10,marginRight:10}}>材料:</div>
+                            <Select style={{ width:'200px',marginRight:'10px' }}
+                                    value={this.state.material}
+                                    onChange={(e) => {this.setState({ material: e }) }}>
+                                <Select.Option value={0}>无</Select.Option>
+                                <Select.Option value={1}>有</Select.Option>
+                            </Select>
+                        </div>
+                        <div style={{display:'flex',flexFlow:'row nowrap'}}>
+                            <div style={{marginLeft:10,marginRight:10}}>加急天数:</div>
+                            <Select placeholder="加急天数"
+                                    style={{ width:'200px',marginRight:'10px' }}
+                                    value={this.state.urgent}
+                                    onChange={(e) => { this.setState({ urgent: e }) }}>
+                                <Select.Option value={0}>无加急</Select.Option>
+                                <Select.Option value={1}>加急3天</Select.Option>
+                                <Select.Option value={2}>加急4天</Select.Option>
+                                <Select.Option value={3}>加急5-10天</Select.Option>
+                                <Select.Option value={4}>加急11-15天</Select.Option>
+                                <Select.Option value={5}>加急16-20天</Select.Option>
+                                <Select.Option value={6}>加急21-25天</Select.Option>
+                                <Select.Option value={7}>加急26-30天</Select.Option>
+                            </Select>
+                        </div>
+                        <Button type="primary" onClick={this.loadData} style={{marginRight:'10px'}}>搜索</Button>
+                        <Button onClick={this.reset} style={{marginRight:'10px'}}>重置</Button>
+                        <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={this.state.pagination}
+                                   onRowClick={this.tableRowClick}/>
+                        </Spin>
+                    </div>
+                </div>
+                {this.state.addSoftVisible ? <AddSoftWritingPrice
+                    visible={this.state.addSoftVisible}
+                    onCancel={()=>{
+                        this.setState({
+                            addSoftVisible : false
+                        })
+                    }}
+                    successFn={()=>{
+                        this.loadData();
+                        this.setState({
+                            addSoftVisible : false
+                        })
+                    }}/> : <div/>}
+            </div>
+        )
+    }
+}
+
+export default SoftwareConfigure