|
|
@ -6,6 +6,7 @@ import { AddequipmentComponent } from './addequipment/addequipment.component'; |
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
import { EditequipmentComponent } from './editequipment/editequipment.component'; |
|
|
|
import { EditequipmentComponent } from './editequipment/editequipment.component'; |
|
|
|
import { Router, ActivatedRoute } from '@angular/router' |
|
|
|
import { Router, ActivatedRoute } from '@angular/router' |
|
|
|
|
|
|
|
import * as moment from 'moment'; |
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-equipment-info', |
|
|
|
selector: 'app-equipment-info', |
|
|
|
templateUrl: './equipment-info.component.html', |
|
|
|
templateUrl: './equipment-info.component.html', |
|
|
@ -13,7 +14,7 @@ import { Router, ActivatedRoute } from '@angular/router' |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class EquipmentInfoComponent implements OnInit { |
|
|
|
export class EquipmentInfoComponent implements OnInit { |
|
|
|
validateForm!: FormGroup; |
|
|
|
validateForm!: FormGroup; |
|
|
|
constructor(private router: Router,private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient) { } |
|
|
|
constructor(private router: Router, private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient) { } |
|
|
|
arr = [] |
|
|
|
arr = [] |
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
this.validateForm = this.fb.group({ |
|
|
|
this.validateForm = this.fb.group({ |
|
|
@ -29,7 +30,7 @@ export class EquipmentInfoComponent implements OnInit { |
|
|
|
getEquipment() { |
|
|
|
getEquipment() { |
|
|
|
this.http.get('/api/services/app/FireEquipment/GetAll', { |
|
|
|
this.http.get('/api/services/app/FireEquipment/GetAll', { |
|
|
|
params: { |
|
|
|
params: { |
|
|
|
Name:this.validateForm.value.search ? this.validateForm.value.search : '', |
|
|
|
Name: this.validateForm.value.search ? this.validateForm.value.search : '', |
|
|
|
organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, |
|
|
|
organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, |
|
|
|
SkipCount: String(this.SkipCount), |
|
|
|
SkipCount: String(this.SkipCount), |
|
|
|
MaxResultCount: String(this.MaxResultCount) |
|
|
|
MaxResultCount: String(this.MaxResultCount) |
|
|
@ -73,9 +74,9 @@ export class EquipmentInfoComponent implements OnInit { |
|
|
|
let body = { |
|
|
|
let body = { |
|
|
|
name: instance.validateForm.value.name, |
|
|
|
name: instance.validateForm.value.name, |
|
|
|
specification: instance.validateForm.value.specification, |
|
|
|
specification: instance.validateForm.value.specification, |
|
|
|
productionDate: instance.validateForm.value.prodtime, |
|
|
|
productionDate: moment(instance.validateForm.value.prodtime).format('yyyy-MM-DD'), |
|
|
|
purchaseDate: instance.validateForm.value.buytime, |
|
|
|
purchaseDate: moment(instance.validateForm.value.buytime).format('yyyy-MM-DD'), |
|
|
|
validityEndTime: instance.validateForm.value.validitytime, |
|
|
|
validityEndTime: moment(instance.validateForm.value.validitytime).format('yyyy-MM-DD'), |
|
|
|
organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id |
|
|
|
organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id |
|
|
|
} |
|
|
|
} |
|
|
|
this.http.post('/api/services/app/FireEquipment/Create', body).subscribe(data => { |
|
|
|
this.http.post('/api/services/app/FireEquipment/Create', body).subscribe(data => { |
|
|
@ -94,9 +95,8 @@ export class EquipmentInfoComponent implements OnInit { |
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
} |
|
|
|
} |
|
|
|
edit(item) { |
|
|
|
edit(item) { |
|
|
|
console.log(item) |
|
|
|
console.log('xxxxx',item) |
|
|
|
const modal = this.modal.create({ |
|
|
|
const modal = this.modal.create({ |
|
|
|
// nzTitle: '新增角色',
|
|
|
|
|
|
|
|
nzContent: EditequipmentComponent, |
|
|
|
nzContent: EditequipmentComponent, |
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
nzWidth: 380, |
|
|
|
nzWidth: 380, |
|
|
@ -119,9 +119,9 @@ export class EquipmentInfoComponent implements OnInit { |
|
|
|
id: item.id, |
|
|
|
id: item.id, |
|
|
|
name: instance.validateForm.value.name, |
|
|
|
name: instance.validateForm.value.name, |
|
|
|
specification: instance.validateForm.value.specification, |
|
|
|
specification: instance.validateForm.value.specification, |
|
|
|
productionDate: instance.validateForm.value.prodtime, |
|
|
|
productionDate: moment(instance.validateForm.value.prodtime).format('yyyy-MM-DD'), |
|
|
|
purchaseDate: instance.validateForm.value.buytime, |
|
|
|
purchaseDate: moment(instance.validateForm.value.buytime).format('yyyy-MM-DD'), |
|
|
|
validityEndTime: instance.validateForm.value.validitytime, |
|
|
|
validityEndTime: moment(instance.validateForm.value.validitytime).format('yyyy-MM-DD'), |
|
|
|
organizationUnitId: item.organizationUnitId |
|
|
|
organizationUnitId: item.organizationUnitId |
|
|
|
} |
|
|
|
} |
|
|
|
this.http.put('/api/services/app/FireEquipment/Update', body).subscribe(data => { |
|
|
|
this.http.put('/api/services/app/FireEquipment/Update', body).subscribe(data => { |
|
|
@ -161,7 +161,7 @@ export class EquipmentInfoComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
goback(){ |
|
|
|
goback() { |
|
|
|
this.router.navigate(['/warning/petrolStation']) |
|
|
|
this.router.navigate(['/warning/petrolStation']) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|