|
|
|
@ -23,6 +23,7 @@ import { NzModalModule } from 'ng-zorro-antd/modal'; |
|
|
|
|
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
|
|
|
|
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
|
|
|
|
import {NzInputNumberComponent} from "ng-zorro-antd/input-number"; |
|
|
|
|
import {NzMessageService} from "ng-zorro-antd/message"; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-menu', |
|
|
|
@ -74,10 +75,12 @@ export class MenuComponent { |
|
|
|
|
// 编辑菜单标题
|
|
|
|
|
editMenuTitle = ''; |
|
|
|
|
constructor(private menuService: MenuService, |
|
|
|
|
private fb: NonNullableFormBuilder) { |
|
|
|
|
private fb: NonNullableFormBuilder, |
|
|
|
|
private message: NzMessageService) { |
|
|
|
|
this.queryMenuData(); |
|
|
|
|
|
|
|
|
|
this.editMenuForm = this.fb.group({ |
|
|
|
|
id: [], |
|
|
|
|
menuName: ['', [Validators.required]], |
|
|
|
|
menuType: ['1', [Validators.required]], |
|
|
|
|
menuUrl: ['', [Validators.required]], |
|
|
|
@ -93,6 +96,7 @@ export class MenuComponent { |
|
|
|
|
*/ |
|
|
|
|
queryMenuData() { |
|
|
|
|
this.menuService.queryMenuList((data: any) => { |
|
|
|
|
console.log(data); |
|
|
|
|
this.menuData = data['return_data']; |
|
|
|
|
// 获取菜单树形结构
|
|
|
|
|
this.queryMenuTree(); |
|
|
|
@ -194,9 +198,25 @@ export class MenuComponent { |
|
|
|
|
this.editMenuVisible = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 提交表单 |
|
|
|
|
*/ |
|
|
|
|
submitEditMenuForm() { |
|
|
|
|
if (this.editMenuForm.valid) { |
|
|
|
|
console.log('submit', this.editMenuForm.value); |
|
|
|
|
this.menuService.editMenu(this.editMenuForm.value, (data: any) => { |
|
|
|
|
if (data['return_code'] == '000000') { |
|
|
|
|
// 刷新数据
|
|
|
|
|
this.queryMenuData(); |
|
|
|
|
|
|
|
|
|
this.message.create('success', '操作成功'); |
|
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
this.closeEditMenu(); |
|
|
|
|
} else { |
|
|
|
|
this.message.create('error', data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
Object.values(this.editMenuForm.controls).forEach(control => { |
|
|
|
|
if (control.invalid) { |
|
|
|
|