From 95cb30bf724c547c1297cc6243f4b9efcdf8bab6 Mon Sep 17 00:00:00 2001
From: zhaoy <137053305@qq.com>
Date: Thu, 18 Jan 2024 13:33:13 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8E=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/routes.js | 14 ++
package.json | 2 +-
src/app.jsx | 17 ++
src/pages/order/orderinfo/index.jsx | 0
src/pages/order/orderrecode/index.jsx | 0
.../scene/foodmenu/components/CreateForm.jsx | 60 +++++
.../foodmenu/components/FoodMenuGoods.jsx | 60 +++++
src/pages/scene/foodmenu/index.jsx | 232 ++++++++++++++++++
src/pages/scene/foodmenu/services.js | 32 +++
src/pages/scene/store/index.jsx | 36 ++-
yarn.lock | 10 +-
11 files changed, 445 insertions(+), 18 deletions(-)
create mode 100644 src/pages/order/orderinfo/index.jsx
create mode 100644 src/pages/order/orderrecode/index.jsx
create mode 100644 src/pages/scene/foodmenu/components/CreateForm.jsx
create mode 100644 src/pages/scene/foodmenu/components/FoodMenuGoods.jsx
diff --git a/config/routes.js b/config/routes.js
index aa9db0f..53172f3 100644
--- a/config/routes.js
+++ b/config/routes.js
@@ -227,6 +227,20 @@ export default [
},
],
},
+ {
+ name: '订单管理',
+ icon: 'BankFilled',
+ path: '/order',
+ routes: [
+ {
+ name: '订单流水',
+ icon: 'smile',
+ path: '/order/orderrecode',
+ component: './order/orderrecode',
+ access: 'k12',
+ },
+ ],
+ },
{
path: '/',
redirect: '/welcome',
diff --git a/package.json b/package.json
index 91ea2d7..d26f2dc 100644
--- a/package.json
+++ b/package.json
@@ -71,7 +71,7 @@
"linq": "^4.0.0",
"lodash": "^4.17.11",
"moment": "^2.25.3",
- "nanoid": "^4.0.2",
+ "nanoid": "3",
"omit.js": "^2.0.2",
"qrcode.react": "^1.0.1",
"react": "^17.0.0",
diff --git a/src/app.jsx b/src/app.jsx
index 6558b63..b57d156 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -272,6 +272,23 @@ export async function getInitialState() {
},
],
},
+ {
+ code: 'order',
+ name: '订单管理',
+ icon: 'PrinterOutlined',
+ path: '/order',
+ routes: [
+ {
+ code: 'orderrecode',
+ name: '订单流水',
+ icon: 'smile',
+ path: '/order/orderrecode',
+ component: './order/orderrecode',
+ access: 'k12',
+ },
+
+ ],
+ },
];
// api.queryMenus();
return data;
diff --git a/src/pages/order/orderinfo/index.jsx b/src/pages/order/orderinfo/index.jsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/order/orderrecode/index.jsx b/src/pages/order/orderrecode/index.jsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/scene/foodmenu/components/CreateForm.jsx b/src/pages/scene/foodmenu/components/CreateForm.jsx
new file mode 100644
index 0000000..7b5469e
--- /dev/null
+++ b/src/pages/scene/foodmenu/components/CreateForm.jsx
@@ -0,0 +1,60 @@
+import React, { useState, useEffect,useRef } from 'react';
+import { PlusOutlined } from '@ant-design/icons';
+import { Modal, Form, Input, Button, TreeSelect,InputNumber } from 'antd';
+import { nanoid } from 'nanoid';
+const CreateForm = (props) => {
+ const [orgId,setorgId]=useState();
+ const [form] = Form.useForm();
+ useEffect(() => {
+ console.log(props.values)
+ if(props?.values?.id){
+ form.setFieldsValue({
+ id:props?.values?.id,
+ name:props?.values?.name,
+ code:props?.values?.code,
+ })
+ setorgId(props?.values?.orgId)
+ }else{
+ form.resetFields();
+ }
+ },[props.values])
+ return (
+ {
+ props.onCancel();
+ }}
+ destroyOnClose
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default CreateForm;
diff --git a/src/pages/scene/foodmenu/components/FoodMenuGoods.jsx b/src/pages/scene/foodmenu/components/FoodMenuGoods.jsx
new file mode 100644
index 0000000..07ad841
--- /dev/null
+++ b/src/pages/scene/foodmenu/components/FoodMenuGoods.jsx
@@ -0,0 +1,60 @@
+import React, { useState, useEffect,useRef } from 'react';
+import { PlusOutlined } from '@ant-design/icons';
+import { Modal, Form, Input, Button, TreeSelect,InputNumber } from 'antd';
+import { nanoid } from 'nanoid';
+const FoodMenuGoods = (props) => {
+ const [orgId,setorgId]=useState();
+ const [form] = Form.useForm();
+ useEffect(() => {
+ console.log(props.values)
+ if(props?.values?.id){
+ form.setFieldsValue({
+ id:props?.values?.id,
+ name:props?.values?.name,
+ code:props?.values?.code,
+ })
+ setorgId(props?.values?.orgId)
+ }else{
+ form.resetFields();
+ }
+ },[props.values])
+ return (
+ {
+ props.onCancel();
+ }}
+ destroyOnClose
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default FoodMenuGoods;
diff --git a/src/pages/scene/foodmenu/index.jsx b/src/pages/scene/foodmenu/index.jsx
index e69de29..2c76d8d 100644
--- a/src/pages/scene/foodmenu/index.jsx
+++ b/src/pages/scene/foodmenu/index.jsx
@@ -0,0 +1,232 @@
+import { PlusOutlined } from '@ant-design/icons';
+import { Modal, Button, message,Popconfirm } from 'antd';
+import React, { useState, useRef, useEffect } from 'react';
+import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import CreateForm from './components/CreateForm';
+import FoodMenuGoods from './components/FoodMenuGoods'
+import {
+ GetFoodPage,
+ FoodAdd,
+ FoodUpdate,
+ FoodDelete,
+} from './services';
+import { gettree } from '../../org/orgamange/service';
+const key = 'message';
+
+
+const FoodMenu = () => {
+ const [OrgList, setOrgList] = useState([]);
+ //初始化数据
+ useEffect(() => {
+ gettree().then((r)=>{
+ setOrgList(r.data)
+ })
+ }, []);
+ /** 新建/更新窗口的弹窗 */
+ const [createModalVisible, handleModalVisible] = useState(false);
+ const [foodMenuGoodsModalVisible,setfoodMenuGoodsModalVisible] = useState(false);
+ /** 分布更新窗口的弹窗 */
+ const actionRef = useRef();
+ const [currentRow, setCurrentRow] = useState();
+ const [selectedRowsState, setSelectedRows] = useState([]);
+ /** 国际化配置 */
+
+ const columns = [
+ {
+ title: '主键',
+ dataIndex: 'id',
+ hideInSearch: true,
+ hideInTable: true,
+ tip: '规则名称是唯一的 key',
+ },
+ {
+ title: '菜谱编码',
+ dataIndex: 'code',
+ search: true,
+ },
+ {
+ title: '菜谱名称',
+ dataIndex: 'name',
+ },
+ {
+ title: '操作',
+ dataIndex: 'option',
+ valueType: 'option',
+ fixed: 'right',
+ width: 200,
+ render: (_, record) => [
+ {
+ handleModalVisible(true);
+ setCurrentRow(record);
+ }}
+ >
+ 更新
+ ,
+ {
+ var ids=[{id:record.id}]
+ handleRemove(ids);
+ }}
+ onCancel={() => {}}
+ >
+ 删除
+ ,
+ {
+ setfoodMenuGoodsModalVisible(true);
+ setCurrentRow(record);
+ }}
+ >
+ 关联商品
+ ,
+ ],
+ },
+ ];
+//添加
+const handleAdd = async (fields) => {
+ await FoodAdd(JSON.stringify(fields)).then((r) => {
+ if (r.succeeded) {
+ message.success('添加成功');
+ handleModalVisible(false);
+ setCurrentRow(undefined);
+ actionRef.current.reload();
+ } else {
+ message.error(r.errors);
+ }
+ });
+
+};
+//修改
+const handleUpdate = async (fields) => {
+
+ await FoodUpdate(JSON.stringify(fields)).then((r) => {
+
+ if (r.succeeded) {
+ message.success('修改成功');
+ handleModalVisible(false);
+ setCurrentRow(undefined);
+ actionRef.current.reload();
+ } else {
+ message.error(r.errors);
+ }
+ });
+
+};
+
+//删除
+const handleRemove = async (selectedRows) => {
+
+ let ids = [];
+ selectedRows.forEach((item) => {
+ ids.push(item.id);
+ });
+ await FoodDelete(ids).then((r) => {
+ if (r.succeeded) {
+ message.success('删除成功');
+ setSelectedRows([]);
+ actionRef.current?.reloadAndRest?.();
+ } else {
+ message.error(r.errors);
+ }
+ });
+};
+
+ return (
+
+ [
+ ,
+ ]}
+ request={async (params) => {
+ var data = [];
+ var total = 0;
+ await GetFoodPage(params).then((r) => {
+ data = r.data.data;
+ total = r.data.total;
+ });
+ return {
+ data: data,
+ success: true,
+ total: total,
+ };
+ }}
+ columns={columns}
+ rowSelection={{
+ onChange: (_, selectedRows) => {
+ setSelectedRows(selectedRows);
+ },
+ }}
+ />
+ {selectedRowsState?.length > 0 && (
+
+ 已选择{' '}
+
+ {selectedRowsState.length}
+ {' '}
+ 项
+ {/*
+ 服务调用次数总计 {selectedRowsState.reduce((pre, item) => pre + item.id, 0)} 万
+ */}
+
+ }
+ >
+ {/* */}
+
+ )}
+
+ {
+ if (value.id) {
+ await handleUpdate(value);
+ } else {
+ await handleAdd(value);
+ }
+
+ }}
+ onCancel={() => {
+ handleModalVisible(false);
+ setCurrentRow(undefined);
+ }}
+ createModalVisible={createModalVisible}
+ values={currentRow || {}}
+ />
+
+
+ );
+};
+
+export default FoodMenu;
diff --git a/src/pages/scene/foodmenu/services.js b/src/pages/scene/foodmenu/services.js
index e69de29..77acc5b 100644
--- a/src/pages/scene/foodmenu/services.js
+++ b/src/pages/scene/foodmenu/services.js
@@ -0,0 +1,32 @@
+import { request } from 'umi';
+
+/** 获取场景列表 */
+export async function GetFoodPage(data) {
+ return request(`/saasstore/api/foodmenu/page`, {
+ method: 'POST',
+ data: data,
+ });
+}
+export async function FoodAdd(data) {
+ return request(`/saasstore/api/foodmenu/add`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+ export async function FoodUpdate(data) {
+ return request(`/saasstore/api/foodmenu/update`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+ export async function FoodDelete(data) {
+ return request(`/saasstore/api/foodmenu/delete`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+ export async function GetGoodsList() {
+ return request(`/saasbase/api/goods/getgoodslist`, {
+ method: 'GET',
+ });
+ }
\ No newline at end of file
diff --git a/src/pages/scene/store/index.jsx b/src/pages/scene/store/index.jsx
index 6614be9..e3de11a 100644
--- a/src/pages/scene/store/index.jsx
+++ b/src/pages/scene/store/index.jsx
@@ -1,5 +1,5 @@
import { PlusOutlined } from '@ant-design/icons';
-import { Modal, Button, message } from 'antd';
+import { Modal, Button, message,Popconfirm } from 'antd';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
@@ -45,12 +45,18 @@ const StoreManage = () => {
{
title: '所属组织',
dataIndex: 'orgName',
- hideInSearch: true,
+ valueType:'treeSelect',
+ fieldProps: {
+ options: OrgList,
+ allowClear:true,
+
+ },
+ hideInSearch: false,
},
{
title: '电话',
dataIndex: 'phone',
- search: false,
+ search: true,
},
{
title: '排序',
@@ -60,6 +66,7 @@ const StoreManage = () => {
{
title: '描述',
dataIndex: 'description',
+ search: false,
},
{
@@ -78,15 +85,20 @@ const StoreManage = () => {
>
更新
,
- {
- var ids=[{id:record.id}]
- handleRemove(ids);
- }}
- >
- 删除
- ,
+ {
+ var ids=[{id:record.id}]
+ handleRemove(ids);
+ }}
+ onCancel={() => {}}
+ >
+ 删除
+ ,
],
},
diff --git a/yarn.lock b/yarn.lock
index a9754bb..da5022c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -13799,6 +13799,11 @@ nano-css@^5.3.1:
stacktrace-js "^2.0.2"
stylis "^4.0.6"
+nanoid@3:
+ version "3.3.7"
+ resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8"
+ integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
+
nanoid@^2.1.0:
version "2.1.11"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-2.1.11.tgz#ec24b8a758d591561531b4176a01e3ab4f0f0280"
@@ -13809,11 +13814,6 @@ nanoid@^3.1.25, nanoid@^3.2.0, nanoid@^3.3.4:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
-nanoid@^4.0.2:
- version "4.0.2"
- resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-4.0.2.tgz#140b3c5003959adbebf521c170f282c5e7f9fb9e"
- integrity sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==
-
nanomatch@^1.2.9:
version "1.2.13"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"