dengzhiguo 7 éve%!(EXTRA string=óta)
szülő
commit
f98456b730

+ 2 - 2
js/component/manageCenter/customer/customerData/companyCustomer.jsx

@@ -132,8 +132,8 @@ const PublicCustomer = Form.create()(React.createClass({
                     };
                     
                 }; 
-                this.state.pagination.current = data.data.pageNo;
-                this.state.pagination.total = data.data.totalCount;
+                this.state.pagination.current = data.data.pageNo?data.data.pageNo:'0';
+                this.state.pagination.total = data.data.totalCount?data.data.totalCount:'0';
                 this.setState({
                     dataSource: theArr,
                     pagination: this.state.pagination

+ 22 - 2
js/component/manageCenter/customer/customerData/myClient.jsx

@@ -131,8 +131,8 @@ const MyClient = Form.create()(React.createClass({
                     };
                     
                 }; 
-                this.state.pagination.current = data.data.pageNo;
-                this.state.pagination.total = data.data.totalCount;
+                this.state.pagination.current = data.data.pageNo?data.data.pageNo:'0';
+                this.state.pagination.total = data.data.totalCount?data.data.totalCount:'0';
                 this.setState({
                     dataSource: theArr,
                     pagination: this.state.pagination
@@ -1048,6 +1048,8 @@ const MyClient = Form.create()(React.createClass({
                         legalPersonEmail:this.state.legalPersonEmail,
                         highTechZone:this.state.highTechZone,
                         listed:this.state.listed,
+                        contacts:this.state.contacts,
+                        contactMobile:this.state.contactMobile,
                         international:this.state.international,
                         orgCode:this.state.orgCode,
                         businessScope:this.state.businessScope,
@@ -1103,6 +1105,8 @@ const MyClient = Form.create()(React.createClass({
                 	companyLogoUrl: thisData.companyLogoUrl ? splitUrl(thisData.companyLogoUrl, ',', globalConfig.avatarHost + '/upload') : [],
                 	dataInformation:thisData,
                 	ProvinceCity:ProvinceCityArr,
+                	contacts:thisData.contacts,
+                	contactMobile:thisData.contactMobile,
                 	industry:String(thisData.industry)=='null'?undefined:String(thisData.industry),
                 	international:thisData.international,
                 	societyTag:thisData.societyTag,
@@ -2194,6 +2198,22 @@ const MyClient = Form.create()(React.createClass({
 						                                <Input placeholder="法人身份证号码" value={this.state.legalPersonIdCard} 
 											    				onChange={(e)=>{this.setState({legalPersonIdCard:e.target.value})}}/>
 						                    </FormItem>
+						                    <FormItem className="half-item" 
+							                    	labelCol={{ span: 4 }}
+							                        wrapperCol={{ span: 18 }}
+							                        label="主要联系人"
+					                           	 >
+						                            <Input placeholder="主要联系人" value={this.state.contacts} onChange={(e) => {
+								                        this.setState({ contacts:  e.target.value })}}/>
+						                     </FormItem>
+						                     <FormItem className="half-item" 
+							                    	labelCol={{ span: 4 }}
+							                        wrapperCol={{ span: 18 }}
+							                        label="主要联系人号码"
+					                           	 >
+						                            <Input placeholder="主要联系人号码" value={this.state.contactMobile} onChange={(e) => {
+								                        this.setState({ contactMobile:  e.target.value })}}/>
+						                     </FormItem>
 						                    <FormItem className="half-item"
 							                    	labelCol={{ span: 4 }}
 							                        wrapperCol={{ span: 18 }}

+ 2 - 2
js/component/manageCenter/customer/customerService/myBusiness.jsx

@@ -56,8 +56,8 @@ const MyBusiness = Form.create()(React.createClass({
                         });
                     };  
                 };
-                this.state.pagination.current = data.data.pageNo;
-                this.state.pagination.total = data.data.totalCount;
+                 this.state.pagination.current = data.data.pageNo?data.data.pageNo:'0';
+                this.state.pagination.total = data.data.totalCount?data.data.totalCount:'0';
                 this.setState({
                     dataSource: theArr,
                     pagination: this.state.pagination

+ 2 - 2
js/component/manageCenter/customer/customerService/serviceQuery.jsx

@@ -54,8 +54,8 @@ const ServiceQuery= Form.create()(React.createClass({
                     };
                     
                 };
-                this.state.pagination.current = data.data.pageNo;
-                this.state.pagination.total = data.data.totalCount;
+                this.state.pagination.current = data.data.pageNo?data.data.pageNo:'0';
+                this.state.pagination.total = data.data.totalCount?data.data.totalCount:'0';
                 this.setState({
                     dataSource: theArr,
                     pagination: this.state.pagination

+ 2 - 2
js/component/manageCenter/customer/individualCustomer/individualCustomer.jsx

@@ -134,8 +134,8 @@ const IndividualCustomer = Form.create()(React.createClass({
                     };  
                    
                 }; 
-                this.state.pagination.current = data.data.pageNo;
-                this.state.pagination.total = data.data.totalCount;
+                this.state.pagination.current = data.data.pageNo?data.data.pageNo:'0';
+                this.state.pagination.total = data.data.totalCount?data.data.totalCount:'0';
                 this.setState({
                     dataSource: theArr,
                     pagination: this.state.pagination

+ 2 - 2
js/component/manageCenter/customer/individualCustomer/queryCustomer.jsx

@@ -138,8 +138,8 @@ const QueryCustomer = Form.create()(React.createClass({
                     };
                      
                 };
-                this.state.pagination.current = data.data.pageNo;
-                this.state.pagination.total = data.data.totalCount;
+                this.state.pagination.current = data.data.pageNo?data.data.pageNo:'0';
+                this.state.pagination.total = data.data.totalCount?data.data.totalCount:'0';
                 this.setState({
                     dataSource: theArr,
                     pagination: this.state.pagination

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

@@ -3,6 +3,7 @@ import ReactDom from 'react-dom';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
+import '../content.less';
 import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload,Popconfirm,TimePicker } from 'antd';
 import {categoryState} from '../../../dataDic.js';
 

+ 13 - 12
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,19 +9,19 @@ 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 Member = require('./userManagement/member').default;
                     this.setState({
@@ -66,18 +67,18 @@ class Content extends Component {
             require.ensure([], () => {
                 const BusinessCategory = require('./business/businessCategory').default;
                 this.setState({
-                    component:<BusinessCategory />,	                                      
+                    component:<BusinessCategory />	    
+                	});
                 });
-      	    });
-      	    break;
-      	    case 'businessProject':
+                break; 
+            case 'businessProject':
             require.ensure([], () => {
                 const BusinessProject = require('./business/businessProject').default;
                 this.setState({
-                    component:<BusinessProject />,	                                      
+                    component:<BusinessProject />	    
+                	});
                 });
-      	    });
-      	    break;
+            break; 
         };
         window.location.hash = key;
     }
@@ -86,7 +87,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>
         )

+ 5 - 1
js/component/manageCenter/set/content.less

@@ -52,4 +52,8 @@
         width: 60px;
         text-align: right;
     }
-}
+}
+.user-content{
+    padding: 15px;
+    background: #ffffff;
+}

+ 7 - 18
js/component/manageCenter/set/leftTab.jsx

@@ -6,7 +6,6 @@ import '../content.less';
 const SubMenu = Menu.SubMenu;
 const MenuItemGroup = Menu.ItemGroup;
 
-
 const LeftTab = React.createClass({
     getInitialState() {
         return {
@@ -19,34 +18,24 @@ const LeftTab = React.createClass({
             ]
         };
     },
-     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"
+                mode="inline"
                 className="account-left"
-                mode="inline" >
+                >
 	            <SubMenu key="sub1" title={<span>用户管理</span>}>	
 	            		<Menu.Item key="member">
 		                    管理员列表
@@ -76,7 +65,7 @@ const LeftTab = React.createClass({
 		        </SubMenu>
             </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;

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

@@ -2,6 +2,7 @@ import React from 'react';
 import ReactDom from 'react-dom';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
+import '../content.less';
 import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload,Popconfirm,AutoComplete } from 'antd';
 import {patternOrganization,conditionOrganization} from '../../../dataDic.js';
 import {getPattern,getCondition} from '../../../tools.js';

+ 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;

+ 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>