|
|
|
@ -3,6 +3,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
|
|
import signalR from '../../../../signalRChat' |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { StationWeeklyPlanComponent } from '../../task/station-weekly-plan/station-weekly-plan.component'; |
|
|
|
|
import { StationTaskExecutionComponent } from '../../task/station-task-execution/station-task-execution.component'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -15,7 +16,8 @@ export class ChatWindowComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private ngZone: NgZone, private element: ElementRef, private message: NzMessageService, |
|
|
|
|
@Inject(StationWeeklyPlanComponent) private parentComponent: any, private http: HttpClient) { } |
|
|
|
|
@Inject(StationWeeklyPlanComponent) private parentComponent: any, private http: HttpClient, |
|
|
|
|
@Inject(StationTaskExecutionComponent) private parentComponent2: any) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,23 +52,41 @@ export class ChatWindowComponent implements OnInit {
|
|
|
|
|
/** |
|
|
|
|
* 消息列表 |
|
|
|
|
*/ |
|
|
|
|
members = [] |
|
|
|
|
MessagesList = [] |
|
|
|
|
|
|
|
|
|
isLoading = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chatName = '' |
|
|
|
|
/** |
|
|
|
|
* 获得所有消息 |
|
|
|
|
*/ |
|
|
|
|
getAllMessages() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
console.log('任务id', this.taskId) |
|
|
|
|
this.http.get('/api/TaskChats/Messages', { |
|
|
|
|
this.http.get('/api/TaskChats/Groups', { |
|
|
|
|
params: { |
|
|
|
|
TaskId: this.taskId, |
|
|
|
|
PageNumber:1, |
|
|
|
|
PageSize:999, |
|
|
|
|
SortProperty:'CreationTime', |
|
|
|
|
SortType:'asc' |
|
|
|
|
PageNumber: 1, |
|
|
|
|
PageSize: 999, |
|
|
|
|
SortProperty: 'CreationTime', |
|
|
|
|
SortType: 'asc' |
|
|
|
|
} |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
this.MessagesList = data.items |
|
|
|
|
console.log('聊天记录', this.MessagesList) |
|
|
|
|
this.MessagesList = data.items[0].taskChatMessages |
|
|
|
|
this.members = data.items[0].members |
|
|
|
|
|
|
|
|
|
this.members.forEach(item => { |
|
|
|
|
this.chatName += item.name + ' ' |
|
|
|
|
}) |
|
|
|
|
this.chatName = this.chatName + '的群聊' + '(' + this.members.length + ')' |
|
|
|
|
this.isLoading = false |
|
|
|
|
console.log('chatName', this.chatName) |
|
|
|
|
console.log('消息列表', this.MessagesList) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.scrollToBottom() |
|
|
|
|
}, 0); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -80,6 +100,7 @@ export class ChatWindowComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
close() { |
|
|
|
|
this.parentComponent.closechat() |
|
|
|
|
this.parentComponent2.closechat() |
|
|
|
|
} |
|
|
|
|
send() { |
|
|
|
|
if (!this.text) { |
|
|
|
|