diff --git a/README.md b/README.md index 061e501..c391e60 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,8 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C ---------------- -# 09/26 +# 09/28 -1. 食谱审核 列表需要 提交审核时间、提交人 字段 \ No newline at end of file +1. 食谱审核 列表需要 提交审核时间、提交人 字段 +2. 食谱列表 需要 返回一个字段 标识当前食谱 是否是 管理系统添加的还是业务系统添加的 +3. 食谱保存 菜品 报500,同样的数据 昨天都可以 \ No newline at end of file diff --git a/projects/admin/src/app/app-routing.module.ts b/projects/admin/src/app/app-routing.module.ts index f20ff9d..c286e4d 100644 --- a/projects/admin/src/app/app-routing.module.ts +++ b/projects/admin/src/app/app-routing.module.ts @@ -15,6 +15,7 @@ import { StandardListComponent, StandardFormComponent, StandardSettingComponent, + IngredientPreviewPageComponent, } from "./pages"; import { AppLayoutComponent } from "./components"; import { authGuard } from "./services/auth.guard"; @@ -86,6 +87,11 @@ const routes: Routes = [ title: "食谱审核", component: IngredientReviewComponent, }, + { + path: "preview", + title: "食谱预览", + component: IngredientPreviewPageComponent, + }, { path: "release", title: "食谱发布计划", diff --git a/projects/admin/src/app/app.module.ts b/projects/admin/src/app/app.module.ts index 8a5b372..6559eae 100644 --- a/projects/admin/src/app/app.module.ts +++ b/projects/admin/src/app/app.module.ts @@ -28,6 +28,7 @@ import { IngredientReleaseComponent, IngredientReviewComponent, IngredientFormComponent, + IngredientPreviewPageComponent, OrganizationListComponent, OrganizationFormComponent, UserManageComponent, @@ -59,6 +60,7 @@ registerLocaleData(zh); IngredientReleaseComponent, IngredientReviewComponent, IngredientFormComponent, + IngredientPreviewPageComponent, OrganizationListComponent, OrganizationFormComponent, 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 94748bf..d0381f0 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 @@ -1,68 +1,74 @@ - - -
-
-
- - -
    -
  • - 退出登录 -
  • -
-
-
-
-
- - - diff --git a/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.less b/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.less index 2ca8252..08c41a0 100644 --- a/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.less +++ b/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.less @@ -3,4 +3,14 @@ padding: 24px; border: 1px solid #f0f0f0; border-top: none; +} + +.total { + td { + background-color: #fafafa; + } +} + +.placeholder-th { + border-right: none !important; } \ No newline at end of file diff --git a/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.ts b/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.ts index 3d2d4e9..6c5be65 100644 --- a/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.ts +++ b/projects/cdk/src/ingredient/ingredient-meals/ingredient-meals.component.ts @@ -52,7 +52,9 @@ export class IngredientMealsComponent implements OnChanges, OnInit { submitLoading = false; - currentDishs: DishInterface[] = []; + // currentDishs: DishInterface[] = []; + + totalObj: Record = {}; ngOnInit(): void { this.init(); @@ -65,9 +67,28 @@ export class IngredientMealsComponent implements OnChanges, OnInit { } init() { - console.log(" ", this.mealDishs, this.day, this.mealIndex); - this.currentDishs = this.mealDishs.filter((f) => f.day === this.day && this.mealIndex === f["mealIndex"]); + this.calcTotal(); + // console.log(" init", this.mealDishs, this.day, this.mealIndex); + // this.currentDishs = this.mealDishs.filter((f) => f.day === this.day && this.mealIndex === f["mealIndex"]); + } + + calcTotal() { + this.totalObj = {}; + this.mealDishs.forEach((dish) => { + if (dish.day === this.day && this.mealIndex === dish["mealIndex"]) { + dish.items.forEach((food) => { + food["groupValues"].forEach((p: any) => { + if (!this.totalObj[p.peopleName]) { + this.totalObj[p.peopleName] = p.value; + } else { + this.totalObj[p.peopleName] = this.totalObj[p.peopleName] + p.value; + } + }); + }); + } + }); } + shopDishForm() { this.drawerRef = this.drawer.create({ nzTitle: "添加菜品", @@ -80,6 +101,16 @@ export class IngredientMealsComponent implements OnChanges, OnInit { }); } + getTotal(dishId: number, people: string) { + const r = this.mealDishs.filter( + (f) => f.day === this.day && f["mealIndex"] === this.mealIndex && f.dish === dishId + ); + r.forEach((dish) => { + dish.items; + }); + return "ad"; + } + clearThisMeal() { this.modal.confirm({ nzTitle: "警告", @@ -104,18 +135,10 @@ export class IngredientMealsComponent implements OnChanges, OnInit { day: this.day, mealIndex: this.mealIndex, meal: this.meals[this.mealIndex], - dishId: dish.id, + dish: dish.id, dishName: dish.name, mark: dish.marks, - items: foods.map((f) => ({ - ...f, - value: f.groupValues.reduce((a, c) => { - return { - ...a, - [c.peopleName]: c.value, - }; - }, {} as Record), - })), + items: foods, }); this.onSaveDish.emit(this.mealDishs); @@ -123,10 +146,17 @@ export class IngredientMealsComponent implements OnChanges, OnInit { this.cancelForm(); } - onRemoveDish(d: DishInterface) { - this.mealDishs = this.mealDishs.filter( - (f) => !(f.dishId === d.dishId && f.day === this.day && f["mealIndex"] === this.mealIndex) - ); + onRemoveDish(d: DishInterface, idx: number) { + // this.mealDishs = this.mealDishs.filter( + // (f) => !(f.dish === d.dish && f.day === this.day && f["mealIndex"] === this.mealIndex) + // ); + this.mealDishs = this.mealDishs.filter((f, i) => i !== idx); this.onSaveDish.emit(this.mealDishs); } + + onValueChange() { + // this.onSaveDish.emit(this.mealDishs); + // console.log("this.currentDishs", this.currentDishs); + this.calcTotal(); + } } diff --git a/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.html b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.html new file mode 100644 index 0000000..c88707d --- /dev/null +++ b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.html @@ -0,0 +1,133 @@ +
+ 食谱名称 +
+ +
+ + Zhou Maomao + 18100000000 + Hangzhou, Zhejiang + Empty + +
+ +
+ + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.less b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.less new file mode 100644 index 0000000..aac7112 --- /dev/null +++ b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.less @@ -0,0 +1,84 @@ +.header { + padding: 10px; + background-color: #fff; + border-bottom: 1px solid #e8e8e8; +} + + +.menu-table { + // width: 100%; + margin: 0 auto; + border-collapse: collapse; + border-spacing: 0; + border: 1px solid #e8e8e8; + + thead { + .table-day-row { + display: flex; + + border-bottom: 1px solid #fafafa; + + .td { + flex: 1; + padding: 10px; + border-right: 1px solid #fafafa; + + &:first-child { + flex: 0 0 420px; + } + + &:last-child { + border-right: none; + + } + } + } + + th { + + + .td { + background-color: transparent; + border-right: 1px solid #fafafa; + background-color: #13c2c2; + } + + border-right: 1px solid #fafafa; + background-color: #13c2c2; + color: #fff; + + } + } + + + .table-herder-ages { + display: flex; + + .td { + &:last-child { + border-right: none; + } + } + } + + .dish-name { + width: 240px; + } + + .food-name { + width: 180px; + } + + .td { + height: 100%; + padding: 10px; + background-color: #fafafa; + } + + .age-range { + // display: inline-block; + width: 150px; + // background-color: #fafafa; + font-weight: bold; + } +} \ No newline at end of file diff --git a/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.ts b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.ts new file mode 100644 index 0000000..f617c88 --- /dev/null +++ b/projects/cdk/src/ingredient/ingredient-preview/ingredient-preview.component.ts @@ -0,0 +1,8 @@ +import { Component } from "@angular/core"; + +@Component({ + selector: "app-ingredient-preview", + templateUrl: "./ingredient-preview.component.html", + styleUrls: ["./ingredient-preview.component.less"], +}) +export class IngredientPreviewComponent {} diff --git a/projects/cdk/src/ingredient/ingredient.module.ts b/projects/cdk/src/ingredient/ingredient.module.ts index 6940216..5fa1433 100644 --- a/projects/cdk/src/ingredient/ingredient.module.ts +++ b/projects/cdk/src/ingredient/ingredient.module.ts @@ -5,6 +5,7 @@ import { IngredientMealsComponent } from "./ingredient-meals/ingredient-meals.co import { ConfirmIngredientComponent } from "./confirm-ingredient/confirm-ingredient.component"; import { IngredientDishComponent } from "./ingredient-dish/ingredient-dish.component"; import { IngredientFormBasicComponent } from "./ingredient-form-basic/ingredient-form-basic.component"; +import { IngredientPreviewComponent } from "./ingredient-preview/ingredient-preview.component"; @NgModule({ declarations: [ @@ -13,6 +14,7 @@ import { IngredientFormBasicComponent } from "./ingredient-form-basic/ingredient ConfirmIngredientComponent, IngredientFormBasicComponent, IngredientDishComponent, + IngredientPreviewComponent, ], imports: [SharedModule], exports: [ @@ -21,6 +23,7 @@ import { IngredientFormBasicComponent } from "./ingredient-form-basic/ingredient ConfirmIngredientComponent, IngredientFormBasicComponent, IngredientDishComponent, + IngredientPreviewComponent, ], }) export class IngredientModule {} diff --git a/projects/cdk/src/services/api.service.ts b/projects/cdk/src/services/api.service.ts index b8614a8..09e8ebf 100644 --- a/projects/cdk/src/services/api.service.ts +++ b/projects/cdk/src/services/api.service.ts @@ -34,17 +34,6 @@ export class ApiService { globalEnum!: GlobalEnum; - page(v: {}, q: {}) { - return this.http.get("https://jsonplaceholder.typicode.com/users", v).pipe( - map((r) => { - return { - total: 10, - content: r, - }; - }) - ); - } - initAccount() { try { const stragedAccount = localStorage.getItem(this.accountKey); @@ -397,6 +386,11 @@ export class ApiService { return this.http.put(`/api/menu/review`, params); } + disableMenu(id: string | number) { + const params = Utils.objectToFormData({ id }); + return this.http.delete(`/api/menu/review`, { body: params }); + } + reviewMenu(id: number, pass: boolean, reason?: string) { const params = Utils.objectToFormData({ id, pass, reason }); return this.http.post(`/api/menu/review`, params); @@ -412,6 +406,11 @@ export class ApiService { return this.http.put(`/api/menu/release`, params); } + cancelRelease(id: string | number) { + const params = Utils.objectToFormData({ id }); + return this.http.delete(`/api/menu/release`, { body: params }); + } + deleteMenu(id: string | number) { const params = Utils.objectToFormData({ id }); return this.http.delete(`/api/menu`, { body: params }); @@ -424,4 +423,19 @@ export class ApiService { saveMenuDist(d: {}) { return this.http.put(`/api/menu/dish/batch`, d); } + + getMenuReleasePage(p: {}, q: {}) { + const params = Utils.objectStringify({ ...p, ...q }); + return this.http.get>(`/api/menu/release?${params}`).pipe( + map((res) => { + if (Array.isArray(res.body.content)) { + res.body.content = res.body.content.map((i) => ({ + ...i, + dateRange: `${format(new Date(i.startTime), "yyyy-MM-dd")}至${format(new Date(i.endTime), "yyyy-MM-dd")}`, + })); + } + return res; + }) + ); + } } diff --git a/projects/cdk/src/table-list/table-list/table-list.component.html b/projects/cdk/src/table-list/table-list/table-list.component.html index 4fde7b6..4b6608f 100644 --- a/projects/cdk/src/table-list/table-list/table-list.component.html +++ b/projects/cdk/src/table-list/table-list/table-list.component.html @@ -73,7 +73,7 @@ {{col.title}} - + 操作 diff --git a/projects/cdk/src/table-list/table-list/table-list.component.ts b/projects/cdk/src/table-list/table-list/table-list.component.ts index b2c9575..14bd9c8 100644 --- a/projects/cdk/src/table-list/table-list/table-list.component.ts +++ b/projects/cdk/src/table-list/table-list/table-list.component.ts @@ -95,6 +95,8 @@ export class TableListComponent implements OnInit, OnChanges, AfterViewInit, OnD @Input() rowClass?: string; + @Input() public optionWidth?: string; + // @Input() resizeable?: boolean; @Output() onRowClick = new EventEmitter(); @@ -107,8 +109,6 @@ export class TableListComponent implements OnInit, OnChanges, AfterViewInit, OnD public advanceSearchVisible: boolean = false; - public optionWidth: string = "200px"; - private cache?: CacheItem; get columns(): TableListColumns[] { @@ -171,7 +171,9 @@ export class TableListComponent implements OnInit, OnChanges, AfterViewInit, OnD if (opEl) { setTimeout(() => { const paddingX = 2 * 24; - this.optionWidth = Math.ceil(opEl.offsetWidth + paddingX) + "px"; + if (!this.optionWidth) { + this.optionWidth = Math.ceil(opEl.offsetWidth + paddingX) + "px"; + } this.cdr.detectChanges(); }); }