diff --git a/config/routes.js b/config/routes.js
index eab16af..00c10e6 100644
--- a/config/routes.js
+++ b/config/routes.js
@@ -241,6 +241,27 @@ export default [
],
},
+ {
+ name: '授权管理',
+ icon: 'BankFilled',
+ path: '/authorization',
+ routes: [
+ {
+ name: '平台授权',
+ icon: 'smile',
+ path: '/authorization/platformAuthorization',
+ component: './authorization/platformAuthorization',
+ access: 'k12',
+ },
+ {
+ name: '店铺授权',
+ icon: 'smile',
+ path: '/authorization/storeAuthorization',
+ component: './authorization/storeAuthorization',
+ access: 'k12',
+ }
+ ],
+ },
{
path: '/',
redirect: '/welcome',
diff --git a/src/pages/authorization/platformAuthorization/index.jsx b/src/pages/authorization/platformAuthorization/index.jsx
new file mode 100644
index 0000000..f7b620b
--- /dev/null
+++ b/src/pages/authorization/platformAuthorization/index.jsx
@@ -0,0 +1,114 @@
+import React, { useState, useRef } from 'react';
+import { Modal, Button, message, Popconfirm, Typography } from 'antd';
+import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
+import { PlusOutlined } from '@ant-design/icons';
+import ProTable from '@ant-design/pro-table';
+const { Paragraph, Text } = Typography;
+
+import { PageAuthorization, AddAuthorization, UpdateAuthorization } from "./services"
+const App = () => {
+
+ const actionRef = useRef();
+ const [ModalVisible, handleModalVisible] = useState(false);
+ const [currentRow, setCurrentRow] = useState();
+ const columns = [
+ {
+ title: '主键',
+ dataIndex: 'id',
+ hideInSearch: true,
+ hideInTable: true,
+ tip: '规则名称是唯一的 key'
+ },
+ {
+ title: 'TenantId',
+ dataIndex: 'groupId',
+ valueType: 'textarea',
+ search: false,
+ render: (text) => {text},
+ },
+ {
+ title: '授权码',
+ dataIndex: 'key',
+ valueType: 'textarea',
+ search: false,
+ render: (text) => {text},
+ },
+ {
+ title: '操作',
+ dataIndex: 'option',
+ valueType: 'option',
+ fixed: 'right',
+ width: 450,
+ render: (_, record) => [
+ {
+ UpdateAuthorization(record.id).then((r) => {
+ if (r.statusCode == 200 && r.data) {
+ actionRef.current.reload();
+ message.success("修改成功");
+ } else {
+ message.error(r.errors || "修改失败");
+ }
+ });
+ }}
+ onCancel={() => { }}
+ >
+ 更新
+ ,
+
+ ],
+ },
+ ];
+
+ return (
+
+ [
+ ,
+ ]}
+ request={async (params) => {
+ var data = [];
+ var total = 0;
+ await PageAuthorization(params).then((r) => {
+ total = r.data.total;
+ data = r.data.data;
+ });
+ return {
+ data: data,
+ success: true,
+ total: total,
+ };
+ }}
+ columns={columns}
+ />
+
+
+ );
+};
+
+export default App;
diff --git a/src/pages/authorization/platformAuthorization/services.js b/src/pages/authorization/platformAuthorization/services.js
new file mode 100644
index 0000000..5ac7fa2
--- /dev/null
+++ b/src/pages/authorization/platformAuthorization/services.js
@@ -0,0 +1,30 @@
+import { request } from 'umi';
+import { getDataBaseUrl,GetkitchbaseUrl } from '@/global_data';
+
+
+/** 获取平台授权码 */
+export async function PageAuthorization(data) {
+ return request(getDataBaseUrl()+`/api/authorization/pageauthorization`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+
+ /** 添加平台授权码 */
+export async function AddAuthorization(data) {
+ return request(getDataBaseUrl()+`/api/authorization/addauthorization`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+
+ /** 修改平台授权码 */
+export async function UpdateAuthorization(data) {
+ return request(getDataBaseUrl()+`/api/authorization/updateauthorization?id=`+data, {
+ method: 'POST',
+ data: data,
+ });
+}
+
+
+
diff --git a/src/pages/authorization/storeAuthorization/index.jsx b/src/pages/authorization/storeAuthorization/index.jsx
new file mode 100644
index 0000000..595202d
--- /dev/null
+++ b/src/pages/authorization/storeAuthorization/index.jsx
@@ -0,0 +1,160 @@
+import React, { useState, useRef, useEffect } from 'react';
+import { Modal, Button, message, Popconfirm, Typography, Select } from 'antd';
+import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
+import { PlusOutlined } from '@ant-design/icons';
+import ProTable from '@ant-design/pro-table';
+import { QuestionCircleOutlined } from '@ant-design/icons';
+const { Paragraph, Text } = Typography;
+
+import { PageStoreAuthorization, AddStoreAuthorization, UpdateStoreAuthorization, GetStoreList } from "./services"
+const App = () => {
+
+ const actionRef = useRef();
+ const [ModalVisible, handleModalVisible] = useState(false);
+ const [currentRow, setCurrentRow] = useState();
+ const [storeList, setStoreList] = useState([]);
+
+ //初始化数据
+ useEffect(() => {
+ function initData() {
+ GetStoreList({ "current": 1, "pageSize": 9999 }).then((r) => {
+ let data = [];
+ if (r.statusCode == 200) {
+ r.data.data.forEach((item) => {
+ data.push({
+ id: item.id,
+ label: item.name,
+ value: item.id,
+ });
+ });
+ setStoreList(data);
+ }
+ });
+ }
+ initData();
+ }, []);
+
+
+
+ const columns = [
+ {
+ title: '主键',
+ dataIndex: 'id',
+ hideInSearch: true,
+ hideInTable: true,
+ tip: '规则名称是唯一的 key'
+ },
+ {
+ title: '授权码',
+ dataIndex: 'key',
+ valueType: 'textarea',
+ search: false,
+ render: (text) => {text},
+ },
+ {
+ title: '店铺',
+ dataIndex: 'storeName',
+ valueType: 'textarea',
+ search: false,
+ },
+ {
+ title: '操作',
+ dataIndex: 'option',
+ valueType: 'option',
+ fixed: 'right',
+ width: 450,
+ render: (_, record) => [
+ {
+ await UpdateStoreAuthorization(record.id).then((r) => {
+ if (r.statusCode == 200 && r.data) {
+ message.success("修改成功");
+ actionRef.current.reload();
+
+ } else {
+ message.error(r.errors || "修改失败");
+ }
+ });
+ }}
+ onCancel={() => { }}
+ >
+ 更新
+ ,
+
+ ],
+ },
+ ];
+
+ return (
+
+ [
+
+ ]}
+ request={async (params) => {
+ var data = [];
+ var total = 0;
+ await PageStoreAuthorization(params).then((r) => {
+ total = r.data.total;
+ data = r.data.data;
+ });
+ return {
+ data: data,
+ success: true,
+ total: total,
+ };
+ }}
+ columns={columns}
+ />
+
+ {
+ if (!currentRow) {
+ message.error("请选择店铺");
+ return;
+ }
+ AddStoreAuthorization(currentRow).then((r) => {
+ if (r.statusCode == 200 && r.data) {
+ message.success("添加成功");
+ actionRef.current.reload();
+ handleModalVisible(false);
+ } else {
+ message.error(r.errors || "添加失败");
+ }
+ });
+
+ }}
+ onCancel={() => {
+ handleModalVisible(false);
+ }}>
+
+
+
+ );
+};
+
+export default App;
diff --git a/src/pages/authorization/storeAuthorization/services.js b/src/pages/authorization/storeAuthorization/services.js
new file mode 100644
index 0000000..b3f9e55
--- /dev/null
+++ b/src/pages/authorization/storeAuthorization/services.js
@@ -0,0 +1,36 @@
+import { request } from 'umi';
+import { getDataBaseUrl,GetkitchbaseUrl } from '@/global_data';
+
+
+/** 获取平台授权码 */
+export async function PageStoreAuthorization(data) {
+ return request(GetkitchbaseUrl()+`/api/authorization/pagestoreauthorization`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+
+ /** 添加平台授权码 */
+export async function AddStoreAuthorization(data) {
+ return request(GetkitchbaseUrl()+`/api/authorization/addstoreauthorization?storeId=`+data, {
+ method: 'POST',
+ data: data,
+ });
+ }
+
+ /** 修改平台授权码 */
+export async function UpdateStoreAuthorization(data) {
+ return request(GetkitchbaseUrl()+`/api/authorization/updatestoreauthorization?id=`+data, {
+ method: 'POST',
+ data: data,
+ });
+}
+
+
+/** 获取店铺列表 */
+export async function GetStoreList(data) {
+ return request(GetkitchbaseUrl()+`/api/store/page`, {
+ method: 'POST',
+ data: data,
+ });
+}