diff --git a/projects/admin/src/app/app.module.ts b/projects/admin/src/app/app.module.ts index f105f87..c034c9a 100644 --- a/projects/admin/src/app/app.module.ts +++ b/projects/admin/src/app/app.module.ts @@ -41,6 +41,8 @@ import { IconsProviderModule, PROJECT_NAME } from "@cdk/public-api"; import { SharedModule } from "@cdk/shared/shared.module"; import { IngredientModule } from "@cdk/ingredient/ingredient.module"; import { NgxPermissionsModule } from "ngx-permissions"; +import { TitleStrategy } from "@angular/router"; +import { TemplatePageTitleStrategy } from "./services"; registerLocaleData(zh); @@ -88,6 +90,7 @@ registerLocaleData(zh); { provide: NZ_I18N, useValue: zh_CN }, { provide: PROJECT_NAME, useValue: "admin" }, { provide: HTTP_INTERCEPTORS, useClass: HTTPInterceptor, multi: true }, + { provide: TitleStrategy, useClass: TemplatePageTitleStrategy }, ], bootstrap: [AppComponent], }) diff --git a/projects/admin/src/app/components/app-layout/app-layout.component.html b/projects/admin/src/app/components/app-layout/app-layout.component.html index f7dd766..2f25b07 100644 --- a/projects/admin/src/app/components/app-layout/app-layout.component.html +++ b/projects/admin/src/app/components/app-layout/app-layout.component.html @@ -47,7 +47,7 @@
  • diff --git a/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html b/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html index 7025e73..b813d94 100644 --- a/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html +++ b/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html @@ -27,7 +27,7 @@ - + @@ -87,7 +87,19 @@
    - + + +
    + 1、请在发布前确认配餐内容是否正确,发布即视为已完成食谱审核; +
    +
    + 2、已发布的食谱无法修改,如需调整,需取消发布后进行编辑 +
    +
    +
    + 发布日期 diff --git a/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts b/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts index 34e25c4..943c07d 100644 --- a/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts +++ b/projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts @@ -95,35 +95,35 @@ export class IngredientListComponent { onClick: this.export.bind(this), }, - { - title: "审核", - premissions: [], - onClick: this.shenhe.bind(this), - visible(v) { - // 0 提交审核 编辑 删除 - // 1 审核中 删除 - // 2 发布 编辑 删除 - // 3 提交审核 编辑 删除 - // 4 提交审核 编辑 删除 - return [0, 3, 4].includes(v.status); - }, - }, + // { + // title: "审核", + // premissions: [], + // onClick: this.shenhe.bind(this), + // visible(v) { + // // 0 提交审核 编辑 删除 + // // 1 审核中 删除 + // // 2 发布 编辑 删除 + // // 3 提交审核 编辑 删除 + // // 4 提交审核 编辑 删除 + // return [0, 3, 4].includes(v.status); + // }, + // }, { title: "发布", premissions: [], onClick: this.release.bind(this), visible(v) { - return [2].includes(v.status); - }, - }, - { - title: "禁用", - premissions: [], - onClick: this.disableMenu.bind(this), - visible(v) { - return [2].includes(v.status); + return [0, 2].includes(v.status); }, }, + // { + // title: "禁用", + // premissions: [], + // onClick: this.disableMenu.bind(this), + // visible(v) { + // return [2].includes(v.status); + // }, + // }, { title: "编辑", premissions: [], diff --git a/projects/admin/src/app/pages/login/login.component.less b/projects/admin/src/app/pages/login/login.component.less index e617a3e..5af256d 100644 --- a/projects/admin/src/app/pages/login/login.component.less +++ b/projects/admin/src/app/pages/login/login.component.less @@ -39,9 +39,11 @@ display: block; width: 560px; height: 100%; - background-image: url('/assets/images/login.jpg'); - background-size: cover; + background-image: url('/assets/images/jl-logo.png'); + background-size: contain; background-position: center; + background-repeat: no-repeat; + background-color: #1890ff; } } diff --git a/projects/admin/src/app/pages/standard/standard-form/standard-form.component.ts b/projects/admin/src/app/pages/standard/standard-form/standard-form.component.ts index 8d25fb7..de56002 100644 --- a/projects/admin/src/app/pages/standard/standard-form/standard-form.component.ts +++ b/projects/admin/src/app/pages/standard/standard-form/standard-form.component.ts @@ -47,7 +47,7 @@ export class StandardFormComponent { // vendors: OptionItemInterface[] = []; - listOfOption: Array<{ value: number; text: string }> = []; + listOfOption: Array<{ value: number | string; text: string }> = []; nzFilterOption = (): boolean => true; @@ -74,23 +74,26 @@ export class StandardFormComponent { }); } } - this.orgSearch$ - .pipe( - filter((f) => !!f), - debounceTime(500), - distinctUntilChanged(), - switchMap((term: string) => this.api.getOrgList({ keyword: term })) - ) - .subscribe((data) => { - const listOfOption: Array<{ value: number; text: string }> = []; - data.forEach((item) => { - listOfOption.push({ - value: item.id, - text: item.name, - }); - }); - this.listOfOption = listOfOption; - }); + this.api.getOrgList().subscribe((res) => { + this.listOfOption = res; + }); + // this.orgSearch$ + // .pipe( + // filter((f) => !!f), + // debounceTime(500), + // distinctUntilChanged(), + // switchMap((term: string) => this.api.getOrgList({ keyword: term })) + // ) + // .subscribe((data) => { + // const listOfOption: Array<{ value: number; text: string }> = []; + // data.forEach((item) => { + // listOfOption.push({ + // value: item.id, + // text: item.name, + // }); + // }); + // this.listOfOption = listOfOption; + // }); } searchOrg = (k: string) => { diff --git a/projects/admin/src/app/services/index.ts b/projects/admin/src/app/services/index.ts index 5c2ea0b..670270c 100644 --- a/projects/admin/src/app/services/index.ts +++ b/projects/admin/src/app/services/index.ts @@ -1 +1,3 @@ export * from "../../../../cdk/src/services/api.service"; + +export * from "./title.service"; diff --git a/projects/admin/src/app/services/title.service.ts b/projects/admin/src/app/services/title.service.ts new file mode 100644 index 0000000..0f5ff00 --- /dev/null +++ b/projects/admin/src/app/services/title.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from "@angular/core"; +import { Title } from "@angular/platform-browser"; +import { RouterStateSnapshot, TitleStrategy } from "@angular/router"; + +@Injectable({ providedIn: "root" }) +export class TemplatePageTitleStrategy extends TitleStrategy { + constructor(private readonly title: Title) { + super(); + } + + override updateTitle(routerState: RouterStateSnapshot) { + const title = this.buildTitle(routerState); + let fullTitle = "营养配餐系统后台"; + if (title !== undefined) { + fullTitle += ` | ${title}`; + } + this.title.setTitle(fullTitle); + } +} diff --git a/projects/admin/src/assets/images/jl-logo.png b/projects/admin/src/assets/images/jl-logo.png index d290310..eb2c5d3 100644 Binary files a/projects/admin/src/assets/images/jl-logo.png and b/projects/admin/src/assets/images/jl-logo.png differ diff --git a/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.html b/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.html index 8d2b0cb..5606e50 100644 --- a/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.html +++ b/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.html @@ -1,9 +1,11 @@
    +
    + - + @@ -62,7 +64,6 @@ {{e.value}} -
    diff --git a/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.ts b/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.ts index fb472b7..1dc69da 100644 --- a/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.ts +++ b/projects/cdk/src/ingredient/ingredient-analysis/ingredient-analysis.component.ts @@ -2,6 +2,7 @@ import { Component, Input, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { ApiService } from "@cdk/services"; import { finalize } from "rxjs"; +import { weekdayMap } from "../ingredient-form-basic/ingredient-form-basic.component"; @Component({ selector: "lib-ingredient-analysis", @@ -29,8 +30,11 @@ export class IngredientAnalysisComponent implements OnInit { analysisLoading = false; + weekdayMap = weekdayMap; + ngOnInit(): void { - this.currentDay = this.current.day; + console.log("this.current", this.menu); + this.currentDay = this.current?.day ?? this.menu.day[0]; this.currentPeople = this.menu.crows[0]; this.id = this.route.snapshot.queryParamMap.get("newId") ?? this.menu.id; this.getAnalysis(); diff --git a/projects/cdk/src/ingredient/ingredient-form-basic/ingredient-form-basic.component.ts b/projects/cdk/src/ingredient/ingredient-form-basic/ingredient-form-basic.component.ts index 4f92509..6d7abb0 100644 --- a/projects/cdk/src/ingredient/ingredient-form-basic/ingredient-form-basic.component.ts +++ b/projects/cdk/src/ingredient/ingredient-form-basic/ingredient-form-basic.component.ts @@ -79,36 +79,38 @@ export class IngredientFormBasicComponent implements OnChanges { vendors: this.fb.control([], this.client ? [] : [FormValidators.required()]), month: this.fb.control([], [FormValidators.required()]), }); - this.standardSearch$ - .pipe( - filter((f) => !!f), - debounceTime(500), - distinctUntilChanged(), - takeUntil(this.destroy$), - switchMap((q) => this.api.getStandard(q)) - ) - .subscribe((data) => { - let listOfOption: Array = []; - if (data.body) { - const getById = data.body && !Array.isArray(data.body); - if (getById) { - data.body = [data.body]; - } - data.body.forEach((item: any) => { - listOfOption.push({ - label: item.name, - value: item.id, - ...item, - }); - }); - this.searchedStandard = this.searchedStandard.concat(listOfOption); - if (getById && this.menu.nutrient) { - this.onStandardChange(this.menu.nutrient); - } - } - this.standardOfOption = listOfOption; - }); - + // this.standardSearch$ + // .pipe( + // filter((f) => !!f), + // debounceTime(500), + // distinctUntilChanged(), + // takeUntil(this.destroy$), + // switchMap((q) => this.api.getStandard(q)) + // ) + // .subscribe((data) => { + // let listOfOption: Array = []; + // if (data.body) { + // const getById = data.body && !Array.isArray(data.body); + // if (getById) { + // data.body = [data.body]; + // } + // data.body.forEach((item: any) => { + // listOfOption.push({ + // label: item.name, + // value: item.id, + // ...item, + // }); + // }); + // this.searchedStandard = this.searchedStandard.concat(listOfOption); + // if (getById && this.menu.nutrient) { + // this.onStandardChange(this.menu.nutrient); + // } + // } + // this.standardOfOption = listOfOption; + // }); + this.api.getStandard().subscribe((res) => { + this.standardOfOption = res; + }); this.setValues(); } diff --git a/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.html b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.html index 6ef81e9..43ca26f 100644 --- a/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.html +++ b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.html @@ -14,7 +14,11 @@
    {{basic.standardName ?? '-'}} - {{basic.day}}天 + + + {{weekdayMap[item]}} + +
    @@ -56,12 +60,12 @@
    - {{days | json}} +
    {{weekdayMap[day]}}
    -
    重量/克
    +
    重量/克
    diff --git a/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.ts b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.ts index eb6187d..3d64155 100644 --- a/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.ts +++ b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.ts @@ -28,6 +28,8 @@ export class IngredientPreviewComponent { totalObj: Record | null = null; + weekdayMap = weekdayMap; + monthText = { 1: "一月", 2: "二月", @@ -43,8 +45,6 @@ export class IngredientPreviewComponent { 12: "十二月", } as any; - weekdayMap = weekdayMap; - days: number[] = []; ngOnInit(): void { @@ -121,7 +121,7 @@ export class IngredientPreviewComponent { } getStandardName(id: string) { - this.api.getStandard({ id }).subscribe((res) => { + this.api.getStandardById({ id }).subscribe((res) => { this.basic["standardName"] = res.body.name; }); } @@ -148,9 +148,7 @@ export class IngredientPreviewComponent { ...this.basic, days: this.days, }, - current: { - day, - }, + current: {}, }, }); } diff --git a/projects/cdk/src/services/api.service.ts b/projects/cdk/src/services/api.service.ts index a5b6bd3..c0850c3 100644 --- a/projects/cdk/src/services/api.service.ts +++ b/projects/cdk/src/services/api.service.ts @@ -356,46 +356,29 @@ export class ApiService { ); } - getO1rgList(query?: { vendors?: number[]; keyword?: string }, force?: boolean) { - if (this.orgList.length && !force) { - return of(this.orgList); - } - // const q = Utils.objectStringify(query); - return this.http.get>(`/api/vender/select?keyword= `).pipe( + standardList: (AnyObject & OptionItemInterface)[] = []; + + getStandard(q?: { id?: string; name?: string }, force?: boolean) { + // if (this.standardList.length && !force) { + // return of(this.standardList); + // } + const query = q ? Utils.objectStringify(q) : "keyword=&name="; + return this.http.get>(`/api/nutrition/select?${query}`).pipe( map((r) => { - return r.body.map((i) => ({ + return r.body.map((i: any) => ({ ...i, value: i.id.toString(), - text: i.name, + label: i.name, })); }), tap((r) => { - this.orgList = r; + this.standardList = r; }) ); } - - standardList: (AnyObject & { value: string; text: string })[] = []; - - getStandard(q: { id?: string; name?: string }, force?: boolean) { - // if (this.standardList.length && !force) { - // return of(this.standardList); - // } - const query = q ? Utils.objectStringify(q) : { name: "" }; - return this.http - .get>(`/api/nutrition/select?${query}`) - .pipe - // map((r) => { - // return r.body.map((i: any) => ({ - // ...i, - // value: i.id.toString(), - // text: i.name, - // })); - // }), - // tap((r) => { - // this.orgList = r; - // }) - (); + getStandardById(q: { id?: string; name?: string }) { + const query = Utils.objectStringify(q); + return this.http.get>(`/api/nutrition/select?${query}`); } saveStandard(v: AnyObject, isEdit?: boolean) { diff --git a/projects/client/src/app/app-routing.module.ts b/projects/client/src/app/app-routing.module.ts index dc543c1..92217b6 100644 --- a/projects/client/src/app/app-routing.module.ts +++ b/projects/client/src/app/app-routing.module.ts @@ -36,6 +36,7 @@ const routes: Routes = [ }, { path: "dashboard", + title: "使用流程", component: DashboardComponent, canActivate: [ngxPermissionsGuard], data: { @@ -60,6 +61,7 @@ const routes: Routes = [ path: "data-vis", component: DataVisComponent, canActivate: [ngxPermissionsGuard], + data: { permissions: { only: ["19", "20"], @@ -71,6 +73,7 @@ const routes: Routes = [ path: "food", component: FoodComponent, canActivate: [ngxPermissionsGuard], + title: "食材管理", data: { permissions: { only: ["23", "24"], @@ -82,6 +85,7 @@ const routes: Routes = [ path: "dish", component: DishComponent, canActivate: [ngxPermissionsGuard], + title: "菜品管理", data: { permissions: { only: ["25", "26"], @@ -154,6 +158,7 @@ const routes: Routes = [ { path: "system", canActivate: [ngxPermissionsGuard], + data: { permissions: { only: ["33", "34", "35", "36", "37"], @@ -165,6 +170,7 @@ const routes: Routes = [ path: "org", component: OrgInfoComponent, canActivate: [ngxPermissionsGuard], + title: "单位信息设置", data: { permissions: { only: ["33", "34"], @@ -176,6 +182,7 @@ const routes: Routes = [ path: "user", component: ClientUserManageComponent, canActivate: [ngxPermissionsGuard], + title: "用户管理", data: { permissions: { only: ["35", "36", "37"], diff --git a/projects/client/src/app/app.module.ts b/projects/client/src/app/app.module.ts index 4720cdc..9bcd91c 100644 --- a/projects/client/src/app/app.module.ts +++ b/projects/client/src/app/app.module.ts @@ -37,6 +37,8 @@ import { import { HTTPInterceptor } from "./services/http.interceptor"; import { IngredientModule } from "@cdk/ingredient/ingredient.module"; import { NgxPermissionsModule } from "ngx-permissions"; +import { TemplatePageTitleStrategy } from "./services/title.service"; +import { TitleStrategy } from "@angular/router"; registerLocaleData(zh); @@ -79,6 +81,7 @@ registerLocaleData(zh); { provide: PROJECT_NAME, useValue: "client" }, { provide: NZ_I18N, useValue: zh_CN }, { provide: HTTP_INTERCEPTORS, useClass: HTTPInterceptor, multi: true }, + { provide: TitleStrategy, useClass: TemplatePageTitleStrategy }, ], bootstrap: [AppComponent], }) diff --git a/projects/client/src/app/pages/dashboard/dashboard.component.html b/projects/client/src/app/pages/dashboard/dashboard.component.html index de64d73..c2c0c07 100644 --- a/projects/client/src/app/pages/dashboard/dashboard.component.html +++ b/projects/client/src/app/pages/dashboard/dashboard.component.html @@ -3,20 +3,12 @@
    - 基础设计及菜品管理 + 菜品管理
    1
    -
    - 进入【配餐设置】,修改三餐摄入能量、营养比例 -
    -
    -
    -
    -
    -
    2
    进入[菜品管理],新增/编辑菜品并保存
    @@ -24,7 +16,7 @@
    -
    3
    +
    2
    菜品管理列表找到所需菜品,下载[营养标签]
    @@ -41,7 +33,7 @@
    -
    4
    +
    3
    进入[食谱管理-食谱库],创建食谱
    @@ -49,7 +41,7 @@
    -
    5
    +
    4

    配置食谱基础信息: @@ -76,7 +68,7 @@

    -
    6
    +
    5

    按实际情况设置菜品:

      @@ -92,7 +84,7 @@
    -
    7
    +
    6

    完成食谱配置后进行食谱分析并确认食谱: @@ -110,7 +102,7 @@

    -
    8
    +
    7
    保存食谱
    @@ -127,7 +119,7 @@
    -
    9
    +
    8
    在食谱列表中找到食谱,发起审核
    @@ -135,7 +127,7 @@
    -
    10
    +
    9
    等待审核通过后返回食谱列表查看进行发布
    @@ -143,7 +135,7 @@
    -
    11
    +
    10
    填写发布时间等信息确认发布
    diff --git a/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html b/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html index 98451f4..b3ffe2b 100644 --- a/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html +++ b/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html @@ -23,7 +23,7 @@ - + @@ -83,7 +83,19 @@
    - + + +
    + 1、请在发布前确认配餐内容是否正确,发布即视为已完成食谱审核; +
    +
    + 2、已发布的食谱无法修改,如需调整,需取消发布后进行编辑 +
    +
    +
    + 发布日期 diff --git a/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts b/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts index 4660dad..615fc3f 100644 --- a/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts +++ b/projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts @@ -95,35 +95,35 @@ export class IngredientListComponent { onClick: this.export.bind(this), }, - { - title: "审核", - premissions: [], - onClick: this.shenhe.bind(this), - visible(v) { - // 0 提交审核 编辑 删除 - // 1 审核中 删除 - // 2 发布 编辑 删除 - // 3 提交审核 编辑 删除 - // 4 提交审核 编辑 删除 - return [0, 3, 4].includes(v.status); - }, - }, + // { + // title: "审核", + // premissions: [], + // onClick: this.shenhe.bind(this), + // visible(v) { + // // 0 提交审核 编辑 删除 + // // 1 审核中 删除 + // // 2 发布 编辑 删除 + // // 3 提交审核 编辑 删除 + // // 4 提交审核 编辑 删除 + // return [0, 3, 4].includes(v.status); + // }, + // }, { title: "发布", premissions: [], onClick: this.release.bind(this), visible(v) { - return [2].includes(v.status); - }, - }, - { - title: "禁用", - premissions: [], - onClick: this.disableMenu.bind(this), - visible(v) { - return [2].includes(v.status); + return [0, 2].includes(v.status); }, }, + // { + // title: "禁用", + // premissions: [], + // onClick: this.disableMenu.bind(this), + // visible(v) { + // return [2].includes(v.status); + // }, + // }, { title: "编辑", premissions: [], diff --git a/projects/client/src/app/pages/login/login.component.html b/projects/client/src/app/pages/login/login.component.html index 545a317..858c9be 100644 --- a/projects/client/src/app/pages/login/login.component.html +++ b/projects/client/src/app/pages/login/login.component.html @@ -8,7 +8,7 @@
    -->
    - +
    diff --git a/projects/client/src/app/services/title.service.ts b/projects/client/src/app/services/title.service.ts new file mode 100644 index 0000000..1540d3e --- /dev/null +++ b/projects/client/src/app/services/title.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from "@angular/core"; +import { Title } from "@angular/platform-browser"; +import { RouterStateSnapshot, TitleStrategy } from "@angular/router"; + +@Injectable({ providedIn: "root" }) +export class TemplatePageTitleStrategy extends TitleStrategy { + constructor(private readonly title: Title) { + super(); + } + + override updateTitle(routerState: RouterStateSnapshot) { + const title = this.buildTitle(routerState); + let fullTitle = "营养配餐系统"; + if (title !== undefined) { + fullTitle += ` | ${title}`; + } + this.title.setTitle(fullTitle); + } +}