@@ -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', | |||
@@ -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", | |||
@@ -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; | |||
@@ -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 ( | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
destroyOnClose | |||
> | |||
<Form | |||
layout="Horizontal" | |||
labelCol={{ span: 4 }} | |||
preserve={false} | |||
form={form} | |||
// initialValues={props.values} | |||
onFinish={props.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={'菜谱编码'} name="code" initialValue={nanoid(20)} rules={[{ required: true, max: 50 }]}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={'菜谱名称'} name="name" rules={[{ required: true, max: 50 }]}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
</Button> | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
); | |||
}; | |||
export default CreateForm; |
@@ -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 ( | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
destroyOnClose | |||
> | |||
<Form | |||
layout="Horizontal" | |||
labelCol={{ span: 4 }} | |||
preserve={false} | |||
form={form} | |||
// initialValues={props.values} | |||
onFinish={props.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={'菜谱编码'} name="code" initialValue={nanoid(20)} rules={[{ required: true, max: 50 }]}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={'菜谱名称'} name="name" rules={[{ required: true, max: 50 }]}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
</Button> | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
); | |||
}; | |||
export default FoodMenuGoods; |
@@ -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) => [ | |||
<a | |||
key="update" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
> | |||
更新 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
var ids=[{id:record.id}] | |||
handleRemove(ids); | |||
}} | |||
onCancel={() => {}} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
<a | |||
key="update" | |||
onClick={() => { | |||
setfoodMenuGoodsModalVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
> | |||
关联商品 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
//添加 | |||
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 ( | |||
<PageContainer host header={{ | |||
title: '', | |||
breadcrumb: {}, | |||
}}> | |||
<ProTable | |||
headerTitle="场景信息" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
pagination={{ defaultPageSize: 10 }} | |||
search={{ | |||
labelWidth: 120, | |||
}} | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
}} | |||
> | |||
<PlusOutlined /> 新建 | |||
</Button>, | |||
]} | |||
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 && ( | |||
<FooterToolbar | |||
extra={ | |||
<div> | |||
已选择{' '} | |||
<a | |||
style={{ | |||
fontWeight: 600, | |||
}} | |||
> | |||
{selectedRowsState.length} | |||
</a>{' '} | |||
项 | |||
{/* <span> | |||
服务调用次数总计 {selectedRowsState.reduce((pre, item) => pre + item.id, 0)} 万 | |||
</span> */} | |||
</div> | |||
} | |||
> | |||
{/* <Button type="primary">批量审批</Button> */} | |||
</FooterToolbar> | |||
)} | |||
<CreateForm | |||
OrgList={OrgList} | |||
onFinish={async (value) => { | |||
if (value.id) { | |||
await handleUpdate(value); | |||
} else { | |||
await handleAdd(value); | |||
} | |||
}} | |||
onCancel={() => { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
}} | |||
createModalVisible={createModalVisible} | |||
values={currentRow || {}} | |||
/> | |||
<FoodMenuGoods foodMenuGoodsModalVisible={foodMenuGoodsModalVisible} values={currentRow || {}}/> | |||
</PageContainer> | |||
); | |||
}; | |||
export default FoodMenu; |
@@ -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', | |||
}); | |||
} |
@@ -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 = () => { | |||
> | |||
更新 | |||
</a>, | |||
<a | |||
key="status" | |||
onClick={async () => { | |||
var ids=[{id:record.id}] | |||
handleRemove(ids); | |||
}} | |||
> | |||
删除 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
var ids=[{id:record.id}] | |||
handleRemove(ids); | |||
}} | |||
onCancel={() => {}} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
}, | |||
@@ -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" | |||