袁野 7 months ago
parent 2901e848c4
commit f1612c729e
  1. 9
      src/app/app.routes.ts
  2. 5
      src/app/data/goods/goods.namespace.ts
  3. 10
      src/app/model/goods.interface.ts
  4. 23
      src/app/pages/account/sys-account/sys-account.component.spec.ts
  5. 23
      src/app/pages/account/sys-role/sys-role.component.spec.ts
  6. 20
      src/app/pages/goods/goods-type/goods-type.component.html
  7. 6
      src/app/pages/goods/goods-type/goods-type.component.less
  8. 57
      src/app/pages/goods/goods-type/goods-type.component.ts
  9. 12
      src/app/pages/goods/goods.module.ts
  10. 8
      src/app/pages/goods/goods.routes.ts
  11. 8
      src/app/pages/system/menu/menu.component.html
  12. 7
      src/app/pages/system/menu/menu.component.ts

@ -7,6 +7,10 @@ export const routes: Routes = [
path: 'login', path: 'login',
loadChildren: () => import('./pages/login/login.routes').then(m => m.LOGIN_ROUTES) loadChildren: () => import('./pages/login/login.routes').then(m => m.LOGIN_ROUTES)
}, },
{
path: 'index',
loadChildren: () => import('./pages/login/login.routes').then(m => m.LOGIN_ROUTES)
},
{ {
path: 'admin', component: IndexComponent, path: 'admin', component: IndexComponent,
children: [ children: [
@ -20,6 +24,11 @@ export const routes: Routes = [
loadChildren: () => import('./pages/account/account.routes').then(m => m.ACCOUNT_ROUTES), loadChildren: () => import('./pages/account/account.routes').then(m => m.ACCOUNT_ROUTES),
canActivate: [InitGuardService] canActivate: [InitGuardService]
}, },
{
path: 'goods',
loadChildren: () => import('./pages/goods/goods.routes').then(m => m.GOODS_ROUTES),
canActivate: [InitGuardService]
},
{ {
path: 'system', path: 'system',
loadChildren: () => import('./pages/system/system.routes').then(m => m.SYSTEM_ROUTES), loadChildren: () => import('./pages/system/system.routes').then(m => m.SYSTEM_ROUTES),

@ -0,0 +1,5 @@
export const goodsTypeSearch = [
{title: "标题" , formControlName: "title"},
{title: "业务类型" , formControlName: "businessType"} ,
];

@ -0,0 +1,10 @@
export interface GoodsTypeData {
id: number;
parentId: number;
title: string;
businessType: number;
imgUrl: string;
createTime: string;
updateTime: string;
status: number;
}

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SysAccountComponent } from './sys-account.component';
describe('SysAccountComponent', () => {
let component: SysAccountComponent;
let fixture: ComponentFixture<SysAccountComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SysAccountComponent]
})
.compileComponents();
fixture = TestBed.createComponent(SysAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SysRoleComponent } from './sys-role.component';
describe('SysRoleComponent', () => {
let component: SysRoleComponent;
let fixture: ComponentFixture<SysRoleComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SysRoleComponent]
})
.compileComponents();
fixture = TestBed.createComponent(SysRoleComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,20 @@
<form nz-form [formGroup]="searchForm">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="8" *ngFor="let item of goodsTypeSearch">
<nz-form-item>
<nz-form-label>{{item.title}}</nz-form-label>
<nz-form-control>
<input nz-input formControlName="{{item.formControlName}}" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<div class="search-area">
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">搜索</button>
<button nz-button (click)="searchFormReset()">重置</button>
<!-- <button nz-button [nzType]="'primary'" (click)="showEdit(true, null)">创建</button>-->
</div>
</div>
</div>
</form>

@ -0,0 +1,6 @@
.search-area {
text-align: center;
}
button {
margin-left: 8px;
}

@ -0,0 +1,57 @@
import { Component } from '@angular/core';
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms";
import {NzButtonComponent} from "ng-zorro-antd/button";
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
import {NzInputDirective} from "ng-zorro-antd/input";
import {RoleService} from "../../../servies/role/role.service";
import {MenuService} from "../../../servies/menu/menu.service";
import {NzMessageService} from "ng-zorro-antd/message";
import {NzModalService} from "ng-zorro-antd/modal";
import {NgForOf} from "@angular/common";
import {goodsTypeSearch} from "../../../data/goods/goods.namespace";
@Component({
selector: 'app-goods-type',
standalone: true,
imports: [
FormsModule,
NzButtonComponent,
NzColDirective,
NzFormControlComponent,
NzFormDirective,
NzFormItemComponent,
NzFormLabelComponent,
NzInputDirective,
NzRowDirective,
ReactiveFormsModule,
NgForOf
],
templateUrl: './goods-type.component.html',
styleUrl: './goods-type.component.less'
})
export class GoodsTypeComponent {
// 搜索表单
searchForm: FormGroup;
constructor(private fb: NonNullableFormBuilder) {
// 初始化搜索框
this.searchForm = this.fb.group({
title: [''],
parentId: [''],
businessType: [''],
});
}
// 搜索表单提交
searchFormSubmit(): void {
}
// 搜索表单重置
searchFormReset(): void {
this.searchForm.reset();
}
protected readonly goodsTypeSearch = goodsTypeSearch;
}

@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@NgModule({
declarations: [],
imports: [
CommonModule
]
})
export class GoodsModule { }

@ -0,0 +1,8 @@
import { Routes } from '@angular/router';
import {GoodsTypeComponent} from "./goods-type/goods-type.component";
export const GOODS_ROUTES: Routes = [
{ path: 'goods_type', component: GoodsTypeComponent},
];

@ -45,9 +45,11 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24">父级菜单</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24">父级菜单</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24"> <nz-form-control [nzSm]="14" [nzXs]="24">
<nz-select formControlName="menuPSid" nzShowSearch nzAllowClear> <nz-tree-select
<nz-option *ngFor="let item of menuData" nzValue="{{item.id}}" nzLabel="{{item.menuName}}"></nz-option> formControlName="menuPSid"
</nz-select> [nzNodes]="menuTree"
nzShowSearch
></nz-tree-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

@ -24,6 +24,7 @@ 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"; import {NzMessageService} from "ng-zorro-antd/message";
import {NzSpinComponent} from "ng-zorro-antd/spin"; import {NzSpinComponent} from "ng-zorro-antd/spin";
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select";
@Component({ @Component({
selector: 'app-menu', selector: 'app-menu',
@ -56,7 +57,8 @@ import {NzSpinComponent} from "ng-zorro-antd/spin";
NzOptionComponent, NzOptionComponent,
NgForOf, NgForOf,
NzInputNumberComponent, NzInputNumberComponent,
NzSpinComponent NzSpinComponent,
NzTreeSelectComponent
], ],
templateUrl: './menu.component.html', templateUrl: './menu.component.html',
styleUrl: './menu.component.less' styleUrl: './menu.component.less'
@ -88,7 +90,7 @@ export class MenuComponent {
menuName: ['', [Validators.required]], menuName: ['', [Validators.required]],
menuType: ['1', [Validators.required]], menuType: ['1', [Validators.required]],
menuUrl: ['', [Validators.required]], menuUrl: ['', [Validators.required]],
menuPSid: [''], menuPSid: [null],
menuUrlImg: [''], menuUrlImg: [''],
menuSort: ['', [Validators.required]], menuSort: ['', [Validators.required]],
menuDesc: [''], menuDesc: [''],
@ -112,6 +114,7 @@ export class MenuComponent {
queryMenuData() { queryMenuData() {
this.menuService.queryMenuList((data: any) => { this.menuService.queryMenuList((data: any) => {
this.menuData = data['return_data']; this.menuData = data['return_data'];
console.log("父类菜单数据" , this.menuData);
}); });
} }

Loading…
Cancel
Save