Browse Source

快速开始

tags/小炒逻辑变更前
yangwenhua 2 years ago
parent
commit
c4cd5aa4f0
7 changed files with 711 additions and 536 deletions
  1. +167
    -122
      src/pages/quickStart/components/DeviceConfig/index.jsx
  2. +142
    -104
      src/pages/quickStart/components/FoodMenuConfig/index.jsx
  3. +154
    -128
      src/pages/quickStart/components/GoodsConfig/index.jsx
  4. +2
    -1
      src/pages/quickStart/components/StepsButton/index.jsx
  5. +133
    -137
      src/pages/quickStart/components/StoreConfig/index.jsx
  6. +23
    -44
      src/pages/quickStart/index.jsx
  7. +90
    -0
      src/pages/quickStart/service.js

+ 167
- 122
src/pages/quickStart/components/DeviceConfig/index.jsx View File

@@ -5,6 +5,9 @@ import quickAPI from "../../service";
import StepsButton from "../StepsButton";
import styles from "./index.less";
import indexStyles from "../../index.less";
import { PlusOutlined } from '@ant-design/icons';

const key = "message";


const DeviceConfig = (props) => {
@@ -16,6 +19,7 @@ const DeviceConfig = (props) => {
const [deviceTypeList, setDeviceTypeList] = useState([]);
//设备分类
const [deviceClassList, setDeviceClassList] = useState([]);
const [deviceClassEnum, setDeviceClassEnum] = useState({});
//组织树
const [orgTree, setOrgTree] = useState([]);
//设备版本
@@ -23,12 +27,39 @@ const DeviceConfig = (props) => {
//是否显示设备分类弹窗
const [isModalOpen, setIsModalOpen] = useState(false);

//当前操作的设备对象
const [currentOption, setCurrentOption] = useState({ id: '' });

//是否显示 新增/编辑 菜谱弹窗
const [isShowModal, setIsShowModal] = useState(false);

/**
* 提交表单
* @param {*} formValues
*/
const onFinishSubmit = (formValues) => {
props.onFinishForm('deviceConfig', formValues, true);
const onFinishSubmit = async (formValues) => {
message.loading('正在配置', key);
if (formValues.id) {
const response = await quickAPI.UpdateDeviceInfo(formValues);
if (response.succeeded) {
message.success('修改成功');
setIsShowModal(false);
actionRef.current.reload();
} else {
message.error(response.errors || '修改出错');
}
} else {
const response = await quickAPI.AddDeviceInfo(formValues);
if (response.succeeded) {
message.success('添加成功');
actionRef.current.reload();
setIsShowModal(false);
} else {
message.error(response.errors || '添加成出错');
}
}
message.destroy(key);
actionRef.current.reload();
}

/**
@@ -37,6 +68,10 @@ const DeviceConfig = (props) => {
const onFetchDeviceTypeList = async () => {
const response = await quickAPI.GetDicList('DeviceClientType');
if (response.statusCode === 200) {
response.data.forEach(item => {
item.code = item.code;
item.value = item.code;
})
setDeviceTypeList(response.data);
} else {
message.error(response.errors || '获取设备类型出错');
@@ -59,7 +94,13 @@ const DeviceConfig = (props) => {
const onFetchDeviceClass = async () => {
const response = await quickAPI.GetDeviceType();
if (response.statusCode === 200) {
response.data.forEach(item => { item.value = item.name; item.code = item.name });
const deviceEnum = {};
response.data.forEach(item => {
deviceEnum[item.id] = {
text: item.name
}
});
setDeviceClassEnum(deviceEnum);
setDeviceClassList(response.data);
} else {
message.error(response.errors || '获取设备分类出错');
@@ -93,8 +134,7 @@ const DeviceConfig = (props) => {
}

const actionRef = useRef();
const [selectedRowsState, setSelectedRows] = useState(props.deviceConfig.id ? [props.deviceConfig] : []);
const [selectedRowKeys, setSelectRowKeys] = useState(props.deviceConfig.id ? [props.deviceConfig.id] : []);
const [selectedRowKeys, setSelectRowKeys] = useState([]);
const columns = [
{
title: '主键',
@@ -114,11 +154,17 @@ const DeviceConfig = (props) => {
valueEnum: deviceTypeList,
hideInSearch: true,
},
// {
// title: '设备分类',
// dataIndex: 'deviceTypeId',
// valueEnum: deviceClassList,
// },
{
title: '归属门店',
dataIndex: 'orgId',
search: false,
// valueEnum: OrgListArray,
},
{
title: '设备分类',
dataIndex: 'deviceTypeId',
valueEnum: deviceClassEnum,
},
{
title: '状态',
dataIndex: 'status',
@@ -127,45 +173,60 @@ const DeviceConfig = (props) => {
1: { text: '停用', status: 'Success' },
},
hideInSearch: true,
}
];
},

const [currentPage, setCurrentPage] = useState(0);
const [pageSize, setPageSize] = useState(5);
{
title: '设备地址',
dataIndex: 'deviceAddr',
search: false,
valueType: 'textarea',
},
{
title: '坐标',
dataIndex: 'deviceLoc',
valueType: 'textarea',
search: false,
},
{
title: '设备物料数量',
dataIndex: 'materialQuantity',
valueType: 'textarea',
search: false,
},

const optionsWithDisabled = [
{
label: '新建设备',
value: true,
title: '设备唯一key',
dataIndex: 'autoKey',
search: false,
},
{
label: '选择设备',
value: false,
title: '归属门店唯一key',
dataIndex: 'orgKey',
search: false,
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key="config"
onClick={() => {
setCurrentOption(record);
setIsShowModal(true);
editDeviceForm.setFieldsValue(record);
}}>更新</a>
]
}
];

const [isCreate, setIsCreate] = useState(props.deviceConfig.id ? false : true);

const onChangeState = ({ target: { value } }) => {
setIsCreate(value);
let emptyObj = {
id: "",
deviceName: "",
deviceTypeKey: "",
orgId: "",
deviceTypeId: "",
deviceLoc: "",
status: 0,
materialQuantity: 1,
deviceAddr: ""
}
props.onFinishForm('deviceConfig', emptyObj);
editDeviceForm.setFieldsValue(emptyObj);
setSelectRowKeys([]);
setSelectedRows([]);
}
const [currentPage, setCurrentPage] = useState(0);
const [pageSize, setPageSize] = useState(10);

useEffect(() => {
if (props.deviceConfig.id) {
setSelectRowKeys([props.deviceConfig.id]);
}
onFetchOrgTree();
onFetchDeviceClass();
onFetchDeviceTypeList();
@@ -173,35 +234,71 @@ const DeviceConfig = (props) => {
}, []);

return <>
<div className={indexStyles.choose_change_state}>
<Radio.Group
options={optionsWithDisabled}
onChange={onChangeState}
value={isCreate}
optionType="button"
buttonStyle="solid"
/>
</div>
<div className={indexStyles.common_row}>
<ProTable
style={{ width: '100%' }}
headerTitle="设备信息"
actionRef={actionRef}
rowKey="id"
search={false}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
request={async (params) => {
let data = [];
let total = 0;
await quickAPI.GetDeviceInfoPage(params).then((r) => {
data = r.data.data;
total = r.data.total;
});
return {
data: data,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
type: 'radio',
onChange: (selectedRowKeys, selectedRows) => {
setSelectRowKeys(selectedRowKeys);
props.onSelectedChange('deviceConfig', selectedRows[0]);
},
selectedRowKeys: selectedRowKeys
}}
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => {
editDeviceForm.resetFields();
setCurrentOption({ id: '' });
setIsShowModal(true);
}}>
新建
</Button>
]}
/>
<StepsButton current={props.current} steps={props.steps} prev={props.prev} next={props.next}></StepsButton>
<Modal width={600} title={currentOption.id ? '编辑设备' : '新增设备'} visible={isShowModal} footer={false} onCancel={() => setIsShowModal(false)}>
<Form
layout="Horizontal"
labelCol={{ span: 6 }}
preserve={false}
initialValues={props.deviceConfig}
form={editDeviceForm}
onFinish={onFinishSubmit}
style={{ width: '600px', marginRight: '30px' }}
>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>

<Form.Item label={'设备名称'} name="deviceName" rules={[{ required: true, max: 50 }]}>
<Input disabled={!isCreate || props.deviceConfig.id} />
<Input />
</Form.Item>

<Form.Item label={'设备类型'} name="deviceTypeKey" rules={[{ required: true }]}>
<Select disabled={!isCreate || props.deviceConfig.id}>
<Select >
{deviceTypeList.map((item, index) => {
return (
<Select.Option index={index} value={item.code} key={item.code}>
@@ -214,7 +311,7 @@ const DeviceConfig = (props) => {

<Form.Item name="orgId" label="归属门店" rules={[{ required: true }]}>
<TreeSelect
disabled={!isCreate || props.deviceConfig.id}
style={{ width: '100%' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={orgTree}
@@ -225,7 +322,7 @@ const DeviceConfig = (props) => {

<div className={styles.add_row_content}>
<Form.Item label={'设备分类'} name="deviceTypeId" rules={[{ required: true }]} >
<Select style={{ width: '75%' }} disabled={!isCreate || props.deviceConfig.id}>
<Select style={{ width: '75%' }} >
{deviceClassList.map((item, index) => {
return (
<Select.Option index={index} value={item.id} key={item.id}>
@@ -235,7 +332,7 @@ const DeviceConfig = (props) => {
})}
</Select>
</Form.Item>
<Button disabled={!isCreate || props.deviceConfig.id} type="primary" className={styles.add_row_btn} onClick={() => { setIsModalOpen(true); addDeviceTypeForm.resetFields(); }}>添加分类</Button>
<Button type="primary" className={styles.add_row_btn} onClick={() => { setIsModalOpen(true); addDeviceTypeForm.resetFields(); }}>添加分类</Button>
</div>

<Form.Item
@@ -245,7 +342,7 @@ const DeviceConfig = (props) => {
{({ getFieldValue }) =>
getFieldValue('deviceTypeKey') === 'TMC' ? (
<Form.Item name="deviceVersion" label="设备版本" initialValue="WorryFreeEdition">
<Select disabled={!isCreate || props.deviceConfig.id}>
<Select >
{deviceVersion.map((item, index) => {
return (
<Select.Option index={index} value={item.code} key={item.code}>
@@ -258,87 +355,35 @@ const DeviceConfig = (props) => {
) : null
}
</Form.Item>

<Form.Item label={'设备坐标'} name="deviceLoc">
<Input placeholder="104.070734,30.575041" disabled={!isCreate || props.deviceConfig.id} />
<Input placeholder="104.070734,30.575041" />
</Form.Item>

<Form.Item label={'状态'} name="status" rules={[{ required: true }]}>
<Select placeholder="请选择状态" disabled={!isCreate || props.deviceConfig.id}>
<Select placeholder="请选择状态" >
<OptGroup>
<Select.Option value={0}>正常</Select.Option>
<Select.Option value={1}>停用</Select.Option>
</OptGroup>
</Select>
</Form.Item>

<Form.Item label={'设备物料数量'} name="materialQuantity">
<InputNumber style={{ width: '100%' }} disabled={!isCreate || props.deviceConfig.id}/>
<InputNumber style={{ width: '100%' }} />
</Form.Item>

<Form.Item label={'设备详细地址'} name="deviceAddr">
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" disabled={!isCreate || props.deviceConfig.id}/>
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" />
</Form.Item>

<Form.Item>
<StepsButton current={props.current} steps={props.steps} prev={props.prev}></StepsButton>
<Button type="primary" htmlType="submit">
确定
</Button>
</Form.Item>
</Form>

{
!isCreate && <ProTable
headerTitle="设备信息"
actionRef={actionRef}
rowKey="id"
search={{
labelWidth: 120,
}}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
request={async (params) => {
let data = [];
let total = 0;
await quickAPI.GetDeviceInfoPage(params).then((r) => {
data = r.data.data;
total = r.data.total;
});
return {
data: data,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
type: 'radio',
onChange: (selectedRowKeys, selectedRows) => {
setSelectRowKeys(selectedRowKeys);
setSelectedRows(selectedRows);
if (selectedRows.length > 0) {
props.onFinishForm('deviceConfig', selectedRows[0]);
editDeviceForm.setFieldsValue(selectedRows[0]);
} else {
let emptyObj = {
id: "",
deviceName: "",
deviceTypeKey: "",
orgId: "",
deviceTypeId: "",
deviceLoc: "",
status: 0,
materialQuantity: 1,
deviceAddr: ""
}
editDeviceForm.setFieldsValue(emptyObj);
props.onFinishForm('deviceConfig', emptyObj);
}
},
selectedRowKeys: selectedRowKeys
}}
/>
}
</div>
</Modal>

<Modal title="添加设备分类" visible={isModalOpen} footer={false} onCancel={() => setIsModalOpen(false)}>
<Form


+ 142
- 104
src/pages/quickStart/components/FoodMenuConfig/index.jsx View File

@@ -1,52 +1,72 @@
import React, { useState, useEffect, useRef } from 'react';
import ProTable from '@ant-design/pro-table';
import { Form, Input, Select, InputNumber, TreeSelect, message, Button, Modal, Radio } from 'antd';
import { Form, Input, message, Button, Modal, Radio } from 'antd';
import quickAPI from "../../service";
import StepsButton from "../StepsButton";
import styles from "./index.less";
import indexStyles from "../../index.less";
import { PlusOutlined } from '@ant-design/icons';
const key = 'message';

const FoodMenuConfig = (props) => {

const [ editFoodMenuForm ] = Form.useForm();
//表单实例
const [editFoodMenuForm] = Form.useForm();

/**
* 提交表单
* @param {*} formValues
*/
const onFinishSubmit = (formValues) => {
props.onFinishForm('foodMenuConfig', formValues, true);
* 提交表单
*/
const onFinishSubmit = async (formValues) => {
if (formValues.id) {
try {
message.loading('正在修改', key);
await quickAPI.UpdateFoodMenu(formValues).then((r) => {
message.destroy(key);
if (r.data) {
message.success('修改成功');
setIsShowModal(false);
actionRef.current.reload();
} else {
message.error('修改失败');
}
});
} catch (error) {
message.destroy(key);
message.error('修改失败请重试!');
}
} else {
try {
message.loading('正在添加', key);
await quickAPI.AddFoodMenu(formValues).then((r) => {
message.destroy(key);
if (r.data) {
message.success('添加成功');
setIsShowModal(false);
actionRef.current.reload();
} else {
message.error('添加失败');
}
});
} catch (error) {
message.destroy(key);
message.error('添加失败请重试!');
}
}
}

const [selectedRowsState, setSelectedRows] = useState(props.foodMenuConfig.id ? [props.foodMenuConfig] : []);
const [selectedRowKeys, setSelectRowKeys] = useState(props.foodMenuConfig.id ? [props.foodMenuConfig.id] : []);
//当前操作的菜谱对象
const [currentOption, setCurrentOption] = useState({ id: '' });

const optionsWithDisabled = [
{
label: '新建菜谱',
value: true,
},
{
label: '选择菜谱',
value: false,
}
];
//是否显示 新增/编辑 菜谱弹窗
const [isShowModal, setIsShowModal] = useState(false);

const [isCreate, setIsCreate] = useState(props.foodMenuConfig.id ? false : true);

const onChangeState = ({ target: { value } }) => {
setIsCreate(value);
let emptyObj = {
id: "",
code: "",
name: ""
}
props.onFinishForm('foodMenuConfig', emptyObj);
editFoodMenuForm.setFieldsValue(emptyObj);
setSelectRowKeys([]);
setSelectedRows([]);
}
//表格实例
const actionRef = useRef();
const [currentPage, setCurrentPage] = useState(1);
const [pageSize, setPageSize] = useState(5);

const [selectedRowKeys, setSelectRowKeys] = useState([]);

const columns = [
{
title: '主键',
@@ -64,99 +84,117 @@ const FoodMenuConfig = (props) => {
title: '菜谱名称',
dataIndex: 'name',
valueType: 'textarea',
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key="config"
onClick={() => {
setCurrentOption(record);
setIsShowModal(true);
editFoodMenuForm.setFieldsValue(record);
}}>更新</a>
]
}
]

const [currentPage, setCurrentPage] = useState(0);
const [pageSize, setPageSize] = useState(5);
/**
* 回显 选中的菜谱
*/
const onSetSelectedState = () => {
if (props.foodMenuConfig.length > 0) {
const selected = [];
props.foodMenuConfig.forEach(item => {
selected.push(item.id);
});
setSelectRowKeys(selected);
}
}

useEffect(() => {
onSetSelectedState();
}, []);

return <>
<div className={indexStyles.choose_change_state}>
<Radio.Group
options={optionsWithDisabled}
onChange={onChangeState}
value={isCreate}
optionType="button"
buttonStyle="solid"
/>
</div>
<div className={indexStyles.common_row}>
<ProTable
style={{ width: '100%' }}
headerTitle="菜谱列表"
actionRef={actionRef}
rowKey="id"
search={false}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
request={async (params) => {
let data = [];
let total = 0;
await quickAPI.GetFoodMenuInfoPage(params).then((r) => {
data = r.data.data;
total = r.data.total;
});
return {
data: data,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
type: 'checkbox',
onChange: (selectedRowKeys, selectedRows) => {
setSelectRowKeys(selectedRowKeys);
props.onSelectedChange('foodMenuConfig', selectedRows);
},
selectedRowKeys: selectedRowKeys
}}
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => {
editFoodMenuForm.resetFields();
setCurrentOption({ id: '' });
setIsShowModal(true);
}}>
新建
</Button>
]}
/>

<StepsButton current={props.current} steps={props.steps} prev={props.prev} next={props.next}></StepsButton>

<Modal width={600} title={currentOption.id ? '编辑菜谱' : '新增菜谱'} visible={isShowModal} footer={false} onCancel={() => setIsShowModal(false)}>
<Form
form={editFoodMenuForm}
layout="Horizontal"
preserve={false}
initialValues={props.foodMenuConfig}
onFinish={onFinishSubmit}
style={{ width: '600px', marginRight: '30px' }}
style={{ width: '100%' }}
>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>

<Form.Item label={"菜谱编码"} name="code" rules={[{ required: true, max: 20 }]}>
<Input disabled={!isCreate || props.foodMenuConfig.id} />
<Input />
</Form.Item>

<Form.Item label={"菜谱名称"} name="name" rules={[{ required: true, max: 20 }]} >
<Input disabled={!isCreate || props.foodMenuConfig.id} />
<Input />
</Form.Item>

<Form.Item>
<StepsButton current={props.current} steps={props.steps} prev={props.prev}></StepsButton>
<Button type="primary" htmlType="submit">
确定
</Button>
</Form.Item>
</Form>
{
!isCreate && <ProTable
headerTitle="菜谱列表"
actionRef={actionRef}
rowKey="id"
search={{
labelWidth: 120,
}}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
request={async (params) => {
let data = [];
let total = 0;
await quickAPI.GetFoodMenuInfoPage(params).then((r) => {
data = r.data.data;
total = r.data.total;
});
return {
data: data,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
type: 'radio',
onChange: (selectedRowKeys, selectedRows) => {
setSelectRowKeys(selectedRowKeys);
setSelectedRows(selectedRows);
if (selectedRows.length > 0) {
props.onFinishForm('foodMenuConfig', selectedRows[0]);
editFoodMenuForm.setFieldsValue(selectedRows[0]);
} else {
let emptyObj = {
id: "",
code: "",
name: ""
}
editFoodMenuForm.setFieldsValue(emptyObj);
props.onFinishForm('foodMenuConfig', emptyObj);
}
},
selectedRowKeys: selectedRowKeys
}}
/>
}
</div>

</Modal>
</>
}


+ 154
- 128
src/pages/quickStart/components/GoodsConfig/index.jsx View File

@@ -7,6 +7,8 @@ import StepsButton from "../StepsButton";
import indexStyles from "../../index.less";
import axios from 'axios';

const key = 'message';

const GoodsConfig = (props) => {
const { Option, OptGroup } = Select;
const [url, setUrl] = useState(props.goodsConfig.imgUrl);
@@ -28,8 +30,7 @@ const GoodsConfig = (props) => {
const [createSmallTypeModal, setCreateSmallTypeModal] = useState(false);

const [currentPage, setCurrentPage] = useState(0);
const [pageSize, setPageSize] = useState(5);
const [total, setTotal] = useState(0);
const [pageSize, setPageSize] = useState(10);

/**
* 获取商品单位
@@ -73,7 +74,6 @@ const GoodsConfig = (props) => {
}



const uploadProp = {
name: 'file',
showUploadList: false,
@@ -133,12 +133,50 @@ const GoodsConfig = (props) => {
},
};

const onFinish = (formValues) => {
const onFinish = async (formValues) => {
delete formValues.imgUrl1;
props.onFinishForm('goodsConfig', formValues, true);
message.loading('正在配置', key);
if (formValues.id) {
const response = await quickAPI.UpdateGoods(formValues);
if (response.succeeded) {
message.success('修改成功');
setIsShowModal(false);
actionRef.current.reload();
} else {
message.error(response.errors || '修改出错');
}
} else {
const response = await quickAPI.AddGoods(formValues);
if (response.data) {
message.success('添加成功');
actionRef.current.reload();
setIsShowModal(false);
} else {
message.error(response.errors || '添加成出错');
}
}
message.destroy(key);
}

const columns = [
{
title: '主键',
dataIndex: 'id',
hideInTable: true,
hideInSearch: true,

},
{
title: '图片地址',
dataIndex: 'imgUrl',
hideInTable: true,
hideInSearch: true,
},
{
title: '编码',
dataIndex: 'code',
valueType: 'textarea',
},
{
title: '名称',
dataIndex: 'name',
@@ -158,6 +196,22 @@ const GoodsConfig = (props) => {
renderText: (val) => `${val}¥`,
hideInSearch: true,
},
{
title: '商品小类',
dataIndex: 'goodsTypeName',
hideInForm: true,
hideInSearch: true,
// valueEnum: goodsTypes
},
{
title: '商品类型',
dataIndex: 'goodsTypeId',
hideInForm: true,
hideInTable: true,
// hideInSearch: true,
// valueEnum: goodsTypes,
},

{
title: '商品属性',
dataIndex: 'goodsAttribute',
@@ -170,6 +224,7 @@ const GoodsConfig = (props) => {
text: '套餐',
}
},

},
{
title: '状态',
@@ -191,41 +246,34 @@ const GoodsConfig = (props) => {
},

},
];

const optionsWithDisabled = [
{
label: '新建商品',
value: true,
title: '创建时间',
dataIndex: 'createAt',
valueType: 'date',
},
{
label: '选择商品',
value: false,
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key="config"
onClick={() => {
setCurrentOption(record);
setIsShowModal(true);
editGoodsForm.setFieldsValue(record);
}}>更新</a>
]
}
];

const [isCreate, setIsCreate] = useState(props.goodsConfig.id ? false : true);

const onChangeState = ({ target: { value } }) => {
setIsCreate(value);
let emptyObj = {
id: "",
name: "",
goodsUintId: "",
price: 0,
vipPrice: 0,
parentTypeID: "",
goodsTypeId: "",
goodsAttribute: 0,
status: 0,
imgUrl: "",
isWeigh: ""
}
props.onFinishForm('goodsConfig', emptyObj);
editGoodsForm.setFieldsValue(emptyObj);
setSelectRowKeys([]);
setSelectedRows([]);
}
//当前操作的门店对象
const [currentOption, setCurrentOption] = useState({ id: '' });
//是否显示 新增/编辑 菜谱弹窗
const [isShowModal, setIsShowModal] = useState(false);
const actionRef = useRef();

const [selectedRowKeys, setSelectRowKeys] = useState([]);

useEffect(() => {
onFetchGoodsUnit();
@@ -233,27 +281,13 @@ const GoodsConfig = (props) => {
onFetchGoodsSmallTypeList();
}, []);

const [selectedRowsState, setSelectedRows] = useState(props.goodsConfig.id ? [props.goodsConfig] : []);
const [selectedRowKeys, setSelectRowKeys] = useState(props.goodsConfig.id ? [props.goodsConfig.id] : []);

return <>
<div className={indexStyles.choose_change_state}>
<Radio.Group
options={optionsWithDisabled}
onChange={onChangeState}
value={isCreate}
optionType="button"
buttonStyle="solid"
/>
</div>
<div className={indexStyles.common_row}>
<Modal width={600} title={currentOption.id ? '编辑商品' : '新增商品'} visible={isShowModal} footer={false} onCancel={() => setIsShowModal(false)}>
<Form
labelCol={{ span: 4 }}
layout="horizontal"
preserve={false}
initialValues={props.goodsConfig}
onFinish={onFinish}
style={{ width: '600px', marginRight: '30px' }}
form={editGoodsForm}
>
<Form.Item name="id" hidden={true}>
@@ -265,12 +299,12 @@ const GoodsConfig = (props) => {
</Form.Item>

<Form.Item name="name" label="商品名称" rules={[{ required: true }]}>
<Input disabled={!isCreate || props.goodsConfig.id} />
<Input />
</Form.Item>

<div className={indexStyles.add_row_content}>
<Form.Item name="goodsUintId" label="商品单位" rules={[{ required: true }]}>
<Select style={{ width: '75%' }} disabled={!isCreate || props.goodsConfig.id} >
<Select style={{ width: '75%' }} >
{
goodsUnit.map((item, index) => {
return (
@@ -282,12 +316,12 @@ const GoodsConfig = (props) => {
}
</Select>
</Form.Item>
<Button disabled={!isCreate || props.goodsConfig.id} type="primary" className={indexStyles.add_row_btn} onClick={() => setCreateUnitModal(true)}>添加单位</Button>
<Button type="primary" className={indexStyles.add_row_btn} onClick={() => setCreateUnitModal(true)}>添加单位</Button>
</div>

<div className={indexStyles.add_row_content}>
<Form.Item name="parentTypeID" label="商品大类" rules={[{ required: true }]}>
<Select style={{ width: '75%' }} disabled={!isCreate || props.goodsConfig.id} >
<Select style={{ width: '75%' }}>
{
goodsBigTypes.map((item, index) => {
return (
@@ -299,12 +333,12 @@ const GoodsConfig = (props) => {
}
</Select>
</Form.Item>
<Button disabled={!isCreate || props.goodsConfig.id} type="primary" className={indexStyles.add_row_btn} onClick={() => setCreateBigTypeModal(true)}>添加大类</Button>
<Button type="primary" className={indexStyles.add_row_btn} onClick={() => setCreateBigTypeModal(true)}>添加大类</Button>
</div>

<div className={indexStyles.add_row_content}>
<Form.Item name="goodsTypeId" label="商品小类" rules={[{ required: true }]}>
<Select style={{ width: '75%' }} disabled={!isCreate || props.goodsConfig.id}>
<Form.Item name="goodsTypeId" label="商品小类" rules={[{ required: true }]}>
<Select style={{ width: '75%' }} >
{
goodsSmallTypes.map((item, index) => {
return (
@@ -316,15 +350,15 @@ const GoodsConfig = (props) => {
}
</Select>
</Form.Item>
<Button type="primary" disabled={!isCreate || props.goodsConfig.id} className={indexStyles.add_row_btn} onClick={() => setCreateSmallTypeModal(true)}>添加小类</Button>
<Button type="primary" className={indexStyles.add_row_btn} onClick={() => setCreateSmallTypeModal(true)}>添加小类</Button>
</div>

<Form.Item name="price" label="商品价格" rules={[{ required: true }]}>
<InputNumber placeholder="价格" min={0} style={{ width: '100%' }} disabled={!isCreate || props.goodsConfig.id} />
<InputNumber placeholder="价格" min={0} style={{ width: '100%' }} />
</Form.Item>

<Form.Item name="vipPrice" label="会员价格">
<InputNumber placeholder="会员价" min={0} style={{ width: '100%' }} disabled={!isCreate || props.goodsConfig.id} />
<InputNumber placeholder="会员价" min={0} style={{ width: '100%' }} />
</Form.Item>

<Form.Item
@@ -333,7 +367,7 @@ const GoodsConfig = (props) => {
defaultValue={0}
rules={[{ required: true, message: '请选择商品属性' }]}
>
<Select placeholder="请选择商品属性" disabled={!isCreate || props.goodsConfig.id} >
<Select placeholder="请选择商品属性" >
<OptGroup>
<Select.Option value={0}>单品</Select.Option>
<Select.Option value={1}>套餐</Select.Option>
@@ -347,7 +381,7 @@ const GoodsConfig = (props) => {
defaultValue={0}
rules={[{ required: true, message: '请选择状态' }]}
>
<Select placeholder="请选择状态" disabled={!isCreate || props.goodsConfig.id} >
<Select placeholder="请选择状态" >
<OptGroup>
<Select.Option value={0}>正常</Select.Option>
<Select.Option value={1}>停用</Select.Option>
@@ -356,7 +390,7 @@ const GoodsConfig = (props) => {
</Form.Item>

<Form.Item name="remark" label="备注">
<Input disabled={!isCreate || props.goodsConfig.id} />
<Input />
</Form.Item>

<Form.Item name="imgUrl" hidden={true} >
@@ -369,83 +403,75 @@ const GoodsConfig = (props) => {
{...uploadProp}
>

{props.goodsConfig.imgUrl ? <img src={props.goodsConfig.imgUrl} alt="avatar" style={{ width: '100%' }} /> : <Button disabled={!isCreate || props.goodsConfig.id} icon={<UploadOutlined />}>上传</Button>}
{currentOption.imgUrl ? <img src={currentOption.imgUrl} alt="avatar" style={{ width: '100%' }} /> : <Button icon={<UploadOutlined />}>上传</Button>}

</Upload>
</Form.Item>

<Form.Item label="是否称重" name="isWeigh" valuePropName="checked" initialValue='false' >
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked='false' disabled={!isCreate || props.goodsConfig.id} />
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked='false' />
</Form.Item>

<Form.Item>
<StepsButton current={props.current} steps={props.steps} prev={props.prev}></StepsButton>
<Button type="primary" htmlType="submit">
确定
</Button>
</Form.Item>
</Form>
</Modal>

{
!isCreate && <ProTable
headerTitle="商品列表"
rowKey="id"
search={{
labelWidth: 120,
}}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
request={async (params) => {
var goodsData = [];
if (params.goodsTypeId != undefined) {
params.goodsTypeId = goodsTypes[params.goodsTypeId].goodsTypeId;
}
var total = 0;
await quickAPI.GetgoodsList(params).then((r) => {
goodsData = r.data.data;
total = r.data.total;
});
return {
data: goodsData,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
type: 'radio',
onChange: (selectedRowKeys, selectedRows) => {
setSelectRowKeys(selectedRowKeys);
setSelectedRows(selectedRows);
if (selectedRows.length > 0) {
props.onFinishForm('goodsConfig', selectedRows[0]);
editGoodsForm.setFieldsValue(selectedRows[0]);
} else {
let emptyObj = {
id: "",
name: "",
goodsUintId: "",
price: 0,
vipPrice: 0,
parentTypeID: "",
goodsTypeId: "",
goodsAttribute: 0,
status: 0,
imgUrl: "",
isWeigh: ""
}
editGoodsForm.setFieldsValue(emptyObj);
props.onFinishForm('goodsConfig', emptyObj);
}
},
selectedRowKeys: selectedRowKeys
}}
/>
}
</div>
<ProTable
actionRef={actionRef}
style={{ width: '100%' }}
headerTitle="商品列表"
rowKey="id"
search={{
labelWidth: 120,
}}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
request={async (params) => {
var goodsData = [];
if (params.goodsTypeId != undefined) {
params.goodsTypeId = goodsTypes[params.goodsTypeId].goodsTypeId;
}
var total = 0;
await quickAPI.GetgoodsList(params).then((r) => {
goodsData = r.data.data;
total = r.data.total;
});
return {
data: goodsData,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
type: 'checkbox',
onChange: (selectedRowKeys, selectedRows) => {
setSelectRowKeys(selectedRowKeys);
},
selectedRowKeys: selectedRowKeys
}}
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => {
editGoodsForm.resetFields();
setCurrentOption({ id: '' });
setIsShowModal(true);
}}>
新建
</Button>
]}
/>

<StepsButton current={props.current} steps={props.steps} prev={props.prev} next={props.next}></StepsButton>

<Modal
title='新建商品单位'


+ 2
- 1
src/pages/quickStart/components/StepsButton/index.jsx View File

@@ -3,6 +3,7 @@ import styles from "./index.less";


const StepsButton = (props) => {
return <div className={styles.steps_btns}>
{props.current > 0 && (
<Button
@@ -16,7 +17,7 @@ const StepsButton = (props) => {
)}

{props.current < props.steps.length - 1 && (
<Button type="primary" htmlType="submit">
<Button type="primary" htmlType="submit" onClick={props.next}>
下一步:{props.steps[props.current + 1]}
</Button>
)}


+ 133
- 137
src/pages/quickStart/components/StoreConfig/index.jsx View File

@@ -1,14 +1,17 @@
import React, { useState, useEffect, useRef } from 'react';
import { Form, Input, Select, InputNumber, TreeSelect, message, Radio } from 'antd';
import { Form, Input, Select, InputNumber, TreeSelect, message, Modal, Button } from 'antd';
import { ProTable } from '@ant-design/pro-table';
import StepsButton from "../StepsButton";
import quickAPI from "../../service";
import styles from "./index.less";
import { PlusOutlined } from '@ant-design/icons';

const key = 'message';

const StoreConfig = (props) => {

const [currentPage, setCurrentPage] = useState(0);
const [pageSize, setPageSize] = useState(5);
const [pageSize, setPageSize] = useState(10);

const { TextArea } = Input;
const { Option, OptGroup } = Select;
@@ -19,48 +22,34 @@ const StoreConfig = (props) => {
const [payTypeList, setPayTypeList] = useState([]);

//提交表单
const onFinishSubmit = (formValues) => {
props.onFinishForm('storeConfig', formValues, true);
}

const [isCreateStore, setIsCreateStore] = useState(props.storeConfig.id ? false : true);

const optionsWithDisabled = [
{
label: '新建组织',
value: true,
},
{
label: '选择组织',
value: false,
}
];

const onChangeState = ({ target: { value } }) => {
storeForm.resetFields();
setIsCreateStore(value);
setSelectedRows([])
setSelectRowKeys([]);
if (value) {
let emptyStore = {
id: "",
code: "",
name: "",
pid: "",
type: 0,
payTemplateId: "",
store_Addr: "",
store_Loc: "",
tel: "",
sort: 1,
remark: ""
const onFinishSubmit = async (formValues) => {
message.loading('正在配置', key);
if (formValues.id) {
const response = await quickAPI.UpdateOrg(formValues);
if (response.succeeded) {
message.success('修改成功');
setIsShowModal(false);
actionRef.current.reload();
} else {
message.error(response.errors || '修改出错');
}
} else {
const response = await quickAPI.AddOrg(formValues);
if (response.succeeded) {
message.success('添加成功');
actionRef.current.reload();
setIsShowModal(false);
} else {
message.error(response.errors || '添加成出错');
}
props.onFinishForm('storeConfig', emptyStore);
storeForm.setFieldsValue(emptyStore);
setSelectedRows([])
}
message.destroy(key);
}

//当前操作的门店对象
const [currentOption, setCurrentOption] = useState({ id: '' });
//是否显示 新增/编辑 菜谱弹窗
const [isShowModal, setIsShowModal] = useState(false);
const actionRef = useRef();

//获取组织树
@@ -105,6 +94,10 @@ const StoreConfig = (props) => {
title: '组织名称',
dataIndex: 'name',
},
{
title: '组织编码',
dataIndex: 'code',
},
{
title: '组织类型',
dataIndex: 'type',
@@ -122,62 +115,52 @@ const StoreConfig = (props) => {
text: '加盟店',
},
},
},
{
title: '电话',
dataIndex: 'tel',
hideInSearch: true,
},
{
title: '排序',
dataIndex: 'sort',
valueType: 'digit',
hideInSearch: true,
},
{
title: '描述',
dataIndex: 'remark',
valueType: 'textarea',
hideInSearch: true,
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key="config"
onClick={() => {
setCurrentOption(record);
setIsShowModal(true);
storeForm.setFieldsValue(record);
}}>更新</a>
]
}
];

const [selectedRows, setSelectedRows] = useState(props.storeConfig.id ? [props.storeConfig] : []);
const [selectedRowKeys, setSelectRowKeys] = useState(props.storeConfig.id ? [props.storeConfig.id] : []);

/**
* 选择组织
*/
const rowSelection = {
onChange: (selectedRowKeys, selectedRows) => {
if (selectedRows.length > 0) {
props.onFinishForm('storeConfig', selectedRows[0]);
storeForm.setFieldsValue(selectedRows[0]);
setSelectedRows(selectedRows);
setSelectRowKeys(selectedRowKeys);
} else {
let emptyStore = {
id: "",
code: "",
name: "",
pid: "",
type: 0,
payTemplateId: "",
store_Addr: "",
store_Loc: "",
tel: "",
sort: 1,
remark: ""
}
props.onFinishForm('storeConfig', emptyStore);
storeForm.setFieldsValue(emptyStore);
setSelectedRows([])
setSelectRowKeys([]);
}
},
selectedRowKeys: selectedRowKeys
};
const [selectedRowKeys, setSelectRowKeys] = useState([]);

useEffect(() => {
if (props.storeConfig.id) {
setSelectRowKeys([props.storeConfig.id]);
}
onFetchOrgTree();
getPayTemplateList();
}, []);

return <div>
<div className={styles.choose_store_state}>
<Radio.Group
options={optionsWithDisabled}
onChange={onChangeState}
value={isCreateStore}
optionType="button"
buttonStyle="solid"
/>
</div>

<div className={styles.store_config_container}>
return <>
<Modal width={600} title={currentOption.id ? '编辑组织架构' : '新增组织架构'} visible={isShowModal} footer={false} onCancel={() => setIsShowModal(false)}>
<Form
form={storeForm}
layout="horizontal"
@@ -185,20 +168,18 @@ const StoreConfig = (props) => {
labelCol={{
span: 4,
}}
initialValues={props.storeConfig}
style={{ width: '600px', marginRight: '50px' }}
onFinish={onFinishSubmit}
>
<Form.Item name="id" hidden={true}>
<Input disabled={props.storeConfig.id || !isCreateStore} />
<Input />
</Form.Item>

<Form.Item name="code" label="组织编码" rules={[{ required: true, max: 64 }]}>
<Input placeholder="请输入组织编码" disabled={props.storeConfig.id || !isCreateStore} />
<Input placeholder="请输入组织编码" />
</Form.Item>

<Form.Item name="name" label="组织名称" rules={[{ required: true, max: 64 }]}>
<Input placeholder="请输入名称" disabled={props.storeConfig.id || !isCreateStore} />
<Input placeholder="请输入名称" />
</Form.Item>

<Form.Item name="pid" label="上级名称" rules={[{ required: true }]}>
@@ -208,7 +189,6 @@ const StoreConfig = (props) => {
treeData={orgTree}
placeholder="请选择上级名称"
treeDefaultExpandAll
disabled={props.storeConfig.id || !isCreateStore}
/>
</Form.Item>

@@ -217,7 +197,7 @@ const StoreConfig = (props) => {
label="组织类型"
rules={[{ required: true, message: '请选择组织类型' }]}
>
<Select placeholder="请选择机构类型" disabled={props.storeConfig.id || !isCreateStore}>
<Select placeholder="请选择机构类型" >
<OptGroup>
<Select.Option value={0}>机构</Select.Option>
<Select.Option value={1}>配送中心</Select.Option>
@@ -231,7 +211,7 @@ const StoreConfig = (props) => {
name="payTemplateId"
label="支付方式"
>
<Select placeholder="请选择支付方式" disabled={props.storeConfig.id || !isCreateStore}>
<Select placeholder="请选择支付方式" >
{
payTypeList?.map(item => {
return <Option value={item.id} key={item.id}>{item.name}</Option>
@@ -241,68 +221,84 @@ const StoreConfig = (props) => {
</Form.Item>

<Form.Item label={'店铺地址'} name="store_Addr" rules={[{ required: true, max: 100 }]}>
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" disabled={props.storeConfig.id || !isCreateStore} />
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" />
</Form.Item>

<Form.Item label={'店铺坐标'} name="store_Loc" rules={[{
required: true, max: 100, pattern: /^[-\+]?\d+(\.\d+)\,[-\+]?\d+(\.\d+)$/,
message: '经纬度格式不对'
}]}>
<Input placeholder="104.070734,30.575041" disabled={props.storeConfig.id || !isCreateStore} />
<Input placeholder="104.070734,30.575041" />
</Form.Item>

<Form.Item name="tel" label="电话" rules={[{ max: 20 }]}>
<Input placeholder="请输入联系电话" disabled={props.storeConfig.id || !isCreateStore} />
<Input placeholder="请输入联系电话" />
</Form.Item>

<Form.Item name="sort" label="排序">
<InputNumber min={1} step={1} precision={0} disabled={props.storeConfig.id || !isCreateStore} />
<InputNumber min={1} step={1} precision={0} />
</Form.Item>

<Form.Item name="remark" label="备注">
<TextArea rows={4} rules={[{ max: 500 }]} disabled={props.storeConfig.id || !isCreateStore} />
<TextArea rows={4} rules={[{ max: 500 }]} />
</Form.Item>

<Form.Item>
<StepsButton current={props.current} steps={props.steps}></StepsButton>
<Button type="primary" htmlType="submit">
确定
</Button>
</Form.Item>
</Form>
{
!isCreateStore && <ProTable
headerTitle="组织列表"
actionRef={actionRef}
rowKey="id"
style={{ width: '600px' }}
rowSelection={{
type: 'radio',
...rowSelection,
}}
request={async (params) => {
let UserData = [];
let total = 0;
await quickAPI.getpage(params).then((r) => {
UserData = r.data.data;
total = r.data.total;
});
return {
data: UserData,
success: true,
total: total,
};
}}
columns={columns}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
/>
}
</div>
</div>
</Modal>

<ProTable
search={false}
style={{ width: '100%' }}
headerTitle="组织列表"
actionRef={actionRef}
rowKey="id"
rowSelection={{
type: 'radio',
onChange: (selectedRowKeys, selectedRows) => {
setSelectRowKeys(selectedRowKeys);
props.onSelectedChange('storeConfig', selectedRows[0]);
},
selectedRowKeys: selectedRowKeys
}}
request={async (params) => {
let UserData = [];
let total = 0;
await quickAPI.getpage(params).then((r) => {
UserData = r.data.data;
total = r.data.total;
});
return {
data: UserData,
success: true,
total: total,
};
}}
columns={columns}
pagination={{
current: currentPage,
pageSize: pageSize,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
}}
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => {
storeForm.resetFields();
setCurrentOption({ id: '' });
setIsShowModal(true);
}}>
新建
</Button>
]}
/>
<StepsButton current={props.current} steps={props.steps} prev={props.prev} next={props.next}></StepsButton>
</>
}

export default StoreConfig;

+ 23
- 44
src/pages/quickStart/index.jsx View File

@@ -16,35 +16,9 @@ const QuickStart = () => {

const [current, setCurrent] = useState(0);
const [quickStartObj, setQuickStartObj] = useState({
storeConfig: {
id: "",
code: "",
name: "",
pid: "",
type: 0,
payTemplateId: "",
store_Addr: "",
store_Loc: "",
tel: "",
sort: 1,
remark: ""
},
deviceConfig: {
id: "",
deviceName: "",
deviceTypeKey: "",
orgId: "",
deviceTypeId: "",
deviceLoc: "",
status: 0,
materialQuantity: 1,
deviceAddr: ""
},
foodMenuConfig: {
id: "",
code: "",
name: ""
},
storeConfig: {},
deviceConfig: {},
foodMenuConfig: [],
goodsConfig: {
id: "",
name: "",
@@ -82,16 +56,21 @@ const QuickStart = () => {
});

//每个页面点击下一步时触发
const onFinishForm = (configType, payload, isNext = false) => {
const onSelectedChange = (configType, payload) => {
const tempQuick = JSON.parse(JSON.stringify(quickStartObj));
const findKey = Object.keys(tempQuick).find(item => item === configType);
if (findKey) {
tempQuick[findKey] = payload;
setQuickStartObj(tempQuick);
if (isNext) {
next();
}
switch (configType) {
case 'storeConfig':
tempQuick.storeConfig = payload;
break;
case 'deviceConfig':
tempQuick.deviceConfig = payload;
break;
case 'foodMenuConfig':
console.log('payload>>>>', payload);
tempQuick.foodMenuConfig = payload;
break;
}
setQuickStartObj(tempQuick);
}

//下一步
@@ -107,13 +86,13 @@ const QuickStart = () => {
const stepsText = ['门店配置', '设备配置', '菜谱配置', '商品配置', '配方配置', '物料配置', '确认配置'];

const stepsContent = [
<StoreConfig storeConfig={quickStartObj.storeConfig} current={current} steps={stepsText} onFinishForm={onFinishForm}></StoreConfig>,
<DeviceConfig deviceConfig={quickStartObj.deviceConfig} current={current} steps={stepsText} onFinishForm={onFinishForm} prev={prev}></DeviceConfig>,
<FoodMenuConfig foodMenuConfig={quickStartObj.foodMenuConfig} current={current} steps={stepsText} onFinishForm={onFinishForm} prev={prev}></FoodMenuConfig>,
<GoodsConfig goodsConfig={quickStartObj.goodsConfig} current={current} steps={stepsText} onFinishForm={onFinishForm} prev={prev}></GoodsConfig>,
<BomConfig bomConfig={quickStartObj.bomConfig} current={current} steps={stepsText} onFinishForm={onFinishForm} prev={prev}></BomConfig>,
<MaterialConfig materialConfig={quickStartObj.materialConfig} current={current} steps={stepsText} onFinishForm={onFinishForm} prev={prev}></MaterialConfig>,
<ConfirmConfig quickStartObj={quickStartObj} current={current} steps={stepsText} onFinishForm={onFinishForm} prev={prev}></ConfirmConfig>
<StoreConfig storeConfig={quickStartObj.storeConfig} current={current} steps={stepsText} next={next} onSelectedChange={onSelectedChange}></StoreConfig>,
<DeviceConfig deviceConfig={quickStartObj.deviceConfig} current={current} steps={stepsText} prev={prev} next={next} onSelectedChange={onSelectedChange} ></DeviceConfig>,
<FoodMenuConfig foodMenuConfig={quickStartObj.foodMenuConfig} current={current} steps={stepsText} prev={prev} next={next} onSelectedChange={onSelectedChange}></FoodMenuConfig>,
<GoodsConfig goodsConfig={quickStartObj.goodsConfig} current={current} steps={stepsText} onSelectedChange={onSelectedChange} prev={prev}></GoodsConfig>,
<BomConfig bomConfig={quickStartObj.bomConfig} current={current} steps={stepsText} onSelectedChange={onSelectedChange} prev={prev}></BomConfig>,
<MaterialConfig materialConfig={quickStartObj.materialConfig} current={current} steps={stepsText} onSelectedChange={onSelectedChange} prev={prev}></MaterialConfig>,
<ConfirmConfig quickStartObj={quickStartObj} current={current} steps={stepsText} onSelectedChange={onSelectedChange} prev={prev}></ConfirmConfig>
];

useEffect(() => {


+ 90
- 0
src/pages/quickStart/service.js View File

@@ -8,6 +8,34 @@ export default {
});
},

/**
* 添加组织架构
* @param {*} params
* @returns
*/
AddOrg(params) {
return request('/kitchen/api/sysOrg/add', {
method: 'POST',
data: {
...params,
},
});
},

/**
* 更新组织架构信息
* @param {*} params
* @returns
*/
UpdateOrg(params) {
return request('​/kitchen/api​/sysOrg​/edit', {
method: 'POST',
data: {
...params,
},
});
},

//获取支付配置
getPayTemplateList() {
return request(`/kitchen/api/paytemplate/getPayTemplatePageList`, {
@@ -16,6 +44,22 @@ export default {
});
},

/** 添加设备 */
AddDeviceInfo(data) {
return request(`/kitchen/api/Device/AddDeviceInfo`, {
method: 'POST',
data: data,
});
},

/** 修改设备 */
UpdateDeviceInfo(data) {
return request(`/kitchen/api/Device/UpdateDeviceInfo`, {
method: 'POST',
data: data,
});
},

/** 获取设备类型 */
GetDicList(TypeCode) {
return request(`/kitchen/api/dict-data/dic-list/${TypeCode}`, {
@@ -79,6 +123,52 @@ export default {
});
},

/**
* 添加菜谱
* @param {*} data
* @returns
*/
AddFoodMenu(data) {
return request(`/kitchen/api/FoodMenu/AddUpdateFoodMenu`, {
method: 'POST',
data: data,
});
},

/**
* 更新菜谱
* @param {*} data
* @returns
*/
UpdateFoodMenu(data) {
return request(`/kitchen/api/FoodMenu/AddUpdateFoodMenu`, {
method: 'POST',
data: data,
});
},

/**
* 添加商品
*/
AddGoods(data) {
return request(`/kitchen/api/goods`, {
method: 'POST',
data: data,
});
},

/**
*
* @param {*} data
* @returns
*/
UpdateGoods(data) {
return request(`/kitchen/api/goods`, {
method: 'PUT',
data: data,
});
},

/**
* 获取商品单位
* @param {*} data


Loading…
Cancel
Save