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, Popconfirm, Spin, Table, Switch, message, DatePicker, Modal, Upload, Tabs } from 'antd'; import Addjurisdiction from "./addjurisdiction.jsx" import './userMangagement.less' import { techAuditStatusList, station, post,urlType } from '../../../dataDic.js'; import {ChooseList} from "../../order/orderNew/chooseList"; const TabPane = Tabs.TabPane; const Jurisdiction = Form.create()(React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/permissions', success: function(data) { console.log(data) if(!data.data || !data.data.one) { if(data.error && data.error.length) { message.warning(data.error[0].message); }; } else { this.setState({ dataSource: data.data.one, }); } }.bind(this), }).always(function() { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { datauser: {}, selectedRowKeys: [], selectedRows: [], loading: false, addnextVisible: false, columns: [{ title: '接口名称', dataIndex: 'name', key: 'name', width: '400px' }, { title: '接口路径', dataIndex: 'url', key: 'url', }, { title: '操作', dataIndex: 'id', key: 'id', render: (text, recard) => { return(
{recard.url.indexOf('.html#')<=0&&} {this.delectRow(recard)}} okText="确认" cancelText="取消" placement="topLeft">
) } }], dataSource: [], }; }, componentWillMount() { this.loadData(); }, tableRowClick(record, index) { this.state.userDetaile = true; this.state.datauser = record; this.setState({ ids:record.id, showDesc: true }); }, //删除(已改接口) delectRow(ids) { this.setState({ loading: true }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/deleteById", data: { id: ids.id } }).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.userDetaile = false; this.setState({ showDesc: true }); }, closeDesc(e, s) { this.state.userDetaile = false; this.state.showDesc = e; if(s) { this.loadData(); }; }, //新建下级 addNext() { this.setState({ addnextVisible: false }) }, nextCancel() { this.setState({ addnextVisible: false }) }, addNextURL(e) { this.state.name = ''; this.state.url = ''; this.state.urlType = undefined; this.setState({ ids: e.id, preName: e.name, addnextVisible: true }) }, //项目任务旧数据处理 handles(){ $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/open/pushOrderArrearsDun", data: {}, success: function (data) { if(data.error.length) { message.warning(data.error[0].message) }else { message.warning("调用成功!") } }.bind(this), }).always( function () { }.bind(this) ); }, //新建二级接口保存 nextSubmit(e) { e.preventDefault(); this.setState({ loading: true }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/addPermission', data: { superId: this.state.preName, name: this.state.name, //接口名称 type:this.state.urlType,//接口类型 url: this.state.url //接口路径 } }).done(function(data) { this.setState({ loading: false }); if(!data.error.length) { message.success('保存成功!'); this.addNext(); this.loadData(); } else { message.warning(data.error[0].message); } }.bind(this)); }, changeList(arr) { const newArr = []; this.state.columns.forEach(item => { arr.forEach(val => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr }); }, render() { const FormItem = Form.Item; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 }, }; const hasSelected = this.state.selectedRowKeys.length > 0; return(
{/**/}
{this.setState({name:e.target.value})}} required="required"/> * {this.setState({url:e.target.value})}} required="required"/> * * {this.state.preName}
); } })); export default Jurisdiction;