Commit 8dbe4035 authored by wangqinghua's avatar wangqinghua

workService

parent 1e59c9f8
<!--新增事件-->
<!--添加资源-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleEditCancel()"
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisiable" [nzTitle]="title" (nzOnCancel)="handleEditCancel()"
(nzOnOk)="handEditleOk()">
<form nz-form [formGroup]="validateForm">
<div nz-form class="ant-advanced-search-form form-select">
<div class="ant-advanced-search-form form-select">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
......@@ -12,79 +11,79 @@
<input id="title" nz-input placeholder="事件标题" name="title" formControlName="title">
</nz-form-control>
</nz-form-item>
</div08
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="type">事件分类
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="type" nzPlaceHolder="选择事件分类" formControlName="type">
<!--<ng-container *ngFor="let item of hostTypeList">-->
<!--<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>-->
<!--</ng-container>-->
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="requester">请求人</nz-form-label>
<nz-form-control [nzSpan]="14">
<input id="requester" nz-input placeholder="显示名" name="requester" formControlName="name">
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="requesterPhone">联系电话</nz-form-label>
<nz-form-control [nzSpan]="14">
<input id="requesterPhone" nz-input placeholder="显示名" name="requesterPhone" formControlName="name">
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="type">事件分类
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="type" nzPlaceHolder="选择事件分类" formControlName="type">
<ng-container *ngFor="let item of eventTypeList">
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
</div>
</div>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>处理人</nz-form-label>
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="requester">请求人</nz-form-label>
<nz-form-control [nzSpan]="14">
<button (click)="selectPerson()" nz-button><span>选择</span></button>
<ng-container *ngFor="let item of operatorsList;let i = index;">
<span>{{item.username}}</span><span (click)="deletePerson(i)">X</span>
</ng-container>
<input id="requester" nz-input placeholder="显示名" name="requester"
formControlName="requester">
</nz-form-control>
</nz-form-item>
</div>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="description">详细描述</nz-form-label>
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="requesterPhone">联系电话
</nz-form-label>
<nz-form-control [nzSpan]="14">
<textarea nz-input id="description" name="description" formControlName="description"
placeholder="发送信息" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="7" nzRequired nzFor="group">附件</nz-form-label>
<nz-form-control [nzSpan]="12">
<nz-upload
[nzBeforeUpload]="beforeUpload"
[(nzFileList)]="fileList">
<button nz-button>
<i class="anticon anticon-upload"></i><span>上传</span>
</button>
</nz-upload>
<input id="requesterPhone" nz-input placeholder="显示名" name="requesterPhone"
formControlName="requesterPhone">
</nz-form-control>
</nz-form-item>
</div>
</div>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>处理人</nz-form-label>
<nz-form-control [nzSpan]="14">
<button (click)="selectPerson()" nz-button><span>选择</span></button>
<ng-container *ngFor="let item of operatorsList;let i = index;">
<span>{{item.username}}</span><span (click)="deletePerson(i)">X</span>
</ng-container>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="description">详细描述</nz-form-label>
<nz-form-control [nzSpan]="14">
<textarea nz-input id="description" name="description" formControlName="description"
placeholder="发送信息" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="7" nzRequired>附件</nz-form-label>
<nz-form-control [nzSpan]="12">
<nz-upload
[nzBeforeUpload]="beforeUpload"
[(nzFileList)]="fileList">
<button nz-button>
<i class="anticon anticon-upload"></i><span>上传</span>
</button>
</nz-upload>
</nz-form-control>
</nz-form-item>
</div>
</form>
</nz-modal>
<smart-select-person #smartSelectPerson (done)="getUser($event)"></smart-select-person>
......
import {Component, OnInit, ViewChild} from '@angular/core';
import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {WorkService} from '../../work.service';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
......@@ -10,20 +10,23 @@ import {SelectPersonComponent} from '../../../modal/select-person/select-person.
styles: []
})
export class EventComponent implements OnInit {
@ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent;
isVisible = false;
@ViewChild('smartSelectPerson') smartSelectPerson: SelectPersonComponent;
@Output() done = new EventEmitter<any>();
isVisiable = false;
title;
eventId;
validateForm: FormGroup;
fileList: UploadFile[] = [];
operatorsList = []; //处理人列表
eventTypeList = []; //事件分类列表
constructor(private workSer: WorkService, private message: NzMessageService,
private fb: FormBuilder) {
}
ngOnInit() {}
ngOnInit() {
this.initForm();
}
initForm() {
this.validateForm = this.fb.group(
......@@ -39,6 +42,19 @@ export class EventComponent implements OnInit {
);
}
getPlanType() {
const data = {
type: 1
};
this.workSer.findByType(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.eventTypeList = res.data;
}
}
);
}
beforeUpload = (file: UploadFile): boolean => {
const isLt5M = file.size / 1024 < 5000;
if (!isLt5M) {
......@@ -50,14 +66,21 @@ export class EventComponent implements OnInit {
};
showAddModal(title) {
this.isVisible = true;
this.isVisiable = true;
this.title = title;
this.getPlanType();
}
showEditModal(title, id) {
this.isVisible = true;
this.isVisiable = true;
this.title = title;
this.eventId = id;
this.getPlanType();
this.workSer.findByNo(this.eventId).subscribe(
(res)=>{
this.validateForm.patchValue(res.data);
}
)
}
handEditleOk() {
......@@ -79,6 +102,9 @@ export class EventComponent implements OnInit {
this.workSer.create(formData).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisiable = false;
this.initForm();
this.done.emit();
this.message.success('新增事件成功');
} else {
this.message.error(res.errMsg);
......@@ -98,6 +124,9 @@ export class EventComponent implements OnInit {
this.workSer.update(formData).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisiable = false;
this.initForm();
this.done.emit();
this.message.success('修改事件成功');
} else {
this.message.error(res.errMsg);
......@@ -107,12 +136,13 @@ export class EventComponent implements OnInit {
}
handleEditCancel() {
this.isVisible = false;
this.isVisiable = false;
this.initForm();
}
//选择处理人
selectPerson(){
// this.smartSelectPerson.showModal("选择处理人");
this.smartSelectPerson.showModal("选择处理人");
}
deletePerson(i){
......
......@@ -81,7 +81,7 @@
</td>
<td>时间分类</td>
<td>
{{data.operators[0].username}}
{{data.operators[0]?.username}}
</td>
<td>
<span *ngIf="data.status == 0">待处理</span>
......@@ -90,14 +90,30 @@
<td class="handle text-center">
<span (click)="lookEvent(data)">查看</span>
<span (click)="showEditModal(data)">编辑</span>
<span (click)="deleteSend(data)">删除</span>
<span (click)="showEditModal(data)">处理</span>
<span (click)="showTransfor(data)">转派</span>
<span (click)="deleteHandle(data)">删除</span>
</td>
</tr>
</tbody>
</nz-table>
<!--事件转派-->
<nz-modal>
<nz-modal [nzWidth]="780" [(nzVisible)]="isVisiable" nzTitle="事件转派" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()">
<form nz-form>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>转派给</nz-form-label>
<nz-form-control [nzSpan]="14">
<button (click)="selectPerson()" nz-button><span>选择</span></button>
<ng-container *ngFor="let item of transforList;let i = index;">
<span>{{item.username}}</span><span (click)="deletePerson(i)">X</span>
</ng-container>
</nz-form-control>
</nz-form-item>
</div>
</form>
</nz-modal>
<smart-event #smartEvent></smart-event>
\ No newline at end of file
<!--选择处理人-->
<smart-select-person #smartSelectPerson (done)="getUser($event)"></smart-select-person>
<!--新增事件-->
<smart-event #smartEvent (done)="getList()"></smart-event>
\ No newline at end of file
......@@ -4,14 +4,17 @@ import {WorkService} from '../work.service';
import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
import {EventComponent} from './Event/event.component';
import {CommonService} from '../../shared/common/common.service';
import {SelectPersonComponent} from '../../modal/select-person/select-person.component';
@Component({
selector: 'smart-work-handle',
templateUrl: './work-handle.component.html',
styles: []
selector: 'smart-work-handle',
templateUrl: './work-handle.component.html',
styles: []
})
export class WorkHandleComponent implements OnInit {
@ViewChild('smartEvent') smartEvent:EventComponent;
@ViewChild('smartEvent') smartEvent: EventComponent;
@ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent;
timeFormat = 'yyyy-MM-dd';
eventList;
......@@ -22,62 +25,148 @@ export class WorkHandleComponent implements OnInit {
totalNum;
obj = {
pageCount:null,
pageNum:null,
searchStr:'',
type:null,
status:null,
source:null,
startTime:'',
endTime:'',
pageCount: null,
pageNum: null,
searchStr: '',
type: null,
status: null,
source: null,
startTime: '',
endTime: '',
};
constructor(private workSer:WorkService,private message:NzMessageService,
private router:Router) { }
ngOnInit() {
//转派
isVisiable= false;
transforList = [];
transforId;
constructor(private workSer: WorkService, private message: NzMessageService,
private router: Router, private commonSer: CommonService) {
}
ngOnInit() {
this.getList();
}
getList(){
const obj = {
pageCount:this.pageCount,
pageNum:this.pageNum,
searchStr:this.obj.searchStr,
type:this.obj.type,
status:this.obj.status,
source:this.obj.source,
startTime:this.obj.startTime,
endTime:this.obj.endTime,
};
this.workSer.find(obj).subscribe(
(res)=>{
if(res.errCode == 10000){
this.eventList = res.data.data;
this.totalNum = res.data.totalNum;
}else{
}
getList() {
const obj = {
pageCount: this.pageCount,
pageNum: this.pageNum,
searchStr: this.obj.searchStr,
type: this.obj.type,
status: this.obj.status,
source: this.obj.source,
startTime: this.obj.startTime,
endTime: this.obj.endTime,
};
this.workSer.find(obj).subscribe(
(res) => {
if (res.errCode == 10000) {
this.eventList = res.data.data;
this.totalNum = res.data.totalNum;
} else {
}
}
}
)
}
);
}
change(e){
change(e) {
this.pageNum = e;
this.getList();
}
//查看详情
lookEvent(item){
this.router.navigate(['app/main/handleDetail'],{
queryParams:{
eventId:item.id
}
})
lookEvent(item) {
this.router.navigate(['app/main/handleDetail'], {
queryParams: {
eventId: item.id
}
});
}
//新增事件
showAddModal(){
this.smartEvent.showAddModal('新增事件');
showAddModal() {
this.smartEvent.showAddModal('新增事件');
}
//编辑事件
showEditModal(item){
this.smartEvent.showEditModal("编辑事件",item.id);
}
//删除事件
deleteHandle(data) {
const arr = {
ids: []
};
arr.ids.push(data.id);
this.commonSer.deleteThing('确定删除该事件', () => {
this.workSer.deleteEvent(arr).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.success('删除成功');
this.getList();
} else {
this.message.error(res.errMsg);
}
}
);
});
}
//事件转派--start
showTransfor(item){
this.transforId = item.id;
this.isVisiable = true;
}
//选择处理人弹窗
selectPerson(){
this.smartSelectPerson.showModal("选择转派人");
}
//选择转派人done
getUser(e){
const arr = [];
e.forEach(res => {
const data = {
username: res.name,
userId: res.id
};
arr.push(data);
});
this.transforList = arr;
}
//取消
handleCancel(){
this.isVisiable = false;
this.transforList = [];
}
deletePerson(i){
this.transforList.splice(i,1);
}
//确定
handleOk(){
const data = {
id:this.transforId,
operators:this.transforList
};
this.workSer.transfer(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("事件转派成功");
this.isVisiable = false;
this.transforList = [];
this.getList();
}else{
this.message.error(res.errMsg);
}
}
)
}
}
......@@ -20,7 +20,7 @@ export class WorkService {
}
//删除事件
delete(data): Observable<any>{
deleteEvent(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/delete' ,data);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment