Browse Source

[完善]完善器材日期保存

dev
邵佳豪 3 years ago
parent
commit
812994ec4a
  1. 22
      src/app/pages/equipment-info/equipment-info.component.ts

22
src/app/pages/equipment-info/equipment-info.component.ts

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

Loading…
Cancel
Save