提交代码

master
胡锐 7 months ago
parent 6ce9cd150c
commit c0be78649b
  1. 22
      src/app/pages/system/menu/menu.component.ts
  2. 1
      src/app/servies/menu/menu.service.ts

@ -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) {

@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import {HttpClient} from "@angular/common/http"; import {HttpClient} from "@angular/common/http";
import {environment} from "../../../environments/environment"; import {environment} from "../../../environments/environment";
import {ObjectData} from "../../utils/objectData.service"; import {ObjectData} from "../../utils/objectData.service";
import {DATA} from "../../data/login/localStorage.namespace";
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

Loading…
Cancel
Save