Browse Source

复制标准 & 食谱列表页样式

main
kkerwin 1 year ago
parent
commit
203f3949bb
  1. 1
      projects/admin/src/app/components/dish-form/dish-form.component.ts
  2. 1
      projects/admin/src/app/pages/dish/dish.component.ts
  3. 4
      projects/admin/src/app/pages/food/food.component.ts
  4. 21
      projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html
  5. 6
      projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts
  6. 4
      projects/admin/src/app/pages/standard/standard-form/standard-form.component.html
  7. 15
      projects/admin/src/app/pages/standard/standard-form/standard-form.component.ts
  8. 18
      projects/admin/src/app/pages/standard/standard-list/standard-list.component.ts
  9. 4
      projects/admin/src/app/pages/standard/standard-setting/standard-setting.component.ts
  10. 46
      projects/cdk/src/app-page/app-page.component.ts
  11. 4
      projects/cdk/src/ingredient/ingredient-dish/ingredient-dish.component.ts
  12. 2
      projects/cdk/src/ingredient/ingredient-form-basic/ingredient-form-basic.component.ts
  13. 22
      projects/cdk/src/table-list/td-overflow.directive.ts
  14. 198
      projects/client/src/app/components/dish-form/dish-form.component.ts
  15. 4
      projects/client/src/app/pages/data-vis/data-vis.component.ts
  16. 17
      projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html
  17. 8
      projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts

1
projects/admin/src/app/components/dish-form/dish-form.component.ts

@ -139,7 +139,6 @@ export class DishFormComponent {
public getValues() {
let values = null
console.log('this.formGroup.getRawValue()', this.formGroup.getRawValue(), this.foodItemSelected)
if (Utils.validateFormGroup(this.formGroup)) {
const value = this.formGroup.getRawValue()
// const { _nutrition, key, name, type } = this.formGroup.getRawValue();

1
projects/admin/src/app/pages/dish/dish.component.ts

@ -198,7 +198,6 @@ export class DishComponent {
[c.key]: c,
}
}, {} as AnyObject)
console.log('this.tableFoods', this.tableFoods)
}
})
}

4
projects/admin/src/app/pages/food/food.component.ts

@ -148,9 +148,7 @@ export class FoodComponent implements OnInit, OnDestroy {
}
downloadTemplate() {
this.api.getFoodExcelTemplate().subscribe((res) => {
console.log('res', res)
})
this.api.getFoodExcelTemplate().subscribe((res) => {})
}
showImportForm(nzContent: TemplateRef<{}>) {

21
projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html

@ -52,8 +52,15 @@
<ng-container *ngSwitchCase="'modify'">
{{ data | date : 'yyyy-MM-dd HH:mm:ss' }}
</ng-container>
<ng-container *ngSwitchCase="'name'">
<span title="{{ data }}">
{{ data }}
</span>
</ng-container>
<ng-container *ngSwitchCase="'vender'">
<span title="{{ tableOrg[data] ? tableOrg[data].name : '-' }}">
{{ tableOrg[data] ? tableOrg[data].name : '-' }}
</span>
</ng-container>
<ng-container *ngSwitchCase="'meals'">
<nz-tag *ngFor="let item of data">{{ item }}</nz-tag>
@ -63,16 +70,12 @@
{{ statusTextMap[data] }}
</ng-container>
<ng-container *ngSwitchCase="'month'">
<div class="flex flex-wrap">
<ng-container *ngIf="data.length === 12">
<nz-tag> 全年 </nz-tag>
</ng-container>
<ng-container *ngIf="data.length !== 12">
<nz-tag *ngFor="let item of data" class="mb-1">
{{ item }}
</nz-tag>
</ng-container>
<a nz-popover [nzPopoverContent]="nzPopoverContent"> {{ data.length }}个月 </a>
<ng-template #nzPopoverContent>
<div class="flex flex-wrap w-48">
<nz-tag *ngFor="let item of data" class="mb-1"> {{ item }}月 </nz-tag>
</div>
</ng-template>
</ng-container>
<ng-container *ngSwitchDefault>
{{ data }}

6
projects/admin/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts

@ -88,9 +88,9 @@ export class IngredientListComponent {
{ key: 'name', title: '食谱名称', width: '200px' },
{ key: 'vender', title: '单位', width: '200px' },
{ key: 'meals', title: '包含餐次', width: '180px' },
{ key: 'month', title: '适用月份' },
{ key: 'day', title: '周期' },
{ key: 'status', title: '状态', width: '120px' },
{ key: 'month', title: '适用月份', width: '100px' },
{ key: 'day', title: '周期', width: '100px' },
{ key: 'status', title: '状态', width: '80px' },
{ key: 'modify', title: '更新时间', width: '170px' },
{ key: 'operate', title: '创建人', width: '160px' },
])

4
projects/admin/src/app/pages/standard/standard-form/standard-form.component.html

@ -28,7 +28,8 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of api.globalEnum.nutrient">
<ng-container *ngFor="let item of api.globalEnum.nutrient">
<tr *ngIf="item.key === 'energy'">
<td>
{{ item.value }}
</td>
@ -43,6 +44,7 @@
</nz-input-group>
</td>
</tr>
</ng-container>
</tbody>
</nz-table>
</nz-form-control>

15
projects/admin/src/app/pages/standard/standard-form/standard-form.component.ts

@ -60,7 +60,7 @@ export class StandardFormComponent {
overflows: Record<string, number> = {}
ngOnInit(): void {
console.log('this.api.globalEnum.nutrient', this.api.globalEnum.nutrient)
// console.log('this.api.globalEnum.nutrient', this.api.globalEnum.nutrient)
this.formGroup = this.fb.group({
id: this.fb.control('', []),
name: this.fb.control('', [FormValidators.required()]),
@ -119,15 +119,20 @@ export class StandardFormComponent {
onSubmit(gotoSetting?: boolean) {
if (Utils.validateFormGroup(this.formGroup)) {
const vendors = this.listOfOption.filter((f) => f.checked).map((i) => i.id)
if (vendors.length === 0) {
this.msg.error('请选择适用单位')
return
}
this.submitLoading = true
this.api
.saveStandard({
foodCategoryDay: this.state?.foodCategoryDay,
foodCategoryWeek: this.state?.foodCategoryWeek,
ingredient: this.state?.ingredient,
foodCategoryDay: this.state?.foodCategoryDay ?? [],
foodCategoryWeek: this.state?.foodCategoryWeek ?? [],
ingredient: this.state?.ingredient ?? {},
overflows: this.overflows,
...this.formGroup.value,
vendors: this.listOfOption.filter((f) => f.checked).map((i) => i.id),
vendors,
})
.pipe(
finalize(() => {

18
projects/admin/src/app/pages/standard/standard-list/standard-list.component.ts

@ -91,14 +91,26 @@ export class StandardListComponent {
if (Utils.validateFormGroup(this.copyForm)) {
const val = this.copyForm.value
const name = val.name!
const res = await lastValueFrom(
const add = await lastValueFrom(
this.api.saveStandard({
...v,
vendors: v['vendors'],
overflow: v['overflow'],
overflows: v['overflows'],
name,
id: null,
}),
)
this.msg.success(res.desc)
const update = await lastValueFrom(
this.api.saveStandard({
foodCategoryDay: v['foodCategoryDay'] ?? [],
foodCategoryWeek: v['foodCategoryWeek'] ?? [],
ingredient: v['ingredient'] ?? {},
name,
id: add.body['id'],
}),
)
this.msg.success(update.desc)
this.tableList.run()
return true
}

4
projects/admin/src/app/pages/standard/standard-setting/standard-setting.component.ts

@ -123,7 +123,8 @@ export class StandardSettingComponent implements AfterViewInit, OnDestroy {
return []
}
this.expand(0)
const sorts = data.crows ?? Object.keys(data.ingredient)
const sorts = data.crows?.length > 0 ? data.crows : Object.keys(data.ingredient)
return sorts.map((peopleName: string) => {
const v: any = data.ingredient[peopleName]
return {
@ -231,7 +232,6 @@ export class StandardSettingComponent implements AfterViewInit, OnDestroy {
}
calcTypeChange() {
console.log('this.calcType', this.calcType)
this.foodCategoryDay = this.foodCategoryDay.map((i) => ({ ...i, type: this.calcType }))
this.foodCategoryWeek = this.foodCategoryWeek.map((i) => ({ ...i, type: this.calcType }))
}

46
projects/cdk/src/app-page/app-page.component.ts

@ -1,19 +1,19 @@
import { CommonModule } from "@angular/common";
import { Component, Input, OnDestroy, TemplateRef } from "@angular/core";
import { ActivatedRoute, NavigationEnd, Router, Scroll } from "@angular/router";
import { Subject, filter, startWith, take, takeUntil } from "rxjs";
import { NzOutletModule } from "ng-zorro-antd/core/outlet";
import { CommonModule } from '@angular/common'
import { Component, Input, OnDestroy, TemplateRef } from '@angular/core'
import { ActivatedRoute, NavigationEnd, Router, Scroll } from '@angular/router'
import { Subject, filter, startWith, take, takeUntil } from 'rxjs'
import { NzOutletModule } from 'ng-zorro-antd/core/outlet'
interface BreadcrumbInterface {
label: string;
href?: string;
label: string
href?: string
}
@Component({
standalone: true,
selector: "app-page",
templateUrl: "./app-page.component.html",
styleUrls: ["./app-page.component.less"],
selector: 'app-page',
templateUrl: './app-page.component.html',
styleUrls: ['./app-page.component.less'],
imports: [CommonModule, NzOutletModule],
})
export class AppPageComponent implements OnDestroy {
@ -28,35 +28,35 @@ export class AppPageComponent implements OnDestroy {
// });
}
@Input() pageTitle?: TemplateRef<{}> | string;
@Input() pageTitle?: TemplateRef<{}> | string
@Input() full: boolean = false;
@Input() full: boolean = false
@Input() scroll: boolean = true;
@Input() scroll: boolean = true
@Input() pageExtra?: TemplateRef<{}> | string;
@Input() pageExtra?: TemplateRef<{}> | string
unSubscribe$ = new Subject<void>();
unSubscribe$ = new Subject<void>()
breadcrumb: BreadcrumbInterface[] = [];
breadcrumb: BreadcrumbInterface[] = []
ngOnDestroy(): void {
this.unSubscribe$.next();
this.unSubscribe$.complete();
this.unSubscribe$.next()
this.unSubscribe$.complete()
}
genBreadcrumb() {
let route: ActivatedRoute | null = this.route;
this.breadcrumb = [];
let route: ActivatedRoute | null = this.route
this.breadcrumb = []
while (route) {
if (route.routeConfig?.title) {
this.breadcrumb.unshift({
label: route.routeConfig!.title as string,
href: route.routeConfig.path,
});
})
}
route = route?.parent ?? null;
route = route?.parent ?? null
}
console.log("this.route", this.breadcrumb);
// console.log("this.route", this.breadcrumb);
}
}

4
projects/cdk/src/ingredient/ingredient-dish/ingredient-dish.component.ts

@ -105,7 +105,7 @@ export class IngredientDishComponent implements OnChanges {
initMenuBasic() {
if (this.menuBaisc) {
const meals = this.menuBaisc.meals as string[]
console.log('this.menuBaisc', this.menuBaisc)
// console.log('this.menuBaisc', this.menuBaisc)
const day = this.menuBaisc.day as number[]
this.days = day.map((i, idx) => {
const d = weekdayMap[i]
@ -146,7 +146,7 @@ export class IngredientDishComponent implements OnChanges {
reuse(day: number, nzContent: TemplateRef<{}>) {
const thisDayDishs = this.mealDishList.filter((f) => f.day === day)
console.log('dayDishs', day, this.mealDishList, thisDayDishs, this.selectDay)
// console.log('dayDishs', day, this.mealDishList, thisDayDishs, this.selectDay)
this.modal.create({
nzTitle: '请选择应用到的日期',
nzContent,

2
projects/cdk/src/ingredient/ingredient-form-basic/ingredient-form-basic.component.ts

@ -118,6 +118,7 @@ export class IngredientFormBasicComponent implements OnChanges {
}
})
if (!this.client) {
this.api.getOrgList().subscribe((res) => {
this.allOrgs = res.map((i) => ({
...i,
@ -126,6 +127,7 @@ export class IngredientFormBasicComponent implements OnChanges {
}))
})
}
}
ngOnChanges(changes: SimpleChanges): void {}

22
projects/cdk/src/table-list/td-overflow.directive.ts

@ -1,30 +1,30 @@
import { AfterContentInit, AfterViewInit, ChangeDetectorRef, Directive, ElementRef, Input } from "@angular/core";
import { NzPopoverDirective } from "ng-zorro-antd/popover";
import { AfterContentInit, AfterViewInit, ChangeDetectorRef, Directive, ElementRef, Input } from '@angular/core'
import { NzPopoverDirective } from 'ng-zorro-antd/popover'
@Directive({
selector: "[jwTdOverflow]",
selector: '[jwTdOverflow]',
})
export class TdOverflowDirective implements AfterViewInit {
@Input("jwTdOverflow") content!: string;
@Input('jwTdOverflow') content!: string
constructor(
private elementRef: ElementRef,
private popoverDirective: NzPopoverDirective,
private cdr: ChangeDetectorRef
private cdr: ChangeDetectorRef,
) {}
ngOnInit() {}
ngAfterViewInit(): void {
const element = this.elementRef.nativeElement as HTMLElement;
console.log("element", element.offsetWidth, element.scrollWidth);
const element = this.elementRef.nativeElement as HTMLElement
// console.log("element", element.offsetWidth, element.scrollWidth);
// 如果元素的实际宽度大于可见宽度,就使用 nz-popover 指令来显示完整的内容
if (element.offsetWidth < element.scrollWidth) {
this.popoverDirective.content = this.content;
this.popoverDirective.content = this.content
} else {
this.popoverDirective.trigger = null;
this.popoverDirective.content = "da";
element.textContent = this.content;
this.popoverDirective.trigger = null
this.popoverDirective.content = 'da'
element.textContent = this.content
}
}
}

198
projects/client/src/app/components/dish-form/dish-form.component.ts

@ -1,203 +1,203 @@
import { Component, Input, OnInit } from "@angular/core";
import { FormArray, FormBuilder, FormGroup } from "@angular/forms";
import { ApiService } from "@cdk/services";
import { Utils } from "@cdk/utils";
import { FormValidators } from "@cdk/validators";
import { NzMessageService } from "ng-zorro-antd/message";
import { Subject, debounceTime, distinctUntilChanged, filter, finalize, switchMap, throttleTime } from "rxjs";
import { Component, Input, OnInit } from '@angular/core'
import { FormArray, FormBuilder, FormGroup } from '@angular/forms'
import { ApiService } from '@cdk/services'
import { Utils } from '@cdk/utils'
import { FormValidators } from '@cdk/validators'
import { NzMessageService } from 'ng-zorro-antd/message'
import { Subject, debounceTime, distinctUntilChanged, filter, finalize, switchMap, throttleTime } from 'rxjs'
@Component({
selector: "app-dish-form",
templateUrl: "./dish-form.component.html",
styleUrls: ["./dish-form.component.less"],
selector: 'app-dish-form',
templateUrl: './dish-form.component.html',
styleUrls: ['./dish-form.component.less'],
})
export class DishFormComponent {
constructor(private fb: FormBuilder, private msg: NzMessageService, private api: ApiService) {}
@Input() data: any;
@Input() data: any
@Input() orgs: any[] = [];
@Input() orgs: any[] = []
@Input() foods: any[] = [];
@Input() foods: any[] = []
private orgSearch$ = new Subject<Record<string, string>>();
private orgSearch$ = new Subject<Record<string, string>>()
private foodSearch$ = new Subject<Record<string, string>>();
private foodSearch$ = new Subject<Record<string, string>>()
formGroup!: FormGroup;
formGroup!: FormGroup
selectedValue = null;
selectedValue = null
orgListOfOption: Array<{ value: string; text: string }> = [];
orgListOfOption: Array<{ value: string; text: string }> = []
foodListOfOption: Array<{ value: string; text: string }> = [];
foodListOfOption: Array<{ value: string; text: string }> = []
searchedFood: Array<{ value: string; text: string }> = [];
searchedFood: Array<{ value: string; text: string }> = []
foodSelected: string[] = [];
foodSelected: string[] = []
foodItemSelected: any[] = [];
foodItemSelected: any[] = []
nzFilterOption = (): boolean => true;
nzFilterOption = (): boolean => true
globalEnum = this.api.globalEnum;
globalEnum = this.api.globalEnum
uploadLoading = false;
uploadLoading = false
addFoodVisible = false;
addFoodVisible = false
iconPreview = "";
iconPreview = ''
get food(): FormArray {
return this.formGroup.get("ingredient") as FormArray;
return this.formGroup.get('ingredient') as FormArray
}
get icon() {
return this.formGroup.get("icon")?.value;
return this.formGroup.get('icon')?.value
}
ngOnInit(): void {
this.formGroup = this.fb.group({
id: this.fb.control("", []),
name: this.fb.control("", [FormValidators.required()]),
icon: this.fb.control("", []),
mark: this.fb.control("", [FormValidators.required()]),
poly: this.fb.control("", [FormValidators.required()]),
id: this.fb.control('', []),
name: this.fb.control('', [FormValidators.required()]),
icon: this.fb.control('', []),
mark: this.fb.control('', [FormValidators.required()]),
poly: this.fb.control('', [FormValidators.required()]),
month: this.fb.control([], []),
});
})
this.orgSearch$
.pipe(
debounceTime(500),
distinctUntilChanged(),
switchMap((q) => this.api.getOrgList(q))
switchMap((q) => this.api.getOrgList(q)),
)
.subscribe((data) => {
const listOfOption: Array<{ value: string; text: string }> = [];
const listOfOption: Array<{ value: string; text: string }> = []
data.forEach((item) => {
listOfOption.push({
value: item.id.toString(),
text: item.name,
});
});
this.orgListOfOption = listOfOption;
});
})
})
this.orgListOfOption = listOfOption
})
this.foodSearch$
.pipe(
filter((f) => !!f),
debounceTime(500),
distinctUntilChanged(),
switchMap((q) => this.api.getFoodList(q))
switchMap((q) => this.api.getFoodList(q)),
)
.subscribe((data) => {
const listOfOption: Array<{ value: string; text: string }> = [];
const listOfOption: Array<{ value: string; text: string }> = []
data.body.forEach((item) => {
listOfOption.push({
value: item.key,
text: item.name,
});
});
this.searchedFood = this.searchedFood.concat(listOfOption);
this.foodListOfOption = listOfOption;
});
this.setValues();
})
})
this.searchedFood = this.searchedFood.concat(listOfOption)
this.foodListOfOption = listOfOption
})
this.setValues()
}
setValues() {
this.orgListOfOption = this.orgs.map((i) => ({ text: i.name, value: i.id }));
this.orgListOfOption = this.orgs.map((i) => ({ text: i.name, value: i.id }))
if (this.data) {
// this.allMonth = this.allMonth.map((i) =>
// (this.data.month ?? []).includes(i.value) ? { ...i, checked: true } : i
// );
this.foods.forEach((f) => {
const item = { text: f.name, value: f.key };
this.foodListOfOption.push(item);
this.searchedFood.push(item);
const num = this.data.ingredient.find((i: any) => i.key === f.key);
const item = { text: f.name, value: f.key }
this.foodListOfOption.push(item)
this.searchedFood.push(item)
const num = this.data.ingredient.find((i: any) => i.key === f.key)
if (num) {
this.foodItemSelected.push({ num: num.value, ...item, isMain: num.isMain });
this.foodSelected.push(f.key);
this.foodItemSelected.push({ num: num.value, ...item, isMain: num.isMain })
this.foodSelected.push(f.key)
}
});
})
this.formGroup.patchValue({
...this.data,
mark: this.data.marks,
});
if (this.data["icon"]) {
this.iconPreview = "/api/icon/" + this.data["icon"];
})
if (this.data['icon']) {
this.iconPreview = '/api/icon/' + this.data['icon']
}
}
}
public getValues() {
let values = null;
console.log("this.formGroup.getRawValue()", this.formGroup.getRawValue(), this.foodItemSelected);
let values = null
// console.log("this.formGroup.getRawValue()", this.formGroup.getRawValue(), this.foodItemSelected);
if (Utils.validateFormGroup(this.formGroup)) {
const value = this.formGroup.getRawValue();
const value = this.formGroup.getRawValue()
// const { _nutrition, key, name, type } = this.formGroup.getRawValue();
let ingredient: any[] = [];
let ingredient: any[] = []
for (const f of this.foodItemSelected) {
let num = Number(f.num);
let num = Number(f.num)
if (!num) {
this.msg.error(`请输入${f.value}-${f.text}的重量`);
return;
this.msg.error(`请输入${f.value}-${f.text}的重量`)
return
}
ingredient.push({
isMain: f.isMain,
key: f.value,
value: num,
});
})
}
const month = value.month.join(",");
const month = value.month.join(',')
values = {
...value,
month,
ingredient,
};
}
return values;
}
return values
}
onMainChange(e: boolean, key: string) {
this.foodItemSelected.forEach((i) => {
if (e) {
i.isMain = false;
i.isMain = false
if (i.value === key) {
i.isMain = true;
i.isMain = true
}
} else {
if (i.value === key) {
i.isMain = false;
i.isMain = false
}
}
});
})
}
searchOrg(value: string): void {
if (value) {
this.orgSearch$.next({ keyword: value });
this.orgSearch$.next({ keyword: value })
}
}
searchFood(value: string): void {
if (value) {
this.foodSearch$.next({ keyword: value });
this.foodSearch$.next({ keyword: value })
}
}
onFoodSelected(v: string[]) {
this.foodItemSelected = [];
this.foodItemSelected = []
this.searchedFood.forEach((item) => {
if (this.foodItemSelected.some((s) => s.value === item.value)) {
return;
return
}
if (v.includes(item.value)) {
this.foodItemSelected.push(item);
this.foodItemSelected.push(item)
}
});
})
// this.foodItemSelected = this.searchedFood.filter((f) => {
// return v.includes(f.value)
@ -207,36 +207,36 @@ export class DishFormComponent {
addFood() {
this.food.push(
this.fb.group({
name: this.fb.control("", [FormValidators.required()]),
name: this.fb.control('', [FormValidators.required()]),
tag: this.fb.control(0, [FormValidators.required()]),
weight: this.fb.control(0, [FormValidators.required()]),
})
);
}),
)
}
removeFood(idx: number) {
this.food.removeAt(idx);
this.food.removeAt(idx)
}
onFileChange(e: Event) {
const target = e.target as HTMLInputElement;
const file = target.files![0];
target.value = "";
const target = e.target as HTMLInputElement
const file = target.files![0]
target.value = ''
if (file.size / 1024 / 1024 >= 2) {
this.msg.error("图片大小不能超过2M");
return;
this.msg.error('图片大小不能超过2M')
return
}
const fileReader = new FileReader();
const fileReader = new FileReader()
fileReader.onload = () => {
const base64 = fileReader.result as string;
this.iconPreview = base64;
const base64 = fileReader.result as string
this.iconPreview = base64
// this.formGroup.get("icon")?.setValue(base64);
};
fileReader.readAsDataURL(file);
const formdata = new FormData();
formdata.append("file", file);
}
fileReader.readAsDataURL(file)
const formdata = new FormData()
formdata.append('file', file)
this.api.upload(formdata).subscribe((res) => {
this.formGroup.get("icon")?.setValue(res.body);
});
this.formGroup.get('icon')?.setValue(res.body)
})
}
}

4
projects/client/src/app/pages/data-vis/data-vis.component.ts

@ -199,7 +199,7 @@ export class DataVisComponent implements AfterViewInit {
this.rd2.setStyle(child, 'transform', `translateY(0px)`)
const elHeight = el.clientHeight
const childHeight = child.clientHeight
console.log(childHeight, elHeight)
// console.log(childHeight, elHeight)
if (childHeight <= elHeight) {
return
}
@ -226,7 +226,7 @@ export class DataVisComponent implements AfterViewInit {
return
}
this.api
.getAnalysis(this.menuId, void 0, this.people)
.getAnalysis(this.menuId, this.day, this.people)
.pipe(
finalize(() => {
this.analysisLoading = false

17
projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.html

@ -50,6 +50,9 @@
<ng-container *ngSwitchCase="'vender'">
{{ tableOrg[data] ? tableOrg[data].name : '-' }}
</ng-container>
<ng-container *ngSwitchCase="'name'">
<span title="{{ data }}">{{ data }}</span>
</ng-container>
<ng-container *ngSwitchCase="'meals'">
<nz-tag *ngFor="let item of data">{{ item }}</nz-tag>
@ -59,16 +62,12 @@
{{ statusTextMap[data] }}
</ng-container>
<ng-container *ngSwitchCase="'month'">
<div class="flex flex-wrap">
<ng-container *ngIf="data.length === 12">
<nz-tag> 全年 </nz-tag>
</ng-container>
<ng-container *ngIf="data.length !== 12">
<nz-tag *ngFor="let item of data" class="mb-1">
{{ item }}
</nz-tag>
</ng-container>
<a nz-popover [nzPopoverContent]="nzPopoverContent"> {{ data.length }}个月 </a>
<ng-template #nzPopoverContent>
<div class="flex flex-wrap w-48">
<nz-tag *ngFor="let item of data" class="mb-1"> {{ item }}月 </nz-tag>
</div>
</ng-template>
</ng-container>
<ng-container *ngSwitchDefault>
{{ data }}

8
projects/client/src/app/pages/ingredients/ingredient-list/ingredient-list.component.ts

@ -82,9 +82,9 @@ export class IngredientListComponent {
{ key: 'name', title: '食谱名称', width: '200px' },
{ key: 'meals', title: '包含餐次', width: '180px' },
{ key: 'month', title: '适用月份' },
{ key: 'day', title: '周期' },
{ key: 'status', title: '状态', width: '120px' },
{ key: 'month', title: '适用月份', width: '100px' },
{ key: 'day', title: '周期', width: '100px' },
{ key: 'status', title: '状态', width: '80px' },
{ key: 'modify', title: '更新时间', width: '170px' },
{ key: 'operate', title: '创建人', width: '160px' },
])
@ -231,7 +231,7 @@ export class IngredientListComponent {
this.msg.error('请选择发布日期')
return false
}
console.log(id, day)
// console.log(id, day)
const res = await lastValueFrom(this.api.release(id, this.startTime, day))
this.msg.success(res.desc)
this.tableList.run()

Loading…
Cancel
Save