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 32dd623..136df85 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
@@ -102,6 +102,12 @@
+
+
+
-
-
-
-
-
- 1、请在发布前确认配餐内容是否正确,发布即视为已完成食谱审核;
-
-
- 2、已发布的食谱无法修改,如需调整,需取消发布后进行编辑
-
-
-
-
-
- 发布日期
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+ 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 6579dfe..8232b69 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
@@ -1,7 +1,7 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'
import { FormControl, FormGroup } from '@angular/forms'
import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer'
-import { AnyObject, OrgDTO, TableListOption } from '@cdk/public-api'
+import { AnyObject, FormValidators, OrgDTO, TableListOption, Utils } from '@cdk/public-api'
import { ApiService } from '@cdk/services'
import { NzModalService } from 'ng-zorro-antd/modal'
import { lastValueFrom, tap } from 'rxjs'
@@ -29,12 +29,18 @@ export class IngredientListComponent {
@ViewChild('releaseStartTimeTpl') releaseStartTimeTpl!: TemplateRef<{}>
+ @ViewChild('copyTpl') copyTpl!: TemplateRef<{}>
+
private drawerRef?: NzDrawerRef
public tableList = new TableListOption(this.fetchData.bind(this), {
frontPagination: false,
})
+ public copyForm = new FormGroup({
+ name: new FormControl('', [FormValidators.required('请输入食谱名称')]),
+ })
+
public queryForm = new FormGroup({
name: new FormControl(''),
vender: new FormControl(''),
@@ -148,15 +154,37 @@ export class IngredientListComponent {
])
}
+ // copy(v: AnyObject) {
+ // this.modal.confirm({
+ // nzTitle: '警告',
+ // nzContent: '是否要复制该食谱?',
+ // nzOnOk: async () => {
+ // const copyName = v['name'] + '【复制】'
+ // const res = await lastValueFrom(this.api.copyMenu(v['id'], copyName))
+ // this.msg.success(res.desc)
+ // this.tableList.run()
+ // },
+ // })
+ // }
+
copy(v: AnyObject) {
- this.modal.confirm({
- nzTitle: '警告',
- nzContent: '是否要复制该食谱?',
+ const copyName = v['name'] + '【复制】'
+ this.copyForm.patchValue({
+ name: copyName,
+ })
+ this.modal.create({
+ nzTitle: '复制食谱',
+ nzContent: this.copyTpl,
nzOnOk: async () => {
- const copyName = v['name'] + '【复制】'
- const res = await lastValueFrom(this.api.copyMenu(v['id'], copyName))
- this.msg.success(res.desc)
- this.tableList.run()
+ if (Utils.validateFormGroup(this.copyForm)) {
+ const val = this.copyForm.value
+ const name = val.name!
+ const res = await lastValueFrom(this.api.copyMenu(v['id'], name))
+ this.msg.success(res.desc)
+ this.tableList.run()
+ return true
+ }
+ return false
},
})
}