提交代码

master
胡锐 7 months ago
parent a7549d7773
commit 728b11f6fd
  1. 13
      src/app/data/common/dictionary.namespace.ts
  2. 38
      src/app/pages/account/sys-account/sys-account.component.html
  3. 2
      src/app/pages/account/sys-account/sys-account.component.less
  4. 8
      src/app/pages/account/sys-account/sys-account.component.ts
  5. 10
      src/app/pages/account/sys-role/sys-role.component.html
  6. 26
      src/app/pages/body/index/index.component.ts
  7. 5
      src/app/pages/system/menu/menu.component.html
  8. 17
      src/app/pages/system/menu/menu.component.ts
  9. 20
      src/app/pipes/account/sys-account-status.pipe.ts
  10. 39
      src/app/pipes/common/dictionary.pipe.ts
  11. 21
      src/app/pipes/menu/menu-type.pipe.ts
  12. 29
      src/app/servies/common/common.service.ts

@ -0,0 +1,13 @@
export interface Dictionary {
codeType: string;
codeValue: string;
codeName: string;
codeDesc: string;
sortId: number;
ext1: string;
ext2: string;
ext3: string;
}
export const dictionaryData: Dictionary[] = [];

@ -1,42 +1,41 @@
<form nz-form [formGroup]="searchForm" class="search_form">
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="4">
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>用户名</nz-form-label>
<nz-form-control>
<input nz-input formControlName="userName" />
<input nz-input formControlName="userName" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="4">
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>登录账户</nz-form-label>
<nz-form-control>
<input nz-input formControlName="loginName" />
<input nz-input formControlName="loginName" placeholder="请输入"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="4">
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>联系方式</nz-form-label>
<nz-form-control>
<input nz-input formControlName="telephone" />
<input nz-input formControlName="telephone" placeholder="请输入"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="4">
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>状态</nz-form-label>
<nz-form-label>账户状态</nz-form-label>
<nz-form-control>
<nz-select formControlName="status" nzAllowClear>
<nz-option nzValue="1" nzLabel="正常"></nz-option>
<nz-option nzValue="2" nzLabel="禁用"></nz-option>
<nz-select formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'">
<nz-option *ngFor="let item of accountStatus" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">搜索</button>
<div nz-col [nzSpan]="6">
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">查询</button>
<button nz-button (click)="searchFormReset()">重置</button>
<button nz-button [nzType]="'primary'" (click)="showEditAccount(true, null)">创建</button>
</div>
@ -44,6 +43,7 @@
</form>
<nz-table #basicTable
[nzScroll]="{ x: '1100px' }"
[nzBordered]="true"
[nzFrontPagination]="false"
[nzShowQuickJumper]="true"
@ -57,10 +57,10 @@
<th nzWidth="80px">用户名</th>
<th nzWidth="50px">登录账户</th>
<th nzWidth="80px">联系方式</th>
<th nzWidth="30px">状态</th>
<th nzWidth="30px">账户状态</th>
<th nzWidth="50px">创建时间</th>
<th nzWidth="50px">更新时间</th>
<th nzWidth="50px">操作</th>
<th nzRight nzWidth="50px">操作</th>
</tr>
</thead>
<tbody>
@ -68,14 +68,14 @@
<td>{{data.userName}}</td>
<td>{{data.loginName}}</td>
<td>{{data.telephone}}</td>
<td>{{data.status | sysAccountStatus}}</td>
<td>{{data.status | dictionary: 'SEC_USER_STATUS'}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>
<td nzRight>
<a (click)="showEditAccount(false, data)">修改</a>
<nz-divider nzType="vertical"></nz-divider>
<a nz-dropdown [nzDropdownMenu]="menu">
更多操作
更多
<span nz-icon nzType="down"></span>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">

@ -2,7 +2,7 @@
overflow: visible;
}
button {
margin-left: 8px;
margin-right: 8px;
}
.search-area {
text-align: left;

@ -21,8 +21,9 @@ import {NzTreeComponent} from "ng-zorro-antd/tree";
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
import {NzDropDownModule} from "ng-zorro-antd/dropdown";
import {NzIconDirective} from "ng-zorro-antd/icon";
import {SysAccountStatusPipe} from "../../../pipes/account/sys-account-status.pipe";
import {RoleService} from "../../../servies/role/role.service";
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe";
import {Dictionary} from "../../../data/common/dictionary.namespace";
@Component({
selector: 'app-sys-account',
@ -56,7 +57,7 @@ import {RoleService} from "../../../servies/role/role.service";
NzOptionComponent,
NzDropDownModule,
NzIconDirective,
SysAccountStatusPipe,
DictionaryPipe,
],
templateUrl: './sys-account.component.html',
styleUrl: './sys-account.component.less'
@ -69,6 +70,7 @@ export class SysAccountComponent {
total: 0,
list: [],
};
accountStatus: Dictionary[] = []
// 角色数据
roleData: any = [];
// 搜索表单
@ -101,6 +103,7 @@ export class SysAccountComponent {
telephone: [''],
roleId: ['', [Validators.required]],
});
this.accountStatus = new DictionaryPipe().getDictionaryList("SEC_USER_STATUS");
this.queryAllRole();
this.queryData();
}
@ -122,6 +125,7 @@ export class SysAccountComponent {
queryData() {
this.searchForm.value.pageNum = this.tablePageNum;
this.searchForm.value.pageSize = 10;
this.searchForm.value.objectType = 1;
this.searchForm.value.time = new Date().getTime();
this.sysAccountService.queryList(this.searchForm.value, (data: any) => {
if (data['return_code'] == '000000') {

@ -1,15 +1,15 @@
<form nz-form [formGroup]="searchForm">
<form nz-form [formGroup]="searchForm" [nzLayout]="'vertical'">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="4">
<nz-form-item>
<nz-form-label>角色名称</nz-form-label>
<nz-form-control>
<input nz-input formControlName="roleName" />
<input nz-input formControlName="roleName" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="4">
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">搜索</button>
<div nz-col [nzSpan]="6" style="margin-top: 30px;">
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">查询</button>
<button nz-button (click)="searchFormReset()">重置</button>
<button nz-button [nzType]="'primary'" (click)="showEditRole(true, null)">创建</button>
</div>
@ -31,7 +31,7 @@
<th nzWidth="100px">角色描述</th>
<th nzWidth="50px">创建时间</th>
<th nzWidth="50px">更新时间</th>
<th nzWidth="50px">操作</th>
<th nzWidth="70px">操作</th>
</tr>
</thead>
<tbody>

@ -10,9 +10,7 @@ import {
import {NzBreadCrumbComponent, NzBreadCrumbItemComponent} from "ng-zorro-antd/breadcrumb";
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
import {NzMenuDirective, NzMenuGroupComponent, NzMenuItemComponent, NzSubMenuComponent} from "ng-zorro-antd/menu";
import {menuData} from "../../../data/menu/menu.namespace";
import {NgClass, NgForOf} from "@angular/common";
import {animate, state, style, transition, trigger} from "@angular/animations";
import {NzIconDirective} from "ng-zorro-antd/icon";
import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs";
import {TabComponent} from "../tab/tab.component";
@ -21,6 +19,8 @@ import {DATA, INIT_FLAG, LOGIN_DATA, USER_TOKEN} from "../../../data/login/local
import {NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown";
import {LoginService} from "../../../servies/login/login.service";
import {NzMessageService} from "ng-zorro-antd/message";
import {CommonService} from "../../../servies/common/common.service";
import {dictionaryData} from "../../../data/common/dictionary.namespace";
@Component({
selector: 'app-index',
@ -62,22 +62,38 @@ export class IndexComponent {
userInfo: any;
// 左侧菜单栏数据
leftMenuData: any = [];
// 侧边菜单展示开关
isCollapse = true;
// 当前顶级菜单
currentParentMenu: any = {};
constructor(
private commonService: CommonService,
private storage: BrowserStorageService,
private message: NzMessageService,
private router: Router, // 路由
private login: LoginService
) {
// 缓存数据字典
this.commonService.queryDictionary('','',(data: any) => {
for (let item of data['return_data']) {
dictionaryData.push(
{
codeType: item.codeType,
codeValue: item.codeValue,
codeName: item.codeName,
codeDesc: item.codeDesc,
sortId: item.sortId,
ext1: item.ext1,
ext2: item.ext2,
ext3: item.ext3
}
);
}
});
this.menuData = this.menuData.concat(this.storage.get(DATA)['menuTree']);
this.userInfo = this.storage.get(DATA)['account'];
console.log("用户数据" , this.userInfo);
}
// 选择操作

@ -23,7 +23,7 @@
>
<nz-descriptions-item nzTitle="父级菜单">{{menuDetail?.parentMenu?menuDetail.parentMenu.menuName:'无'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="菜单名称">{{menuDetail.menuName?menuDetail.menuName:'无'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="菜单类型">{{menuDetail.menuType| menuType}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="菜单类型">{{menuDetail.menuType | dictionary: '菜单类型'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="菜单URL">{{menuDetail.menuUrl?menuDetail.menuUrl:'无'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="菜单图标">{{menuDetail.menuUrlImg?menuDetail.menuUrlImg:'无'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="菜单描述">{{menuDetail.menuDesc?menuDetail.menuDesc:'无'}}</nz-descriptions-item>
@ -64,8 +64,7 @@
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>菜单类型</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="菜单类型选择有误!">
<nz-select formControlName="menuType" nzShowSearch>
<nz-option nzValue="1" nzLabel="菜单"></nz-option>
<nz-option nzValue="2" nzLabel="按钮"></nz-option>
<nz-option *ngFor="let item of menuTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>

@ -14,7 +14,6 @@ import {NzCardComponent} from "ng-zorro-antd/card";
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
import {NzButtonComponent} from "ng-zorro-antd/button";
import {NzDescriptionsComponent, NzDescriptionsItemComponent} from "ng-zorro-antd/descriptions";
import {MenuTypePipe} from "../../../pipes/menu/menu-type.pipe";
import {NzFormDirective, NzFormLabelComponent, NzFormModule} from "ng-zorro-antd/form";
import {FormGroup, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms";
import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input";
@ -25,6 +24,8 @@ import {NzInputNumberComponent} from "ng-zorro-antd/input-number";
import {NzMessageService} from "ng-zorro-antd/message";
import {NzSpinComponent} from "ng-zorro-antd/spin";
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select";
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe";
import {Dictionary} from "../../../data/common/dictionary.namespace";
@Component({
selector: 'app-menu',
@ -42,7 +43,6 @@ import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select";
NzRowDirective,
NzColDirective,
NzButtonComponent,
MenuTypePipe,
NzModalModule,
NzFormDirective,
ReactiveFormsModule,
@ -58,7 +58,8 @@ import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select";
NgForOf,
NzInputNumberComponent,
NzSpinComponent,
NzTreeSelectComponent
NzTreeSelectComponent,
DictionaryPipe
],
templateUrl: './menu.component.html',
styleUrl: './menu.component.less'
@ -78,11 +79,15 @@ export class MenuComponent {
editMenuTitle = '';
// 树视图展示状态
treeView= false;
menuTypeArray:Dictionary[] = [];
constructor(private menuService: MenuService,
private fb: NonNullableFormBuilder,
private modal: NzModalService,
private message: NzMessageService) {
// 菜单类型
this.menuTypeArray = new DictionaryPipe().getDictionaryList('MENU_TYPE');
// 获取菜单数据
this.queryMenuTree();
this.editMenuForm = this.fb.group({
@ -114,7 +119,6 @@ export class MenuComponent {
queryMenuData() {
this.menuService.queryMenuList((data: any) => {
this.menuData = data['return_data'];
console.log("父类菜单数据" , this.menuData);
});
}
@ -148,7 +152,7 @@ export class MenuComponent {
};
if (edit == false && this.menuDetail?.id == null) {
this.modal.confirm({
this.modal.warning({
nzTitle: '提示',
nzContent: '请点击需要修改的菜单',
});
@ -180,7 +184,6 @@ export class MenuComponent {
submitEditMenuForm() {
if (this.editMenuForm.valid) {
this.treeView = false;
console.log(this.editMenuForm.value['menuPSid']);
this.editMenuForm.value['menuPSid']!=null?this.editMenuForm.value['menuPSid']:null;
this.menuService.editMenu(this.editMenuForm.value, (data: any) => {
if (data['return_code'] == '000000') {

@ -1,20 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'sysAccountStatus',
standalone: true
})
export class SysAccountStatusPipe implements PipeTransform {
transform(value: number): string {
switch (value) {
case 1:
return '正常';
case 2:
return '禁用';
default:
return '未知';
}
}
}

@ -0,0 +1,39 @@
import { Pipe, PipeTransform } from '@angular/core';
import {dictionaryData, Dictionary} from "../../data/common/dictionary.namespace";
@Pipe({
name: 'dictionary',
standalone: true
})
export class DictionaryPipe implements PipeTransform {
data: Dictionary[] = dictionaryData;
/**
*
* @param codeType
*/
getDictionaryList(codeType: string): any {
return this.data.filter(o => o.codeType == codeType);
}
/**
*
* @param codeType
* @param codeValue
*/
getDictionary(codeType: string, codeValue: string): any {
// 读取缓存数据
return this.data.find(o => o.codeType == codeType && o.codeValue == codeValue);
}
transform(codeValue: string,codeType: string): string {
const obj = this.getDictionary(codeType, codeValue);
if (obj == null) {
return '未知';
} else {
return obj.codeName;
}
}
}

@ -1,21 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'menuType',
standalone: true
})
export class MenuTypePipe implements PipeTransform {
// @ts-ignore
transform(value: number): string {
switch (value) {
case 1:
return '菜单';
case 2:
return '按钮';
default:
return '未知';
}
}
}

@ -0,0 +1,29 @@
import { Injectable } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {environment} from "../../../environments/environment";
import {ObjectData} from "../../utils/objectData.service";
@Injectable({
providedIn: 'root'
})
export class CommonService {
constructor(private http: HttpClient) { }
/**
*
*
* @param codeType
* @param codeValue
* @param callBack
*/
public queryDictionary(codeType: string, codeValue: string, callBack:any) {
const param = {
codeType: codeType,
codeValue: codeValue
};
this.http.get(environment.baseUrl + 'common/queryDictionary?'+ObjectData.objectByString(param)).subscribe(data => {
callBack(data);
});
}
}
Loading…
Cancel
Save