固定资产项目前端文件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.5 KiB

2 years ago
import { Component } from '@angular/core'
import { FormControl, FormGroup } from '@angular/forms'
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table'
2 years ago
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'
@Component({
selector: 'app-fixed-asset-employee',
standalone: true,
imports: [SharedModule],
templateUrl: './fixed-asset-employee.component.html',
styleUrl: './fixed-asset-employee.component.less',
})
export class FixedAssetEmployeeComponent {
constructor(private api: ApiService) {}
queryForm = new FormGroup({
name: new FormControl(''),
type: new FormControl(''),
status: new FormControl(''),
date: new FormControl(''),
})
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,
},
]
nzEvent(event: NzFormatEmitEvent): void {
console.log(event)
}
ngOnInit(): void {
this.table
.setConfig({
selectable: true,
})
.setColumn([
{ key: '公司ID', title: '公司ID', visible: true },
{ key: '工号', title: '工号', visible: true },
{ key: '姓名', title: '姓名', visible: true },
{ key: '手机号', title: '手机号', visible: true },
{ key: '创建时间', title: '创建时间', visible: true },
{ key: 'ID', title: 'ID', visible: true },
{ key: '人员ID', title: '人员ID', visible: true },
{ key: '状态', title: '状态', visible: true },
{ key: '身份证', title: '身份证', visible: true },
])
.setRowOperate([{ title: '资产', premissions: [] }])
}
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 of({
data: {
total: 5,
records: [
{
id: 1,
name: '沙滩',
price: 590,
type: 0,
lifespan: 6,
number: 20,
max: 20,
status: 1,
createTime: '2024-05-01',
},
],
},
})
2 years ago
// return this.api.getEntityPage(p, q)
2 years ago
}
}