83 changed files with 2852 additions and 861 deletions
@ -0,0 +1,37 @@ |
|||
<div class="overflow-auto"> |
|||
<div class="flex items-center"> |
|||
<div class="flex-1"> |
|||
<nz-input-group [nzSuffix]="suffixIcon"> |
|||
<input type="text" nz-input placeholder="请输入关键字" [(ngModel)]="searchValue" /> |
|||
</nz-input-group> |
|||
<ng-template #suffixIcon> |
|||
<span nz-icon nzType="search"></span> |
|||
</ng-template> |
|||
</div> |
|||
</div> |
|||
<div class="py-4"> |
|||
<nz-tree |
|||
class="tree" |
|||
nzBlockNode |
|||
[nzData]="nodes" |
|||
[nzExpandedKeys]="expandedKeys" |
|||
[nzSearchValue]="searchValue" |
|||
(nzClick)="nzEvent($event)" |
|||
(nzExpandChange)="onExpandChange($event)" |
|||
[nzTreeTemplate]="nzTreeTemplate" |
|||
> |
|||
<ng-template #nzTreeTemplate let-node let-origin="origin"> |
|||
<div class="custom-node flex items-center overflow-hidden"> |
|||
<div class="flex-1"> |
|||
<span class="ml-2 overflow-hidden text-ellipsis">{{ node.title }}</span> |
|||
</div> |
|||
@if (createable) { |
|||
<button nz-button nzType="text" onclick="event.stopPropagation()"> |
|||
<span nz-icon nzType="more"></span> |
|||
</button> |
|||
} |
|||
</div> |
|||
</ng-template> |
|||
</nz-tree> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,73 @@ |
|||
import { Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core' |
|||
import { FormBuilder, FormGroup } from '@angular/forms' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { FormValidators, Utils } from 'app/utils' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzFormatEmitEvent, NzTreeNodeOptions } from 'ng-zorro-antd/tree' |
|||
|
|||
@Component({ |
|||
selector: 'app-position-tree', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './position-tree.component.html', |
|||
styleUrl: './position-tree.component.less', |
|||
}) |
|||
export class PositionTreeComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private drawer: NzDrawerService, |
|||
private fb: FormBuilder, |
|||
private msg: NzMessageService, |
|||
private modal: NzModalService, |
|||
) {} |
|||
|
|||
@Input() createable = true |
|||
|
|||
@Output() onSelectedChange = new EventEmitter<NzSafeAny>() |
|||
|
|||
drawerRef?: NzDrawerRef |
|||
|
|||
searchValue = '' |
|||
|
|||
parentId?: number |
|||
|
|||
originTreeData: NzSafeAny[] = [] |
|||
|
|||
nodes: NzSafeAny[] = [] |
|||
|
|||
expandedKeys: string[] = [] |
|||
|
|||
form!: FormGroup |
|||
|
|||
initTree() { |
|||
this.api.getBasicPositionTree().subscribe((res) => { |
|||
this.originTreeData = res.body |
|||
|
|||
this.nodes = Utils.buildTree(res.body, 'positionId', 'name') |
|||
this.expandedKeys = [...this.expandedKeys] |
|||
}) |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.initTree() |
|||
} |
|||
|
|||
nzEvent(event: NzFormatEmitEvent): void { |
|||
if (event.eventName === 'click') { |
|||
const { node } = event |
|||
this.onSelectedChange.emit(event.keys?.length === 0 ? null : node?.origin) |
|||
} |
|||
} |
|||
|
|||
onExpandChange(e: NzFormatEmitEvent) { |
|||
this.expandedKeys = e.keys ?? [] |
|||
} |
|||
|
|||
onSelectedKeysChange(e: string[]) { |
|||
console.log('e', e) |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
<app-page> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm" [renderColumn]="renderColumnTpl"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('status') { |
|||
@switch (data) { |
|||
@case ('0') { |
|||
<nz-badge nzStatus="processing" nzText="正常"></nz-badge> |
|||
} |
|||
@case ('1') { |
|||
<nz-badge nzStatus="error" nzText="停用"></nz-badge> |
|||
} |
|||
} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="资产名称"> |
|||
<input nz-input placeholder="请输入" formControlName="roleName" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
@ -0,0 +1,61 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
import { FormValidators } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-alert-borrow', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './alert-borrow.component.html', |
|||
styleUrl: './alert-borrow.component.less', |
|||
}) |
|||
export class AlertBorrowComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
@ViewChild('createFormTpl') createFormTpl!: TemplateRef<{}> |
|||
|
|||
queryForm = new FormGroup({ |
|||
roleName: new FormControl(''), |
|||
status: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: 'roleId', title: '主键', visible: false }, |
|||
|
|||
{ key: 'roleName', title: '资产分类', visible: true }, |
|||
{ key: 'roleSort', title: '资产编号', visible: true }, |
|||
{ key: 'roleSort', title: '名称', visible: true }, |
|||
{ key: 'roleSort', title: '规格型号', visible: true }, |
|||
|
|||
{ key: 'status', title: '状态', visible: true }, |
|||
{ key: 'remark', title: '备注', visible: true }, |
|||
// { key: 'createTime', title: '创建时间', visible: true },
|
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAlertBorrow({ ...p, ...q }) |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<app-page> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm" [renderColumn]="renderColumnTpl"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('_useUser') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_warehouse') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_position') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_head') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_ownCompany') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_useOrganization') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_category') { |
|||
{{ data?.categoryName ?? '-' }} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="资产名称"> |
|||
<input nz-input placeholder="请输入" formControlName="roleName" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
@ -0,0 +1,56 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
import { FormValidators } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-alert-inventory-down', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './alert-inventory-down.component.html', |
|||
styleUrl: './alert-inventory-down.component.less', |
|||
}) |
|||
export class AlertInventoryDownComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
roleName: new FormControl(''), |
|||
status: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '名称', visible: true }, |
|||
{ key: 'model', title: '规格型号', visible: true }, |
|||
|
|||
{ key: '_warehouse', title: '仓库', visible: true }, |
|||
// { key: 'createTime', title: '创建时间', visible: true },
|
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAlertSafetyDown({ ...p, ...q }) |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<app-page> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm" [renderColumn]="renderColumnTpl"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('_useUser') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_warehouse') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_position') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_head') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_ownCompany') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_useOrganization') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_category') { |
|||
{{ data?.categoryName ?? '-' }} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="资产名称"> |
|||
<input nz-input placeholder="请输入" formControlName="roleName" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
@ -0,0 +1,56 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
import { FormValidators } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-alert-inventory-safety', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './alert-inventory-safety.component.html', |
|||
styleUrl: './alert-inventory-safety.component.less', |
|||
}) |
|||
export class AlertInventorySafetyComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
roleName: new FormControl(''), |
|||
status: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '名称', visible: true }, |
|||
{ key: 'model', title: '规格型号', visible: true }, |
|||
|
|||
{ key: '_warehouse', title: '仓库', visible: true }, |
|||
// { key: 'createTime', title: '创建时间', visible: true },
|
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAlertSafety({ ...p, ...q }) |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<app-page> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm" [renderColumn]="renderColumnTpl"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('_useUser') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_warehouse') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_position') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_head') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_ownCompany') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_useOrganization') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_category') { |
|||
{{ data?.categoryName ?? '-' }} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="资产名称"> |
|||
<input nz-input placeholder="请输入" formControlName="roleName" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
@ -0,0 +1,56 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
import { FormValidators } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-alert-inventory-up', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './alert-inventory-up.component.html', |
|||
styleUrl: './alert-inventory-up.component.less', |
|||
}) |
|||
export class AlertInventoryUpComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
roleName: new FormControl(''), |
|||
status: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '名称', visible: true }, |
|||
{ key: 'model', title: '规格型号', visible: true }, |
|||
|
|||
{ key: '_warehouse', title: '仓库', visible: true }, |
|||
// { key: 'createTime', title: '创建时间', visible: true },
|
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAlertSafetyUp({ ...p, ...q }) |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<app-page> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm" [renderColumn]="renderColumnTpl"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('_useUser') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_warehouse') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_position') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_head') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_ownCompany') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_useOrganization') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_category') { |
|||
{{ data?.categoryName ?? '-' }} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="资产名称"> |
|||
<input nz-input placeholder="请输入" formControlName="roleName" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
@ -0,0 +1,55 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
import { FormValidators } from 'app/utils' |
|||
@Component({ |
|||
selector: 'app-alert-maintenance', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './alert-maintenance.component.html', |
|||
styleUrl: './alert-maintenance.component.less', |
|||
}) |
|||
export class AlertMaintenanceComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
roleName: new FormControl(''), |
|||
status: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '名称', visible: true }, |
|||
{ key: 'model', title: '规格型号', visible: true }, |
|||
|
|||
{ key: '_warehouse', title: '仓库', visible: true }, |
|||
// { key: 'createTime', title: '创建时间', visible: true },
|
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAlertMaintenance({ ...p, ...q }) |
|||
} |
|||
} |
|||
@ -1,77 +1,110 @@ |
|||
import { Component } from '@angular/core' |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ComponentOrgTreeComponent } from 'app/components/component-org-tree/component-org-tree.component' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { of } from 'rxjs' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { |
|||
AssetFormComponent, |
|||
ComponentOrgTreeComponent, |
|||
ManufacturerSelectComponent, |
|||
PositionSelectComponent, |
|||
} from 'app/components' |
|||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, ASSET_STATUS_MAP } from 'app/constants' |
|||
import { Utils } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-fixed-asset-belong', |
|||
standalone: true, |
|||
imports: [SharedModule, ComponentOrgTreeComponent], |
|||
imports: [ |
|||
SharedModule, |
|||
AssetFormComponent, |
|||
ComponentOrgTreeComponent, |
|||
PositionSelectComponent, |
|||
ManufacturerSelectComponent, |
|||
], |
|||
templateUrl: './fixed-asset-belong.component.html', |
|||
styleUrl: './fixed-asset-belong.component.less', |
|||
}) |
|||
export class FixedAssetBelongComponent { |
|||
constructor(private api: ApiService) {} |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
type: new FormControl(''), |
|||
status: new FormControl(''), |
|||
date: new FormControl(''), |
|||
name: new FormControl(), |
|||
model: new FormControl(), |
|||
status: new FormControl(), |
|||
assetCode: new FormControl(), |
|||
serialNumber: new FormControl(), |
|||
sourceId: new FormControl(), |
|||
positionId: new FormControl(), |
|||
manufacturersVendorId: new FormControl(), |
|||
}) |
|||
|
|||
@ViewChild('copyTpl') copyTpl!: TemplateRef<NzSafeAny> |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
organizationId: number | null = null |
|||
|
|||
copyNum = 1 |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: '资产编号', title: '资产编号', visible: true }, |
|||
{ key: '资产分类', title: '资产分类', visible: true }, |
|||
{ key: '资产状态', title: '资产状态', visible: true }, |
|||
{ key: '资产名称', title: '资产名称', visible: true }, |
|||
{ key: '规格型号', title: '规格型号', visible: true }, |
|||
{ key: '序列号', title: '序列号', visible: true }, |
|||
{ key: '使用人员', title: '使用人员', visible: true }, |
|||
{ key: '所属公司', title: '所属公司', visible: true }, |
|||
{ key: '使用组织', title: '使用组织', visible: true }, |
|||
{ key: '存放位置', title: '存放位置', visible: true }, |
|||
{ key: '资产标签', title: '资产标签', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: '_ownCompany', title: '所属公司', visible: true }, |
|||
{ key: '_useOrganization', title: '使用组织', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
]) |
|||
.setRowOperate([{ title: '查看', premissions: [] }, { title: '变更明细' }]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
if (Array.isArray(q['createTime'])) { |
|||
const createTimeStart = q['createTime']?.[0] |
|||
const createTimeEnd = q['createTime']?.[1] |
|||
|
|||
q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
return this.api.getAssetPage({ ...p, ...q, ownCompanyId: this.organizationId }) |
|||
} |
|||
return of({ |
|||
data: { |
|||
total: 5, |
|||
records: [ |
|||
{ |
|||
id: 1, |
|||
name: '沙滩', |
|||
price: 590, |
|||
type: 0, |
|||
lifespan: 6, |
|||
number: 20, |
|||
max: 20, |
|||
status: 1, |
|||
createTime: '2024-05-01', |
|||
}, |
|||
], |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: '查看资产', |
|||
nzContent: AssetFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzFooter: null, |
|||
}) |
|||
return this.api.getEntityPage(p, q) |
|||
} |
|||
|
|||
onOrgSelectedChange(e: NzSafeAny) { |
|||
this.organizationId = e ? e.organizationId : null |
|||
this.table.ref.search() |
|||
} |
|||
} |
|||
|
|||
@ -1,115 +1,111 @@ |
|||
import { Component } from '@angular/core' |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { NzFormatEmitEvent } from 'ng-zorro-antd/tree' |
|||
import { of } from 'rxjs' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { |
|||
AssetFormComponent, |
|||
ComponentBasicCategoryTreeComponent, |
|||
ComponentOrgTreeComponent, |
|||
ManufacturerSelectComponent, |
|||
PositionTreeComponent, |
|||
} from 'app/components' |
|||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, ASSET_STATUS_MAP } from 'app/constants' |
|||
|
|||
@Component({ |
|||
selector: 'app-fixed-asset-category', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
imports: [ |
|||
SharedModule, |
|||
AssetFormComponent, |
|||
ComponentOrgTreeComponent, |
|||
PositionTreeComponent, |
|||
ManufacturerSelectComponent, |
|||
ComponentBasicCategoryTreeComponent, |
|||
], |
|||
templateUrl: './fixed-asset-category.component.html', |
|||
styleUrl: './fixed-asset-category.component.less', |
|||
}) |
|||
export class FixedAssetCategoryComponent { |
|||
constructor(private api: ApiService) {} |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
type: new FormControl(''), |
|||
status: new FormControl(''), |
|||
date: new FormControl(''), |
|||
name: new FormControl(), |
|||
model: new FormControl(), |
|||
status: new FormControl(), |
|||
assetCode: new FormControl(), |
|||
serialNumber: new FormControl(), |
|||
sourceId: new FormControl(), |
|||
positionId: new FormControl(), |
|||
manufacturersVendorId: new FormControl(), |
|||
}) |
|||
|
|||
@ViewChild('copyTpl') copyTpl!: TemplateRef<NzSafeAny> |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
nodes = [ |
|||
{ |
|||
title: '数据中心设备', |
|||
key: '0-0', |
|||
children: [ |
|||
{ |
|||
title: '组织1', |
|||
key: '0-0-0', |
|||
isLeaf: true, |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
title: '办公设备', |
|||
key: '0-1', |
|||
isLeaf: true, |
|||
}, |
|||
{ |
|||
title: '办公家具', |
|||
key: '0-2', |
|||
isLeaf: true, |
|||
}, |
|||
{ |
|||
title: '特种设备', |
|||
key: '0-21', |
|||
isLeaf: true, |
|||
}, |
|||
{ |
|||
title: '车辆资产', |
|||
key: '0-21', |
|||
isLeaf: true, |
|||
}, |
|||
] |
|||
categoryId: number | null = null |
|||
|
|||
nzEvent(event: NzFormatEmitEvent): void { |
|||
console.log(event) |
|||
} |
|||
copyNum = 1 |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: '资产编号', title: '资产编号', visible: true }, |
|||
{ key: '资产分类', title: '资产分类', visible: true }, |
|||
{ key: '资产状态', title: '资产状态', visible: true }, |
|||
{ key: '资产名称', title: '资产名称', visible: true }, |
|||
{ key: '规格型号', title: '规格型号', visible: true }, |
|||
{ key: '序列号', title: '序列号', visible: true }, |
|||
{ key: '使用人员', title: '使用人员', visible: true }, |
|||
{ key: '所属公司', title: '所属公司', visible: false }, |
|||
{ key: '使用组织', title: '使用组织', visible: false }, |
|||
{ key: '存放位置', title: '存放位置', visible: false }, |
|||
{ key: '资产标签', title: '资产标签', visible: false }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: '_ownCompany', title: '所属公司', visible: true }, |
|||
{ key: '_useOrganization', title: '使用组织', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
]) |
|||
.setRowOperate([{ title: '查看', premissions: [] }, { title: '变更明细' }]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
if (Array.isArray(q['createTime'])) { |
|||
const createTimeStart = q['createTime']?.[0] |
|||
const createTimeEnd = q['createTime']?.[1] |
|||
|
|||
q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
return this.api.getAssetPage({ ...p, ...q, categoryId: this.categoryId }) |
|||
} |
|||
return of({ |
|||
data: { |
|||
total: 5, |
|||
records: [ |
|||
{ |
|||
id: 1, |
|||
name: '沙滩', |
|||
price: 590, |
|||
type: 0, |
|||
lifespan: 6, |
|||
number: 20, |
|||
max: 20, |
|||
status: 1, |
|||
createTime: '2024-05-01', |
|||
}, |
|||
], |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: '查看资产', |
|||
nzContent: AssetFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzFooter: null, |
|||
}) |
|||
return this.api.getEntityPage(p, q) |
|||
} |
|||
|
|||
onSelectedChange(e: NzSafeAny) { |
|||
this.categoryId = e ? e.categoryId : null |
|||
this.table.ref.search() |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,22 @@ |
|||
<app-page> |
|||
<app-page class="ledger"> |
|||
<div class="mb-3"> |
|||
<nz-radio-group [(ngModel)]="tab" (ngModelChange)="onTabChange($event)" nzButtonStyle="solid"> |
|||
<!-- <nz-radio-group [(ngModel)]="tab" (ngModelChange)="onTabChange($event)" nzButtonStyle="solid"> |
|||
@for (t of tabs; track $index) { |
|||
<label nz-radio-button [nzValue]="t.path">{{ t.title }}</label> |
|||
} |
|||
</nz-radio-group> |
|||
</nz-radio-group> --> |
|||
<!-- <nz-tabset> |
|||
@for (t of tabs; track $index) { |
|||
<nz-tab [nzTitle]="t.title"> 1313 </nz-tab> |
|||
} |
|||
</nz-tabset> --> |
|||
<ul class="flex bg-white tabs"> |
|||
@for (t of tabs; track $index) { |
|||
<li [ngClass]="{ active: tab === t.path }"> |
|||
<button nz-button nzType="text" [routerLink]="t.path">{{ t.title }}</button> |
|||
</li> |
|||
} |
|||
</ul> |
|||
</div> |
|||
<router-outlet /> |
|||
</app-page> |
|||
|
|||
@ -0,0 +1,22 @@ |
|||
.tabs { |
|||
li { |
|||
border-bottom: 2px solid transparent; |
|||
} |
|||
|
|||
.active { |
|||
border-color: #40a9ff; |
|||
|
|||
button { |
|||
color: #40a9ff; |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
.ledger { |
|||
::ng-deep { |
|||
.formgroup-container { |
|||
padding: 12px 12px 0; |
|||
} |
|||
} |
|||
} |
|||
@ -1,26 +1,188 @@ |
|||
<div class="flex flex-1"> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm"> |
|||
<div class="flex-1 overflow-hidden bg-white"> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm" [renderColumn]="renderColumnTpl"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('status') { |
|||
<nz-tag> |
|||
{{ ASSET_STATUS_MAP[data] }} |
|||
</nz-tag> |
|||
} |
|||
@case ('_useUser') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_warehouse') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_position') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_head') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_ownCompany') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_useOrganization') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_category') { |
|||
{{ data?.categoryName ?? '-' }} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<!-- <ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link">资产确认</button> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> --> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="资产名称"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="资产编号"> |
|||
<input nz-input placeholder="请输入" formControlName="assetCode" /> |
|||
</app-query-item> |
|||
<app-query-item label="规格型号"> |
|||
<input nz-input placeholder="请输入" formControlName="model" /> |
|||
</app-query-item> |
|||
<app-query-item label="序列号"> |
|||
<input nz-input placeholder="请输入" formControlName="serialNumber" /> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="资产状态"> |
|||
<nz-select nzPlacement="bottomRight" nzBorderless class="!w-auto" [nzDropdownMatchSelectWidth]="false"> |
|||
<nz-option nzValue="123" nzLabel="闲置"></nz-option> |
|||
<nz-option nzValue="22" nzLabel="在用"></nz-option> |
|||
<nz-option nzValue="2211" nzLabel="借用中"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="维修中"></nz-option> |
|||
<nz-option nzValue="2231" nzLabel="调拨中"></nz-option> |
|||
<nz-option nzValue="2241" nzLabel="待作废"></nz-option> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-24" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
formControlName="status" |
|||
> |
|||
@for (item of ASSET_STATUS_MAP | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="资产来源"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-24" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
formControlName="sourceId" |
|||
> |
|||
@for (item of ASSET_SOURCE_MAP | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="资产编号"> |
|||
<app-query-item label="位置"> |
|||
<app-position-select formControlName="positionId" /> |
|||
</app-query-item> |
|||
<app-query-item label="生产厂商"> |
|||
<app-manufacturer-select class="block w-36" formControlName="manufacturersVendorId" /> |
|||
</app-query-item> |
|||
|
|||
<!-- <app-query-item label="设备标签"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="名称"> |
|||
<app-query-item label="设备IP"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="规格型号"> |
|||
<app-query-item label="管理IP"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="设备IP"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="运行环境"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="营业"></nz-option> |
|||
<nz-option nzValue="22" nzLabel="办公"></nz-option> |
|||
<nz-option nzValue="2211" nzLabel="生产"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="测试"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="来源"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="捐赠"></nz-option> |
|||
<nz-option nzValue="22" nzLabel="赠送"></nz-option> |
|||
<nz-option nzValue="2211" nzLabel="采购"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="自建"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="自购"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="其他"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="厂商"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="维保商"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="采购日期"> |
|||
<app-date-query></app-date-query> |
|||
</app-query-item> |
|||
<app-query-item label="所属公司"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="使用组织"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="管理人员"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="使用人员"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> --> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
|
|||
@ -1,77 +1,92 @@ |
|||
import { Component } from '@angular/core' |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { of } from 'rxjs' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { AssetFormComponent, ManufacturerSelectComponent, PositionSelectComponent } from 'app/components' |
|||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, ASSET_STATUS_MAP } from 'app/constants' |
|||
import { Utils } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-fixed-asset-myown', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
imports: [SharedModule, AssetFormComponent, PositionSelectComponent, ManufacturerSelectComponent], |
|||
templateUrl: './fixed-asset-myown.component.html', |
|||
styleUrl: './fixed-asset-myown.component.less', |
|||
}) |
|||
export class FixedAssetMyownComponent { |
|||
constructor(private api: ApiService) {} |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
type: new FormControl(''), |
|||
status: new FormControl(''), |
|||
date: new FormControl(''), |
|||
name: new FormControl(), |
|||
model: new FormControl(), |
|||
status: new FormControl(), |
|||
assetCode: new FormControl(), |
|||
serialNumber: new FormControl(), |
|||
sourceId: new FormControl(), |
|||
positionId: new FormControl(), |
|||
manufacturersVendorId: new FormControl(), |
|||
}) |
|||
|
|||
@ViewChild('copyTpl') copyTpl!: TemplateRef<NzSafeAny> |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
copyNum = 1 |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: '资产编号', title: '资产编号', visible: true }, |
|||
{ key: '资产分类', title: '资产分类', visible: true }, |
|||
{ key: '资产状态', title: '资产状态', visible: true }, |
|||
{ key: '资产名称', title: '资产名称', visible: true }, |
|||
{ key: '规格型号', title: '规格型号', visible: true }, |
|||
{ key: '序列号', title: '序列号', visible: true }, |
|||
{ key: '使用人员', title: '使用人员', visible: true }, |
|||
{ key: '所属公司', title: '所属公司', visible: true }, |
|||
{ key: '使用组织', title: '使用组织', visible: true }, |
|||
{ key: '存放位置', title: '存放位置', visible: true }, |
|||
{ key: '资产标签', title: '资产标签', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: '_ownCompany', title: '所属公司', visible: true }, |
|||
{ key: '_useOrganization', title: '使用组织', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
]) |
|||
.setRowOperate([{ title: '查看', premissions: [] }, { title: '变更明细' }]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
if (Array.isArray(q['createTime'])) { |
|||
const createTimeStart = q['createTime']?.[0] |
|||
const createTimeEnd = q['createTime']?.[1] |
|||
|
|||
q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
return this.api.getAssetPage({ ...p, ...q }) |
|||
} |
|||
return of({ |
|||
data: { |
|||
total: 5, |
|||
records: [ |
|||
{ |
|||
id: 1, |
|||
name: '沙滩', |
|||
price: 590, |
|||
type: 0, |
|||
lifespan: 6, |
|||
number: 20, |
|||
max: 20, |
|||
status: 1, |
|||
createTime: '2024-05-01', |
|||
}, |
|||
], |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: '查看资产', |
|||
nzContent: AssetFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzFooter: null, |
|||
}) |
|||
return this.api.getEntityPage(p, q) |
|||
} |
|||
} |
|||
|
|||
@ -1,105 +1,109 @@ |
|||
import { Component } from '@angular/core' |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { NzFormatEmitEvent } from 'ng-zorro-antd/tree' |
|||
import { of } from 'rxjs' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { |
|||
AssetFormComponent, |
|||
ComponentOrgTreeComponent, |
|||
ManufacturerSelectComponent, |
|||
PositionSelectComponent, |
|||
} from 'app/components' |
|||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, ASSET_STATUS_MAP } from 'app/constants' |
|||
|
|||
@Component({ |
|||
selector: 'app-fixed-asset-org', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
imports: [ |
|||
SharedModule, |
|||
AssetFormComponent, |
|||
ComponentOrgTreeComponent, |
|||
PositionSelectComponent, |
|||
ManufacturerSelectComponent, |
|||
], |
|||
templateUrl: './fixed-asset-org.component.html', |
|||
styleUrl: './fixed-asset-org.component.less', |
|||
}) |
|||
export class FixedAssetOrgComponent { |
|||
constructor(private api: ApiService) {} |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
type: new FormControl(''), |
|||
status: new FormControl(''), |
|||
date: new FormControl(''), |
|||
name: new FormControl(), |
|||
model: new FormControl(), |
|||
status: new FormControl(), |
|||
assetCode: new FormControl(), |
|||
serialNumber: new FormControl(), |
|||
sourceId: new FormControl(), |
|||
positionId: new FormControl(), |
|||
manufacturersVendorId: new FormControl(), |
|||
}) |
|||
|
|||
@ViewChild('copyTpl') copyTpl!: TemplateRef<NzSafeAny> |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
nodes = [ |
|||
{ |
|||
title: '科技部', |
|||
key: '0-0', |
|||
children: [ |
|||
{ |
|||
title: '组织1', |
|||
key: '0-0-0', |
|||
isLeaf: true, |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
title: '组织2', |
|||
key: '0-1', |
|||
isLeaf: true, |
|||
}, |
|||
{ |
|||
title: '组织3', |
|||
key: '0-2', |
|||
isLeaf: true, |
|||
}, |
|||
] |
|||
organizationId: number | null = null |
|||
|
|||
nzEvent(event: NzFormatEmitEvent): void { |
|||
console.log(event) |
|||
} |
|||
copyNum = 1 |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: '资产编号', title: '资产编号', visible: true }, |
|||
{ key: '资产分类', title: '资产分类', visible: true }, |
|||
{ key: '资产状态', title: '资产状态', visible: true }, |
|||
{ key: '资产名称', title: '资产名称', visible: true }, |
|||
{ key: '规格型号', title: '规格型号', visible: true }, |
|||
{ key: '序列号', title: '序列号', visible: true }, |
|||
{ key: '使用人员', title: '使用人员', visible: true }, |
|||
{ key: '所属公司', title: '所属公司', visible: true }, |
|||
{ key: '使用组织', title: '使用组织', visible: true }, |
|||
{ key: '存放位置', title: '存放位置', visible: true }, |
|||
{ key: '资产标签', title: '资产标签', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: '_ownCompany', title: '所属公司', visible: true }, |
|||
{ key: '_useOrganization', title: '使用组织', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
]) |
|||
.setRowOperate([{ title: '查看', premissions: [] }, { title: '变更明细' }]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
if (Array.isArray(q['createTime'])) { |
|||
const createTimeStart = q['createTime']?.[0] |
|||
const createTimeEnd = q['createTime']?.[1] |
|||
|
|||
q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
return this.api.getAssetPage({ ...p, ...q, ownCompanyId: this.organizationId }) |
|||
} |
|||
return of({ |
|||
data: { |
|||
total: 5, |
|||
records: [ |
|||
{ |
|||
id: 1, |
|||
name: '沙滩', |
|||
price: 590, |
|||
type: 0, |
|||
lifespan: 6, |
|||
number: 20, |
|||
max: 20, |
|||
status: 1, |
|||
createTime: '2024-05-01', |
|||
}, |
|||
], |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: '查看资产', |
|||
nzContent: AssetFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzFooter: null, |
|||
}) |
|||
return this.api.getEntityPage(p, q) |
|||
} |
|||
|
|||
onOrgSelectedChange(e: NzSafeAny) { |
|||
this.organizationId = e ? e.organizationId : null |
|||
this.table.ref.search() |
|||
} |
|||
} |
|||
|
|||
@ -1,105 +1,108 @@ |
|||
import { Component } from '@angular/core' |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { NzFormatEmitEvent } from 'ng-zorro-antd/tree' |
|||
import { of } from 'rxjs' |
|||
|
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { |
|||
AssetFormComponent, |
|||
ComponentOrgTreeComponent, |
|||
ManufacturerSelectComponent, |
|||
PositionTreeComponent, |
|||
} from 'app/components' |
|||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, ASSET_STATUS_MAP } from 'app/constants' |
|||
@Component({ |
|||
selector: 'app-fixed-asset-position', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
imports: [ |
|||
SharedModule, |
|||
AssetFormComponent, |
|||
ComponentOrgTreeComponent, |
|||
PositionTreeComponent, |
|||
ManufacturerSelectComponent, |
|||
], |
|||
templateUrl: './fixed-asset-position.component.html', |
|||
styleUrl: './fixed-asset-position.component.less', |
|||
}) |
|||
export class FixedAssetPositionComponent { |
|||
constructor(private api: ApiService) {} |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
type: new FormControl(''), |
|||
status: new FormControl(''), |
|||
date: new FormControl(''), |
|||
name: new FormControl(), |
|||
model: new FormControl(), |
|||
status: new FormControl(), |
|||
assetCode: new FormControl(), |
|||
serialNumber: new FormControl(), |
|||
sourceId: new FormControl(), |
|||
positionId: new FormControl(), |
|||
manufacturersVendorId: new FormControl(), |
|||
}) |
|||
|
|||
@ViewChild('copyTpl') copyTpl!: TemplateRef<NzSafeAny> |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
nodes = [ |
|||
{ |
|||
title: '位置1', |
|||
key: '0-0', |
|||
children: [ |
|||
{ |
|||
title: '位置1-1', |
|||
key: '0-0-0', |
|||
isLeaf: true, |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
title: '位置2', |
|||
key: '0-1', |
|||
isLeaf: true, |
|||
}, |
|||
{ |
|||
title: '位置3', |
|||
key: '0-2', |
|||
isLeaf: true, |
|||
}, |
|||
] |
|||
positionId: number | null = null |
|||
|
|||
nzEvent(event: NzFormatEmitEvent): void { |
|||
console.log(event) |
|||
} |
|||
copyNum = 1 |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: '资产编号', title: '资产编号', visible: true }, |
|||
{ key: '资产分类', title: '资产分类', visible: true }, |
|||
{ key: '资产状态', title: '资产状态', visible: true }, |
|||
{ key: '资产名称', title: '资产名称', visible: true }, |
|||
{ key: '规格型号', title: '规格型号', visible: true }, |
|||
{ key: '序列号', title: '序列号', visible: true }, |
|||
{ key: '使用人员', title: '使用人员', visible: true }, |
|||
{ key: '所属公司', title: '所属公司', visible: true }, |
|||
{ key: '使用组织', title: '使用组织', visible: true }, |
|||
{ key: '存放位置', title: '存放位置', visible: true }, |
|||
{ key: '资产标签', title: '资产标签', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: '_ownCompany', title: '所属公司', visible: true }, |
|||
{ key: '_useOrganization', title: '使用组织', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
]) |
|||
.setRowOperate([{ title: '查看', premissions: [] }, { title: '变更明细' }]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
if (Array.isArray(q['createTime'])) { |
|||
const createTimeStart = q['createTime']?.[0] |
|||
const createTimeEnd = q['createTime']?.[1] |
|||
|
|||
q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
return this.api.getAssetPage({ ...p, ...q, positionId: this.positionId }) |
|||
} |
|||
return of({ |
|||
data: { |
|||
total: 5, |
|||
records: [ |
|||
{ |
|||
id: 1, |
|||
name: '沙滩', |
|||
price: 590, |
|||
type: 0, |
|||
lifespan: 6, |
|||
number: 20, |
|||
max: 20, |
|||
status: 1, |
|||
createTime: '2024-05-01', |
|||
}, |
|||
], |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: '查看资产', |
|||
nzContent: AssetFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzFooter: null, |
|||
}) |
|||
return this.api.getEntityPage(p, q) |
|||
} |
|||
|
|||
onSelectedChange(e: NzSafeAny) { |
|||
this.positionId = e ? e.positionId : null |
|||
this.table.ref.search() |
|||
} |
|||
} |
|||
|
|||
@ -1,77 +1,92 @@ |
|||
import { Component } from '@angular/core' |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { of } from 'rxjs' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { AssetFormComponent, ManufacturerSelectComponent, PositionSelectComponent } from 'app/components' |
|||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, ASSET_STATUS_MAP } from 'app/constants' |
|||
import { Utils } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-fixed-asset-search', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
imports: [SharedModule, AssetFormComponent, PositionSelectComponent, ManufacturerSelectComponent], |
|||
templateUrl: './fixed-asset-search.component.html', |
|||
styleUrl: './fixed-asset-search.component.less', |
|||
}) |
|||
export class FixedAssetSearchComponent { |
|||
constructor(private api: ApiService) {} |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
type: new FormControl(''), |
|||
status: new FormControl(''), |
|||
date: new FormControl(''), |
|||
name: new FormControl(), |
|||
model: new FormControl(), |
|||
status: new FormControl(), |
|||
assetCode: new FormControl(), |
|||
serialNumber: new FormControl(), |
|||
sourceId: new FormControl(), |
|||
positionId: new FormControl(), |
|||
manufacturersVendorId: new FormControl(), |
|||
}) |
|||
|
|||
@ViewChild('copyTpl') copyTpl!: TemplateRef<NzSafeAny> |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
copyNum = 1 |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: '资产编号', title: '资产编号', visible: true }, |
|||
{ key: '资产分类', title: '资产分类', visible: true }, |
|||
{ key: '资产状态', title: '资产状态', visible: true }, |
|||
{ key: '资产名称', title: '资产名称', visible: true }, |
|||
{ key: '规格型号', title: '规格型号', visible: true }, |
|||
{ key: '序列号', title: '序列号', visible: true }, |
|||
{ key: '使用人员', title: '使用人员', visible: true }, |
|||
{ key: '所属公司', title: '所属公司', visible: true }, |
|||
{ key: '使用组织', title: '使用组织', visible: true }, |
|||
{ key: '存放位置', title: '存放位置', visible: true }, |
|||
{ key: '资产标签', title: '资产标签', visible: true }, |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: '_ownCompany', title: '所属公司', visible: true }, |
|||
{ key: '_useOrganization', title: '使用组织', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
]) |
|||
.setRowOperate([{ title: '查看', premissions: [] }, { title: '变更明细' }]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
if (Array.isArray(q['createTime'])) { |
|||
const createTimeStart = q['createTime']?.[0] |
|||
const createTimeEnd = q['createTime']?.[1] |
|||
|
|||
q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
return this.api.getAssetPage({ ...p, ...q }) |
|||
} |
|||
return of({ |
|||
data: { |
|||
total: 5, |
|||
records: [ |
|||
{ |
|||
id: 1, |
|||
name: '沙滩', |
|||
price: 590, |
|||
type: 0, |
|||
lifespan: 6, |
|||
number: 20, |
|||
max: 20, |
|||
status: 1, |
|||
createTime: '2024-05-01', |
|||
}, |
|||
], |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: '查看资产', |
|||
nzContent: AssetFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzFooter: null, |
|||
}) |
|||
return this.api.getEntityPage(p, q) |
|||
} |
|||
} |
|||
|
|||
@ -1,2 +1,12 @@ |
|||
<div>ad</div> |
|||
<router-outlet /> |
|||
<div |
|||
class="menu bg-white shadow fixed left-0 top-12 bottom-0 z-20 w-48 flex-shrink-0 py-3 overflow-y-auto overflow-x-hidden" |
|||
> |
|||
<ul nz-menu nzMode="inline"> |
|||
<li nz-menu-item [nzPaddingLeft]="12" [routerLink]="['/system/user']" nzMatchRouter>组织架构</li> |
|||
<li nz-menu-item [nzPaddingLeft]="12" [routerLink]="['/system/role']" nzMatchRouter>角色管理</li> |
|||
</ul> |
|||
</div> |
|||
|
|||
<div class="pl-48 overflow-hidden"> |
|||
<router-outlet></router-outlet> |
|||
</div> |
|||
|
|||
@ -0,0 +1,97 @@ |
|||
<app-page> |
|||
<ng-template #actionTpl> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="primary" (click)="onCreate()"> |
|||
<span>新建</span> |
|||
</button> |
|||
</nz-space> |
|||
</ng-template> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table |
|||
[options]="table" |
|||
[tableAction]="actionTpl" |
|||
[formGroup]="queryForm" |
|||
[renderColumn]="renderColumnTpl" |
|||
> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('status') { |
|||
@switch (data) { |
|||
@case ('0') { |
|||
<nz-badge nzStatus="processing" nzText="正常"></nz-badge> |
|||
} |
|||
@case ('1') { |
|||
<nz-badge nzStatus="error" nzText="停用"></nz-badge> |
|||
} |
|||
} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="角色名称"> |
|||
<input nz-input placeholder="请输入" formControlName="roleName" /> |
|||
</app-query-item> |
|||
<app-query-item label="状态"> |
|||
<nz-select nzPlaceHolder="请选择" nzAllowClear class="w-40" formControlName="status"> |
|||
<nz-option nzValue="0" nzLabel="正常"></nz-option> |
|||
<nz-option nzValue="1" nzLabel="停用"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
|
|||
<ng-template #createFormTpl> |
|||
<form nz-form [formGroup]="createForm" [nzLayout]="'vertical'"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>名称</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入名称" formControlName="roleName" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
<nz-form-item> |
|||
<nz-form-label>权限菜单</nz-form-label> |
|||
<nz-form-control> 《权限菜单》 </nz-form-control> |
|||
</nz-form-item> |
|||
<!-- <nz-form-item> |
|||
<nz-form-label>备注</nz-form-label> |
|||
<nz-form-control> |
|||
<input nz-input nzPlaceHolder="请输入备注" formControlName="roleKey" /> |
|||
</nz-form-control> |
|||
</nz-form-item> --> |
|||
<nz-form-item> |
|||
<nz-form-label>显示顺序</nz-form-label> |
|||
<nz-form-control> |
|||
<nz-input-number nzPlaceHolder="请输入" class="!w-full" formControlName="roleSort" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
<nz-form-item> |
|||
<nz-form-label>状态</nz-form-label> |
|||
<nz-form-control> |
|||
<nz-radio-group formControlName="status"> |
|||
<label nz-radio nzValue="0">正常</label> |
|||
<label nz-radio nzValue="1">停用</label> |
|||
</nz-radio-group> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
<nz-form-item> |
|||
<nz-form-label>备注</nz-form-label> |
|||
<nz-form-control> |
|||
<input nz-input nzPlaceHolder="请输入备注" formControlName="remark" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</form> |
|||
</ng-template> |
|||
|
|||
<ng-template #errorTpl let-control> |
|||
<form-error-tips [control]="control"></form-error-tips> |
|||
</ng-template> |
|||
@ -0,0 +1,107 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
import { FormValidators } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-system-role', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './system-role.component.html', |
|||
styleUrl: './system-role.component.less', |
|||
}) |
|||
export class SystemRoleComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
@ViewChild('createFormTpl') createFormTpl!: TemplateRef<{}> |
|||
|
|||
queryForm = new FormGroup({ |
|||
roleName: new FormControl(''), |
|||
status: new FormControl(''), |
|||
}) |
|||
|
|||
createForm = new FormGroup({ |
|||
roleId: new FormControl(), |
|||
roleName: new FormControl('', [FormValidators.required('请输入')]), |
|||
roleKey: new FormControl(''), |
|||
roleSort: new FormControl(0), |
|||
status: new FormControl('0'), |
|||
remark: new FormControl(''), |
|||
menuIdList: new FormControl([]), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: 'roleId', title: '主键', visible: false }, |
|||
|
|||
{ key: 'roleName', title: '名称', visible: true }, |
|||
{ key: 'roleSort', title: '显示顺序', visible: true }, |
|||
|
|||
{ key: 'status', title: '状态', visible: true }, |
|||
{ key: 'remark', title: '备注', visible: true }, |
|||
// { key: 'createTime', title: '创建时间', visible: true },
|
|||
]) |
|||
.setRowOperate([ |
|||
{ title: '修改', onClick: this.onCreate.bind(this) }, |
|||
|
|||
{ title: '删除', onClick: this.deleteItem.bind(this) }, |
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getRolePage({ ...p, ...q }) |
|||
} |
|||
|
|||
onCreate(data?: NzSafeAny) { |
|||
if (data) { |
|||
this.createForm.patchValue(data) |
|||
} |
|||
this.modal.create({ |
|||
nzTitle: data ? '编辑角色' : '添加角色', |
|||
nzContent: this.createFormTpl, |
|||
nzOnOk: async () => { |
|||
if (FormValidators.validateFormGroup(this.createForm)) { |
|||
const vals = this.createForm.value |
|||
const res = await lastValueFrom(this.api.saveRole(vals)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
return true |
|||
} |
|||
return false |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
deleteItem(item?: NzSafeAny) { |
|||
const ids = [item.roleId] |
|||
this.modal.confirm({ |
|||
nzTitle: '警告', |
|||
nzContent: `是否要删除${ids.length}个角色?`, |
|||
nzOnOk: async () => { |
|||
const res = await lastValueFrom(this.api.deleteRole(ids)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
}, |
|||
}) |
|||
} |
|||
} |
|||
Loading…
Reference in new issue