Browse Source

[新增]新增语音播报

master
邵佳豪 3 years ago
parent
commit
aa07bb560c
  1. 4
      src/app/pages/criminal-records-admin/criminal-records-admin.component.html
  2. 58
      src/app/pages/criminal-records-admin/criminal-records-admin.component.ts
  3. 4
      src/app/pages/histories/histories.component.html
  4. 20
      src/app/pages/histories/histories.component.ts
  5. 59
      src/app/pages/home/home.component.ts

4
src/app/pages/criminal-records-admin/criminal-records-admin.component.html

@ -98,7 +98,9 @@
<div nz-col nzSpan="1" style="text-align: center;">
<span>序号</span>
</div>
<div nz-col nzSpan="2" style="text-align: center;">
<div nz-col nzSpan="2" style="text-align: center;white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;">
<span style="margin-right:46px;">
预警级别
</span>

58
src/app/pages/criminal-records-admin/criminal-records-admin.component.ts

@ -11,6 +11,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
import { TreeService } from 'src/app/service/tree.service';
import { DisposeequipmentComponent } from '../disposeequipment/disposeequipment.component';
import { SignalRAspNetCoreHelper } from '../../../shared/helpers/SignalRAspNetCoreHelper';
import { listRefreshService } from '../../service/listRefresh.service';
declare var abp: any
import 'linqjs';
@Component({
@ -21,7 +22,7 @@ import 'linqjs';
export class CriminalRecordsAdminComponent implements OnInit {
validateForm!: FormGroup;
constructor(private element: ElementRef, private toTree: TreeService, private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { }
constructor(private listRefreshService: listRefreshService, private element: ElementRef, private toTree: TreeService, private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { }
startdate
enddate
@ -53,6 +54,24 @@ export class CriminalRecordsAdminComponent implements OnInit {
this.warningType()
this.tableSpin = true
this.getAllOrganization()
this.listRefreshService.getMessage().subscribe((message: any) => {
//列表刷新
if (message.type == 'add') {
this.reloadPage(message.data)
}
if (message.type == 'update') {
this.list = []
this.SkipCount = '0'
this.getViolateRecordList()
}
if (message.type == 'delete') {
this.message.create('success', '一条预警已自动处置!');
this.deleteViolateRecordList(message.data.notification.entityId)
}
});
}
defaultOrId: string
@ -81,6 +100,20 @@ export class CriminalRecordsAdminComponent implements OnInit {
})
}
deleteViolateRecordList(id) {
for (let index = 0; index < this.list.length; index++) {
const element = this.list[index];
if (element.id == id) {
this.list.splice(index, 1)
this.totalCount = String(Number(this.totalCount) - 1)
this.SkipCount = String(Number(this.SkipCount) - 1)
}
}
}
//获得违规记录列表
SkipCount: string = '0'
MaxResultCount: string = '50'
@ -97,14 +130,6 @@ export class CriminalRecordsAdminComponent implements OnInit {
item.id ? ViolationIds.push(item.id) : null
});
}
// let disposalState
// if (this.validateForm.value.disposalState == '0') {
// disposalState = true
// } else if (this.validateForm.value.disposalState == '1') {
// disposalState = false
// } else {
// disposalState = null
// }
let params = {
Level: this.validateForm.value.level,
ViolationIds: ViolationIds,
@ -145,13 +170,10 @@ export class CriminalRecordsAdminComponent implements OnInit {
}
}
});
SignalRAspNetCoreHelper.initSignalR();
abp.event.on('abp.notifications.received', this.reloadPage);
}
reloadPage = (userNotification) => {
console.log('abp.notifications.received收到通知', userNotification);
console.log('违规记录列表', this.list)
// console.log('abp.notifications.received收到通知', userNotification);
// console.log('违规记录列表', this.list)
let params = {
id: userNotification.notification.entityId
}
@ -166,11 +188,7 @@ export class CriminalRecordsAdminComponent implements OnInit {
console.log('新获取一条', data.result)
})
};
ngOnDestroy() {
console.log('退出')
abp.event.off('abp.notifications.received', this.reloadPage);
abp.signalr.disconnect()
}
getThirtyDays() {
//获取当前日期
let myDate = new Date();
@ -205,6 +223,7 @@ export class CriminalRecordsAdminComponent implements OnInit {
}
return dateList;
}
submitForm(): void {
for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
@ -215,6 +234,7 @@ export class CriminalRecordsAdminComponent implements OnInit {
this.getViolateRecordList()
// this.getAggregations()
}
resetForm(e: MouseEvent): void {
e.preventDefault();
this.validateForm.reset();

4
src/app/pages/histories/histories.component.html

@ -100,7 +100,9 @@
<div nz-col nzSpan="1" style="text-align: center;">
<span>序号</span>
</div>
<div nz-col nzSpan="2" style="text-align: center;">
<div nz-col nzSpan="2" style="text-align: center;white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;">
<span style="margin-right:46px;">
预警级别
</span>

20
src/app/pages/histories/histories.component.ts

@ -139,26 +139,8 @@ export class HistoriesComponent implements OnInit {
}
});
SignalRAspNetCoreHelper.initSignalR();
abp.event.on('abp.notifications.received', this.reloadPage);
}
reloadPage = (userNotification) => {
console.log('abp.notifications.received收到通知', userNotification);
console.log('违规记录列表', this.list)
let params = {
id: userNotification.notification.entityId
}
this.http.get('/api/services/app/ViolateRecordVerification/Get', {
params: params
}).subscribe((data: any) => {
this.message.create('success', '收到一条新预警!');
})
};
ngOnDestroy() {
console.log('退出')
abp.event.off('abp.notifications.received', this.reloadPage);
abp.signalr.disconnect()
}
getThirtyDays() {
//获取当前日期
let myDate = new Date();

59
src/app/pages/home/home.component.ts

@ -101,22 +101,45 @@ export class HomeComponent implements OnInit {
reloadPage = (userNotification) => {
console.log('abp.notifications.received收到通知', userNotification);
if (this.router.url.indexOf('todaywarning') != -1) {
let obj = {
type: 'add',
data: userNotification
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.listRefreshService.sendMessage(obj);//发布一条消息
} else {
if (!userNotification.notification.data.properties.Positive) {
this.receiptOfNotification(userNotification)//右下角弹窗+播报语音
}
}
this.receiptOfNotification(userNotification)
};
ngAfterViewInit() {
// SignalRAspNetCoreHelper.initSignalR();
// abp.event.on('abp.notifications.received', this.reloadPage);
SignalRAspNetCoreHelper.initSignalR();
abp.event.on('abp.notifications.received', this.reloadPage);
}
messageId = []
receiptOfNotification(userNotification) {
// console.log('语音播报')
if (!window.speechSynthesis) {
this.message.create('warning', `该游览器不支持语音播报`);
} else {
let speakMsg = new SpeechSynthesisUtterance('请注意,收到一条新的预警信息,请及时处理!');
speakMsg.lang = "zh-CN";
speakMsg.rate = 1;
speakMsg.pitch = 1.5;
window.speechSynthesis.speak(speakMsg);
}
let obj = {
id: userNotification.notification.entityId,
messageId: this.notificationService.template(this.template!, { nzPlacement: 'bottomRight', nzClass: 'receiptOfNotification', nzDuration: 0, nzData: userNotification }).messageId
@ -242,11 +265,25 @@ export class HomeComponent implements OnInit {
'background': '#000D21',
},
nzComponentParams: {
data: copydata
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);
@ -270,9 +307,9 @@ export class HomeComponent implements OnInit {
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()
}
//获得时间

Loading…
Cancel
Save