From 4eb0ce71567bedc7b61e311af1fdd4e4e5a967d3 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Fri, 1 Mar 2024 19:49:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/proxy.js | 10 ++- src/global_data.js | 2 +- .../platformAuthorization/index.jsx | 30 ++++++-- .../platformAuthorization/services.js | 10 ++- .../storeAuthorization/index.jsx | 68 ++++++++++++++----- .../storeAuthorization/services.js | 11 +++ 6 files changed, 105 insertions(+), 26 deletions(-) diff --git a/config/proxy.js b/config/proxy.js index 90de5e5..fc94b84 100644 --- a/config/proxy.js +++ b/config/proxy.js @@ -9,13 +9,21 @@ export default { dev: { '/kitchbase/': { - target: 'http://localhost:5006/', + target: 'http://localhost:5009/', changeOrigin: true, secure: false, //关闭证书验证 pathRewrite: { '/kitchbase/': '', }, }, + '/kitchorder/': { + target: 'http://localhost:5007', + changeOrigin: true, + secure: false, //关闭证书验证 + pathRewrite: { + '/kitchorder/': '', + }, + }, // Nginx发布的时候需要配置 '/cos/':{ target: 'https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com', diff --git a/src/global_data.js b/src/global_data.js index b14735f..5638601 100644 --- a/src/global_data.js +++ b/src/global_data.js @@ -10,7 +10,7 @@ export function getDataBaseUrl() { } export function GetkitchbaseUrl() { - return '/kitchbase'; + return '/kitchorder'; } diff --git a/src/pages/authorization/platformAuthorization/index.jsx b/src/pages/authorization/platformAuthorization/index.jsx index a334ab2..2656bb5 100644 --- a/src/pages/authorization/platformAuthorization/index.jsx +++ b/src/pages/authorization/platformAuthorization/index.jsx @@ -11,7 +11,7 @@ dayjs.extend(localeData); const dateFormat = 'YYYY/MM/DD'; const { Paragraph, Text } = Typography; -import { PageAuthorization, AddAuthorization, UpdateAuthorization, UpdateAuthTime } from "./services" +import { PageAuthorization, AddAuthorization, UpdateAuthorization, UpdateAuthTime,DelAuthorization } from "./services" const App = () => { const actionRef = useRef(); @@ -34,16 +34,17 @@ const App = () => { dataIndex: 'key', valueType: 'textarea', search: false, - width:300, render: (text) => {text}, }, { title: '有效日期', dataIndex: 'periodValidity', valueType: 'textarea', + width:200, search: false, render: (_, record) => { - return {record.periodValidity == null ? "长期有效" : record.periodValidity} + var time=dayjs(record.periodValidity, dateFormat).format('YYYY-MM-DD'); + return {record.periodValidity == null ? "长期有效" : time} } }, { @@ -87,7 +88,28 @@ const App = () => { form.setFieldsValue({ id: record.id, autho:aa, periodValidity: time }); handleModalVisible(true); - }}>更新授权时间 + }}>更新授权时间, + { + DelAuthorization(record.id).then((r) => { + if (r.statusCode == 200 && r.data) { + actionRef.current.reload(); + message.success("删除成功"); + } else { + message.error(r.errors || "删除失败"); + } + }); + }} + onCancel={() => { }} + > + 删除 + + ], }, diff --git a/src/pages/authorization/platformAuthorization/services.js b/src/pages/authorization/platformAuthorization/services.js index 4d5df51..548f347 100644 --- a/src/pages/authorization/platformAuthorization/services.js +++ b/src/pages/authorization/platformAuthorization/services.js @@ -34,6 +34,12 @@ export async function UpdateAuthorization(data) { }); } + /** 删除授权码 */ + export async function DelAuthorization(data) { + return request(getDataBaseUrl()+`/api/authorization/delauthorization?id=`+data, { + method: 'POST', + data: data, + }); +} - - + diff --git a/src/pages/authorization/storeAuthorization/index.jsx b/src/pages/authorization/storeAuthorization/index.jsx index 8f35abb..612d7a8 100644 --- a/src/pages/authorization/storeAuthorization/index.jsx +++ b/src/pages/authorization/storeAuthorization/index.jsx @@ -1,5 +1,5 @@ import React, { useState, useRef, useEffect } from 'react'; -import { Modal, Button, message, Popconfirm, Typography, Select } from 'antd'; +import { Modal, Button, message, Popconfirm, Typography, Select,Form,Input,Radio,DatePicker} from 'antd'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import { PlusOutlined } from '@ant-design/icons'; import ProTable from '@ant-design/pro-table'; @@ -12,13 +12,14 @@ dayjs.extend(localeData); const dateFormat = 'YYYY/MM/DD'; const { Paragraph, Text } = Typography; -import { PageStoreAuthorization, AddStoreAuthorization, UpdateStoreAuthorization, UpdateStoreAuthTime, GetStoreList } from "./services" +import { PageStoreAuthorization, AddStoreAuthorization, UpdateStoreAuthorization, UpdateStoreAuthTime, GetStoreList,DelStoreAuthTime } from "./services" const App = () => { const actionRef = useRef(); const [ModalVisible, handleModalVisible] = useState(false); const [currentRow, setCurrentRow] = useState(); const [storeList, setStoreList] = useState([]); + const [form] = Form.useForm(); //初始化数据 useEffect(() => { @@ -51,32 +52,36 @@ const App = () => { tip: '规则名称是唯一的 key' }, { - title: '授权码', - dataIndex: 'key', + title: '店铺', + dataIndex: 'storeName', valueType: 'textarea', + width:200, search: false, - render: (text) => {text}, }, { - title: '店铺', - dataIndex: 'storeName', + title: '授权码', + dataIndex: 'key', valueType: 'textarea', search: false, + render: (text) => {text}, }, + { title: '有效日期', dataIndex: 'periodValidity', - valueType: 'textarea', + valueType: 'date', + width:150, search: false, render: (_, record) => { - return {record.periodValidity == null ? "长期有效" : record.periodValidity} + var time=dayjs(record.periodValidity, dateFormat).format('YYYY-MM-DD'); + return {record.periodValidity == null ? "长期有效" : time} } }, { title: '修改时间', dataIndex: 'updateAt', valueType: 'textarea', - width: 200, + width: 150, search: false }, { @@ -84,7 +89,7 @@ const App = () => { dataIndex: 'option', valueType: 'option', fixed: 'right', - width: 450, + width: 250, render: (_, record) => [ { }} onCancel={() => { }} > - 更新 + 更新授权码 + , + { + setCurrentRow(record); + var aa = record.periodValidity == null ? "cqyx" : "gdsj"; + var time=record.periodValidity == null ?null:dayjs(record.periodValidity, dateFormat); + + form.setFieldsValue({ id: record.id, autho:aa, periodValidity: time,storeId:record.storeId }); + handleModalVisible(true); + }}>更新授权时间, + { + await DelStoreAuthTime(record.id).then((r) => { + if (r.statusCode == 200 && r.data) { + message.success("删除成功"); + actionRef.current.reload(); + + } else { + message.error(r.errors || "删除失败"); + } + }); + }} + onCancel={() => { }} + > + 删除 , ], @@ -155,7 +189,7 @@ const App = () => {
{ if (values.id) { - UpdateAuthTime(values).then((r) => { + UpdateStoreAuthTime(values).then((r) => { if (r.statusCode == 200 && r.data) { message.success("修改成功"); actionRef.current.reload(); @@ -167,7 +201,7 @@ const App = () => { }); } else { - AddAuthorization(values).then((r) => { + AddStoreAuthorization(values).then((r) => { if (r.statusCode == 200 && r.data) { message.success("添加成功"); actionRef.current.reload(); @@ -185,11 +219,9 @@ const App = () => { - - - 长期有效 diff --git a/src/pages/authorization/storeAuthorization/services.js b/src/pages/authorization/storeAuthorization/services.js index 1bf8b3a..39a1edd 100644 --- a/src/pages/authorization/storeAuthorization/services.js +++ b/src/pages/authorization/storeAuthorization/services.js @@ -34,6 +34,17 @@ export async function UpdateStoreAuthorization(data) { }); } + /** 删除店铺授权码 */ + export async function DelStoreAuthTime(data) { + return request(GetkitchbaseUrl()+`/api/authorization/delstoreauthorization?id=`+data, { + method: 'POST', + data: data, + }); + } + + + + /** 获取店铺列表 */ export async function GetStoreList(data) {