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