Commit 6ae0c009 by 牛晓林

latest

parents 4d424452 baee629e
......@@ -7,6 +7,7 @@ import {
HttpErrorResponse,
HttpEvent,
HttpResponseBase,
HttpResponse,
} from '@angular/common/http';
import { Observable, of, throwError } from 'rxjs';
import { mergeMap, catchError } from 'rxjs/operators';
......@@ -71,20 +72,20 @@ export class DefaultInterceptor implements HttpInterceptor {
// 错误内容:{ status: 1, msg: '非法参数' }
// 正确内容:{ status: 0, response: { } }
// 则以下代码片断可直接适用
// if (event instanceof HttpResponse) {
// const body: any = event.body;
// if (body && body.status !== 0) {
if (event instanceof HttpResponse) {
const body: any = event.body;
if (body && body.status !== 0) {
// this.msg.error(body.msg);
// // 继续抛出错误中断后续所有 Pipe、subscribe 操作,因此:
// // this.http.get('/').subscribe() 并不会触发
// return throwError({});
// } else {
// // 重新修改 `body` 内容为 `response` 内容,对于绝大多数场景已经无须再关心业务状态码
// return of(new HttpResponse(Object.assign(event, { body: body.response })));
// // 或者依然保持完整的格式
// 继续抛出错误中断后续所有 Pipe、subscribe 操作,因此:
// this.http.get('/').subscribe() 并不会触发
return throwError({});
} else {
// 重新修改 `body` 内容为 `response` 内容,对于绝大多数场景已经无须再关心业务状态码
return of(new HttpResponse(Object.assign(event, { body: body.response })));
// 或者依然保持完整的格式
// return of(event);
// }
// }
}
}
break;
case 401:
this.notification.error(`未登录或登录已过期,请重新登录。`, ``);
......
......@@ -51,7 +51,13 @@ import { DelonAuthConfig } from '@delon/auth';
export function fnDelonAuthConfig(): DelonAuthConfig {
return {
...new DelonAuthConfig(),
...({ login_url: '/passport/login' } as DelonAuthConfig),
...({
login_url: '/passport/login',
token_send_key: 'JSESSIONID',
token_send_place: 'url',
token_send_template: '${token}',
ignores: [/\/login/, /^assets\//, /passport\//],
} as DelonAuthConfig),
};
}
......@@ -75,9 +81,7 @@ const GLOBAL_CONFIG_PROVIDES = [
// #endregion
@NgModule({
imports: [
AlainThemeModule.forRoot()
],
imports: [AlainThemeModule.forRoot()],
})
export class DelonModule {
constructor(@Optional() @SkipSelf() parentModule: DelonModule) {
......
<p>
固定资产台账
</p>
<page-header [title]="'资产列表'" [extra]="extra">
<form nz-form [nzLayout]="'inline'" (ngSubmit)="getData()" class="search__form">
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
<div nz-col nzMd="8" nzSm="24">
<nz-form-item>
<nz-form-label nzFor="no">规则编号</nz-form-label>
<nz-form-control>
<input nz-input [(ngModel)]="q.no" name="no" placeholder="请输入" id="no">
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzMd="8" nzSm="24">
<nz-form-item>
<nz-form-label nzFor="status">使用状态</nz-form-label>
<nz-form-control>
<nz-select [(ngModel)]="q.status" name="status" id="status" [nzPlaceHolder]="'请选择'" [nzShowSearch]="true">
<nz-option *ngFor="let i of status; let idx = index" [nzLabel]="i.text" [nzValue]="idx"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
<nz-form-item>
<nz-form-label nzFor="callNo">调用次数</nz-form-label>
<nz-form-control>
<input nz-input id="callNo">
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
<nz-form-item>
<nz-form-label nzFor="updatedAt">更新日期</nz-form-label>
<nz-form-control>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
<nz-form-item>
<nz-form-label nzFor="status2">使用状态</nz-form-label>
<nz-form-control>
<nz-select [nzPlaceHolder]="'请选择'" nzId="status2" [nzShowSearch]="true">
<nz-option *ngFor="let i of status; let idx = index" [nzLabel]="i.text" [nzValue]="idx"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
<nz-form-item>
<nz-form-label nzFor="status3">使用状态</nz-form-label>
<nz-form-control>
<nz-select [nzPlaceHolder]="'请选择'" nzId="status3" [nzShowSearch]="true">
<nz-option *ngFor="let i of status; let idx = index" [nzLabel]="i.text" [nzValue]="idx"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="24">
<button nz-button type="submit" [nzType]="'primary'" [nzLoading]="loading">查询</button>
<button nz-button type="reset" (click)="reset()" class="mx-sm">重置</button>
<a (click)="expandForm=!expandForm">
{{expandForm ? '收起' : '展开'}}
<i class="anticon" [class.anticon-down]="!expandForm" [class.anticon-up]="expandForm"></i>
</a>
</div>
</div>
</form>
</page-header>
<nz-list [nzLoading]="loading" [nzDataSource]="list" [nzRenderItem]="item"
[nzGrid]="{gutter: 24, lg: 8, md: 12, sm: 24, xs: 24 }">
<ng-template #item let-item>
<nz-list-item>
<nz-card nzHoverable *ngIf="item !== null" [nzActions]="[op1]">
<ng-template #op1>
<a [routerLink]="['./detail', item.id]">查看</a>
</ng-template>
<nz-card-meta [nzAvatar]="nzAvatar" [nzTitle]="nzTitle" [nzDescription]="nzDescription">
<ng-template #nzTitle>
<a (click)="msg.success('标题:' + item.id);">{{item.name}}</a>
</ng-template>
<ng-template #nzDescription>
<ellipsis>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ellipsis>
</ng-template>
</nz-card-meta>
</nz-card>
</nz-list-item>
</ng-template>
</nz-list>
import { Component, OnInit } from '@angular/core';
import { ListService } from '@core/services/list/list.service';
@Component({
selector: 'app-fixed-assets',
templateUrl: './fixed-assets.component.html',
styleUrls: ['./fixed-assets.component.less']
styleUrls: ['./fixed-assets.component.less'],
})
export class FixedAssetsComponent implements OnInit {
constructor() { }
list: any[] = [];
loading = true;
q: any = {
pi: 1,
ps: 10,
sorter: '',
status: null,
statusList: [],
};
expandForm = false;
constructor(private listSrv: ListService) {}
ngOnInit() {
}
this.loading = true;
this.listSrv.getKindAssetList(2).subscribe(res => {
this.list = res['rows'];
console.log(this.list);
this.loading = false;
});
// this.http.get('/api/list', { count: 8 }).subscribe((res: any) => {
// this.list = this.list.concat(res);
// this.loading = false;
// this.cdr.detectChanges();
// });
}
}
<page-header [title]="'详情'"></page-header>
<nz-collapse>
<nz-collapse-panel *ngFor="let panel of panels" [nzHeader]="panel.name" [nzActive]="panel.active"
[nzDisabled]="panel.disabled">
<ng-container *ngIf="panel.id == 1">
<ng-container *ngFor="let item of panel.items">
<span>{{item.text}}</span>
</ng-container>
</ng-container>
</nz-collapse-panel>
</nz-collapse>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FixedDetailComponent } from './fixed-detail.component';
describe('FixedDetailComponent', () => {
let component: FixedDetailComponent;
let fixture: ComponentFixture<FixedDetailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDetailComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FixedDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-fixed-detail',
templateUrl: './fixed-detail.component.html',
styleUrls: ['./fixed-detail.component.less'],
})
export class FixedDetailComponent implements OnInit {
panels = [
{
id: 1,
active: true,
name: '基本情况',
disabled: false,
items: [
{
text: '资产编号',
fieid: 'num',
},
{
text: '资产名称',
fieid: 'name',
},
{
text: '规格型号',
fieid: 'modelNum',
},
{
text: '资产分类',
fieid: 'assetClass',
},
{
text: '资产来源',
fieid: 'source',
},
{
text: '资产状态',
fieid: 'assetState',
},
{
text: '验收单号',
fieid: 'acceptNum',
},
{
text: '领用单号',
fieid: 'receiveNum',
},
{
text: '购入日期',
fieid: 'buyDate',
},
{
text: '制造厂商',
fieid: 'madeFirms',
},
{
text: '出厂编码',
fieid: 'factoryCode',
},
{
text: '供应商',
fieid: 'supplier',
},
{
text: '工作场景',
fieid: 'workPlace',
},
{
text: '存放地',
fieid: 'storage',
},
{
text: '管理部门',
fieid: 'company.name',
},
{
text: '产权单位',
fieid: 'belongUnit.name',
},
{
text: '使用单位',
fieid: 'useUnit.name',
},
{
text: '所在项目部',
fieid: 'belongProject',
},
],
},
{
id: 2,
active: false,
disabled: false,
name: '财务信息',
},
{
id: 3,
active: false,
disabled: false,
name: '资产折旧',
},
{
id: 4,
active: false,
disabled: false,
name: '车辆信息',
},
{
id: 5,
active: false,
disabled: false,
name: '技术参数',
},
{
id: 6,
active: false,
disabled: false,
name: '合格证',
},
{
id: 7,
active: false,
disabled: false,
name: '资产照片',
},
{
id: 8,
active: false,
disabled: false,
name: '附件及资料',
},
{
id: 9,
active: false,
disabled: false,
name: '附属设备及配件',
},
{
id: 10,
active: false,
disabled: false,
name: '折旧记录',
},
{
id: 11,
active: false,
disabled: false,
name: '资产维修保养记录',
},
{
id: 12,
active: false,
disabled: false,
name: '资产盘点记录',
},
{
id: 13,
active: false,
disabled: false,
name: '资产使用记录',
},
];
constructor() {}
ngOnInit() {}
}
......@@ -47,6 +47,7 @@ import { SharedModule } from '@shared';
import { AssetsCateComponent } from './assets-info/assets-cate/assets-cate.component';
import { AssetsLeaseHouseComponent } from './assets-lease/house/house.component';
import { BusinessComponent } from './single-machine/business/business.component';
import { FixedDetailComponent } from './assets-info/fixed-assets/fixed-detail/fixed-detail.component';
@NgModule({
declarations: [
......@@ -93,7 +94,8 @@ import { BusinessComponent } from './single-machine/business/business.component'
DeviceComponent,
UserComponent,
TypeComponent,
VendorComponent
VendorComponent,
FixedDetailComponent
],
imports: [SharedModule, FixedAssetsRoutingModule]
})
......
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