|
@@ -0,0 +1,699 @@
|
|
|
|
+import React, { Component } from 'react';
|
|
|
|
+import { jrequest } from 'utils/request';
|
|
|
|
+import { Modal, Row, Col, Table, Button, Popconfirm, message, Descriptions, Select, Input } from 'antd';
|
|
|
|
+
|
|
|
|
+import 'antd/dist/antd.css';
|
|
|
|
+
|
|
|
|
+const { Option } = Select
|
|
|
|
+
|
|
|
|
+class Resources extends Component {
|
|
|
|
+ constructor(props) {
|
|
|
|
+ super(props);
|
|
|
|
+ this.state = {
|
|
|
|
+ resourceTypeEditVisiable: false,
|
|
|
|
+ resourceTypeEditConfirmLoading: false,
|
|
|
|
+ resourceTypeEdit: {},
|
|
|
|
+ resourceTypeAddVisiable: false,
|
|
|
|
+ resourceTypeAddConfirmLoading: false,
|
|
|
|
+ resourceTypeAdd: '',
|
|
|
|
+ resourceTypeCurrent: 1,
|
|
|
|
+ resourceTypeTotal: 0,
|
|
|
|
+ resourceTypePageSize: 10,
|
|
|
|
+ resourceTypeList: [
|
|
|
|
+ ],
|
|
|
|
+ resourceTypeListAll: [
|
|
|
|
+ ],
|
|
|
|
+
|
|
|
|
+ resourceEditVisiable: false,
|
|
|
|
+ resourceEditConfirmLoading: false,
|
|
|
|
+ resourceEdit: {},
|
|
|
|
+ resourceAddVisiable: false,
|
|
|
|
+ resourceAddConfirmLoading: false,
|
|
|
|
+ resourceAdd: {},
|
|
|
|
+ resourceCurrent: 1,
|
|
|
|
+ resourceTotal: 0,
|
|
|
|
+ resourcePageSize: 10,
|
|
|
|
+ resourceList: [
|
|
|
|
+ ],
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ //初始化所有接口类型列表
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resourceType/all",
|
|
|
|
+ method: "get"
|
|
|
|
+ }).then(result => {
|
|
|
|
+ let resourceTypeListTemp = result.data;
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeListAll: resourceTypeListTemp,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //初始化接口类型列表
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resourceType/searchByCondition",
|
|
|
|
+ method: "post",
|
|
|
|
+ data: {
|
|
|
|
+ current: this.state.resourceTypeCurrent,
|
|
|
|
+ searchCount: true,
|
|
|
|
+ size: this.state.resourceTypePageSize,
|
|
|
|
+ }
|
|
|
|
+ }).then(result => {
|
|
|
|
+ let resourceTypeListTemp = result.data.records;
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeList: resourceTypeListTemp,
|
|
|
|
+ resourceTypeTotal: result.data.total
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //初始化接口标签列表
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resource/searchByCondition",
|
|
|
|
+ method: "post",
|
|
|
|
+ data: {
|
|
|
|
+ current: this.state.resourceCurrent,
|
|
|
|
+ searchCount: true,
|
|
|
|
+ size: this.state.resourcePageSize,
|
|
|
|
+ }
|
|
|
|
+ }).then(result => {
|
|
|
|
+ let resourceListTemp = result.data.records;
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceList: resourceListTemp,
|
|
|
|
+ resourceTotal: result.data.total
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 设置接口类型表格标签
|
|
|
|
+ getResourceTypeTableColumnDef = () => {
|
|
|
|
+ return [{
|
|
|
|
+ title: "类型Id",
|
|
|
|
+ dataIndex: "id",
|
|
|
|
+ key: "id",
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ return <span>{text}</span>
|
|
|
|
+ }
|
|
|
|
+ }, {
|
|
|
|
+ title: "类型名称",
|
|
|
|
+ dataIndex: "name",
|
|
|
|
+ key: "name",
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ return <span>{text}</span>
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '操作',
|
|
|
|
+ key: 'action',
|
|
|
|
+ render: (text, record) => (
|
|
|
|
+ <span>
|
|
|
|
+ <a style={{ marginRight: 16 }} onClick={() => this.handResourceTypeEdit(text, record)}>编辑</a>
|
|
|
|
+ </span>
|
|
|
|
+ ),
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 刷新接口类型表格数据
|
|
|
|
+ refreshResourceTypeData = () => {
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resourceType/searchByCondition",
|
|
|
|
+ method: "post",
|
|
|
|
+ data: {
|
|
|
|
+ current: this.state.resourceTypeCurrent,
|
|
|
|
+ searchCount: true,
|
|
|
|
+ size: this.state.resourceTypePageSize,
|
|
|
|
+ }
|
|
|
|
+ }).then(result => {
|
|
|
|
+ let resourceTypeListTemp = result.data.records;
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeList: resourceTypeListTemp,
|
|
|
|
+ resourceTypetotal: result.data.total
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口类型表格显示总条数
|
|
|
|
+ resourceTypeShowTotal = () => {
|
|
|
|
+ return '总共' + this.state.resourceTypeTotal + '条'
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口类型表格页数发生变化
|
|
|
|
+ resourceTypeOnShowSizeChange = (current, pageSize) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypePageSize: pageSize
|
|
|
|
+ }, () => { this.refreshResourceTypeData() });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口类型表格点击换页
|
|
|
|
+ resourceTypeChangePage = (page) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeCurrent: page,
|
|
|
|
+ }, () => { this.refreshResourceTypeData() });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 接口类型编辑按钮
|
|
|
|
+ handResourceTypeEdit = (text, record) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeEdit: record,
|
|
|
|
+ }, () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeEditVisiable: true,
|
|
|
|
+ resourceTypeEditConfirmLoading: true,
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 接口类型取消编辑模态框
|
|
|
|
+ resourceTypeHandEditCancelClick = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeEditVisiable: false,
|
|
|
|
+ resourceTypeEditConfirmLoading: false,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 编辑接口类型输入框
|
|
|
|
+ resourceTypeHandEditInput = (event) => {
|
|
|
|
+ // let resourceTypeEditTemp = {...this.state.resourceTypeEdit}
|
|
|
|
+ let resourceTypeEditTemp = JSON.parse(JSON.stringify(this.state.resourceTypeEdit))
|
|
|
|
+ resourceTypeEditTemp.name = event.target.value
|
|
|
|
+ resourceTypeEditTemp.updateTime = new Date().toLocaleDateString
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeEdit: resourceTypeEditTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口类型编辑成功
|
|
|
|
+ resourceTypehandEditOk = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeEditVisiable: false,
|
|
|
|
+ resourceTypeEditConfirmLoading: false,
|
|
|
|
+ }, () => {
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resourceType/update",
|
|
|
|
+ method: "put",
|
|
|
|
+ data: this.state.resourceTypeEdit
|
|
|
|
+ }).then(result => {
|
|
|
|
+ message.success("更新成功")
|
|
|
|
+ this.refreshResourceTypeData()
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 接口类型添加按钮
|
|
|
|
+ resourceTypeHandAdd = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeAddVisiable: true,
|
|
|
|
+ resourceTypeAddConfirmLoading: true,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 取消接口类型添加
|
|
|
|
+ resourceTypeAddCancelClick = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeAddVisiable: false,
|
|
|
|
+ resourceTypeAddConfirmLoading: false,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 新增接口类型成功
|
|
|
|
+ resourceTypehandAddOk = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeAddVisiable: false,
|
|
|
|
+ resourceTypeAddConfirmLoading: false,
|
|
|
|
+ }, () => {
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resourceType/add",
|
|
|
|
+ method: "post",
|
|
|
|
+ data: {
|
|
|
|
+ name: this.state.resourceTypeAdd
|
|
|
|
+ }
|
|
|
|
+ }).then(result => {
|
|
|
|
+ message.success("新增接口成功");
|
|
|
|
+ this.refreshResourceTypeData();
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 新增接口类型输入框
|
|
|
|
+ resourceTypeHandAddInput = (event) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceTypeAdd: event.target.value
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
+ // 刷新接口数据
|
|
|
|
+ refreshResourceData = () => {
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resource/searchByCondition",
|
|
|
|
+ method: "post",
|
|
|
|
+ data: {
|
|
|
|
+ current: this.state.resourceCurrent,
|
|
|
|
+ searchCount: true,
|
|
|
|
+ size: this.state.resourcePageSize,
|
|
|
|
+ }
|
|
|
|
+ }).then(result => {
|
|
|
|
+ let resourceListTemp = result.data.records;
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceList: resourceListTemp,
|
|
|
|
+ resourceTotal: result.data.total
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 设置接口表格标签
|
|
|
|
+ getResourceTableColumnDef = () => {
|
|
|
|
+ return [{
|
|
|
|
+ title: "接口编码",
|
|
|
|
+ dataIndex: "id",
|
|
|
|
+ key: "id",
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ return <span>{text}</span>
|
|
|
|
+ }
|
|
|
|
+ }, {
|
|
|
|
+ title: "接口名称",
|
|
|
|
+ dataIndex: "name",
|
|
|
|
+ key: "name",
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ return <span>{text}</span>
|
|
|
|
+ }
|
|
|
|
+ }, {
|
|
|
|
+ title: "接口描述",
|
|
|
|
+ dataIndex: "description",
|
|
|
|
+ key: "description",
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ return <span>{text}</span>
|
|
|
|
+ }
|
|
|
|
+ }, {
|
|
|
|
+ title: "接口地址",
|
|
|
|
+ dataIndex: "url",
|
|
|
|
+ key: "url",
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ return <span>{text}</span>
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '操作',
|
|
|
|
+ key: 'action',
|
|
|
|
+ render: (text, record) => (
|
|
|
|
+ <span>
|
|
|
|
+ <a style={{ marginRight: 16 }} onClick={() => this.handresourceEdit(text, record)}>编辑</a>
|
|
|
|
+ </span>
|
|
|
|
+ ),
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 接口显示页数发生变化
|
|
|
|
+ resourceOnShowSizeChange = (current, pageSize) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourcePageSize: pageSize
|
|
|
|
+ }, () => { this.refreshResourceData() });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口表格点击换页
|
|
|
|
+ resourceChangePage = (page) => {
|
|
|
|
+
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceCurrent: page,
|
|
|
|
+ }, () => { this.refreshResourceData() });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口显示总条数
|
|
|
|
+ resourceShowTotal = () => {
|
|
|
|
+ return '总共' + this.state.resourceTotal + '条'
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口显示页数发生变化
|
|
|
|
+ resourceOnShowSizeChange = (current, pageSize) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourcePageSize: pageSize
|
|
|
|
+ }, () => { this.refreshResourceData() });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口编辑数据
|
|
|
|
+ handresourceEdit = (text, record) => {
|
|
|
|
+ record.parentName = this.state.resourceTypeListAll.find(resourceType => resourceType.id == record.parentId).name
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEditVisiable: true,
|
|
|
|
+ resourceEditConfirmLoading: true,
|
|
|
|
+ resourceEdit: record
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接口取消编辑
|
|
|
|
+ editResourceCancelClick = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEditVisiable: false,
|
|
|
|
+ resourceEditConfirmLoading: false,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 点击按钮添加接口
|
|
|
|
+ resourceHandAdd = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAddVisiable: true,
|
|
|
|
+ resourceAddConfirmLoading: true,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 取消添加接口
|
|
|
|
+ resourceAddCancelClick = () => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAddVisiable: false,
|
|
|
|
+ resourceAddConfirmLoading: false,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 新增接口name输入框
|
|
|
|
+ resourceHandAddInputName = (event) => {
|
|
|
|
+ let resourceAddTemp = { ...this.state.resourceAdd }
|
|
|
|
+ resourceAddTemp.name = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAdd: resourceAddTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 新增接口code输入框
|
|
|
|
+ resourceHandAddInputCode = (event) => {
|
|
|
|
+ let resourceAddTemp = { ...this.state.resourceAdd }
|
|
|
|
+ resourceAddTemp.code = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAdd: resourceAddTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 新增接口parentName输入框
|
|
|
|
+ resourceHandAddInputParentName = (value) => {
|
|
|
|
+ let resourceAddTemp = { ...this.state.resourceAdd }
|
|
|
|
+ resourceAddTemp.parentName = value
|
|
|
|
+ resourceAddTemp.parentId = this.state.resourceTypeListAll.find(resourceType => value == resourceType.name).id
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAdd: resourceAddTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 新增接口url输入框
|
|
|
|
+ resourceHandAddInputUrl = (event) => {
|
|
|
|
+ let resourceAddTemp = { ...this.state.resourceAdd }
|
|
|
|
+ resourceAddTemp.url = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAdd: resourceAddTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 新增接口description输入框
|
|
|
|
+ resourceHandAddInputDescription = (event) => {
|
|
|
|
+ let resourceAddTemp = { ...this.state.resourceAdd }
|
|
|
|
+ resourceAddTemp.description = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAdd: resourceAddTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 新增接口成功
|
|
|
|
+ resourcehandAddOk = (value) => {
|
|
|
|
+
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceAddVisiable: false,
|
|
|
|
+ resourceAddConfirmLoading: false,
|
|
|
|
+ }, () => {
|
|
|
|
+ console.log(this.state.resourceAdd)
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resource/add",
|
|
|
|
+ method: "post",
|
|
|
|
+ data: this.state.resourceAdd
|
|
|
|
+ }).then(result => {
|
|
|
|
+ if (result.msg == "响应成功") {
|
|
|
|
+ message.success("新增接口成功")
|
|
|
|
+ this.refreshResourceData()
|
|
|
|
+ } else {
|
|
|
|
+ message.error("新增接口失败")
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 编辑接口name输入框
|
|
|
|
+ resourceHandEditInputName = (event) => {
|
|
|
|
+ let resourceEditTemp = { ...this.state.resourceEdit }
|
|
|
|
+ resourceEditTemp.name = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEdit: resourceEditTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 编辑接口code输入框
|
|
|
|
+ resourceHandEditInputCode = (event) => {
|
|
|
|
+ let resourceEditTemp = { ...this.state.resourceEdit }
|
|
|
|
+ resourceEditTemp.code = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEdit: resourceEditTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 编辑接口parentName输入框
|
|
|
|
+ resourceHandEditInputParentName = (value) => {
|
|
|
|
+ let resourceEditTemp = { ...this.state.resourceEdit }
|
|
|
|
+ resourceEditTemp.parentName = value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEdit: resourceEditTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 编辑接口url输入框
|
|
|
|
+ resourceHandEditInputUrl = (event) => {
|
|
|
|
+ let resourceEditTemp = { ...this.state.resourceEdit }
|
|
|
|
+ resourceEditTemp.url = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEdit: resourceEditTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 编辑接口description输入框
|
|
|
|
+ resourceHandEditInputDescription = (event) => {
|
|
|
|
+ let resourceEditTemp = { ...this.state.resourceEdit }
|
|
|
|
+ resourceEditTemp.description = event.target.value
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEdit: resourceEditTemp
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 编辑接口成功
|
|
|
|
+ resourcehandEditOk = (value) => {
|
|
|
|
+ this.setState({
|
|
|
|
+ resourceEditVisiable: false,
|
|
|
|
+ resourceEditConfirmLoading: false,
|
|
|
|
+ }, () => {
|
|
|
|
+ jrequest({
|
|
|
|
+ url: "/resource/update",
|
|
|
|
+ method: "put",
|
|
|
|
+ data: this.state.resourceEdit
|
|
|
|
+ }).then(result => {
|
|
|
|
+ if (result.msg == "响应成功") {
|
|
|
|
+ message.success("编辑接口成功")
|
|
|
|
+ this.refreshResourceData()
|
|
|
|
+ } else {
|
|
|
|
+ message.success("编辑接口失败")
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ render() {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <Row style={{ background: "white", padding: "10px 10px" }}>
|
|
|
|
+ <Col span={8} style={{ padding: "10px 10px" }}>
|
|
|
|
+ <div>
|
|
|
|
+ <Button style={{ margin: "10px 0px" }} type="primary" onClick={this.resourceTypeHandAdd}>添加接口类型</Button>
|
|
|
|
+ {/* 机构表 */}
|
|
|
|
+ <Table
|
|
|
|
+ size="small"
|
|
|
|
+ dataSource={this.state.resourceTypeList}
|
|
|
|
+ bordered
|
|
|
|
+ pagination={{ pageSize: 10 }}
|
|
|
|
+ columns={this.getResourceTypeTableColumnDef()}
|
|
|
|
+ rowKey={record => record.id}
|
|
|
|
+ pagination={{ // 分页
|
|
|
|
+ current: this.state.resourceTypeCurrent,
|
|
|
|
+ total: this.state.resourceTypeTotal,
|
|
|
|
+ onChange: this.resourceTypeChangePage,
|
|
|
|
+ showTotal: this.resourceTypeShowTotal,
|
|
|
|
+ showSizeChanger: true,
|
|
|
|
+ showQuickJumper: true,
|
|
|
|
+ onShowSizeChange: (current, pageSize) => this.resourceTypeOnShowSizeChange(current, pageSize)
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </Col>
|
|
|
|
+ <Col span={16} style={{ padding: "10px 10px" }}>
|
|
|
|
+ <div>
|
|
|
|
+ <Button style={{ margin: "10px 0px" }} type="primary" onClick={this.resourceHandAdd}>添加接口</Button>
|
|
|
|
+ {/* 机构表 */}
|
|
|
|
+ <Table
|
|
|
|
+ size="small"
|
|
|
|
+ dataSource={this.state.resourceList}
|
|
|
|
+ bordered
|
|
|
|
+ pagination={{ pageSize: 10 }}
|
|
|
|
+ columns={this.getResourceTableColumnDef()}
|
|
|
|
+ rowKey={record => record.id}
|
|
|
|
+ pagination={{ // 分页
|
|
|
|
+ current: this.state.resourceCurrent,
|
|
|
|
+ total: this.state.resourceTotal,
|
|
|
|
+ onChange: this.resourceChangePage,
|
|
|
|
+ showTotal: this.resourceShowTotal,
|
|
|
|
+ showSizeChanger: true,
|
|
|
|
+ showQuickJumper: true,
|
|
|
|
+ onShowSizeChange: (current, pageSize) => this.resourceOnShowSizeChange(current, pageSize)
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </Col>
|
|
|
|
+ </Row>
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ {/* 添加接口类型 */}
|
|
|
|
+ <div>
|
|
|
|
+ <Modal title="添加接口类型"
|
|
|
|
+ width="70%"
|
|
|
|
+ visible={this.state.resourceTypeAddVisiable}
|
|
|
|
+ okButtonProps={{ disabled: true }}
|
|
|
|
+ onCancel={() => this.resourceTypeAddCancelClick()}
|
|
|
|
+ confirmLoading={this.state.resourceTypeAddConfirmLoading}
|
|
|
|
+ footer={[
|
|
|
|
+ <Button key="submit" type="primary" onClick={this.resourceTypehandAddOk} >
|
|
|
|
+ 保存
|
|
|
|
+ </Button>,
|
|
|
|
+ ]}>
|
|
|
|
+
|
|
|
|
+ <Descriptions bordered column={1} style={{ padding: '10px 0px' }}>
|
|
|
|
+ <Descriptions.Item label="类型名称"><Input placeholder={this.state.resourceTypeAdd} onChange={this.resourceTypeHandAddInput}></Input></Descriptions.Item>
|
|
|
|
+ </Descriptions>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </Modal>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ {/* 编辑接口类型 */}
|
|
|
|
+ <div>
|
|
|
|
+ <Modal title="类型信息编辑"
|
|
|
|
+ width="70%"
|
|
|
|
+ visible={this.state.resourceTypeEditVisiable}
|
|
|
|
+ okButtonProps={{ disabled: true }}
|
|
|
|
+ onCancel={() => this.resourceTypeHandEditCancelClick()}
|
|
|
|
+ confirmLoading={this.state.add}
|
|
|
|
+ footer={[
|
|
|
|
+ <Button key="submit" type="primary" onClick={this.resourceTypehandEditOk}>
|
|
|
|
+ 保存
|
|
|
|
+ </Button>,
|
|
|
|
+ ]}>
|
|
|
|
+
|
|
|
|
+ <Descriptions bordered column={1} style={{ padding: '10px 0px' }}>
|
|
|
|
+ <Descriptions.Item label="类型名称"><Input value={this.state.resourceTypeEdit.name} onChange={this.resourceTypeHandEditInput}></Input></Descriptions.Item>
|
|
|
|
+ </Descriptions>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </Modal>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ {/* 添加接口 */}
|
|
|
|
+ <div>
|
|
|
|
+ <Modal title="添加接口"
|
|
|
|
+ width="70%"
|
|
|
|
+ visible={this.state.resourceAddVisiable}
|
|
|
|
+ okButtonProps={{ disabled: true }}
|
|
|
|
+ onCancel={() => this.resourceAddCancelClick()}
|
|
|
|
+ confirmLoading={this.state.resourceAddConfirmLoading}
|
|
|
|
+ footer={[
|
|
|
|
+ <Button key="submit" type="primary" onClick={this.resourcehandAddOk}>
|
|
|
|
+ 保存
|
|
|
|
+ </Button>,
|
|
|
|
+ ]}>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <Descriptions bordered column={1} style={{ padding: '10px 0px' }}>
|
|
|
|
+ <Descriptions.Item label="接口类型">
|
|
|
|
+ <Select value={this.state.resourceAdd.parentName} style={{ width: 180 }} onChange={this.resourceHandAddInputParentName}>
|
|
|
|
+ {
|
|
|
|
+ this.state.resourceTypeListAll.map((x) => {
|
|
|
|
+ return (<Option value={x.name} key={x.id}>{x.name}</Option>)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ </Select>
|
|
|
|
+ </Descriptions.Item>
|
|
|
|
+ {/* <Descriptions.Item label="接口类型"><Input value={this.state.resourceAdd.parentName} onChange={this.resourceHandAddInputParentName}></Input></Descriptions.Item> */}
|
|
|
|
+ <Descriptions.Item label="接口编码"><Input value={this.state.resourceAdd.code} onChange={this.resourceHandAddInputCode}></Input></Descriptions.Item>
|
|
|
|
+ <Descriptions.Item label="接口名称"><Input value={this.state.resourceAdd.name} onChange={this.resourceHandAddInputName}></Input></Descriptions.Item>
|
|
|
|
+ <Descriptions.Item label="接口地址"><Input value={this.state.resourceAdd.url} onChange={this.resourceHandAddInputUrl}></Input></Descriptions.Item>
|
|
|
|
+ <Descriptions.Item label="接口描述"><Input value={this.state.resourceAdd.description} onChange={this.resourceHandAddInputDescription}></Input></Descriptions.Item>
|
|
|
|
+ </Descriptions>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </Modal>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ {/* 编辑接口 */}
|
|
|
|
+ <div>
|
|
|
|
+ <Modal title="类型信息编辑"
|
|
|
|
+ width="70%"
|
|
|
|
+ visible={this.state.resourceEditVisiable}
|
|
|
|
+ okButtonProps={{ disabled: true }}
|
|
|
|
+ onCancel={() => this.editResourceCancelClick()}
|
|
|
|
+ confirmLoading={this.state.resourceTypeEditConfirmLoading}
|
|
|
|
+ footer={[
|
|
|
|
+ <Button key="submit" type="primary" onClick={this.resourcehandEditOk}>
|
|
|
|
+ 保存
|
|
|
|
+ </Button>,
|
|
|
|
+ ]}>
|
|
|
|
+
|
|
|
|
+ <Descriptions bordered column={1} style={{ padding: '10px 0px' }}>
|
|
|
|
+ <Descriptions.Item label="接口名称"><Input value={this.state.resourceEdit.name} onChange={this.resourceHandEditInputName}></Input></Descriptions.Item>
|
|
|
|
+ <Descriptions.Item label="接口编码"><Input value={this.state.resourceEdit.code} onChange={this.resourceHandEditInputCode}></Input></Descriptions.Item>
|
|
|
|
+ <Descriptions.Item label="接口地址"><Input value={this.state.resourceEdit.url} onChange={this.resourceHandEditInputUrl}></Input></Descriptions.Item>
|
|
|
|
+ <Descriptions.Item label="接口描述"><Input value={this.state.resourceEdit.description} onChange={this.resourceHandEditInputDescription}></Input></Descriptions.Item>
|
|
|
|
+ <Descriptions.Item label="接口类型">
|
|
|
|
+ <Select value={this.state.resourceEdit.parentName} style={{ width: 180 }} onChange={this.resourceHandEditInputParentName}>
|
|
|
|
+ {
|
|
|
|
+ this.state.resourceTypeListAll.map((x) => {
|
|
|
|
+ return (<Option value={x.name} key={x.id}>{x.name}</Option>)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ </Select>
|
|
|
|
+ </Descriptions.Item>
|
|
|
|
+ </Descriptions>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </Modal>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+export default Resources;
|