Ver código fonte

Merge branch 'master' of http://192.168.20.122:3000/root/qiyewechatApp.git

Lgx 4 anos atrás
pai
commit
0045b71412

+ 731 - 0
UI/src/pages/organization/Organization.js

@@ -0,0 +1,731 @@
+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 Orginazation extends Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            editVisiable: false,
+            editConfirmLoading: false,
+            secretVisiable: false,
+            secretConfirmLoading: false,
+            resourceVisiable: false,
+            resourceConfirmLoading: false,
+            addVisiable: false,
+            addConfirmLoading: false,
+            organizationList: [
+            ],
+            resourceList: [
+            ],
+            organizationEdit: {},
+            organizationSecret: {},
+            organizationAdd: {},
+            current: 1,
+            total: 0,
+            pageSize: 10,
+
+
+            resourceListAll: [],
+            resourceListCondition: [],
+            resourceTypeListAll: [],
+            selectedRowKeysInit: [],
+            selectedRowKeys: [],
+
+            // 即将授权的机构
+            organizationResource: {},
+            // 选择的接口类型
+            selectedResourceType: '',
+            // 选择的接口名称
+            selectedResourceName: '',
+
+        };
+
+        //初始化所有接口类型列表
+        jrequest({
+            url: "/resourceType/all",
+            method: "get"
+        }).then(result => {
+            let resourceTypeListTemp = result.data;
+            this.setState({
+                resourceTypeListAll: resourceTypeListTemp,
+            });
+
+        });
+
+
+        //初始化接口列表
+        jrequest({
+            url: "/resource/all",
+            method: "get",
+        }).then(result => {
+            let resourceListAllTemp = result.data;
+            this.setState({
+                resourceListAll: resourceListAllTemp,
+                resourceListCondition: resourceListAllTemp,
+            });
+        });
+
+
+        //初始化机构列表列表
+        jrequest({
+            url: "/orgdoc/searchByCondition",
+            method: "post",
+            data: {
+                current: this.state.current,
+                searchCount: true,
+                size: this.state.pageSize,
+            }
+        }).then(result => {
+            let organizationListTemp = result.data.records;
+            this.setState({
+                organizationList: organizationListTemp,
+                total: result.data.total
+            });
+        });
+    }
+
+
+    // 刷新机构数据
+    refreshOrganizationData = () => {
+        jrequest({
+            url: "/orgdoc/searchByCondition",
+            method: "post",
+            data: {
+                current: this.state.current,
+                searchCount: true,
+                size: this.state.pageSize,
+            }
+        }).then(result => {
+            let organizationListTemp = result.data.records;
+            this.setState({
+                organizationList: organizationListTemp,
+                total: result.data.total
+            });
+        });
+    }
+
+    // 设置机构表格
+    getTableColumnDef = () => {
+        return [{
+            title: "机构Id",
+            dataIndex: "orgId",
+            key: "orgId",
+            render: (text, record, index) => {
+                return <span>{text}</span>
+            }
+        }, {
+            title: "机构名称",
+            dataIndex: "orgName",
+            key: "orgName",
+            render: (text, record, index) => {
+                return <span>{text}</span>
+            }
+        }, {
+            title: "合作状态",
+            dataIndex: "authStatus",
+            key: "authStatus",
+            render: (text, record, index) => {
+                return <span>{text == 1 ? "合作中" : "已停止"}</span>
+            }
+        }, {
+            title: "接口授权数量",
+            dataIndex: "authNum",
+            key: "authNum",
+            render: (text, record, index) => {
+                return <span><a style={{ marginRight: 16 }} onClick={() => this.handResource(text, record)}>{text}</a></span>
+            }
+        },
+        {
+            title: '操作',
+            key: 'action',
+            render: (text, record) => (
+                <span>
+                    <a style={{ marginRight: 16 }} onClick={() => this.handOrganizationEdit(text, record)}>编辑</a>
+                    <a onClick={() => this.handOrganizationCheck(text, record)}>查看密钥</a>
+                </span>
+            ),
+        },
+        ];
+    }
+
+    // 设置授权表格
+    getTableColumnDefResource = () => {
+        return [{
+            title: "接口编码",
+            dataIndex: "code",
+            key: "code",
+            render: (text, record, index) => {
+                return <span>{text}</span>
+            }
+        }, {
+            title: "接口类型",
+            dataIndex: "parentId",
+            key: "parentId",
+            render: (text, record, index) => {
+                return <span>
+                    {
+                        this.state.resourceTypeListAll.find(resourceType => resourceType.id == text).name
+                    }
+                </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>
+            }
+        }
+
+        ];
+    }
+
+
+    // 显示页数发生变化
+    onShowSizeChange = (current, pageSize) => {
+        this.setState({
+            pageSize: pageSize
+        }, () => { this.refreshOrganizationData() });
+
+    }
+
+    // 表格点击换页
+    changePage = (page) => {
+
+        this.setState({
+            current: page,
+        }, () => { this.refreshOrganizationData() });
+
+    }
+
+    // 显示总条数
+    showTotal = () => {
+        return '总共' + this.state.total + '条'
+    }
+
+    // 显示页数发生变化
+    onShowSizeChange = (current, pageSize) => {
+        this.setState({
+            pageSize: pageSize
+        }, () => { this.refreshOrganizationData() });
+
+    }
+
+
+
+    // 新增组织机构
+    onAddOrganization = () => {
+        this.setState({
+            addVisiable: true,
+            addConfirmLoading: true
+        });
+    }
+
+    /* 新增机构取消事件 */
+    addCancelClick = () => {
+        this.setState({
+            addVisiable: false,
+            addConfirmLoading: false
+        });
+    }
+
+
+    // 机构新增parentName
+    organizationAddParentName = (value) => {
+        let organizationAddTemp = { ...this.state.organizationAdd }
+        organizationAddTemp.parentName = value
+        this.setState({
+            organizationAdd: organizationAddTemp
+        })
+    }
+
+    // 机构新增orgName
+    organizationAddOrgName = (event) => {
+        let organizationAddTemp = { ...this.state.organizationAdd }
+        organizationAddTemp.orgName = event.target.value
+        this.setState({
+            organizationAdd: organizationAddTemp
+        })
+    }
+
+
+
+    // 保存新增数据
+    handAddOk = (e) => {
+        this.setState({
+            addVisiable: false,
+            addConfirmLoading: false,
+        }, () => {
+            jrequest({
+                url: "/orgdoc/add",
+                method: "post",
+                data: this.state.organizationAdd
+            }).then(result => {
+                message.success("新增机构成功")
+                this.refreshOrganizationData()
+            });
+        })
+    }
+
+
+
+
+    // 机构信息数据编辑
+    handOrganizationEdit = (text, record) => {
+        this.setState({
+            editVisiable: true,
+            organizationEdit: record
+        })
+
+    }
+
+
+    /* 机构信息编辑取消 */
+    editCancelClick = () => {
+        this.setState({
+            editVisiable: false,
+            editConfirmLoading: false
+        });
+    }
+
+
+    // 机构编辑OrgName
+    organizationEditOrgName = (event) => {
+        let organizationEditTemp = { ...this.state.organizationEdit }
+        organizationEditTemp.orgName = event.target.value
+        this.setState({
+            organizationEdit: organizationEditTemp
+        })
+    }
+
+
+    // 机构编辑ParentName
+    organizationEditParentName = (value) => {
+        let organizationEditTemp = { ...this.state.organizationEdit }
+        organizationEditTemp.parentName = value
+        this.setState({
+            organizationEdit: organizationEditTemp
+        })
+    }
+
+    // 机构编辑authStatus
+    organizationEditauthStatus = (value) => {
+        let organizationEditTemp = { ...this.state.organizationEdit }
+        organizationEditTemp.authStatus = value == "合作中" ? 1 : 0;
+        this.setState({
+            organizationEdit: organizationEditTemp
+        })
+    }
+
+    // 保存修改数据
+    handEditOk = (e) => {
+        this.setState({
+            editVisiable: false,
+            editConfirmLoading: false,
+        }, () => {
+            jrequest({
+                url: "/orgdoc/update",
+                method: "put",
+                data: this.state.organizationEdit
+            }).then(result => {
+                message.success("更新机构信息成功")
+                this.refreshOrganizationData()
+            });
+        })
+    }
+
+
+    // 接口授权窗口弹出
+    handResource = (text, record) => {
+
+        // 查询机构授权的接口
+        jrequest({
+            url: "/orgdocResource/selectByOrgId?orgId=" + record.id,
+            method: "get",
+        }).then(result => {
+            let selectedRowKeysTemp = result.data.map(x => { return (x.resourceId) })
+            // selectedRowKeys.push(result.data.resourceId)
+            this.setState({
+                selectedRowKeys: selectedRowKeysTemp,
+                selectedRowKeysInit: selectedRowKeysTemp,
+                organizationResource: record,
+                resourceVisiable: true,
+                resourceConfirmLoading: true,
+                selectedResourceType: '',
+                selectedResourceName: '',
+            })
+        });
+
+
+    }
+
+
+    /* 接口授权框取消事件 */
+    resourceCancelClick = () => {
+        this.setState({
+            resourceVisiable: false,
+            resourceConfirmLoading: false,
+            resourceListCondition: this.state.resourceListAll
+        });
+    }
+
+    // 接口授权保存
+    handResourceOk = (e) => {
+
+        const { selectedRowKeysInit, selectedRowKeys } = this.state;
+
+        let selectedRowKeysInitSet = new Set(selectedRowKeysInit)
+        let selectedRowKeysSet = new Set(selectedRowKeys)
+
+        // 要删除的授权
+        let resourceDelete = selectedRowKeysInit.filter(x => !selectedRowKeysSet.has(x)).map(key => {
+            return ({
+                "orgId": this.state.organizationResource.id,
+                "resourceId": key
+            })
+        })
+
+
+        if (resourceDelete.length > 0) {
+            // 将删除授权信息写入数据库
+            jrequest({
+                url: "/orgdocResource/deleteBatch",
+                method: "delete",
+                data: resourceDelete
+            }).then(result => {
+                message.success("删除授权成功")
+                this.refreshOrganizationData()
+            });
+        }
+
+
+        // 要保存的授权
+        let resourceAdd = selectedRowKeys.filter(x => !selectedRowKeysInitSet.has(x)).map(key => {
+            return ({
+                "orgId": this.state.organizationResource.id,
+                "resourceId": key
+            })
+        })
+
+        if (resourceAdd.length > 0) {
+            // 将授权信息写入数据库
+            jrequest({
+                url: "/orgdocResource/addBatch",
+                method: "post",
+                data: resourceAdd
+            }).then(result => {
+                message.success("新增授权成功")
+                this.refreshOrganizationData()
+            });
+        }
+
+        this.setState({
+            resourceVisiable: false,
+            resourceConfirmLoading: false,
+            resourceListCondition: this.state.resourceListAll
+        })
+
+
+    }
+
+
+    /* 密钥查看取消事件 */
+    secretCancelClick = () => {
+        this.setState({
+            secretVisiable: false,
+            secretConfirmLoading: false
+        });
+    }
+
+
+    // 接口密钥查看
+    handOrganizationCheck = (text, record) => {
+        this.setState({
+            organizationSecret: record,
+            secretVisiable: true,
+            secretConfirmLoading: true,
+        })
+
+    }
+
+    // 接口密钥Ips
+    organizationSecretIps = (event) => {
+        let organizationSecretTemp = { ...this.state.organizationSecret }
+        organizationSecretTemp.ips = event.target.value
+        this.setState({
+            organizationSecret: organizationSecretTemp
+        })
+    }
+
+
+    // 接口密钥保存
+    handSecretOk = (e) => {
+        this.setState({
+            secretVisiable: false,
+            secretConfirmLoading: false,
+        }, () => {
+            jrequest({
+                url: "/orgdoc/update",
+                method: "put",
+                data: this.state.organizationSecret
+            }).then(result => {
+                message.success("更新ip白名单成功")
+                this.refreshOrganizationData()
+            });
+        })
+    }
+
+
+    // 选择授权
+    onSelectChange = selectedRowKeys => {
+        this.setState({
+            selectedRowKeys
+        })
+    };
+
+    // 全部授权按钮
+    selectAllRowkeys = () => {
+        this.setState({
+            selectedRowKeys: this.state.resourceListCondition.map(x => { return (x.id) })
+        })
+    }
+
+    // 选择接口类型
+    selectedResourceTypeChange = (value) => {
+        this.setState({
+            selectedResourceType: value
+        })
+    }
+
+    // 选择接口名称
+    selectedResourceNameChange = (event) => {
+        this.setState({
+            selectedResourceName: event.target.value
+        })
+    }
+
+    // 查询
+    conditionQuery = () => {
+        let resourceListConditionTemp = null
+        if (this.state.selectedResourceType != '' && this.state.selectedResourceName != '') {
+            resourceListConditionTemp = this.state.resourceListAll.filter(x => x.parentId == this.state.resourceTypeListAll.find(x => x.name == this.state.selectedResourceType).id && x.name == this.state.selectedResourceName)
+        }
+        if (this.state.selectedResourceType != '' && this.state.selectedResourceName == '') {
+            resourceListConditionTemp = this.state.resourceListAll.filter(x => x.parentId == this.state.resourceTypeListAll.find(x => x.name == this.state.selectedResourceType).id )
+        }
+        if (this.state.selectedResourceType == '' && this.state.selectedResourceName != '') {
+            resourceListConditionTemp = this.state.resourceListAll.filter(x => x.name == this.state.selectedResourceName )
+        }
+        if (this.state.selectedResourceType == '' && this.state.selectedResourceName == '') {
+            resourceListConditionTemp = this.state.resourceListAll
+        }
+
+
+        this.setState({
+            resourceListCondition: resourceListConditionTemp
+        })
+
+
+    }
+
+
+    render() {
+
+
+        const { selectedRowKeys } = this.state;
+
+        const rowSelection = {
+            selectedRowKeys,
+            onChange: this.onSelectChange,
+            columnTitle: "授权",
+            fixed: true
+        };
+
+        return (
+            <div style={{ padding: '25px', background: 'white' }}>
+                <div style={{ padding: '10px 0px' }}>
+                    <Button type="primary" onClick={this.onAddOrganization} >添加</Button>
+                </div>
+
+                {/* 机构表 */}
+                <div>
+                    <Table
+                        size="small"
+                        dataSource={this.state.organizationList}
+                        bordered
+                        pagination={{ pageSize: 10 }}
+                        columns={this.getTableColumnDef()}
+                        rowKey={record => record.id}
+                        pagination={{  // 分页
+                            current: this.state.current,
+                            total: this.state.total,
+                            onChange: this.changePage,
+                            showTotal: this.showTotal,
+                            showSizeChanger: true,
+                            showQuickJumper: true,
+                            onShowSizeChange: (current, pageSize) => this.onShowSizeChange(current, pageSize)
+                        }}
+                    />
+                </div>
+
+                {/* 添加机构 */}
+                <div>
+                    <Modal title="添加机构"
+                        width="70%"
+                        visible={this.state.addVisiable}
+                        okButtonProps={{ disabled: true }}
+                        onCancel={() => this.addCancelClick()}
+                        confirmLoading={this.state.addConfirmLoading}
+                        footer={[
+                            <Button key="submit" type="primary" onClick={this.handAddOk} >
+                                保存
+                            </Button>,
+                        ]}>
+
+                        <Descriptions bordered column={1} style={{ padding: '10px 0px' }}>
+                            <Descriptions.Item label="机构名称"><Input value={this.state.organizationAdd.orgName} onChange={this.organizationAddOrgName}></Input></Descriptions.Item>
+                            <Descriptions.Item label="所属平台">
+                                <Select value={this.state.organizationAdd.parentName} style={{ width: 180 }} onChange={this.organizationAddParentName}>
+                                    <Option value="亮健官网">亮健官网</Option>
+                                    <Option value="互联网医院">互联网医院</Option>
+                                    <Option value="亮健优医">亮健优医</Option>
+                                </Select>
+                            </Descriptions.Item>
+                        </Descriptions>
+
+
+                    </Modal>
+                </div>
+
+                {/* 机构信息编辑 */}
+                <div>
+                    <Modal title="机构信息编辑"
+                        width="70%"
+                        visible={this.state.editVisiable}
+                        okButtonProps={{ disabled: true }}
+                        onCancel={() => this.editCancelClick()}
+                        confirmLoading={this.state.editConfirmLoading}
+                        footer={[
+                            <Button key="submit" type="primary" onClick={this.handEditOk} >
+                                保存
+                            </Button>,
+                        ]}>
+
+                        <Descriptions bordered column={1} style={{ padding: '10px 0px' }}>
+                            <Descriptions.Item label="机构ID">{this.state.organizationEdit.id}</Descriptions.Item>
+                            <Descriptions.Item label="机构名称">
+                                <Input value={this.state.organizationEdit.orgName} onChange={this.organizationEditOrgName}></Input>
+                            </Descriptions.Item>
+                            <Descriptions.Item label="所属平台">
+                                <Select value={this.state.organizationEdit.parentName} style={{ width: 180 }} onChange={this.organizationEditParentName}>
+                                    <Option value="亮健官网">亮健官网</Option>
+                                    <Option value="互联网医院">互联网医院</Option>
+                                    <Option value="亮健优医">亮健优医</Option>
+                                </Select>
+                            </Descriptions.Item>
+                            <Descriptions.Item label="合作状态">
+                                <Select value={this.state.organizationEdit.authStatus == 1 ? "合作中" : "已停止"} style={{ width: 180 }} onChange={this.organizationEditauthStatus}>
+                                    <Option value="合作中">合作中</Option>
+                                    <Option value="已停止">已停止</Option>
+                                </Select>
+                            </Descriptions.Item>
+                        </Descriptions>
+
+
+                    </Modal>
+                </div>
+
+                {/* 接口密钥 */}
+                <div>
+                    <Modal title="接口密钥"
+                        width="70%"
+                        visible={this.state.secretVisiable}
+                        okButtonProps={{ disabled: true }}
+                        onCancel={() => this.secretCancelClick()}
+                        confirmLoading={this.state.secretConfirmLoading}
+                        footer={[
+                            <Button key="submit" type="primary" onClick={this.handSecretOk} >
+                                保存
+                            </Button>,
+                        ]}>
+
+                        <Descriptions bordered column={1} style={{ padding: '10px 0px' }}>
+                            <Descriptions.Item label="机构">{this.state.organizationSecret.id}</Descriptions.Item>
+                            <Descriptions.Item label="机构名称">{this.state.organizationSecret.orgName}</Descriptions.Item>
+                            <Descriptions.Item label="所属平台">{this.state.organizationSecret.parentName}</Descriptions.Item>
+                            <Descriptions.Item label="APPID">{this.state.organizationSecret.orgId}</Descriptions.Item>
+                            <Descriptions.Item label="KEY">{this.state.organizationSecret.secret}</Descriptions.Item>
+                            <Descriptions.Item label="IP白名单"><Input value={this.state.organizationSecret.ips} onChange={this.organizationSecretIps}></Input></Descriptions.Item>
+                        </Descriptions>
+
+
+                    </Modal>
+
+                </div>
+
+                {/* 接口授权 */}
+                <div>
+                    <Modal title="接口授权"
+                        width="70%"
+                        visible={this.state.resourceVisiable}
+                        okButtonProps={{ disabled: true }}
+                        onCancel={() => this.resourceCancelClick()}
+                        confirmLoading={this.state.resourceConfirmLoading}
+                        footer={[
+                            <Button key="submit" type="primary" onClick={this.handResourceOk} >
+                                保存
+                            </Button>,
+                        ]}>
+
+                        <Select value={this.state.selectedResourceType} style={{ padding: "10px 0px", width: "100px" }} onChange={this.selectedResourceTypeChange}>
+                            <Option value='' key='empty'></Option>
+                            {
+                                this.state.resourceTypeListAll.map((x) => {
+                                    return (<Option value={x.name} key={x.id}>{x.name}</Option>)
+                                })
+                            }
+                            
+                        </Select>
+                        <Input value={this.state.selectedResourceName} style={{ padding: "10px 10px", width: "100px" }} onChange={this.selectedResourceNameChange}></Input>
+                        <Button type="primary" style={{ padding: "0px 10px", width: "100px" }} onClick={this.conditionQuery}>查询</Button>
+                        <Button type="primary" style={{ width: "100px", float: "right" }} onClick={this.selectAllRowkeys}>全部授权</Button>
+
+                        <Table
+                            size="small"
+                            dataSource={this.state.resourceListCondition}
+                            bordered
+                            pagination={{ pageSize: 10 }}
+                            columns={this.getTableColumnDefResource()}
+                            rowKey={record => record.id}
+                            rowSelection={rowSelection}
+                            pagination={{  // 分页
+                                showTotal: (() => { return '总共' + this.state.resourceListAll.length + '条' }),
+                                showSizeChanger: true,
+                                showQuickJumper: true,
+                            }}
+                        />
+
+
+                    </Modal>
+
+
+                </div>
+
+            </div>
+        );
+    }
+}
+
+export default Orginazation;

+ 699 - 0
UI/src/pages/resources/Resources copy.js

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

+ 626 - 0
UI/src/pages/resources/Resources.js

@@ -0,0 +1,626 @@
+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,
+
+            resourceTypeListAll: [
+            ],
+
+            resourceEditVisiable: false,
+            resourceEditConfirmLoading: false,
+            resourceEdit: {},
+            resourceAddVisiable: false,
+            resourceAddConfirmLoading: false,
+            resourceAdd: {},
+            resourceCurrent: 1,
+            resourceTotal: 0,
+            resourcePageSize: 10,
+            resourceListAll: [
+            ],
+
+
+        };
+
+        //初始化所有接口类型列表
+        jrequest({
+            url: "/resourceType/all",
+            method: "get"
+        }).then(result => {
+            let resourceTypeListTemp = result.data;
+            this.setState({
+                resourceTypeListAll: resourceTypeListTemp,
+            });
+
+        });
+
+
+        //初始化接口列表
+        jrequest({
+            url: "/resource/all",
+            method: "get",
+        }).then(result => {
+            let resourceListAllTemp = result.data;
+            this.setState({
+                resourceListAll: resourceListAllTemp,
+            });
+        });
+    }
+
+    // 设置接口类型表格标签
+    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/all",
+            method: "get"
+        }).then(result => {
+            let resourceTypeListTemp = result.data;
+            this.setState({
+                resourceTypeListAll: resourceTypeListTemp,
+            });
+
+        });
+    }
+
+    // 接口类型表格显示总条数
+    resourceTypeShowTotal = () => {
+        return '总共' + this.state.resourceTypeListAll.length + '条'
+    }
+
+
+    // 接口类型编辑按钮
+    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/all",
+            method: "get",
+            
+        }).then(result => {
+            let resourceListAllTemp = result.data;
+            this.setState({
+                resourceListAll: resourceListAllTemp,
+            });
+        });
+    }
+
+
+    // 设置接口表格标签
+    getResourceTableColumnDef = () => {
+        return [{
+            title: "接口编码",
+            dataIndex: "code",
+            key: "code",
+            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>
+            ),
+        },
+        ];
+    }
+
+
+    // 接口显示总条数
+    resourceShowTotal = () => {
+        return '总共' + this.state.resourceListAll.length + '条'
+    }
+
+    // 接口显示页数发生变化
+    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
+        resourceAddTemp.types = 2
+        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.parentId = this.state.resourceTypeListAll.find(resourceType => value == resourceType.name).id
+        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.resourceTypeListAll}
+                                bordered
+                                pagination={{ pageSize: 10 }}
+                                columns={this.getResourceTypeTableColumnDef()}
+                                rowKey={record => record.id}
+                                pagination={{  // 分页
+                                    total: this.state.resourceTypeListAll.size,
+                                    showTotal: this.resourceTypeShowTotal,
+                                    showSizeChanger: true,
+                                    showQuickJumper: true,
+                                }}
+                            />
+                        </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.resourceListAll}
+                                bordered
+                                pagination={{ pageSize: 10 }}
+                                columns={this.getResourceTableColumnDef()}
+                                rowKey={record => record.id}
+                                pagination={{  // 分页
+                                    showTotal: this.resourceShowTotal,
+                                    showSizeChanger: true,
+                                    showQuickJumper: true,
+                                }}
+                            />
+                        </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;

+ 1 - 1
UI/src/utils/config.js

@@ -1,6 +1,6 @@
 const APIV1 = '/api/v1'
 const APIV2 = '/api/v2' 
-const APIV3 = 'http://localhost:8004'
+const APIV3 = 'http://119.130.113.245:8004'
 const APIV3Auth = 'http://119.130.113.245:7777'
 const JAPIV = 'http://localhost:8005'
 const APIV4 = 'http://localhost:8005'