From 4e97415cb80ae4e7cbece0294c2d2fbb04972ba1 Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Fri, 30 Sep 2022 14:40:45 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E9=80=9F=E5=BC=80=E5=A7=8B=20?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/ConfirmConfig/index.jsx | 155 +++++++-----------
.../components/StepsButton/index.jsx | 54 +++++-
src/pages/quickStart/index.jsx | 57 +++++--
src/pages/quickStart/service.js | 8 +-
4 files changed, 160 insertions(+), 114 deletions(-)
diff --git a/src/pages/quickStart/components/ConfirmConfig/index.jsx b/src/pages/quickStart/components/ConfirmConfig/index.jsx
index 259235b..24ef9d5 100644
--- a/src/pages/quickStart/components/ConfirmConfig/index.jsx
+++ b/src/pages/quickStart/components/ConfirmConfig/index.jsx
@@ -1,121 +1,86 @@
import React, { useState, useEffect, useRef } from 'react';
-
+import ReactDOM from 'react-dom';
+import { OrganizationGraph } from '@ant-design/graphs';
+import { nanoid } from 'nanoid'
import quickAPI from "../../service";
import indexStyles from "../../index.less";
import { message } from 'antd';
-
/**
* 确认配置
* @returns
*/
const ConfirmConfig = (props) => {
- const data = {
- id: 'root',
+ const [orgData, setOrgData] = useState({
+ // 门店
+ id: props.storeConfig.id,
value: {
- name: '股东会',
+ name: props.storeConfig.name,
},
+ // 设备
children: [
{
- id: 'joel',
+ id: props.deviceConfig.id,
value: {
- name: 'Joel Alan',
+ name: props.deviceConfig.deviceName,
},
- children: [
- {
- id: 'c1',
- value: {
- name: 'c1',
- },
- children: [
- {
- id: 'c1-1',
- value: {
- name: 'c1-1',
- },
- },
- {
- id: 'c1-2',
- value: {
- name: 'c1-2',
- },
- children: [
- {
- id: 'c1-2-1',
- value: {
- name: 'c1-2-1',
- },
- },
- {
- id: 'c1-2-2',
- value: {
- name: 'c1-2-2',
- },
- },
- ],
- },
- ],
- },
- {
- id: 'c2',
- value: {
- name: 'c2',
- },
+ //菜谱
+ children: []
+ }
+ ]
+ });
+
+
+ const initOrgData = () => {
+ const tempData = JSON.parse(JSON.stringify(orgData));
+ props.foodMenuConfig.forEach((foodMenu, foodMenuIndex) => {
+ tempData.children[0].children[foodMenuIndex] = {
+ id: nanoid(),
+ value: {
+ name: foodMenu.name,
+ },
+ children: []
+ }
+ foodMenu?.goodsConfig.forEach((foodItem, foodIndex) => {
+ tempData.children[0].children[foodMenuIndex].children[foodIndex] = {
+ id: nanoid(),
+ value: {
+ name: foodItem.name,
},
- {
- id: 'c3',
+ children: []
+ }
+ foodItem?.bomConfig.forEach((bomItem, bomIndex) => {
+ tempData.children[0].children[foodMenuIndex].children[foodIndex].children[bomIndex] = {
+ id: nanoid(),
value: {
- name: 'c3',
+ name: bomItem.name,
},
- children: [
- {
- id: 'c3-1',
- value: {
- name: 'c3-1',
- },
- },
- {
- id: 'c3-2',
- value: {
- name: 'c3-2',
- },
- children: [
- {
- id: 'c3-2-1',
- value: {
- name: 'c3-2-1',
- },
- },
- {
- id: 'c3-2-2',
- value: {
- name: 'c3-2-2',
- },
- },
- {
- id: 'c3-2-3',
- value: {
- name: 'c3-2-3',
- },
- },
- ],
- },
- {
- id: 'c3-3',
- value: {
- name: 'c3-3',
- },
- },
- ],
- },
- ],
- },
- ],
- };
+ children: []
+ }
+ bomItem?.materialConfig.forEach((materialItem, materialIndex) => {
+ tempData.children[0].children[foodMenuIndex].children[foodIndex].children[bomIndex].children[materialIndex] = {
+ id: nanoid(),
+ value: {
+ name: materialItem.name,
+ }
+ }
+ });
+ });
+ });
+ });
+ setOrgData(tempData);
+ }
+
+ useEffect(() => {
+ initOrgData();
+ }, []);
+
+
return <>
+