Browse Source

update 1.0.33

yee 7 years ago
parent
commit
4c90cf9cf0

+ 146 - 0
js/component/manageCenter/userManage/batchImport.jsx

@@ -0,0 +1,146 @@
+import React from 'react';
+import { Input, Modal, Button, message, Select } from 'antd';
+import { achievementCategoryList } from '../../dataDic.js';
+import ajax from 'jquery/src/ajax/xhr.js';
+import $ from 'jquery/src/ajax';
+
+const BatchImport = React.createClass({
+    getInitialState: function () {
+        return {
+            loading: false
+        };
+    },
+    showModal() {
+        this.setState({
+            visible: true,
+        });
+    },
+    handleOk(e) {
+        this.setState({
+            visible: false,
+        });
+    },
+    handleCancel(e) {
+        this.setState({
+            visible: false,
+        });
+    },
+    provinceChange(e) {
+        let theArr = [];
+        this.props.provinceList.map((item) => {
+            if (item.id == e) {
+                item.cityList.map((city) => {
+                    theArr.push(
+                        <Select.Option key={city.id}>{city.name}</Select.Option>
+                    )
+                });
+            }
+        });
+        this.setState({
+            cityOption: theArr,
+            province: e,
+            city: undefined
+        });
+    },
+    cityChange(e) {
+        this.setState({
+            city: e
+        });
+    },
+    //提交
+    handleSubmit() {
+        let theArr = this.state.inputValue.split(/[\r\n]/g);
+        if (!theArr.length) {
+            return;
+        };
+        if (theArr.length > 999) {
+            message.warning("数据条数不能多于1000条!");
+            return;
+        };
+        let unitName = theArr.join(',');
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "POST",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + '/api/admin/cognizanceRecord/import',
+            data: {
+                unitName: unitName,
+                district: this.state.city || this.state.province,
+                year: this.state.year
+            }
+        }).done(function (data) {
+            this.setState({
+                loading: false
+            });
+            if (!data.error.length) {
+                message.success('导入成功!');
+                this.handleOk();
+            } else {
+                message.warning(data.error[0].message);
+            };
+        }.bind(this));
+    },
+    reset() {
+        this.setState({
+            province: undefined,
+            city: undefined,
+            year: undefined,
+            inputValue: undefined
+        });
+    },
+    render() {
+        return (
+            <div>
+                <Button type="primary" onClick={this.showModal}>批量导入</Button>
+                <Modal
+                    title="批量导入"
+                    visible={this.state.visible}
+                    onCancel={this.handleCancel}
+                    width='1000px'
+                    footer={[
+                        <Button key="ok" className="set-submit" type="primary" loading={this.state.loading} onClick={this.handleSubmit}>保存</Button>,
+                        <Button key="clancel" className="set-submit" type="ghost" onClick={this.handleCancel}>取消</Button>
+                    ]} >
+                    <div>
+                        <span style={{ marginRight: '10px' }}>地区</span>
+                        <Select style={{ width: '100px' }}
+                            value={this.state.province}
+                            placeholder="请选择省份"
+                            notFoundContent="未获取到省份列表"
+                            showSearch
+                            filterOption={this.props.companySearch}
+                            onChange={this.provinceChange}>
+                            {this.props.provinceOption}
+                        </Select>
+                        <Select style={{ width: '120px', marginLeft: '10px' }}
+                            value={this.state.city}
+                            placeholder="请选择城市"
+                            notFoundContent="未获取到城市列表"
+                            showSearch
+                            filterOption={this.props.companySearch}
+                            onChange={this.cityChange}>
+                            {this.state.cityOption}
+                        </Select>
+                        <span style={{ marginLeft: '10px', marginRight: '10px' }}>年份</span>
+                        <Select style={{ width: 80 }}
+                            value={this.state.year}
+                            onChange={(e) => { this.setState({ year: e }) }} >
+                            {this.props.yearOption}
+                        </Select>
+                        <Button style={{ marginLeft: '20px' }} type="ghost" onClick={this.reset}>重置</Button>
+                    </div>
+                    <div style={{ margin: '10px 0' }}>
+                        公司名称
+                    </div>
+                    <Input type="textarea" rows={12} value={this.state.inputValue}
+                        onChange={(e) => { this.setState({ inputValue: e.target.value }); }} />
+                </Modal>
+            </div>
+        );
+    }
+});
+
+export default BatchImport;

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

@@ -53,6 +53,14 @@ class Content extends Component {
                     });
                 });
                 break;
+            case 'highTechSearch':
+                require.ensure([], () => {
+                    const HighTechSearch = require('./highTechSearch').default;
+                    this.setState({
+                        component: <HighTechSearch />,
+                    });
+                });
+                break;
         };
         window.location.hash = key;
     }

+ 0 - 1
js/component/manageCenter/userManage/customerSearch.jsx

@@ -3,7 +3,6 @@ import { Icon, Button, Input, Select, Spin, message, Col, Row } from 'antd';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 import './userList.less';
-import { getSearchUrl } from '../../tools.js';
 
 const CustomerSearch = React.createClass({
     loadData(pageNo) {

+ 214 - 0
js/component/manageCenter/userManage/highTechSearch.jsx

@@ -0,0 +1,214 @@
+import React from 'react';
+import { Icon, Button, Input, Select, Spin, message, Col, Row, Table } from 'antd';
+import ajax from 'jquery/src/ajax/xhr.js';
+import $ from 'jquery/src/ajax';
+import './userList.less';
+import BatchImport from './batchImport';
+import { provinceList, getProvince } from '../../NewDicProvinceList';
+import { companySearch } from '../../tools';
+
+const HighTechSearch = React.createClass({
+    loadData(pageNo) {
+        if (!this.state.searchUnitName && !this.state.province && !this.state.city && !this.state.searchYear) {
+            message.warning('请选择至少一个搜索条件!');
+            return;
+        };
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/admin/cognizanceRecord/search",
+            data: {
+                "district": this.state.city || this.state.province,
+                "unitName": this.state.searchUnitName,
+                "year": this.state.searchYear
+            },
+            success: function (data) {
+                let theArr = [];
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                } else {
+                    for (let i = 0; i < data.data.list.length; i++) {
+                        let thisdata = data.data.list[i];
+                        theArr.push({
+                            key: i + 1,
+                            id: thisdata.id,
+                            district: thisdata.district,
+                            unitName: thisdata.unitName,
+                            year: thisdata.year
+                        });
+                    };
+                    this.state.pagination.current = data.data.pageNo;
+                    this.state.pagination.total = data.data.totalCount;
+                };
+                this.setState({
+                    dataSource: theArr,
+                    pagination: this.state.pagination
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    },
+    getInitialState() {
+        return {
+            loading: false,
+            yearOption: [],
+            pagination: {
+                defaultCurrent: 1,
+                defaultPageSize: 10,
+                showQuickJumper: true,
+                pageSize: 10,
+                onChange: function (page) {
+                    this.loadData(page);
+                }.bind(this),
+                showTotal: function (total) {
+                    return '共' + total + '条数据';
+                }
+            },
+            columns: [
+                {
+                    title: '序号',
+                    dataIndex: 'key',
+                    key: 'key',
+                }, {
+                    title: '省份',
+                    dataIndex: 'district',
+                    key: 'district',
+                    render: (text) => { return getProvince(text) }
+                }, {
+                    title: '公司名称',
+                    dataIndex: 'unitName',
+                    key: 'unitName',
+                }, {
+                    title: '申报年份',
+                    dataIndex: 'year',
+                    key: 'year',
+                }
+            ],
+            dataSource: []
+        };
+    },
+    componentWillMount() {
+        let theProvinceArr = [];
+        let d = new Date();
+        let thisYear = d.getFullYear();
+
+        for (let i = thisYear; i >= 2000; i--) {
+            this.state.yearOption.push(<Select.Option key={i.toString()}>{i}</Select.Option>)
+        };
+        provinceList.map((item) => {
+            theProvinceArr.push(
+                <Select.Option key={item.id}>{item.name}</Select.Option>
+            )
+        });
+        this.state.provinceOption = theProvinceArr;
+        //this.loadData();
+    },
+    provinceChange(e) {
+        let theArr = [];
+        provinceList.map((item) => {
+            if (item.id == e) {
+                item.cityList.map((city) => {
+                    theArr.push(
+                        <Select.Option key={city.id}>{city.name}</Select.Option>
+                    )
+                });
+            }
+        });
+        this.setState({
+            cityOption: theArr,
+            province: e,
+            city: undefined
+        });
+    },
+    cityChange(e) {
+        this.setState({
+            city: e
+        });
+    },
+    search() {
+        this.loadData();
+    },
+    reset() {
+        this.state.city = undefined;
+        this.state.province = undefined;
+        this.state.searchUnitName = undefined;
+        this.state.searchYear = undefined;
+        this.loadData();
+    },
+    render() {
+        return (
+            <div className="user-content" >
+                <div className="content-title">
+                    <span>高企查询</span>
+                </div>
+                <Row className="clearfix" style={{ marginBottom: '20px' }}>
+                    <Col style={{ width: 60, float: 'left' }}>
+                        <span>企业名称</span>
+                    </Col>
+                    <Col span={5}>
+                        <Input placeholder="请输入用户全称"
+                            value={this.state.searchName}
+                            onChange={(e) => { this.setState({ searchName: e.target.value }) }} />
+                    </Col>
+                    <Col style={{ width: 20, float: 'left' }}></Col>
+                    <Col style={{ width: 40, float: 'left' }}>
+                        <span>地区</span>
+                    </Col>
+                    <Col span={6}>
+                        <Select style={{ width: '40%' }}
+                            value={this.state.province}
+                            placeholder="请选择省份"
+                            notFoundContent="未获取到省份列表"
+                            showSearch
+                            filterOption={companySearch}
+                            onChange={this.provinceChange}>
+                            {this.state.provinceOption}
+                        </Select>
+                        <Select style={{ width: '50%', marginLeft: '10px' }}
+                            value={this.state.city}
+                            placeholder="请选择城市"
+                            notFoundContent="未获取到城市列表"
+                            showSearch
+                            filterOption={companySearch}
+                            onChange={this.cityChange}>
+                            {this.state.cityOption}
+                        </Select>
+                    </Col>
+                    <Col style={{ width: 40, float: 'left' }}>
+                        <span>年份</span>
+                    </Col>
+                    <Col span={2}>
+                        <Select style={{ width: 80 }}
+                            value={this.state.searchYear}
+                            onChange={(e) => { this.setState({ searchYear: e }) }} >
+                            {this.state.yearOption}
+                        </Select>
+                    </Col>
+                    <Col span={4}>
+                        <Button style={{ marginRight: '20px' }} type="primary" onClick={this.search}>搜索</Button>
+                        <Button style={{ marginRight: '20px' }} type="ghost" onClick={this.reset}>重置</Button>
+                    </Col>
+                    <BatchImport
+                        yearOption={this.state.yearOption}
+                        provinceOption={this.state.provinceOption}
+                        provinceList={provinceList}
+                        companySearch={companySearch} />
+                </Row>
+                <Spin spinning={this.state.loading}>
+                    <Table columns={this.state.columns}
+                        dataSource={this.state.dataSource}
+                        pagination={this.state.pagination} />
+                </Spin>
+            </div >
+        );
+    }
+});
+
+export default HighTechSearch;

+ 3 - 0
js/component/manageCenter/userManage/leftTab.jsx

@@ -40,6 +40,9 @@ const LeftTab = React.createClass({
                 <Menu.Item style={{ display: window.showCustomer ? 'block' : 'none' }} key="customerSearch">
                     客户查询
                 </Menu.Item>
+                <Menu.Item style={{ display: window.showCustomer ? 'block' : 'none' }} key="highTechSearch">
+                    高企查询
+                </Menu.Item>
             </Menu>
         );
     },

+ 1 - 1
js/component/portal/search/subscriber.jsx

@@ -291,7 +291,7 @@ const SubContent = React.createClass({
                             </Select>
                             <Select style={{ width: 160, marginRight: '10px', marginBottom: '10px' }}
                                 value={this.state.city}
-                                placeholder="请选择行业城市"
+                                placeholder="请选择城市"
                                 notFoundContent="未获取到城市列表"
                                 showSearch
                                 filterOption={companySearch}

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.0.32",
+  "version": "1.0.33",
   "description": "",
   "main": "index.js",
   "scripts": {