diff --git a/projects/admin/src/app/pages/dish/dish.component.html b/projects/admin/src/app/pages/dish/dish.component.html index 303407a..85f6bcf 100644 --- a/projects/admin/src/app/pages/dish/dish.component.html +++ b/projects/admin/src/app/pages/dish/dish.component.html @@ -115,7 +115,7 @@ - + 名称 diff --git a/projects/cdk/src/services/api.service.ts b/projects/cdk/src/services/api.service.ts index c7f490c..c9d1cdf 100644 --- a/projects/cdk/src/services/api.service.ts +++ b/projects/cdk/src/services/api.service.ts @@ -14,6 +14,7 @@ import { AdminAccountDTO, OrgConfigDTO, CategoryDTO, + NutrientDTO, } from "@cdk/public-api"; export const PROJECT_NAME = new InjectionToken("projectName"); @@ -34,6 +35,24 @@ export class ApiService { globalEnum!: GlobalEnum; + // 能量、蛋白质、脂肪、碳水化合物、糖、钠/食盐、钙、铁、锌、维生素A、维生素B1、维生素B2、维生素C、膳食纤维 + nutrientSort = new Map([ + ["energy", { sort: 0 }], + ["protein", { sort: 1 }], + ["fat", { sort: 2 }], + ["carbs", { sort: 3 }], + ["sugar", { sort: 4 }], + ["sodium", { sort: 5 }], + ["calcium", { sort: 6 }], + ["iron", { sort: 7 }], + ["zinc", { sort: 8 }], + ["va", { sort: 9 }], + ["vb1", { sort: 10 }], + ["vb2", { sort: 11 }], + ["vc", { sort: 12 }], + ["fiber", { sort: 13 }], + ]); + initAccount() { try { const stragedAccount = localStorage.getItem(this.accountKey); @@ -57,6 +76,12 @@ export class ApiService { return v.map((i) => ({ label: i.key, value: i.value })); } + private _sortNutrient(n: NutrientDTO[]) { + return n.map((i) => { + return { ...i, ...this.nutrientSort.get(i.key) }; + }); + } + getAllEnum(force?: boolean): Observable { if (this.globalEnum && !force) { return of(this.globalEnum); @@ -67,6 +92,7 @@ export class ApiService { ...res.body, mealType: this._formatEnum(res.body.mealType), menuStatus: this._formatEnum(res.body.menuStatus), + nutrient: this._sortNutrient(res.body.nutrient), }; }), tap((r) => { @@ -96,6 +122,14 @@ export class ApiService { ); } + getOrgInfo() { + return this.http.get("/api/vender/info").pipe( + tap((res) => { + this.account["vender"] = res.body; + }) + ); + } + getOrgConfig() { return this.http.get>("/api/vender/config"); } @@ -347,7 +381,26 @@ export class ApiService { getDishLabel(ids: (string | number)[]) { const query = Utils.objectStringify({ ids }); - return this.http.get>(`/api/dish/label?${query}`); + return this.http.get>(`/api/dish/label?${query}`).pipe( + map((res) => { + return { + ...res, + body: res.body.map((i) => { + return { + ...i, + component: (i.component as AnyObject[]) + .map((c) => { + return { + ...c, + ...this.nutrientSort.get(c["key"]), + }; + }) + .sort((a, b) => a["sort"]! - b["sort"]!), + }; + }), + }; + }) + ); } saveDish(v: AnyObject) { diff --git a/projects/cdk/src/types/index.ts b/projects/cdk/src/types/index.ts index c221cd0..692a70c 100644 --- a/projects/cdk/src/types/index.ts +++ b/projects/cdk/src/types/index.ts @@ -6,6 +6,13 @@ export type DecText = number | string; export type Augmented = O & AnyObject; +export type NutrientInterface = { + key: string; + measurement: string; + nrv: number; + value: string; +}; + export type OptionItemInterface = Augmented<{ label: string; value: string; diff --git a/projects/client/src/app/pages/dashboard/dashboard.component.html b/projects/client/src/app/pages/dashboard/dashboard.component.html index 17f7322..de64d73 100644 --- a/projects/client/src/app/pages/dashboard/dashboard.component.html +++ b/projects/client/src/app/pages/dashboard/dashboard.component.html @@ -1,74 +1,159 @@ - -
-
- 开始 + +
+
+ 基础设计及菜品管理
-
- 进入【配餐设置】,修改三餐摄入能量、营养比例 - -
-
- 进入【菜品管理】,新增/编辑菜品,并打印营养标签 - +
+
+
+
1
+
+ 进入【配餐设置】,修改三餐摄入能量、营养比例 +
+
+
+
+
+
2
+
+ 进入[菜品管理],新增/编辑菜品并保存 +
+
+
+
+
+
3
+
+ 菜品管理列表找到所需菜品,下载[营养标签] +
+
+
-
- 进入【食谱管理-食谱库】,创建食谱 - +
+ + +
+
+ 创建食谱
-
- -
- 1、填写食谱名称 +
+
+
+
4
+
+ 进入[食谱管理-食谱库],创建食谱 +
+
-
- 2、选择营养标准 +
+
+
5
+
+

+ 配置食谱基础信息: +

+
    +
  • + 填写食谱名称 +
  • +
  • + 选择营养标准 +
  • +
  • + 选择适用月份 +
  • +
  • + 选择配餐天数 +
  • +
  • + 选择配餐餐次 +
  • +
+
+
-
- 3、选择适用月份 +
+
+
6
+
+

按实际情况设置菜品:

+
    +
  • + 设置每餐菜品及重量 +
  • +
  • + 根据营养分析实时调整菜品 +
  • +
+
+
-
- 4、选择配餐天数 +
+
+
7
+
+

+ 完成食谱配置后进行食谱分析并确认食谱: +

+
    +
  • + 点击右上角[食谐预览]完成查看食谱全貌 +
  • +
  • + 确认食谱应用分析结果 +
  • +
+
+
-
- 5、选择配餐餐次 +
+
+
8
+
+ 保存食谱 +
+
-
- -
- 1、按餐次添加菜品及重量 -
-
- 2、根据营养分析实时调整菜品 -
+
+ + +
+
+ 食谱审核及发布
-
- -
- 1、点击右上角【食谱预览】完成查看食谱全貌 +
+
+
+
9
+
+ 在食谱列表中找到食谱,发起审核 +
+
-
- 2、确认食谱应用分析结果 +
+
+
10
+
+ 等待审核通过后返回食谱列表查看进行发布 +
+
+
+
+
+
11
+
+ 填写发布时间等信息确认发布 +
+
-
-
- - 保存食谱 -
-
- - 在食谱库列表中发起审核 -
-
- - 等待审核通过后发布食谱 -
-
- - 结束
+ + + + \ No newline at end of file diff --git a/projects/client/src/app/pages/dashboard/dashboard.component.less b/projects/client/src/app/pages/dashboard/dashboard.component.less index 86e5bdf..b3de00f 100644 --- a/projects/client/src/app/pages/dashboard/dashboard.component.less +++ b/projects/client/src/app/pages/dashboard/dashboard.component.less @@ -1,39 +1,42 @@ -.flow { - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; +.card { + padding: 24px; + border-radius: 6px; + background-color: #e9f1fe; - .item { - width: 256px; - margin-bottom: 48px; - padding: 24px; - position: relative; - border-radius: 4px; - border: 1px solid #333; - text-align: center; + .icon { + display: flex; + align-items: center; + justify-content: center; + width: 40px; + height: 40px; + border-radius: 50%; + background-color: #2e7ef8; + color: #fff; + font-size: 26px; + font-weight: bold; + margin-right: 12px; + } - &:not(:last-child):after { - content: ''; - width: 1px; - height: 48px; - position: absolute; - bottom: -48px; - left: 50%; - transform: translateX(-50%); - background-color: #333; - } + p { + margin-bottom: 6px; + } - &.ellipse { - width: 180px; - border-radius: 50%; - } + .ul { + padding-left: 20px; - .arrow { - position: absolute; - left: 50%; - top: -12px; - transform: translateX(-50%); + li { + list-style: disc !important; } } +} + +.flow-title { + width: 100px; + margin-right: 12px; + font-size: 18px; + font-weight: bold; + + &+div { + flex: 1; + } } \ No newline at end of file diff --git a/projects/client/src/app/pages/data-vis/data-vis.component.ts b/projects/client/src/app/pages/data-vis/data-vis.component.ts index 597120c..db8e773 100644 --- a/projects/client/src/app/pages/data-vis/data-vis.component.ts +++ b/projects/client/src/app/pages/data-vis/data-vis.component.ts @@ -42,9 +42,12 @@ export class DataVisComponent implements AfterViewInit { logo = ""; ngOnInit(): void { - const account = this.api.account; - this.orgName = account?.vender?.name ?? ""; - this.logo = account?.vender?.icon ?? ""; + this.api.getOrgInfo().subscribe((res) => { + const account = this.api.account; + + this.orgName = account?.vender?.name ?? ""; + this.logo = account?.vender?.icon ?? ""; + }); interval(1000) .pipe(takeUntil(this.destroy$)) diff --git a/projects/client/src/app/pages/dish/dish.component.html b/projects/client/src/app/pages/dish/dish.component.html index 0c48227..78e10f6 100644 --- a/projects/client/src/app/pages/dish/dish.component.html +++ b/projects/client/src/app/pages/dish/dish.component.html @@ -122,7 +122,7 @@ - + 名称 diff --git a/projects/client/src/app/pages/system/org-info/org-info.component.ts b/projects/client/src/app/pages/system/org-info/org-info.component.ts index 6ddab24..cc03e3a 100644 --- a/projects/client/src/app/pages/system/org-info/org-info.component.ts +++ b/projects/client/src/app/pages/system/org-info/org-info.component.ts @@ -56,18 +56,19 @@ export class OrgInfoComponent implements OnInit { if (Utils.validateFormGroup(e.formGroup)) { const res = await lastValueFrom(this.api.saveOrg({ ...e.formGroup.value, venderId: this.account.vender.id })); this.msg.success(res.desc); - localStorage.setItem( - this.api.accountKey, - JSON.stringify({ - ...this.account, - vender: { - ...this.account.vender, - ...e.formGroup.value, - venderId: this.account.vender.id, - }, - }) - ); - window.location.reload(); + // localStorage.setItem( + // this.api.accountKey, + // JSON.stringify({ + // ...this.account, + // vender: { + // ...this.account.vender, + // ...e.formGroup.value, + // venderId: this.account.vender.id, + // }, + // }) + // ); + // window.location.reload(); + this.api.getOrgInfo().subscribe(() => {}); return true; } return false;