Browse Source

Revert "客户系统重构"

This reverts commit bf76550151487393147695bf56ba65b8464ab9bc.
wanghui 7 years ago
parent
commit
e134bddee8

+ 0 - 15
js/component/manageCenter/set/business/businessCategory.jsx

@@ -1,15 +0,0 @@
-import React from 'react';
-import ReactDom from 'react-dom';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-import {Form} from 'antd';
-
-const BusinessCategory=Form.create()(React.createClass({
-	render(){
-		return (
-			<div>业务品类管理</div>
-		)
-	}
-}));
-
-export default BusinessCategory;

+ 0 - 14
js/component/manageCenter/set/business/businessProject.jsx

@@ -1,14 +0,0 @@
-import React from 'react';
-import ReactDom from 'react-dom';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-import {Form} from 'antd';
-const BusinessProject=Form.create()(React.createClass({
-	render(){
-		return (
-			<div>用户管理</div>
-		)
-	}
-}));
-
-export default BusinessProject;

+ 27 - 44
js/component/manageCenter/set/content.jsx

@@ -1,5 +1,6 @@
 import React, { Component } from 'react';
 import '../content.less';
+import './content.less';
 import LeftTab from './leftTab';
 
 
@@ -8,68 +9,50 @@ class Content extends Component {
         super();
         this.state = {
             loading: false,
-            component: <div></div>,
+            component: <div />,
         };
     }
     componentWillMount() {
         if (window.location.hash) {
             this.getKey(window.location.hash.substr(1));
         } else {
-            this.getKey("user");
+            this.getKey('member');
         };
     }
     getKey(key) {
-        switch (key) {          	
-            case 'user':
+        switch (key) {
+            case 'member':
                 require.ensure([], () => {
-                    const User = require('./userManagement/user').default;
+                    const Member = require('./member').default;
                     this.setState({
-                        component: <User />                      
+                        component: <Member />,
                     });
                 });
-                break;           
-           
-            case 'role':
-                require.ensure([], () => {
-	                const Role = require('./userManagement/role').default;
-	                this.setState({
-	                    component:<Role />,	                    	                  
-	                });
-          	    });
-          	    break;
-          	case 'jurisdiction':
+                break;
+            case 'permission':
                 require.ensure([], () => {
-                    const Jurisdiction = require('./userManagement/jurisdiction').default;
+                    const Permission = require('./permission').default;
                     this.setState({
-                        component: <Jurisdiction />                      
-                      
+                        component: <Permission />,
                     });
                 });
-                break;          
-      	    case 'organization':
-            require.ensure([], () => {
-                const Organization = require('./organization/organization').default;
-                this.setState({
-                    component:<Organization />,	                                      
-                });
-      	    });
-      	    break;
-      	    case 'businessCategory':
-            require.ensure([], () => {
-                const BusinessCategory = require('./business/businessCategory').default;
-                this.setState({
-                    component:<BusinessCategory />,	                                      
+                break;
+            case 'role':
+                require.ensure([], () => {
+                    const Role = require('./role').default;
+                    this.setState({
+                        component: <Role />,
+                    });
                 });
-      	    });
-      	    break;
-      	    case 'businessProject':
-            require.ensure([], () => {
-                const BusinessProject = require('./business/businessProject').default;
-                this.setState({
-                    component:<BusinessProject />,	                                      
+                break;           
+            case 'site':
+                require.ensure([], () => {
+                    const Site = require('./site').default;
+                    this.setState({
+                        component: <Site />,
+                    });
                 });
-      	    });
-      	    break;
+                break;
         };
         window.location.hash = key;
     }
@@ -78,7 +61,7 @@ class Content extends Component {
             <div className="manage-content">
                 <LeftTab handlekey={this.getKey.bind(this)} />
                 <div className="content-right">
-                   {this.state.component}
+                    {this.state.component}
                 </div>
             </div>
         )

+ 55 - 0
js/component/manageCenter/set/content.less

@@ -0,0 +1,55 @@
+.set-content {
+    background: #fff;
+    padding: 20px;
+    .set-title {
+        >span {
+            font-size: 16px;
+            color: #333;
+        }
+        >button {
+            float: right;
+            margin-right: 20px;
+        }
+    }
+    .member-table {
+        margin-top: 20px;
+    }
+    .set-search {
+        >input {
+            width: 120px;
+        }
+        >* {
+            margin-right: 10px;
+            margin-top: 10px;
+        }
+    }
+}
+
+.ant-modal-body {
+    .modal-content {
+        >.list {
+            margin-bottom: 20px;
+            float: left;
+            width: 50%;
+            >span {
+                margin-right: 20px;
+                display: inline-block;
+                width: 60px;
+                text-align: right;
+            }
+            >input {
+                width: 200px;
+            }
+            .modal-det {
+                width: 200px;
+                text-align: left;
+            }
+        }
+    }
+    .modal-text {
+        margin-right: 20px;
+        display: inline-block;
+        width: 60px;
+        text-align: right;
+    }
+}

+ 19 - 47
js/component/manageCenter/set/leftTab.jsx

@@ -8,70 +8,42 @@ const MenuItemGroup = Menu.ItemGroup;
 const LeftTab = React.createClass({
     getInitialState() {
         return {
-            current: 'user', 
-            subKey: 'sub1', 
-            keyList: [
-                { key: 'sub1', value: ['user','role','jurisdiction'] },
-                { key: 'sub2', value: ['organization'] },
-                { key: 'sub3', value: ['businessCategory', 'businessProject'] },
-            ]
+            current: 'userList',
         };
     },
-     handleClick(e) {
+    handleClick(e) {
         this.props.handlekey(e.key);
         this.setState({
             current: e.key,
         });
     },
-    componentWillMount() {
-        const _me = this;
-        if (window.location.hash) {
-            let theKey = window.location.hash.substr(1);
-            this.state.keyList.map(function (item1) {
-                item1.value.map(function (item2) {
-                    if (theKey == item2) {
-                        _me.state.subKey = item1.key
-                    };
-                });
-            });
-            this.state.current = theKey;
+    componentWillMount(){
+        if ( window.location.hash ) {
+            this.state.current = window.location.hash.substr(1);
         };
     },
     render() {
         return (
             <Menu onClick={this.handleClick}
                 selectedKeys={[this.state.current]}
-                defaultOpenKeys={[this.state.subKey]}
                 mode="vertical"
                 className="account-left"
-                mode="inline" >
-	            <SubMenu key="sub1" title={<span>用户管理</span>}>	
-	            		<Menu.Item key="user">
-		                    用户信息
-		                </Menu.Item> 
-		                <Menu.Item key="role">
-		                    角色信息
-		                </Menu.Item>                              
-		                <Menu.Item key="jurisdiction">
-		                    权限信息
-		                </Menu.Item>		           
-		        </SubMenu> 
-		        <SubMenu key="sub2" title={<span>组织机构管理</span>}>	            	
-		                <Menu.Item key="organization">
-		                    组织机构
-		                </Menu.Item>               	               		           
-		        </SubMenu>
-		        <SubMenu key="sub3" title={<span>业务品种管理</span>}>		            
-		                <Menu.Item key="businessCategory">
-		                    业务品类管理
-		                </Menu.Item>               
-		                <Menu.Item key="businessProject">
-		                    业务项目管理
-		                </Menu.Item>	               		           
-		        </SubMenu>
+                >
+                <Menu.Item key="member">
+                    管理员列表
+                </Menu.Item>
+                <Menu.Item key="permission">
+                    权限控制
+                </Menu.Item>
+                <Menu.Item key="role">
+                    角色控制
+                </Menu.Item>               
+                <Menu.Item key="site" style={{display:'none'}}>
+                    站点设置
+                </Menu.Item>
             </Menu>
         );
-    },
+    }
 });
 
 export default LeftTab;

+ 252 - 0
js/component/manageCenter/set/member.jsx

@@ -0,0 +1,252 @@
+import React from 'react';
+import { Table, Button, Spin, message, Icon, Select, Input } from 'antd';
+import { provinceSelect, provinceList, getProvince } from '../../NewDicProvinceList.js';
+import { companySearch } from '../../tools';
+import ajax from 'jquery/src/ajax/xhr.js';
+import $ from 'jquery/src/ajax';
+import TheModal from './modal.jsx';
+
+const Member = React.createClass({
+    loadData(pageNo) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            type: 'get',
+            cache: false,
+            url: globalConfig.context + "/api/admin/supervise/adminList",
+            dataType: "json",
+            data: {
+                pageNo: pageNo || 1,
+                pageSize: this.state.pagination.pageSize,
+                province: this.state.searchProvince,
+                mobile: this.state.searchMobile,
+                name: this.state.searchName
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data) {
+                    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];
+                        this.state.onlyProvince = thisdata.province;
+                        theArr.push({
+                            key: i,
+                            id: thisdata.id,
+                            mobile: thisdata.mobile,
+                            name: thisdata.name,
+                            email: thisdata.email,
+                            createTime: thisdata.createTime,
+                            number: thisdata.number,
+                            province: thisdata.province,
+                            position: thisdata.position,
+                            superior: thisdata.superior,
+                            superiorId: thisdata.superiorId,
+                            createTimeFormattedDate: thisdata.createTimeFormattedDate
+                        });
+                    };
+                    this.state.pagination.current = data.data.pageNo;
+                    this.state.pagination.total = data.data.totalCount;
+                };
+                this.setState({
+                    data: theArr,
+                    pagination: this.state.pagination
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    },
+    loadInitialData() {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/roles',
+            cache: false
+        }).done((rolesres) => {
+            let theAdminRole = [], rolesObj = {};
+            if (rolesres.data && window.adminData) {
+                rolesres.data.map((item) => {
+                    theAdminRole.push(item.id);
+                    rolesObj[item.id] = item.roleName;
+                })
+            }
+            this.setState({
+                roles: rolesres.data,
+                theAdminRole: theAdminRole,
+                rolesObj:rolesObj,
+                loading: false
+            });
+        })
+    },
+    loadBindRoles(uid) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/admin/role',
+            cache: false,
+            data: {
+                "uid": window.adminData.uid
+            }
+        }).done((data) => {
+            this.setState({
+                currentRoles: data.data || [],
+                loading: false
+            });
+        })
+    },
+    getInitialState() {
+        return {
+            data: [],
+            roles: [],
+            currentRoles:[],
+            rolesObj: {},
+            theAdminRole: [],
+            provinceList: [],
+            dataSource: [],
+            selectedRowKeys: [],
+            selectedRows: [],
+            loading: false,
+            modalData: {},
+            modalShow: false,
+            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: 'number',
+                    key: 'number'
+                }, {
+                    title: '登录账号',
+                    dataIndex: 'mobile',
+                    key: 'mobile'
+                }, {
+                    title: '名字',
+                    dataIndex: 'name',
+                    key: 'name'
+                }, {
+                    title: '职位',
+                    dataIndex: 'position',
+                    key: 'position'
+                }, {
+                    title: '上级管理员',
+                    dataIndex: 'superior',
+                    key: 'superior'
+                }, {
+                    title: '省份',
+                    dataIndex: 'province',
+                    key: 'province',
+                    render: text => {
+                        return text ? text.split(',').map((item) => {
+                            return getProvince(item) + ' '
+                        }) : []
+                    }
+                }, {
+                    title: '邮箱',
+                    dataIndex: 'email',
+                    key: 'email'
+                }, {
+                    title: '创建时间',
+                    dataIndex: 'createTimeFormattedDate',
+                    key: 'createTimeFormattedDate'
+                }
+            ]
+        }
+    },
+    componentWillMount() {
+        this.state.provinceList = provinceSelect();
+        this.loadData();
+        this.loadInitialData();
+        this.loadBindRoles();
+    },
+    addNew() {
+        let e = {}
+        this.setState({
+            modalData: e,
+            modalShow: true
+        })
+    },
+    edit(e) {
+        this.setState({
+            modalData: e,
+            modalShow: true
+        })
+    },
+    reset() {
+        this.state.searchMobile = undefined;
+        this.state.searchName = undefined;
+        this.state.searchProvince = undefined;
+        this.loadData();
+    },
+    handleReturn(show, render) {
+        this.state.modalShow = show;
+        if (render) {
+            this.loadData();
+        }
+    },
+    render() {
+        return (
+            <Spin spinning={this.state.loading}>
+                <div className="set-content">
+                    <div className="set-title">
+                        <span>管理员设置</span>
+                        <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
+                            onClick={this.addNew}>添加<Icon type="plus" /></Button>
+                    </div>
+                    <div className="set-search">
+                        <Input placeholder="登录号"
+                            value={this.state.searchMobile}
+                            onChange={(e) => { this.setState({ searchMobile: e.target.value }); }} />
+                        <Input placeholder="管理员名字"
+                            value={this.state.searchName}
+                            onChange={(e) => { this.setState({ searchName: e.target.value }); }} />
+                        <Select style={{ width: 120 }}
+                            placeholder="选择一个省份"
+                            showSearch
+                            filterOption={companySearch}
+                            value={this.state.searchProvince}
+                            onChange={(e) => { this.setState({ searchProvince: e }) }} >
+                            {this.state.provinceList.map((item) => {
+                                return <Select.Option key={String(item.value)}>{item.label}</Select.Option>
+                            })}
+                        </Select>
+                        <Button type="primary" onClick={() => { this.loadData() }}>搜索</Button>
+                        <Button onClick={this.reset}>重置</Button>
+                    </div>
+                    <TheModal
+                        theAdminRole={this.state.theAdminRole}
+                        currentRoles={this.state.currentRoles}
+                        roles={this.state.roles}
+                        rolesObj={this.state.rolesObj}
+                        data={this.state.modalData}
+                        onlyProvince={this.state.onlyProvince}
+                        show={this.state.modalShow}
+                        handleReturn={this.handleReturn} />
+                    <Table className='member-table'
+                        columns={this.state.columns}
+                        onRowClick={this.edit}
+                        dataSource={this.state.data}
+                        pagination={this.state.pagination} />
+                </div>
+            </Spin>
+        );
+    }
+});
+export default Member;

+ 533 - 0
js/component/manageCenter/set/modal.jsx

@@ -0,0 +1,533 @@
+import React from 'react';
+import { Tag, Modal, Input, Spin, Switch, Select, message, Popconfirm, Button, Cascader, Icon } from 'antd';
+import { provinceSelect, provinceList, getProvince } from '../../NewDicProvinceList.js';
+import { companySearch } from '../../tools.js';
+import ajax from 'jquery/src/ajax/xhr.js';
+import $ from 'jquery/src/ajax';
+
+const ProvinceAdd = React.createClass({
+    getInitialState() {
+        return {
+            cityOption: [],
+            theProvince: [],
+            citys: []
+        };
+    },
+    componentWillMount() {
+        let theArr = [];
+        this.state.theProvince = [this.props.locations[this.props.index].province];
+        this.state.citys = this.props.locations[this.props.index].city || [];
+        this.props.provinceList.map((item) => {
+            if (item.id == this.props.locations[this.props.index].province) {
+                item.cityList.map((city) => {
+                    theArr.push({
+                        value: city.id,
+                        label: city.name
+                    })
+                });
+            };
+        });
+        this.state.cityOption = theArr;
+    },
+    componentWillReceiveProps(nextProps) {
+        let theArr = [];
+        this.state.theProvince = [nextProps.locations[nextProps.index].province];
+        this.state.citys = nextProps.locations[nextProps.index].city || [];
+        this.props.provinceList.map((item) => {
+            if (item.id == nextProps.locations[nextProps.index].province) {
+                item.cityList.map((city) => {
+                    theArr.push({
+                        value: city.id,
+                        label: city.name
+                    })
+                });
+            };
+        });
+        this.state.cityOption = theArr;
+    },
+    render() {
+        return (
+            <div style={{ display: 'inline-block', marginRight: '20px', marginBottom: '10px' }}>
+                <Cascader placeholder="选择省份"
+                    style={{ width: 80, marginRight: '20px', verticalAlign: 'middle' }}
+                    options={this.props.provinceOption}
+                    value={this.state.theProvince}
+                    showSearch
+                    filterOption={companySearch}
+                    onChange={(e) => {
+                        let bool = true, theArr = [], _me = this;;
+                        this.props.locations.map((item, i) => {
+                            if (item.province == e[0] && this.props.index != i) {
+                                bool = false;
+                            };
+                        });
+                        if (!bool) {
+                            message.warning('请选择一个其他省份');
+                            this.setState({
+                                theProvince: undefined,
+                                citys: undefined,
+                                cityOption: []
+                            });
+                            return;
+                        };
+                        this.props.provinceList.map((item) => {
+                            if (item.id == e) {
+                                item.cityList.map((city) => {
+                                    theArr.push({
+                                        value: city.id,
+                                        label: city.name
+                                    })
+                                });
+                            };
+                        });
+                        this.props.getLocations(this.props.index, e[0])
+                        this.setState({
+                            theProvince: e,
+                            citys: undefined,
+                            cityOption: theArr,
+                        })
+                    }} />
+                <Select style={{ verticalAlign: 'middle', width: 584 }}
+                    placeholder="选择城市" notFoundContent="请先选择一个省份" multiple={true}
+                    showSearch
+                    filterOption={companySearch}
+                    value={this.state.citys}
+                    onChange={(e) => { this.setState({ citys: e }) }}
+                    onBlur={() => {
+                        this.props.getLocations(this.props.index, this.state.theProvince ? this.state.theProvince[0] : null, this.state.citys)
+                    }}>
+                    {this.state.cityOption.map((item) => {
+                        return <Select.Option key={String(item.value)}>{item.label}</Select.Option>
+                    })}
+                </Select>
+                <Button style={{ verticalAlign: 'middle', marginLeft: '20px' }} type="dashed" size="small"
+                    onClick={() => { this.props.delLocations(this.props.index) }}>
+                    <Icon type="minus" />
+                </Button>
+            </div>
+        );
+    },
+})
+
+const TheModal = React.createClass({
+    postData() {
+        this.setState({
+            loading: true
+        });
+        let theArr = [];
+        let theLocations = this.state.locations.concat();
+        theLocations.map((item, i) => {
+            if (item.province) {
+                theArr.push(item);
+            };
+        });
+        theArr.map((item) => {
+            if (item.city && item.city.length) {
+                item.city = item.city.join(',');
+            } else {
+                item.city = null;
+            };
+        });
+        $.ajax({
+            type: "POST",
+            url: this.state.id ? globalConfig.context + "/api/admin/supervise/updateAdmin" : globalConfig.context + "/api/admin/supervise/insertAdmin",
+            data: {
+                data: JSON.stringify({
+                    'id': this.state.id,
+                    'name': this.state.name,
+                    'email': this.state.email,
+                    'mobile': this.state.mobile,
+                    'position': this.state.position,
+                    'locations': theArr,
+                    'superiorId': this.state.superiorId
+                }),
+                'roles': this.state.bindroles
+            }
+        }).done((res) => {
+            if (res.error.length) {
+                message.error(res.error[0].message);
+            } else {
+                message.success("保存成功");
+                this.setState({
+                    visible: false,
+                });
+                this.props.handleReturn(false, true);
+                //第二个参数表示保存
+            }
+        }).always(() => {
+            this.setState({
+                loading: false
+            })
+        })
+        this.props.postData;
+    },
+    getInitialState() {
+        return {
+            name: '',
+            email: '',
+            mobile: '',
+            roles: [],
+            visible: false,
+            loading: false,
+            theSwitch: true,
+            bindroles: [],
+            locations: [],
+            cityOption: [],
+            locationsObj: {},
+            adminSelectObj: {}
+        }
+    },
+    handleCancel() {
+        this.setState({
+            visible: false,
+            locations:[]
+        });
+        this.props.handleReturn(false, false);
+    },
+    loadAdminSelectList() {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/admin/supervise/adminSelectList',
+            cache: false
+        }).done((data) => {
+            if (!data.data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                    return;
+                };
+            };
+            let theArr = [], i;
+            for (i in data.data) {
+                theArr.push(
+                    <Select.Option key={i}>{data.data[i]}</Select.Option>
+                )
+            };
+            this.setState({
+                adminSelectOption: theArr,
+                adminSelectObj: data.data,
+                loading: false
+            });
+        })
+    },
+    loadAdminOwnLocation() {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/admin/supervise/adminOwnLocation',
+            cache: false
+        }).done((data) => {
+            if (!data.data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                    return;
+                };
+            };
+            let theArr = [], theList = [];
+            if ((typeof (data.data)).indexOf('string') == -1) {
+                data.data.map((item) => {
+                    theArr.push({
+                        value: item.province,
+                        label: getProvince(item.province)
+                    });
+                    let cityList = [];
+                    if (item.city) {
+                        item.city.split(',').map((c) => {
+                            cityList.push({
+                                id: Number(c),
+                                name: getProvince(c)
+                            });
+                        });
+                    };
+                    theList.push({
+                        id: item.province,
+                        name: getProvince(item.province),
+                        cityList: cityList.length ? cityList : null
+                    });
+                });
+            } else {
+                theArr = provinceSelect();
+                theList = provinceList;
+            }
+            this.setState({
+                provinceOption: theArr,
+                provinceList: theList,
+                loading: false
+            });
+        })
+    },
+    loadBindRoles(uid) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/admin/role',
+            cache: false,
+            data: {
+                "uid": uid
+            }
+        }).done((data) => {
+            if (!data.data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                };
+                return;
+            } else if (data.data) {
+                this.state.theSwitch = true;
+                for (let i = 0; i < data.data.length; i++) {
+                    for (let n = 0; n < this.props.currentRoles.length; n++) {
+                        if (data.data[i] === this.props.currentRoles[n] && uid != 1) {
+                            this.state.theSwitch = false;
+                        }
+                    }
+                };
+            };
+            this.setState({
+                bindroles: data.data || [],
+                theSwitch: this.state.theSwitch,
+                loading: false
+            });
+        })
+    },
+    loadLocations(id) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/admin/supervise/adminDetailLocation',
+            cache: false,
+            data: {
+                "id": id
+            }
+        }).done((data) => {
+            if (!data.data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                    return;
+                };
+            };
+            data.data.map((item) => {
+                if (item.city) {
+                    item.city = item.city.split(',');
+                }
+            });
+            this.setState({
+                locations: data.data,
+                loading: false
+            });
+        })
+    },
+    componentWillMount() {
+        this.loadAdminSelectList();
+        this.loadAdminOwnLocation();
+    },
+    componentWillReceiveProps(nextProps) {
+        if (!this.state.visible && nextProps.show) {
+            if (nextProps.data.id) {
+                this.loadBindRoles(nextProps.data.id);
+                this.loadLocations(nextProps.data.id);
+            }
+        };
+        let nextState = {
+            visible: nextProps.show,
+            id: nextProps.data ? nextProps.data.id : '',
+            name: nextProps.data ? nextProps.data.name : '',
+            email: nextProps.data ? nextProps.data.email : '',
+            mobile: nextProps.data ? nextProps.data.mobile : '',
+            position: nextProps.data ? nextProps.data.position : '',
+            superiorId: nextProps.data ? nextProps.data.superiorId : '',    
+        };
+        this.setState(nextState)
+    },
+    resetPwd(e) {
+        this.setState({
+            loading: true
+        })
+        $.ajax({
+            type: 'post',
+            url: globalConfig.context + "/api/admin/supervise/resetPwd",
+            dataType: "json",
+            data: {
+                id: this.state.id
+            }
+        }).done((res) => {
+            if (res.error && res.error.length) {
+                message.error(res.error[0].message);
+            } else {
+                message.success("密码重置成功");
+            }
+        }).always(() => {
+            this.setState({
+                loading: false
+            })
+        });
+    },
+    getRolesSelection() {
+        if (!this.state.id) {
+            return <li></li>
+        } else if (this.state.id != '1') {
+            return <li className="list">
+                <span className='modal-text'>角色</span>
+                <Select
+                    multiple
+                    style={{ width: '60%' }}
+                    placeholder="选择用户关联角色"
+                    value={this.state.bindroles}
+                    onChange={this.bindRoles} >
+                    {this.getRolesOptions()}
+                </Select>
+            </li>
+        } else if (this.state.id == "1") {
+            return <li><span className='modal-text'>角色</span><span>系统管理员</span></li>
+        }
+    },
+    bindRoles(val) {
+        this.setState({
+            bindroles: val
+        });
+    },
+    getRolesOptions() {
+        let options = [];
+        for (let i = 0; i < this.props.roles.length; i++) {
+            options.push(<Select.Option key={String(this.props.roles[i].id)}>{this.props.roles[i].roleName}</Select.Option>);
+        }
+        return options;
+    },
+    getLocations(index, p, c) {
+        this.state.locations.map((item, i) => {
+            if (index == i) {
+                item.province = p;
+                item.city = c || [];
+            };
+        });
+    },
+    delLocations(index) {
+        this.state.locations.splice(index, 1);
+        this.setState({ locations: this.state.locations });
+    },
+    provinceAdd() {
+        this.state.locations.push({
+            province: null,
+            city: null
+        });
+        this.setState({ locations: this.state.locations });
+    },
+    render() {
+        return (
+            <div className="modal" >
+                <Modal maskClosable={false} title="管理员详情"
+                    closable={false} width={1000}
+                    visible={this.state.visible}
+                    onOk={this.postData}
+                    onCancel={this.handleCancel} >
+                    <Spin spinning={this.state.loading} >
+                        {this.state.theSwitch ? <div className="modal-box">
+                            <ul className="modal-content clearfix">
+                                <li className="list">
+                                    <span className='modal-text'>名字</span>
+                                    <Input value={this.state.name} onChange={(e) => { this.state.name = e.target.value; this.setState({ name: this.state.name }); }} />
+                                </li>
+                                <li className="list">
+                                    <span className='modal-text'>职位</span>
+                                    <Input value={this.state.position} onChange={(e) => { this.state.position = e.target.value; this.setState({ position: this.state.position }); }} />
+                                </li>
+                                <li className="list">
+                                    <span className='modal-text'>上级</span>
+                                    <Select style={{ verticalAlign: 'middle', width: 200 }}
+                                        placeholder="选择一个上级" notFoundContent="没有获取到管理员列表"
+                                        showSearch
+                                        filterOption={companySearch}
+                                        value={this.state.superiorId}
+                                        onChange={(e) => { this.setState({ superiorId: e }) }} >
+                                        {this.state.adminSelectOption}
+                                    </Select>
+                                </li>
+                                <li className="list">
+                                    <span className='modal-text'>登录账号</span>
+                                    <Input value={this.state.mobile} onChange={(e) => { this.state.mobile = e.target.value; this.setState({ mobile: this.state.mobile }); }} />
+                                </li>
+                                <li className="list">
+                                    <span className='modal-text'>邮箱</span>
+                                    <Input value={this.state.email} onChange={(e) => { this.state.email = e.target.value; this.setState({ email: this.state.email }); }} />
+                                </li>
+                                {this.getRolesSelection()}
+                                {this.state.id ? <li className="list">
+                                    <span></span>
+                                    <Popconfirm
+                                        title={"用户 [ " + this.state.name + " ] 的密码将会重置为123456,确认操作?"}
+                                        onConfirm={this.resetPwd}
+                                        okText="确认"
+                                        cancelText="取消"
+                                        placement="topLeft">
+                                        <Button>重置密码</Button>
+                                    </Popconfirm>
+                                </li> : <li></li>}
+                            </ul>
+                            <div>
+                                <span className='modal-text' style={{ verticalAlign: 'top' }}>地区</span>
+                                {window.showPermissionList && window.showRoleList ? <div style={{ display: 'inline-block', width: '88%' }}>
+                                    {this.state.locations.map((item, i) => {
+                                        return <ProvinceAdd
+                                            provinceList={this.state.provinceList}
+                                            provinceOption={this.state.provinceOption}
+                                            getLocations={this.getLocations}
+                                            delLocations={this.delLocations}
+                                            locations={this.state.locations}
+                                            index={i} key={i} />
+                                    })}
+                                    <Button style={{ verticalAlign: 'middle' }} type="dashed" size="small"
+                                        onClick={this.provinceAdd}>
+                                        <Icon type="plus" />
+                                    </Button>
+                                </div> : <div style={{ display: 'inline-block', width: '88%' }}>
+                                        {this.state.locations.map((item, i) => {
+                                            return <Tag key={i}>{getProvince(item.province) + ' ' + (item.city ? item.city.map((c) => {
+                                                return getProvince(c) + ' '
+                                            }) : '')}</Tag>
+                                        })}
+                                    </div>}
+                            </div>
+                        </div> : <div className="modal-box">
+                                <ul className="modal-content clearfix">
+                                    <li className="list">
+                                        <span className='modal-text'>名字</span>
+                                        <span className="modal-det">{this.state.name}</span>
+                                    </li>
+                                    <li className="list">
+                                        <span className='modal-text'>职位</span>
+                                        <span className="modal-det">{this.state.position}</span>
+                                    </li>
+                                    <li className="list">
+                                        <span className='modal-text'>上级</span>
+                                        <span className="modal-det">{this.state.adminSelectObj[this.state.superiorId]}</span>
+                                    </li>
+                                    <li className="list">
+                                        <span className='modal-text'>登录账号</span>
+                                        <span className="modal-det">{this.state.mobile}</span>
+                                    </li>
+                                    <li className="list">
+                                        <span className='modal-text'>邮箱</span>
+                                        <span className="modal-det">{this.state.email}</span>
+                                    </li>
+                                </ul>
+                                <div>
+                                    <span className='modal-text' style={{ verticalAlign: 'top' }}>地区</span>
+                                    <div style={{ display: 'inline-block', width: '88%' }}>
+                                        {this.state.locations.map((item, i) => {
+                                            return <Tag key={i}>{getProvince(item.province) + ' ' + (item.city ? item.city.map((c) => {
+                                                return getProvince(c) + ' '
+                                            }) : '')}</Tag>
+                                        })}
+                                    </div>
+                                </div>
+                            </div>}
+                    </Spin>
+                </Modal>
+            </div >
+        );
+    }
+})
+
+export default TheModal;

+ 0 - 15
js/component/manageCenter/set/organization/organization.jsx

@@ -1,15 +0,0 @@
-import React from 'react';
-import ReactDom from 'react-dom';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-import {Form} from 'antd';
-
-const Organization=Form.create()(React.createClass({
-	render(){
-		return (
-			<div>组织机构管理</div>
-		)
-	}
-}));
-
-export default Organization;

+ 166 - 0
js/component/manageCenter/set/permission.jsx

@@ -0,0 +1,166 @@
+import React from 'react';
+import { Table, Button, Input, Spin, Message, Icon } from 'antd';
+import ajax from 'jquery/src/ajax/xhr.js';
+import $ from 'jquery/src/ajax';
+
+const Permission = React.createClass({
+    getInitialState() {
+        return {
+            data: [],
+            selectedRowKeys: [],
+            selectedRows: [],
+            loading: false
+        }
+    },
+
+    componentDidMount() {
+        this.loadData();
+    },
+
+    loadData() {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/permissions',
+            method: 'get',
+            cache: false
+        }).done((res) => {
+            if (!res.error.length) {
+                this.setState({
+                    data: res.data
+                })
+            }
+        }).always(() => {
+            this.setState({
+                loading: false
+            });
+        });
+    },
+
+    save() {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/permission',
+            method: 'post',
+            data: {
+                data: JSON.stringify(this.state.data)
+            }
+        }).done((res) => {
+            if (!res.error.length) {
+                Message.success("保存成功");
+                this.loadData();
+            } else {
+                Message.error(res.error[0].message);
+            }
+        }).always(() => {
+            this.setState({
+                loading: false
+            });
+        })
+    },
+
+    remove() {
+        let deletedIds = [];
+        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
+            let rowItem = this.state.selectedRows[idx];
+            if (rowItem.id) {
+                deletedIds.push(rowItem.id)
+            }
+        };
+        this.setState({
+            loading: deletedIds.length > 0
+        });
+        if (deletedIds.length) {
+            $.ajax({
+                url: globalConfig.context + '/api/permission/delete',
+                method: 'post',
+                data: {
+                    data: JSON.stringify(deletedIds)
+                }
+            }).done((res) => {
+                if (!res.error.length) {
+                    Message.success("删除成功");
+                    this.state.selectedRowKeys.sort((a, b) => { return b - a });
+                    for (let idx = 0; idx < this.state.selectedRowKeys.length; idx++) {
+                        let dataIndex = this.state.selectedRowKeys[idx];
+                        this.state.data.splice(dataIndex, 1);
+                    };
+                    this.setState({
+                        data: this.state.data,
+                        selectedRowKeys: []
+                    });
+                } else {
+                    Message.error(res.error[0].message);
+                }
+            }).always(() => {
+                this.setState({
+                    loading: false
+                });
+            })
+        }
+    },
+
+    addNew() {
+        this.state.data.push({
+            id: null,
+            name: '',
+            url: ''
+        });
+        this.setState({
+            data: this.state.data
+        })
+    },
+
+    render() {
+        const columns = [{
+            title: '权限名字',
+            dataIndex: 'name',
+            key: 'name',
+            render: (text, record, index) => {
+                return <Input value={record.name} onChange={(e) => { record.name = e.target.value; this.setState({ data: this.state.data }); }} />
+            }
+        }, {
+            title: '接口路径',
+            dataIndex: 'url',
+            key: 'url',
+            render: (text, record, index) => {
+                return <Input value={record.url} onChange={(e) => { record.url = e.target.value; this.setState({ data: this.state.data }); }} />
+            }
+        }];
+        const rowSelection = {
+            type: 'checkbox',
+            selectedRowKeys: this.state.selectedRowKeys,
+            onChange: (selectedRowKeys, selectedRows) => {
+                this.setState({
+                    selectedRows: selectedRows,
+                    selectedRowKeys: selectedRowKeys
+                });
+            }
+        };
+        const hasSelected = this.state.selectedRowKeys.length > 0;
+        return (
+            <Spin spinning={this.state.loading}>
+                <div className="set-content">
+                    <div className="set-title">
+                        <span>权限控制</span>
+                        <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
+                            onClick={this.addNew}>添加<Icon type="plus" /></Button>
+                        <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
+                            disabled={!hasSelected}
+                            onClick={this.remove}>删除<Icon type="minus" /></Button>
+                        <Button type="primary" onClick={this.save}>保存修改</Button>
+                    </div>
+                    <Table className="member-table"
+                        columns={columns}
+                        dataSource={this.state.data}
+                        pagination={false}
+                        rowSelection={rowSelection} />
+                </div>
+            </Spin>
+        );
+    }
+});
+export default Permission;

+ 273 - 0
js/component/manageCenter/set/role.jsx

@@ -0,0 +1,273 @@
+import React from 'react';
+import { Table, Button, Input, Spin, Message, Select, Modal, Tag, Icon } from 'antd';
+import ajax from 'jquery/src/ajax/xhr.js'
+import $ from 'jquery/src/ajax';
+
+const Role = React.createClass({
+    getInitialState() {
+        return {
+            visible: false,
+            disabled: false,
+            name: '',
+            selectOption: [],
+            data: [],
+            selectedRowKeys: [],
+            selectedRows: [],
+            loading: false,
+            permissions: {
+
+            },
+            modelRecord: {
+                id: '',
+                name: '',
+                permissions: []
+            }
+        }
+    },
+
+    componentWillMount() {
+        this.loadData();
+    },
+
+    loadData() {
+        let _me = this;
+        this.setState({
+            loading: true
+        });
+        $.when($.ajax({
+            url: globalConfig.context + '/api/roles',
+            method: 'get',
+            cache: false
+        }), $.ajax({
+            url: globalConfig.context + '/api/permissions',
+            method: 'get',
+            cache: false
+        })).done((roles, permissions) => {
+            if (!roles[0].error.length && roles[0].data) {
+                this.state.data = [];
+                for (let i = 0; i < roles[0].data.length; i++) {
+                    let thisdata = roles[0].data[i];
+                    this.state.data.push({
+                        key: i,
+                        id: thisdata.id,
+                        roleName: thisdata.roleName,
+                        permissions: thisdata.permissions.map((p) => { return String(p.id) }) || []
+                    });
+                };
+            }
+            if (!permissions[0].error.length && permissions[0].data) {
+                _me.state.selectOption = [];
+                permissions[0].data.map(function (item) {
+                    _me.state.selectOption.push(
+                        <Select.Option key={item.id}>{item.name}</Select.Option>
+                    )
+                    _me.state.permissions[String(item.id)] = item.name;
+                });
+            }
+        }).always(() => {
+            this.setState({
+                loading: false
+            });
+        });
+    },
+
+    save() {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            url: globalConfig.context + '/api/role',
+            method: 'post',
+            data: { data: JSON.stringify(this.state.modelRecord) },
+        }).done((res) => {
+            if (!res.error.length) {
+                Message.success("保存成功");
+                this.loadData();
+            } else {
+                Message.error(res.error[0].message);
+            }
+        }).always(() => {
+            this.setState({
+                loading: false,
+                visible: false,
+                disabled: false
+            });
+        })
+    },
+
+    remove() {
+        let deletedIds = [];
+        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
+            let rowItem = this.state.selectedRows[idx];
+            if (rowItem.id) {
+                deletedIds.push(rowItem.id)
+            }
+        };
+        this.setState({
+            loading: deletedIds.length > 0
+        });
+        if (deletedIds.length) {
+            $.ajax({
+                url: globalConfig.context + '/api/role/delete',
+                method: 'post',
+                data: {
+                    data: JSON.stringify(deletedIds)
+                }
+            }).done((res) => {
+                if (!res.error.length) {
+                    Message.success("删除成功");
+                    this.state.selectedRowKeys.sort((a, b) => { return b - a });
+                    for (let idx = 0; idx < this.state.selectedRowKeys.length; idx++) {
+                        let dataIndex = this.state.selectedRowKeys[idx];
+                        this.state.data.splice(dataIndex, 1);
+                    };
+                    this.setState({
+                        data: this.state.data,
+                        selectedRowKeys: []
+                    });
+                } else {
+                    Message.error(res.error[0].message);
+                }
+            }).always(() => {
+                this.setState({
+                    loading: false
+                });
+            })
+        }
+    },
+
+    addNew() {
+        this.setState({
+            visible: true,
+            modelRecord: {
+                id: null,
+                roleName: '',
+                permissions: []
+            }
+        })
+    },
+
+    edit(e) {
+        this.setState({
+            modelRecord: {
+                id: e.id,
+                roleName: e.roleName,
+                permissions: e.permissions
+            },
+            visible: true,
+            disabled: false
+        })
+    },
+
+    handleCancel() {
+        this.setState({
+            visible: false,
+            disabled: false
+        })
+    },
+
+    render() {
+        const columns = [{
+            title: '名字',
+            dataIndex: 'roleName',
+            key: 'roleName'
+        }, {
+            title: '绑定权限',
+            dataIndex: 'permissions',
+            key: 'permissions',
+            render: (text, record, index) => {
+                let _me = this;
+                if (record.permissions) {
+                    return <div>
+                        {record.permissions.map((tag, i) => {
+                            if (i < 3) {
+                                return <Tag key={tag} closable={false}>
+                                    {_me.state.permissions[tag]}
+                                </Tag>
+                            } else if (i == 3) {
+                                return <Tag key={tag} closable={false}>
+                                    ...
+                                </Tag>
+                            } else {
+                                return false;
+                            }
+                        }
+                        )}
+                    </div>
+                } else {
+                    return <div></div>;
+                }
+            },
+        }];
+        const rowSelection = {
+            type: 'checkbox',
+            selectedRowKeys: this.state.selectedRowKeys,
+            onChange: (selectedRowKeys, selectedRows) => {
+                this.setState({
+                    selectedRows: selectedRows,
+                    selectedRowKeys: selectedRowKeys
+                });
+            }
+        };
+        const hasSelected = this.state.selectedRowKeys.length > 0;
+        return (
+            <Spin spinning={this.state.loading}>
+                <Modal maskClosable={false} title="角色编辑"
+                    closable={false}
+                    visible={this.state.visible}
+                    onOk={this.save}
+                    width={1000}
+                    onCancel={this.handleCancel}>
+                    <ul className="modal-content">
+                        <li>
+                            <span className='modal-text'>名字</span>
+                            <Input value={this.state.modelRecord.roleName} onChange={(e) => {
+                                this.state.modelRecord.roleName = e.target.value;
+                                this.setState({
+                                    modelRecord: this.state.modelRecord
+                                })
+                            }} />
+                        </li>
+                        <li>
+                            <span className='modal-text'>权限</span>
+                            <Select
+                                multiple
+                                style={{ width: '80%' }}
+                                placeholder="选择绑定权限"
+                                disabled={!this.state.modelRecord.id}
+                                filterOption={(input, option) => { return option.props.children.indexOf(input) >= 0 }}
+                                value={this.state.modelRecord.permissions}
+                                onChange={(pids) => {
+                                    this.state.modelRecord.permissions = pids;
+                                    this.setState({
+                                        modelRecord: this.state.modelRecord
+                                    })
+                                }}
+                            >
+                                {this.state.selectOption}
+                            </Select>
+                        </li>
+                    </ul>
+                </Modal>
+                <div className="set-content">
+                    <div className="set-title">
+                        <span>角色控制</span>
+                        <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
+                            onClick={this.addNew}>添加<Icon type="plus" /></Button>
+                        <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
+                            disabled={!hasSelected}
+                            onClick={this.remove}>删除<Icon type="minus" /></Button>
+                    </div>
+                    <Table className='member-table'
+                        columns={columns}
+                        dataSource={this.state.data}
+                        onRowClick={this.edit}
+                        pagination={false}
+                        rowSelection={rowSelection} />
+                </div>
+            </Spin>
+        );
+    }
+});
+
+export default Role;

+ 24 - 0
js/component/manageCenter/set/site.jsx

@@ -0,0 +1,24 @@
+import React from 'react';
+import theme from 'react-quill/dist/quill.snow.css'
+import ReactQuill from 'react-quill'
+
+class Site extends React.Component {
+  constructor(props) {
+    super(props)
+    this.state = { text: '' }
+    this.handleChange = this.handleChange.bind(this)
+  }
+
+  handleChange(value) {
+    this.setState({ text: value })
+  }
+
+  render() {
+    return (
+      <ReactQuill value={this.state.text}
+                  onChange={this.handleChange} />
+    )
+  }
+}
+
+export default Site;

+ 0 - 15
js/component/manageCenter/set/userManagement/jurisdiction.jsx

@@ -1,15 +0,0 @@
-import React from 'react';
-import ReactDom from 'react-dom';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-import {Form} from 'antd';
-
-const Jurisdiction=Form.create()(React.createClass({
-	render(){
-		return (
-			<div>权限管理</div>
-		)
-	}
-}));
-
-export default Jurisdiction;

+ 0 - 15
js/component/manageCenter/set/userManagement/newUser.jsx

@@ -1,15 +0,0 @@
-import React from 'react';
-import ReactDom from 'react-dom';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-import {Form} from 'antd';
-
-const Newuser=Form.create()(React.createClass({
-	render(){
-		return (
-			<div>新建用户</div>
-		)
-	}
-}));
-
-export default Newuser;

+ 0 - 15
js/component/manageCenter/set/userManagement/role.jsx

@@ -1,15 +0,0 @@
-import React from 'react';
-import ReactDom from 'react-dom';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-import {Form} from 'antd';
-
-const Role=Form.create()(React.createClass({
-	render(){
-		return (
-			<div>角色管理</div>
-		)
-	}
-}));
-
-export default Role;

+ 0 - 133
js/component/manageCenter/set/userManagement/techAchievement.less

@@ -1,133 +0,0 @@
-.user-content {
-    background: #fff;
-    padding: 20px;
-    .content-title {
-        color: #333;
-        font-size: 16px;
-        overflow: hidden;
-    }
-    .user-search {
-        margin-bottom: 10px;
-        >input {
-            width: 140px;
-        }
-        >input,
-        >button,
-        .ant-select {
-            margin-right: 10px;
-            margin-top: 10px;
-        }
-        .ant-switch {
-            margin-left: 10px;
-        }
-        .search-more {
-            margin: 10px 0;
-            >span {
-                margin-right: 10px
-            }
-        }
-    }
-}
-.avatar-uploader,
-.avatar-uploader-trigger,
-.avatar {
-    width: 150px;
-    height: 150px;
-}
-.modal-box-title{float: left;}
-.modal-box-detail{margin-left: 10px;vertical-align: top;float: left;margin-top: 0px;width: 160px!important;}
-.avatar-uploader-trigger {
-    display: table-cell;
-    vertical-align: middle;
-    font-size: 28px;
-    color: #999;
-}
-.avatar-uploader {
-    display: block;
-    padding: 1px;
-    border: 1px dashed #d9d9d9;
-    border-radius: 6px;
-    cursor: pointer;
-    position: relative;
-    img {
-        position: absolute;
-        top: -1px;
-        left: -1px;
-        height: 150px;
-    } //
-    float: left;
-    margin-right: 20px;
-}
-.patent-addNew {
-    float: right;
-    margin-left: 20px;
-    >* {
-        float: left;
-        margin-right: 20px;
-    }
-    .addButton {
-        background: #ea0862;
-        color: #fff;
-        border: none;
-        border-radius: 4px;
-        padding: 4px 10px;
-    }
-    .addButton:hover {
-        background: #ea0862;
-    }
-}
-
-#demand-form {
-    .half-item {
-        float: left;
-        width: 50%;
-        margin-bottom: 10px;
-    }
-    .item-title {
-        line-height: 30px;
-        font-size: 14px;
-        color: #666;
-    }
-    .form-title {
-        font-size: 16px;
-        color: #333;
-    }
-    .keyWord-tips {
-        >button {
-            vertical-align: middle;
-        }
-    }
-    .set-submit {
-        margin-right: 20px;
-    }
-    .demandDetailShow-upload {
-        .anticon-eye-o {
-            margin-left: -8px;
-        }
-        .anticon-delete {
-            display: none
-        }
-    }
-}
-
-.ant-modal-content {
-    .modal-submit {
-        margin-left: 20px;
-    }
-}
-
-.demand-order-content {
-    .ant-row {
-        margin-bottom: 20px;
-    }
-    .ant-input-number-handler-wrap {
-        display: none
-    }
-}
-.ant-table-thead {
-    .ant-table-selection-column {
-        .ant-checkbox-wrapper {
-            display: none;
-        }
-    }
-}

+ 0 - 250
js/component/manageCenter/set/userManagement/user.jsx

@@ -1,250 +0,0 @@
-import React from 'react';
-import ReactDom from 'react-dom';
-import ajax from 'jquery/src/ajax/xhr.js';
-import $ from 'jquery/src/ajax';
-import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload } from 'antd';
-import Newuser from "./newUser.jsx"
-
-
-const User=Form.create()(React.createClass({
-	loadData(pageNo, apiUrl) {
-        this.state.data = [];
-        this.setState({
-            loading: true
-        });
-        $.ajax({
-            method: "get",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + (apiUrl || this.props['data-listApiUrl']),
-            data: {
-                pageNo: pageNo || 1,
-                pageSize: this.state.pagination.pageSize,
-            },
-            success: function (data) {
-                let theArr = [];
-                if (!data.data || !data.data.list) {
-                    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,
-                            id: thisdata.id,
-                            serialNumber: thisdata.serialNumber,
-                        });
-                    };
-                    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 {
-            searchMore: true,
-            selectedRowKeys: [],
-            selectedRows: [],
-            loading: false,
-            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: 'serialNumber',
-                    key: 'serialNumber',
-                }, {
-                    title: '名称',
-                    dataIndex: 'name',
-                    key: 'name',
-                }, {
-                    title: '关键字',
-                    dataIndex: 'keyword',
-                    key: 'keyword',
-                }, {
-                    title: '类型',
-                    dataIndex: 'category',
-                    key: 'category',
-                    render: text => { return getAchievementCategory(text); }
-                }, {
-                    title: '所有人名称',
-                    dataIndex: 'theName',
-                    key: 'theName',
-                }, {
-                    title: '审核状态',
-                    dataIndex: 'auditStatus',
-                    key: 'auditStatus',
-                    render: text => { return getTechAuditStatus(text) }
-                }, 
-                {
-                    title: '是否精品',
-                    dataIndex: 'boutique',
-                    key: 'boutique',
-                    render: text => { return getboutique(text) }
-                },
-                 {
-                    title: '首页展示',
-                    dataIndex: 'hot',
-                    key: 'hot',
-                    render: text => { return gethot(text) }
-                },
-                {
-                    title: '发布时间',
-                    dataIndex: 'releaseDateFormattedDate',
-                    key: 'releaseDateFormattedDate',
-                }
-            ],
-            dataSource: [],
-        };
-    },
-    componentWillMount() {
-       
-        this.loadData();
-    },
-    
-    tableRowClick(record, index) {
-        this.state.RowData = record;
-        this.setState({
-            showDesc: true
-        });
-    },
-    delectRow() {
-        let deletedIds = [];
-        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
-            let rowItem = this.state.selectedRows[idx];
-            if (rowItem.id) {
-                deletedIds.push(rowItem.id)
-            };
-        };
-        this.setState({
-            selectedRowKeys: [],
-            loading: deletedIds.length > 0
-        });
-        $.ajax({
-            method: "POST",
-            dataType: "json",
-            crossDomain: false,
-            url: globalConfig.context + "/api/admin/achievement/delete",
-            data: {
-                ids: deletedIds
-            }
-        }).done(function (data) {
-            if (!data.error.length) {
-                message.success('删除成功!');
-                this.setState({
-                    loading: false,
-                });
-            } else {
-                message.warning(data.error[0].message);
-            };
-            this.loadData();
-        }.bind(this));
-    },
-    addClick() {
-        this.state.RowData = {};
-        this.setState({
-            showDesc: true
-        });
-    },
-    closeDesc(e, s) {
-        this.state.showDesc = e;
-        if (s) {
-            this.loadData();
-        };
-    },
-    search() {
-        this.loadData();
-    },
-    reset() {
-        this.state.serialNumber = undefined;
-        this.state.name = undefined;
-        this.state.keyword = undefined;
-        this.state.category = undefined;
-        this.state.ownerType = undefined;
-        this.state.releaseStatus = undefined;
-        this.state.auditStatus = undefined;
-        this.state.searchName = undefined;
-        this.state.releaseDate = [];
-        this.state.boutique = '';
-        this.state.hot='' ;
-        this.loadData();       
-    },
-    searchSwitch() {
-        this.setState({
-            searchMore: !this.state.searchMore
-        });
-    },
-    render() {
-        const rowSelection = {
-            selectedRowKeys: this.state.selectedRowKeys,
-            onChange: (selectedRowKeys, selectedRows) => {
-                this.setState({
-                    selectedRows: selectedRows.slice(-1),
-                    selectedRowKeys: selectedRowKeys.slice(-1)
-                });
-            }
-        };
-        const hasSelected = this.state.selectedRowKeys.length > 0;
-        const { RangePicker } = DatePicker;
-        return (
-            <div className="user-content" >
-                <div className="content-title">
-                <div className="user-search">
-                    <Input placeholder="编号" style={{width:'150px'}}
-                        value={this.state.serialNumber}
-                        onChange={(e) => { this.setState({ serialNumber: e.target.value }); }} />
-                    <Button type="primary" onClick={this.search}>搜索</Button>
-                    <Button onClick={this.reset}>重置</Button>
-                    <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
-                        disabled={!hasSelected}
-                        onClick={this.delectRow}>删除<Icon type="minus" /></Button>
-                    <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
-                    <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
-                    	<Radio.Group value={this.state.boutique} onChange={(e) => {
-		                    this.setState({ boutique: e.target.value })
-		                    }}>
-		                        <Radio value={1}>精品</Radio>
-		                        <Radio value={0}>非精品</Radio>
-		                </Radio.Group>
-                    </div>
-                </div>
-                <div className="patent-table">
-                    <Spin spinning={this.state.loading}>
-                        <Table columns={this.state.columns}
-                            dataSource={this.state.dataSource}
-                            rowSelection={rowSelection}
-                            pagination={this.state.pagination}
-                            onRowClick={this.tableRowClick} />
-                    </Spin>
-                </div>
-                <Newuser
-                    data={this.state.RowData}
-                    showDesc={this.state.showDesc}
-                    closeDesc={this.closeDesc} />
-            </div >
-            </div>
-        );
-    }
-}));
-
-export default User;

+ 1 - 1
package.json

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

+ 4 - 2
template/template.html

@@ -7,8 +7,10 @@
         <%= htmlWebpackPlugin.options.title %>
     </title>
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
+
+
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css">
-    <script>
+    <!--<script>
            window.userData = {
                mobile: "13600000000",
                nickname: "Lina",
@@ -26,7 +28,7 @@
                uploadPath: "/data/wwwroot/aft/upload",
                uploadPrivatePath: "/data/upload"
            };
-    </script>
+    </script>-->
 </head>
 
 <body>