提交代码

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

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

Loading…
Cancel
Save