import React from 'react'; import { Row, Col, Icon, Modal, Button, Spin, Select, Input, message, Badge, Table, Tabs, Tag } from 'antd'; import { getProvince } from '../NewDicProvinceList.js'; import { companySearch ,getActives} from '../tools.js'; import './topTab.less'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; import logo from '../../../image/acc-logo.png'; const MessageModal = React.createClass({ getInitialState() { return { visible: false, loading: false, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadReaded(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, UnreadPagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadUnread(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '编号', dataIndex: 'key', key: 'key' }, { title: '类型', dataIndex: 'noticeType', key: 'noticeType', render: (text, record) => { switch (text) { case 1: return {record.noticeTypeName} ; case 3: return {record.noticeTypeName} ; case 2: return {record.noticeTypeName} ; case 4: return {record.noticeTypeName} ; case 5: return {record.noticeTypeName} ; case 6: return {record.noticeTypeName} ; case 7: return {record.noticeTypeName} ; case 8: return {record.noticeTypeName} ; case 9: return {record.noticeTypeName} ; case 10: return {record.noticeTypeName} ; case 11: return {record.noticeTypeName} ; } } }, { title: '时间', dataIndex: 'createTimeFormattedDate', key: 'createTimeFormattedDate' }, { title: '内容', dataIndex: 'content', key: 'content', }, { title: '公司', dataIndex: 'unitName', key: 'unitName', }, { title: '业务员', dataIndex: 'principle', key: 'principle', } ], data: [] }; }, loadReaded(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/notice/readed", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, } }).done((data) => { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); return; }; }; this.state.data = []; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i + 1, id: thisdata.id, rid: thisdata.rid, uid: thisdata.uid, aid: thisdata.aid, noticeType: thisdata.noticeType, year: thisdata.year, noticeTypeName: thisdata.noticeTypeName, content: thisdata.content, createTime: thisdata.createTime, createTimeFormattedDate: thisdata.createTimeFormattedDate, principle: thisdata.principle, unitName: thisdata.unitName }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: this.state.data, pagination: this.state.pagination }); }).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadUnread(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/notice/unread", data: { pageNo: pageNo || 1, pageSize: this.state.UnreadPagination.pageSize, } }).done((data) => { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); return; }; }; this.state.data = []; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i + 1, id: thisdata.id, rid: thisdata.rid, uid: thisdata.uid, aid: thisdata.aid, noticeType: thisdata.noticeType, year: thisdata.year, noticeTypeName: thisdata.noticeTypeName, content: thisdata.content, createTime: thisdata.createTime, createTimeFormattedDate: thisdata.createTimeFormattedDate, principle: thisdata.principle, unitName: thisdata.unitName }); }; this.state.UnreadPagination.current = data.data.pageNo; this.state.UnreadPagination.total = data.data.totalCount; this.setState({ unreadData: this.state.data, UnreadPagination: this.state.UnreadPagination }); }).always(function () { this.setState({ loading: false }); }.bind(this)); }, componentWillReceiveProps(nextProps) { if (!this.state.visible && nextProps.showDesc) { this.loadReaded(); this.loadUnread(); }; this.state.visible = nextProps.showDesc }, handleOk() { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, render() { return (
); } }); const UserModal = React.createClass({ getInitialState() { return { visible: false, loading: false, locations: [] }; }, loadData() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/adminInfo", success: function (data) { if (!data.data) { if (data.error[0] && data.error[0]) { message.warning(data.error[0].message); }; return; }; this.setState({ id: data.data.id, mobile: data.data.mobile, name: data.data.name, position: data.data.position, email: data.data.email, createTime: data.data.createTime, number: data.data.number, createTimeFormattedDate: data.data.createTimeFormattedDate }); this.loadLocations(data.data.id); }.bind(this), }).always(function (data) { this.setState({ loading: false }); }.bind(this)); }, 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 }); }) }, componentWillReceiveProps(nextProps) { if (!this.state.visible && nextProps.showDesc) { this.loadData(); }; this.state.visible = nextProps.showDesc }, handleOk() { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/updateAdminInfo", data: { id: this.state.id, mobile: this.state.mobile, name: this.state.name, email: this.state.email, province: this.state.province, password: this.state.password, pwd: this.state.pwd } }).always(function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); this.setState({ loading: false }); } else { message.success('保存成功!'); this.props.closeDesc(false, true); }; }.bind(this)); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false); }, render() { return (
  • 名字 { this.state.name = e.target.value; this.setState({ name: this.state.name }); }} />
  • 职位 {this.state.position}
  • 登录账号 { this.state.mobile = e.target.value; this.setState({ mobile: this.state.mobile }); }} />
  • 省份
    {this.state.locations.map((item, i) => { return {getProvince(item.province) + ' ' + (item.city ? item.city.map((c) => { return getProvince(c) + ' ' }) : '')} })}
  • 邮箱 { this.state.email = e.target.value; this.setState({ email: this.state.email }); }} />
  • 密码 { this.state.password = e.target.value; this.setState({ password: this.state.password }); }} />
  • 原密码 { this.state.pwd = e.target.value; this.setState({ pwd: this.state.pwd }); }} />
); } }); const TopTab = React.createClass({ getInitialState() { return { username: '请登录!', }; }, logOut() { let theActive = this.props.active; $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/login", }).done(function (data) { window.location.href = globalConfig.context + "/admin/login.html" }); }, componentWillMount() { if (this.props.active) { this.loadData(); }; this.mainMenu(); }, //主菜单请求 mainMenu(){ this.setState({ loading:true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/selectNavList", data: { }, success:function(data){ if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); return; }; }; let menu=data.data; var htmlMenu=[]; console.log(globalConfig.context) for(var i=0;i7){ htmlMenu.push( 用户管理*/} {/*客户管理科技服务管理科技成果管理科技需求管理科技思想管理用户订单管理系统设置 */} {this.state.htmlMenus} ) } }); export default TopTab;