|
|
|
@ -1,140 +1,172 @@
|
|
|
|
|
import { Component, OnInit, ViewChild, TemplateRef, ViewContainerRef } from '@angular/core'; |
|
|
|
|
import { Router, NavigationEnd } from '@angular/router'; |
|
|
|
|
import { filter } from 'rxjs/operators'; |
|
|
|
|
import { NavChangeService } from '../../service/navChange.service'; |
|
|
|
|
import { CacheTokenService } from '../../service/cache-token.service' //引入服务
|
|
|
|
|
import { |
|
|
|
|
Component, |
|
|
|
|
OnInit, |
|
|
|
|
ViewChild, |
|
|
|
|
TemplateRef, |
|
|
|
|
ViewContainerRef, |
|
|
|
|
} from "@angular/core"; |
|
|
|
|
import { Router, NavigationEnd } from "@angular/router"; |
|
|
|
|
import { filter } from "rxjs/operators"; |
|
|
|
|
import { NavChangeService } from "../../service/navChange.service"; |
|
|
|
|
import { CacheTokenService } from "../../service/cache-token.service"; //引入服务
|
|
|
|
|
|
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
import { SignalRAspNetCoreHelper } from '../../../shared/helpers/SignalRAspNetCoreHelper'; |
|
|
|
|
import { NzNotificationService } from 'ng-zorro-antd/notification'; |
|
|
|
|
import { GetOutOfLineDetailsComponent } from '../get-out-of-line-details/get-out-of-line-details.component'; |
|
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal'; |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { ChangePasswordComponent, MyValidators } from '../change-password/change-password.component'; |
|
|
|
|
import { listRefreshService } from '../../service/listRefresh.service'; |
|
|
|
|
import { DisposeequipmentComponent } from '../disposeequipment/disposeequipment.component'; |
|
|
|
|
declare var abp: any |
|
|
|
|
import * as moment from 'moment'; |
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
|
|
import { NzMessageService } from "ng-zorro-antd/message"; |
|
|
|
|
import { SignalRAspNetCoreHelper } from "../../../shared/helpers/SignalRAspNetCoreHelper"; |
|
|
|
|
import { NzNotificationService } from "ng-zorro-antd/notification"; |
|
|
|
|
import { GetOutOfLineDetailsComponent } from "../get-out-of-line-details/get-out-of-line-details.component"; |
|
|
|
|
import { NzModalService } from "ng-zorro-antd/modal"; |
|
|
|
|
import { HttpClient } from "@angular/common/http"; |
|
|
|
|
import { |
|
|
|
|
ChangePasswordComponent, |
|
|
|
|
MyValidators, |
|
|
|
|
} from "../change-password/change-password.component"; |
|
|
|
|
import { listRefreshService } from "../../service/listRefresh.service"; |
|
|
|
|
import { DisposeequipmentComponent } from "../disposeequipment/disposeequipment.component"; |
|
|
|
|
declare var abp: any; |
|
|
|
|
import * as moment from "moment"; |
|
|
|
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-home', |
|
|
|
|
templateUrl: './home.component.html', |
|
|
|
|
styleUrls: ['./home.component.scss'] |
|
|
|
|
selector: "app-home", |
|
|
|
|
templateUrl: "./home.component.html", |
|
|
|
|
styleUrls: ["./home.component.scss"], |
|
|
|
|
}) |
|
|
|
|
export class HomeComponent implements OnInit { |
|
|
|
|
@ViewChild('warning', { static: false }) template?: TemplateRef<{}>; |
|
|
|
|
@ViewChild("warning", { static: false }) template?: TemplateRef<{}>; |
|
|
|
|
passwordValidateForm!: FormGroup; |
|
|
|
|
constructor(private listRefreshService: listRefreshService, private http: HttpClient, private router: Router, private navChangeService: NavChangeService, public token: CacheTokenService, |
|
|
|
|
private message: NzMessageService, private notificationService: NzNotificationService, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private fb: FormBuilder) { |
|
|
|
|
constructor( |
|
|
|
|
private listRefreshService: listRefreshService, |
|
|
|
|
private http: HttpClient, |
|
|
|
|
private router: Router, |
|
|
|
|
private navChangeService: NavChangeService, |
|
|
|
|
public token: CacheTokenService, |
|
|
|
|
private message: NzMessageService, |
|
|
|
|
private notificationService: NzNotificationService, |
|
|
|
|
private modal: NzModalService, |
|
|
|
|
private viewContainerRef: ViewContainerRef, |
|
|
|
|
private fb: FormBuilder |
|
|
|
|
) { |
|
|
|
|
const { password } = MyValidators; |
|
|
|
|
this.passwordValidateForm = this.fb.group({ |
|
|
|
|
oldpassword: [null, [Validators.required]], |
|
|
|
|
newpassword: [null, [Validators.required, password]], |
|
|
|
|
affirmpassword: [null, [Validators.required, password]] |
|
|
|
|
affirmpassword: [null, [Validators.required, password]], |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isGasStation: boolean; |
|
|
|
|
|
|
|
|
|
isGasStation: boolean |
|
|
|
|
num; |
|
|
|
|
|
|
|
|
|
num |
|
|
|
|
|
|
|
|
|
surname: string |
|
|
|
|
userName: string |
|
|
|
|
surname: string; |
|
|
|
|
userName: string; |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
//右上角信息
|
|
|
|
|
setInterval(() => { |
|
|
|
|
this.getTime() |
|
|
|
|
this.getTime(); |
|
|
|
|
}, 1000); |
|
|
|
|
this.isGasStation = JSON.parse(sessionStorage.getItem('isGasStation')) |
|
|
|
|
this.isGasStation = JSON.parse(sessionStorage.getItem("isGasStation")); |
|
|
|
|
if (this.isGasStation) { |
|
|
|
|
this.surname = JSON.parse(sessionStorage.getItem('userdataOfgasstation')).name |
|
|
|
|
this.userName = JSON.parse(sessionStorage.getItem('userdataOfgasstation')).userName |
|
|
|
|
this.surname = JSON.parse( |
|
|
|
|
sessionStorage.getItem("userdataOfgasstation") |
|
|
|
|
).name; |
|
|
|
|
this.userName = JSON.parse( |
|
|
|
|
sessionStorage.getItem("userdataOfgasstation") |
|
|
|
|
).userName; |
|
|
|
|
} else { |
|
|
|
|
this.surname = JSON.parse(sessionStorage.getItem('userdata')).name |
|
|
|
|
this.userName = JSON.parse(sessionStorage.getItem('userdata')).userName |
|
|
|
|
this.surname = JSON.parse(sessionStorage.getItem("userdata")).name; |
|
|
|
|
this.userName = JSON.parse(sessionStorage.getItem("userdata")).userName; |
|
|
|
|
} |
|
|
|
|
//修改密码提示框
|
|
|
|
|
// if ((sessionStorage.getItem('isDefaultPassword') == 'true' || sessionStorage.getItem('isPasswordExpired') == 'true') && JSON.parse(sessionStorage.getItem('userdata')).userName != 'admin') {
|
|
|
|
|
// this.changePasswordPopup()
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//初次登陆修改密码弹窗
|
|
|
|
|
isVisible = false |
|
|
|
|
isConfirmLoading = false |
|
|
|
|
isVisible = false; |
|
|
|
|
isConfirmLoading = false; |
|
|
|
|
changePasswordPopup() { |
|
|
|
|
this.isVisible = true |
|
|
|
|
this.isVisible = true; |
|
|
|
|
} |
|
|
|
|
handleOk(): void { |
|
|
|
|
console.log(this.passwordValidateForm) |
|
|
|
|
console.log(this.passwordValidateForm); |
|
|
|
|
if (this.passwordValidateForm.invalid) { |
|
|
|
|
this.message.create('warning', `输入格式不正确`); |
|
|
|
|
this.message.create("warning", `输入格式不正确`); |
|
|
|
|
} else { |
|
|
|
|
if (this.passwordValidateForm.value.newpassword != this.passwordValidateForm.value.affirmpassword) { |
|
|
|
|
this.message.create('warning', '两次密码输入不一致!'); |
|
|
|
|
} else if (this.passwordValidateForm.value.newpassword == this.passwordValidateForm.value.oldpassword) { |
|
|
|
|
this.message.create('warning', '旧密码和新密码不能相同!'); |
|
|
|
|
if ( |
|
|
|
|
this.passwordValidateForm.value.newpassword != |
|
|
|
|
this.passwordValidateForm.value.affirmpassword |
|
|
|
|
) { |
|
|
|
|
this.message.create("warning", "两次密码输入不一致!"); |
|
|
|
|
} else if ( |
|
|
|
|
this.passwordValidateForm.value.newpassword == |
|
|
|
|
this.passwordValidateForm.value.oldpassword |
|
|
|
|
) { |
|
|
|
|
this.message.create("warning", "旧密码和新密码不能相同!"); |
|
|
|
|
} else { |
|
|
|
|
this.isConfirmLoading = true; |
|
|
|
|
let body = { |
|
|
|
|
currentPassword: this.passwordValidateForm.value.oldpassword, |
|
|
|
|
newPassword: this.passwordValidateForm.value.newpassword |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/services/app/User/ChangePassword', body).subscribe(data => { |
|
|
|
|
this.message.create('success', '修改成功!'); |
|
|
|
|
this.isConfirmLoading = false; |
|
|
|
|
this.isVisible = false; |
|
|
|
|
//清除sessionStorage
|
|
|
|
|
sessionStorage.removeItem('isDefaultPassword') |
|
|
|
|
sessionStorage.removeItem('isPasswordExpired') |
|
|
|
|
}, err => { |
|
|
|
|
this.message.create('warning', err.error.error.message); |
|
|
|
|
this.isConfirmLoading = false; |
|
|
|
|
}) |
|
|
|
|
newPassword: this.passwordValidateForm.value.newpassword, |
|
|
|
|
}; |
|
|
|
|
this.http.post("/api/services/app/User/ChangePassword", body).subscribe( |
|
|
|
|
(data) => { |
|
|
|
|
this.message.create("success", "修改成功!"); |
|
|
|
|
this.isConfirmLoading = false; |
|
|
|
|
this.isVisible = false; |
|
|
|
|
//清除sessionStorage
|
|
|
|
|
sessionStorage.removeItem("isDefaultPassword"); |
|
|
|
|
sessionStorage.removeItem("isPasswordExpired"); |
|
|
|
|
}, |
|
|
|
|
(err) => { |
|
|
|
|
this.message.create("warning", err.error.error.message); |
|
|
|
|
this.isConfirmLoading = false; |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reloadPage = (userNotification) => { |
|
|
|
|
console.log('abp.notifications.received收到通知', userNotification); |
|
|
|
|
if (this.router.url.indexOf('records') != -1) { |
|
|
|
|
let obj |
|
|
|
|
if (!userNotification.notification.data.properties.Positive) { |
|
|
|
|
obj = { |
|
|
|
|
type: 'add', |
|
|
|
|
data: userNotification |
|
|
|
|
console.log("abp.notifications.received收到通知", userNotification); |
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
if (this.router.url.indexOf("records") != -1) { |
|
|
|
|
let obj; |
|
|
|
|
if (!userNotification.notification.data.properties.Positive) { |
|
|
|
|
obj = { |
|
|
|
|
type: "add", |
|
|
|
|
data: userNotification, |
|
|
|
|
}; |
|
|
|
|
this.receiptOfNotification(userNotification); //右下角弹窗+播报语音
|
|
|
|
|
} else { |
|
|
|
|
obj = { |
|
|
|
|
type: "delete", |
|
|
|
|
data: userNotification, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
this.receiptOfNotification(userNotification)//右下角弹窗+播报语音
|
|
|
|
|
this.listRefreshService.sendMessage(obj); //发布一条消息
|
|
|
|
|
} else { |
|
|
|
|
obj = { |
|
|
|
|
type: 'delete', |
|
|
|
|
data: userNotification |
|
|
|
|
if (!userNotification.notification.data.properties.Positive) { |
|
|
|
|
this.receiptOfNotification(userNotification); //右下角弹窗+播报语音
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.listRefreshService.sendMessage(obj);//发布一条消息
|
|
|
|
|
} else { |
|
|
|
|
if (!userNotification.notification.data.properties.Positive) { |
|
|
|
|
this.receiptOfNotification(userNotification)//右下角弹窗+播报语音
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, 1000); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
ngAfterViewInit() { |
|
|
|
|
SignalRAspNetCoreHelper.initSignalR(); |
|
|
|
|
abp.event.on('abp.notifications.received', this.reloadPage); |
|
|
|
|
abp.event.on("abp.notifications.received", this.reloadPage); |
|
|
|
|
} |
|
|
|
|
messageId = [] |
|
|
|
|
messageId = []; |
|
|
|
|
receiptOfNotification(userNotification) { |
|
|
|
|
// console.log('语音播报')
|
|
|
|
|
if (!window.speechSynthesis) { |
|
|
|
|
this.message.create('warning', `该游览器不支持语音播报`); |
|
|
|
|
this.message.create("warning", `该游览器不支持语音播报`); |
|
|
|
|
} else { |
|
|
|
|
let speakMsg = new SpeechSynthesisUtterance('请注意,收到一条新的预警信息,请及时处理!'); |
|
|
|
|
let speakMsg = new SpeechSynthesisUtterance( |
|
|
|
|
"请注意,收到一条新的预警信息,请及时处理!" |
|
|
|
|
); |
|
|
|
|
speakMsg.lang = "zh-CN"; |
|
|
|
|
speakMsg.rate = 1; |
|
|
|
|
speakMsg.pitch = 1.5; |
|
|
|
@ -142,187 +174,234 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
let obj = { |
|
|
|
|
id: userNotification.notification.entityId, |
|
|
|
|
messageId: this.notificationService.template(this.template!, { nzPlacement: 'bottomRight', nzClass: 'receiptOfNotification', nzDuration: 0, nzData: userNotification }).messageId |
|
|
|
|
} |
|
|
|
|
this.messageId.push(obj) |
|
|
|
|
messageId: this.notificationService.template(this.template!, { |
|
|
|
|
nzPlacement: "bottomRight", |
|
|
|
|
nzClass: "receiptOfNotification", |
|
|
|
|
nzDuration: 0, |
|
|
|
|
nzData: userNotification, |
|
|
|
|
}).messageId, |
|
|
|
|
}; |
|
|
|
|
this.messageId.push(obj); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
modalData |
|
|
|
|
modalData; |
|
|
|
|
look(item) { |
|
|
|
|
console.log('推送信息', item) |
|
|
|
|
console.log("推送信息", item); |
|
|
|
|
let params = { |
|
|
|
|
id: item.notification.entityId |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/services/app/ViolateRecord/Get', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
console.log('推送信息后获取信息', data) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
let copydata = data.result |
|
|
|
|
if (item.notification.data.properties.EventSystemName == '灭火器维护') { |
|
|
|
|
copydata.violatedItemSnapshotObj = JSON.parse(copydata.violatedItemSnapshot) |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzContent: DisposeequipmentComponent, |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: 380, |
|
|
|
|
nzBodyStyle: { |
|
|
|
|
'border': '1px solid #91CCFF', |
|
|
|
|
'border-radius': '0px', |
|
|
|
|
'padding': '7px', |
|
|
|
|
'box-shadow': '0 0 8px 0 #fff', |
|
|
|
|
'background-image': 'linear-gradient(#003665, #000f25)' |
|
|
|
|
}, |
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: copydata |
|
|
|
|
}, |
|
|
|
|
nzFooter: null, |
|
|
|
|
nzClosable: false, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
if (instance.isScrap) { |
|
|
|
|
await new Promise(resolve => { |
|
|
|
|
let body = { |
|
|
|
|
id: copydata.violatedItemSnapshotObj.id, |
|
|
|
|
isScrapped: true, |
|
|
|
|
organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId, |
|
|
|
|
name: instance.copydata2.violatedItemSnapshotObj.name, |
|
|
|
|
storageLocation: instance.copydata2.violatedItemSnapshotObj.storageLocation, |
|
|
|
|
productionDate: moment(instance.copydata2.violatedItemSnapshotObj.productionDate).format('yyyy-MM-DD'), |
|
|
|
|
maintenanceDate: moment(instance.copydata2.violatedItemSnapshotObj.maintenanceDate).format('yyyy-MM-DD'), |
|
|
|
|
validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validityEndTime).format('yyyy-MM-DD') |
|
|
|
|
} |
|
|
|
|
this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { |
|
|
|
|
let body = { |
|
|
|
|
id: copydata.id, |
|
|
|
|
handleRecord: '报废成功!' |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.message.create('success', '报废成功!'); |
|
|
|
|
copydata.handleTime = new Date() |
|
|
|
|
if (this.router.url.indexOf('todaywarning') != -1) { |
|
|
|
|
let obj = { |
|
|
|
|
type: 'updatehandleTime', |
|
|
|
|
data: copydata.id |
|
|
|
|
} |
|
|
|
|
this.listRefreshService.sendMessage(obj);//发布一条消息
|
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
|
await new Promise(resolve => { |
|
|
|
|
id: item.notification.entityId, |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get("/api/services/app/ViolateRecord/Get", { |
|
|
|
|
params: params, |
|
|
|
|
}) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
console.log("推送信息后获取信息", data); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
let copydata = data.result; |
|
|
|
|
if ( |
|
|
|
|
item.notification.data.properties.EventSystemName == "灭火器维护" |
|
|
|
|
) { |
|
|
|
|
copydata.violatedItemSnapshotObj = JSON.parse( |
|
|
|
|
copydata.violatedItemSnapshot |
|
|
|
|
); |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzContent: DisposeequipmentComponent, |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: 380, |
|
|
|
|
nzBodyStyle: { |
|
|
|
|
border: "1px solid #91CCFF", |
|
|
|
|
"border-radius": "0px", |
|
|
|
|
padding: "7px", |
|
|
|
|
"box-shadow": "0 0 8px 0 #fff", |
|
|
|
|
"background-image": "linear-gradient(#003665, #000f25)", |
|
|
|
|
}, |
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: copydata, |
|
|
|
|
}, |
|
|
|
|
nzFooter: null, |
|
|
|
|
nzClosable: false, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
if (instance.isScrap) { |
|
|
|
|
await new Promise((resolve) => { |
|
|
|
|
let body = { |
|
|
|
|
id: copydata.violatedItemSnapshotObj.id, |
|
|
|
|
name: instance.validateForm.value.name, |
|
|
|
|
storageLocation: instance.validateForm.value.storageLocation, |
|
|
|
|
productionDate: moment(instance.validateForm.value.productionDate).format('yyyy-MM-DD'), |
|
|
|
|
maintenanceDate: moment(instance.validateForm.value.maintenanceDate).format('yyyy-MM-DD'), |
|
|
|
|
validityEndTime: moment(instance.validateForm.value.validityEndTime).format('yyyy-MM-DD'), |
|
|
|
|
organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId |
|
|
|
|
} |
|
|
|
|
this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { |
|
|
|
|
let body = { |
|
|
|
|
id: copydata.id, |
|
|
|
|
handleRecord: '维保成功!' |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.message.create('success', '维保成功!'); |
|
|
|
|
copydata.handleTime = new Date() |
|
|
|
|
if (this.router.url.indexOf('todaywarning') != -1) { |
|
|
|
|
let obj = { |
|
|
|
|
type: 'updatehandleTime', |
|
|
|
|
data: copydata.id |
|
|
|
|
} |
|
|
|
|
this.listRefreshService.sendMessage(obj);//发布一条消息
|
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
isScrapped: true, |
|
|
|
|
organizationUnitId: |
|
|
|
|
copydata.violatedItemSnapshotObj.organizationUnitId, |
|
|
|
|
name: instance.copydata2.violatedItemSnapshotObj.name, |
|
|
|
|
storageLocation: |
|
|
|
|
instance.copydata2.violatedItemSnapshotObj |
|
|
|
|
.storageLocation, |
|
|
|
|
productionDate: moment( |
|
|
|
|
instance.copydata2.violatedItemSnapshotObj |
|
|
|
|
.productionDate |
|
|
|
|
).format("yyyy-MM-DD"), |
|
|
|
|
maintenanceDate: moment( |
|
|
|
|
instance.copydata2.violatedItemSnapshotObj |
|
|
|
|
.maintenanceDate |
|
|
|
|
).format("yyyy-MM-DD"), |
|
|
|
|
validityEndTime: moment( |
|
|
|
|
instance.copydata2.violatedItemSnapshotObj |
|
|
|
|
.validityEndTime |
|
|
|
|
).format("yyyy-MM-DD"), |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.put("/api/services/app/FireEquipment/Update", body) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
let body = { |
|
|
|
|
id: copydata.id, |
|
|
|
|
handleRecord: "报废成功!", |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.post( |
|
|
|
|
"/api/services/app/ViolateRecord/HandleViolateRecord", |
|
|
|
|
body |
|
|
|
|
) |
|
|
|
|
.subscribe((data) => { |
|
|
|
|
resolve(data); |
|
|
|
|
this.message.create("success", "报废成功!"); |
|
|
|
|
copydata.handleTime = new Date(); |
|
|
|
|
if (this.router.url.indexOf("todaywarning") != -1) { |
|
|
|
|
let obj = { |
|
|
|
|
type: "updatehandleTime", |
|
|
|
|
data: copydata.id, |
|
|
|
|
}; |
|
|
|
|
this.listRefreshService.sendMessage(obj); //发布一条消息
|
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
|
return false |
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
|
await new Promise((resolve) => { |
|
|
|
|
let body = { |
|
|
|
|
id: copydata.violatedItemSnapshotObj.id, |
|
|
|
|
name: instance.validateForm.value.name, |
|
|
|
|
storageLocation: |
|
|
|
|
instance.validateForm.value.storageLocation, |
|
|
|
|
productionDate: moment( |
|
|
|
|
instance.validateForm.value.productionDate |
|
|
|
|
).format("yyyy-MM-DD"), |
|
|
|
|
maintenanceDate: moment( |
|
|
|
|
instance.validateForm.value.maintenanceDate |
|
|
|
|
).format("yyyy-MM-DD"), |
|
|
|
|
validityEndTime: moment( |
|
|
|
|
instance.validateForm.value.validityEndTime |
|
|
|
|
).format("yyyy-MM-DD"), |
|
|
|
|
organizationUnitId: |
|
|
|
|
copydata.violatedItemSnapshotObj.organizationUnitId, |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.put("/api/services/app/FireEquipment/Update", body) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
let body = { |
|
|
|
|
id: copydata.id, |
|
|
|
|
handleRecord: "维保成功!", |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.post( |
|
|
|
|
"/api/services/app/ViolateRecord/HandleViolateRecord", |
|
|
|
|
body |
|
|
|
|
) |
|
|
|
|
.subscribe((data) => { |
|
|
|
|
resolve(data); |
|
|
|
|
this.message.create("success", "维保成功!"); |
|
|
|
|
copydata.handleTime = new Date(); |
|
|
|
|
if ( |
|
|
|
|
this.router.url.indexOf("todaywarning") != -1 |
|
|
|
|
) { |
|
|
|
|
let obj = { |
|
|
|
|
type: "updatehandleTime", |
|
|
|
|
data: copydata.id, |
|
|
|
|
}; |
|
|
|
|
this.listRefreshService.sendMessage(obj); //发布一条消息
|
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.message.create("warning", "请填写完整!"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
} else { |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzContent: GetOutOfLineDetailsComponent, |
|
|
|
|
nzWrapClassName: "vertical-center-modal", |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: |
|
|
|
|
document.documentElement.clientHeight < 650 || |
|
|
|
|
document.documentElement.clientWidth < 1400 |
|
|
|
|
? 1000 |
|
|
|
|
: 1200, |
|
|
|
|
nzBodyStyle: { |
|
|
|
|
border: "1px solid #6d9cc7", |
|
|
|
|
"border-radius": "0px", |
|
|
|
|
padding: "0px", |
|
|
|
|
"box-shadow": "0 0 8px 0 #fff", |
|
|
|
|
background: "#000D21", |
|
|
|
|
}, |
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: copydata, |
|
|
|
|
isBtn: true, |
|
|
|
|
}, |
|
|
|
|
nzFooter: null, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
console.log("推送成功了!!!", item); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
modal.afterClose.subscribe((result) => { |
|
|
|
|
if (this.router.url.indexOf("records") != -1) { |
|
|
|
|
let obj = { |
|
|
|
|
type: "update", |
|
|
|
|
data: null, |
|
|
|
|
}; |
|
|
|
|
this.listRefreshService.sendMessage(obj); //发布一条消息
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
} else { |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzContent: GetOutOfLineDetailsComponent, |
|
|
|
|
nzWrapClassName: "vertical-center-modal", |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: (document.documentElement.clientHeight < 650 || document.documentElement.clientWidth < 1400) ? 1000 : 1200, |
|
|
|
|
nzBodyStyle: { |
|
|
|
|
'border': '1px solid #6d9cc7', |
|
|
|
|
'border-radius': '0px', |
|
|
|
|
'padding': '0px', |
|
|
|
|
'box-shadow': '0 0 8px 0 #fff', |
|
|
|
|
'background': '#000D21', |
|
|
|
|
}, |
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: copydata, |
|
|
|
|
isBtn: true |
|
|
|
|
}, |
|
|
|
|
nzFooter: null, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
console.log('推送成功了!!!', item) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
modal.afterClose.subscribe(result => { |
|
|
|
|
if (this.router.url.indexOf('records') != -1) { |
|
|
|
|
let obj = { |
|
|
|
|
type: 'update', |
|
|
|
|
data: null |
|
|
|
|
} |
|
|
|
|
this.listRefreshService.sendMessage(obj);//发布一条消息
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
this.messageId.forEach((element) => { |
|
|
|
|
if (element.id == item.notification.entityId) { |
|
|
|
|
this.notificationService.remove(element.messageId) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// this.readMess(item.notification.id)
|
|
|
|
|
}) |
|
|
|
|
this.messageId.forEach((element) => { |
|
|
|
|
if (element.id == item.notification.entityId) { |
|
|
|
|
this.notificationService.remove(element.messageId); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// this.readMess(item.notification.id)
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close(item) { |
|
|
|
|
// console.log(item)
|
|
|
|
|
this.messageId.forEach((element) => { |
|
|
|
|
if (element.id == item.notification.entityId) { |
|
|
|
|
this.notificationService.remove(element.messageId) |
|
|
|
|
this.notificationService.remove(element.messageId); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
|
console.log('退出') |
|
|
|
|
abp.event.off('abp.notifications.received', this.reloadPage); |
|
|
|
|
abp.signalr.disconnect() |
|
|
|
|
console.log("退出"); |
|
|
|
|
abp.event.off("abp.notifications.received", this.reloadPage); |
|
|
|
|
abp.signalr.disconnect(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得时间
|
|
|
|
|
time: string |
|
|
|
|
time: string; |
|
|
|
|
getTime() { |
|
|
|
|
let myDate = new Date(); |
|
|
|
|
let y = myDate.getFullYear(); |
|
|
|
|
let M = myDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
|
|
|
|
|
let d = myDate.getDate(); //获取当前日(1-31)
|
|
|
|
|
let h = myDate.getHours(); //获取当前小时数(0-23)
|
|
|
|
|
let m = myDate.getMinutes(); //获取当前分钟数(0-59)
|
|
|
|
|
let s = myDate.getSeconds(); //获取当前秒数(0-59)
|
|
|
|
|
let M = myDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
|
|
|
|
|
let d = myDate.getDate(); //获取当前日(1-31)
|
|
|
|
|
let h = myDate.getHours(); //获取当前小时数(0-23)
|
|
|
|
|
let m = myDate.getMinutes(); //获取当前分钟数(0-59)
|
|
|
|
|
let s = myDate.getSeconds(); //获取当前秒数(0-59)
|
|
|
|
|
|
|
|
|
|
//检查是否小于10
|
|
|
|
|
M = check(M); |
|
|
|
@ -334,42 +413,44 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
this.time = timestr; |
|
|
|
|
//时间数字小于10,则在之前加个“0”补位。
|
|
|
|
|
function check(i) { |
|
|
|
|
let num = (i < 10) ? ("0" + i) : i; |
|
|
|
|
let num = i < 10 ? "0" + i : i; |
|
|
|
|
return num; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//退出系统
|
|
|
|
|
signOut() { |
|
|
|
|
this.message.create('success', `退出成功`); |
|
|
|
|
this.token.delete() |
|
|
|
|
sessionStorage.clear() |
|
|
|
|
localStorage.removeItem("isautologin") |
|
|
|
|
this.router.navigate(['/login']) |
|
|
|
|
this.message.create("success", `退出成功`); |
|
|
|
|
this.token.delete(); |
|
|
|
|
sessionStorage.clear(); |
|
|
|
|
localStorage.removeItem("isautologin"); |
|
|
|
|
this.router.navigate(["/login"]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//全屏
|
|
|
|
|
isfullscreen: boolean = false; |
|
|
|
|
fullscreenToggle() { |
|
|
|
|
const docElmWithBrowsersFullScreenFunctions = document.documentElement as HTMLElement & { |
|
|
|
|
mozRequestFullScreen(): Promise<void>; |
|
|
|
|
webkitRequestFullscreen(): Promise<void>; |
|
|
|
|
msRequestFullscreen(): Promise<void>; |
|
|
|
|
}; |
|
|
|
|
const docElmWithBrowsersFullScreenFunctions = |
|
|
|
|
document.documentElement as HTMLElement & { |
|
|
|
|
mozRequestFullScreen(): Promise<void>; |
|
|
|
|
webkitRequestFullscreen(): Promise<void>; |
|
|
|
|
msRequestFullscreen(): Promise<void>; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (docElmWithBrowsersFullScreenFunctions.requestFullscreen) { |
|
|
|
|
docElmWithBrowsersFullScreenFunctions.requestFullscreen(); |
|
|
|
|
} else if (docElmWithBrowsersFullScreenFunctions.mozRequestFullScreen) { /* Firefox */ |
|
|
|
|
} else if (docElmWithBrowsersFullScreenFunctions.mozRequestFullScreen) { |
|
|
|
|
/* Firefox */ |
|
|
|
|
docElmWithBrowsersFullScreenFunctions.mozRequestFullScreen(); |
|
|
|
|
} else if (docElmWithBrowsersFullScreenFunctions.webkitRequestFullscreen) { /* Chrome, Safari and Opera */ |
|
|
|
|
} else if (docElmWithBrowsersFullScreenFunctions.webkitRequestFullscreen) { |
|
|
|
|
/* Chrome, Safari and Opera */ |
|
|
|
|
docElmWithBrowsersFullScreenFunctions.webkitRequestFullscreen(); |
|
|
|
|
} else if (docElmWithBrowsersFullScreenFunctions.msRequestFullscreen) { /* IE/Edge */ |
|
|
|
|
} else if (docElmWithBrowsersFullScreenFunctions.msRequestFullscreen) { |
|
|
|
|
/* IE/Edge */ |
|
|
|
|
docElmWithBrowsersFullScreenFunctions.msRequestFullscreen(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.isfullscreen = true; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
closefullscreen() { |
|
|
|
|
const docWithBrowsersExitFunctions = document as Document & { |
|
|
|
@ -379,11 +460,14 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
}; |
|
|
|
|
if (docWithBrowsersExitFunctions.exitFullscreen) { |
|
|
|
|
docWithBrowsersExitFunctions.exitFullscreen(); |
|
|
|
|
} else if (docWithBrowsersExitFunctions.mozCancelFullScreen) { /* Firefox */ |
|
|
|
|
} else if (docWithBrowsersExitFunctions.mozCancelFullScreen) { |
|
|
|
|
/* Firefox */ |
|
|
|
|
docWithBrowsersExitFunctions.mozCancelFullScreen(); |
|
|
|
|
} else if (docWithBrowsersExitFunctions.webkitExitFullscreen) { /* Chrome, Safari and Opera */ |
|
|
|
|
} else if (docWithBrowsersExitFunctions.webkitExitFullscreen) { |
|
|
|
|
/* Chrome, Safari and Opera */ |
|
|
|
|
docWithBrowsersExitFunctions.webkitExitFullscreen(); |
|
|
|
|
} else if (docWithBrowsersExitFunctions.msExitFullscreen) { /* IE/Edge */ |
|
|
|
|
} else if (docWithBrowsersExitFunctions.msExitFullscreen) { |
|
|
|
|
/* IE/Edge */ |
|
|
|
|
docWithBrowsersExitFunctions.msExitFullscreen(); |
|
|
|
|
} |
|
|
|
|
this.isfullscreen = false; |
|
|
|
@ -392,44 +476,52 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
//修改密码
|
|
|
|
|
changePassword() { |
|
|
|
|
const modal: any = this.modal.create({ |
|
|
|
|
nzTitle: '修改密码', |
|
|
|
|
nzTitle: "修改密码", |
|
|
|
|
nzContent: ChangePasswordComponent, |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: 288, |
|
|
|
|
nzComponentParams: {}, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
|
if (instance.validateForm.value.newpassword != instance.validateForm.value.affirmpassword) { |
|
|
|
|
this.message.create('warning', '两次密码输入不一致!'); |
|
|
|
|
return false |
|
|
|
|
if ( |
|
|
|
|
instance.validateForm.value.newpassword != |
|
|
|
|
instance.validateForm.value.affirmpassword |
|
|
|
|
) { |
|
|
|
|
this.message.create("warning", "两次密码输入不一致!"); |
|
|
|
|
return false; |
|
|
|
|
} else { |
|
|
|
|
await new Promise((resolve, reject) => { |
|
|
|
|
let body = { |
|
|
|
|
currentPassword: instance.validateForm.value.oldpassword, |
|
|
|
|
newPassword: instance.validateForm.value.newpassword |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/services/app/User/ChangePassword', body).subscribe(data => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.message.create('success', '修改成功!'); |
|
|
|
|
return true |
|
|
|
|
}, err => { |
|
|
|
|
this.message.create('warning', err.error.error.message); |
|
|
|
|
modal.config.nzOkLoading = false |
|
|
|
|
return false |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
newPassword: instance.validateForm.value.newpassword, |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.post("/api/services/app/User/ChangePassword", body) |
|
|
|
|
.subscribe( |
|
|
|
|
(data) => { |
|
|
|
|
resolve(data); |
|
|
|
|
this.message.create("success", "修改成功!"); |
|
|
|
|
return true; |
|
|
|
|
}, |
|
|
|
|
(err) => { |
|
|
|
|
this.message.create("warning", err.error.error.message); |
|
|
|
|
modal.config.nzOkLoading = false; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
|
return false |
|
|
|
|
this.message.create("warning", "请填写完整!"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); |
|
|
|
|
modal.afterOpen.subscribe(() => console.log("[afterOpen] emitted!")); |
|
|
|
|
// Return a result when closed
|
|
|
|
|
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); |
|
|
|
|
modal.afterClose.subscribe((result) => |
|
|
|
|
console.log("[afterClose] The result is:", result) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|