Commit 205fa6a5 authored by wangqinghua's avatar wangqinghua

update

parent 7f51ad2d
...@@ -48,6 +48,9 @@ import {ServerComponent} from './overAll/modal/server/server.component'; ...@@ -48,6 +48,9 @@ import {ServerComponent} from './overAll/modal/server/server.component';
import {SwitchComponent} from './overAll/modal/switch/switch.component'; import {SwitchComponent} from './overAll/modal/switch/switch.component';
import {MineComponent} from './mine/mine.component'; import {MineComponent} from './mine/mine.component';
import {CommentStmt} from '@angular/compiler'; import {CommentStmt} from '@angular/compiler';
import {CommonProblemComponent} from './knowladge/common-problem/common-problem.component';
import {InformationTechComponent} from './knowladge/information-tech/information-tech.component';
import {ManagementSystemComponent} from './knowladge/management-system/management-system.component';
export const route: Routes = [ export const route: Routes = [
{path: '', redirectTo: 'app/main/home', pathMatch: 'prefix'}, //空路由定向 {path: '', redirectTo: 'app/main/home', pathMatch: 'prefix'}, //空路由定向
...@@ -101,6 +104,9 @@ export const route: Routes = [ ...@@ -101,6 +104,9 @@ export const route: Routes = [
{path: 'database', component: DatabaseComponent, data: {breadcrumb: '数据库'},}, {path: 'database', component: DatabaseComponent, data: {breadcrumb: '数据库'},},
{path: 'server', component: ServerComponent, data: {breadcrumb: '服务器'},}, {path: 'server', component: ServerComponent, data: {breadcrumb: '服务器'},},
{path: 'switch', component: SwitchComponent, data: {breadcrumb: '交换机'},}, {path: 'switch', component: SwitchComponent, data: {breadcrumb: '交换机'},},
{path: 'commonProblem', component: CommonProblemComponent, data: {breadcrumb: '常见问题'},},
{path: 'informationTech', component: InformationTechComponent, data: {breadcrumb: '信息技术'},},
{path: 'managementSystem', component: ManagementSystemComponent, data: {breadcrumb: '管理制度'},},
{path: 'mine', component: MineComponent, data: {breadcrumb: '菜单栏'},}, {path: 'mine', component: MineComponent, data: {breadcrumb: '菜单栏'},},
] ]
}, },
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<nz-table #basicTable [nzData]="dataSet" [nzFrontPagination]="true"> <nz-table #basicTable [nzData]="dataSet" [nzFrontPagination]="true">
<thead> <thead>
<tr> <tr>
<th>id</th> <th nzWidth="25%">id</th>
<th>名称</th> <th>名称</th>
<th>父级ID</th> <th>父级ID</th>
<th>code</th> <th>code</th>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of basicTable.data"> <tr *ngFor="let data of basicTable.data">
<td> <td nzWidth="25%">
{{data.id}} {{data.id}}
</td> </td>
<td> <td>
......
...@@ -2,6 +2,7 @@ import {Component, OnInit} from '@angular/core'; ...@@ -2,6 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {SystemService} from '../system/system.service'; import {SystemService} from '../system/system.service';
import {LocalStorageService} from 'ngx-webstorage'; import {LocalStorageService} from 'ngx-webstorage';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import {UtilService} from '../shared/common/util.service';
@Component({ @Component({
selector: 'smart-mine', selector: 'smart-mine',
...@@ -10,11 +11,11 @@ import {NzMessageService} from 'ng-zorro-antd'; ...@@ -10,11 +11,11 @@ import {NzMessageService} from 'ng-zorro-antd';
}) })
export class MineComponent implements OnInit { export class MineComponent implements OnInit {
editCache = {}; editCache = [];
dataSet = []; dataSet = [];
constructor(private systemSer: SystemService, private localStorage: LocalStorageService, constructor(private systemSer: SystemService, private localStorage: LocalStorageService,
private message: NzMessageService) { private message: NzMessageService, private util: UtilService) {
} }
ngOnInit() { ngOnInit() {
...@@ -51,16 +52,19 @@ export class MineComponent implements OnInit { ...@@ -51,16 +52,19 @@ export class MineComponent implements OnInit {
} }
add() { add() {
this.dataSet.forEach((e, index) => e.key = index + 1);
const item = { const item = {
id: this.util.generateUUID(),
name: '', name: '',
parentId: '', parentId: '',
code: '', code: '',
url: '', url: '',
imageUrl: '', imageUrl: '',
showOrder: '', showOrder: '',
key: 0
}; };
this.dataSet = [item, ...this.dataSet,]; this.dataSet = [item, ...this.dataSet];
this.updateEditCache(0); this.editCache = [{data: item, edit: true}, ...this.editCache];
console.log(this.dataSet); console.log(this.dataSet);
console.log(this.editCache); console.log(this.editCache);
} }
...@@ -77,6 +81,7 @@ export class MineComponent implements OnInit { ...@@ -77,6 +81,7 @@ export class MineComponent implements OnInit {
const index = this.dataSet.findIndex(item => item.key === key); const index = this.dataSet.findIndex(item => item.key === key);
this.dataSet[index] = this.editCache[key].data; this.dataSet[index] = this.editCache[key].data;
this.editCache[key].edit = false; this.editCache[key].edit = false;
console.log(this.dataSet[index]);
this.systemSer.createMenu(this.dataSet[index]).subscribe( this.systemSer.createMenu(this.dataSet[index]).subscribe(
(res) => { (res) => {
this.message.success('保存成功'); this.message.success('保存成功');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment