Commit 8dbe4035 authored by wangqinghua's avatar wangqinghua

workService

parent 1e59c9f8
<!--新增事件--> <!--新增事件-->
<!--添加资源--> <nz-modal [nzWidth]="1080" [(nzVisible)]="isVisiable" [nzTitle]="title" (nzOnCancel)="handleEditCancel()"
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleEditCancel()"
(nzOnOk)="handEditleOk()"> (nzOnOk)="handEditleOk()">
<form nz-form [formGroup]="validateForm"> <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-row [nzGutter]="24">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<nz-form-item nzFlex> <nz-form-item nzFlex>
...@@ -12,79 +11,79 @@ ...@@ -12,79 +11,79 @@
<input id="title" nz-input placeholder="事件标题" name="title" formControlName="title"> <input id="title" nz-input placeholder="事件标题" name="title" formControlName="title">
</nz-form-control> </nz-form-control>
</nz-form-item> </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>
<div nz-col [nzSpan]="12">
<div nz-row [nzGutter]="24"> <nz-form-item nzFlex>
<div nz-col [nzSpan]="12"> <nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="type">事件分类
<nz-form-item nzFlex> </nz-form-label>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="requester">请求人</nz-form-label> <nz-form-control [nzSpan]="14">
<nz-form-control [nzSpan]="14"> <nz-select name="type" nzPlaceHolder="选择事件分类" formControlName="type">
<input id="requester" nz-input placeholder="显示名" name="requester" formControlName="name"> <ng-container *ngFor="let item of eventTypeList">
</nz-form-control> <nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</nz-form-item> </ng-container>
</div> </nz-select>
</nz-form-control>
<div nz-col [nzSpan]="12"> </nz-form-item>
<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> </div>
</div>
</div>
<div nz-row [nzGutter]="24">
<nz-form-item> <div nz-col [nzSpan]="12">
<nz-form-label [nzSpan]="4" nzRequired>处理人</nz-form-label> <nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="requester">请求人</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<button (click)="selectPerson()" nz-button><span>选择</span></button> <input id="requester" nz-input placeholder="显示名" name="requester"
<ng-container *ngFor="let item of operatorsList;let i = index;"> formControlName="requester">
<span>{{item.username}}</span><span (click)="deletePerson(i)">X</span>
</ng-container>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div>
<nz-form-item> <div nz-col [nzSpan]="12">
<nz-form-label [nzSpan]="4" nzRequired nzFor="description">详细描述</nz-form-label> <nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="requesterPhone">联系电话
</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<textarea nz-input id="description" name="description" formControlName="description" <input id="requesterPhone" nz-input placeholder="显示名" name="requesterPhone"
placeholder="发送信息" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea> formControlName="requesterPhone">
</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>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
</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> </form>
</nz-modal> </nz-modal>
<smart-select-person #smartSelectPerson (done)="getUser($event)"></smart-select-person> <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 {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {WorkService} from '../../work.service'; import {WorkService} from '../../work.service';
import {NzMessageService, UploadFile} from 'ng-zorro-antd'; import {NzMessageService, UploadFile} from 'ng-zorro-antd';
...@@ -10,20 +10,23 @@ import {SelectPersonComponent} from '../../../modal/select-person/select-person. ...@@ -10,20 +10,23 @@ import {SelectPersonComponent} from '../../../modal/select-person/select-person.
styles: [] styles: []
}) })
export class EventComponent implements OnInit { export class EventComponent implements OnInit {
@ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent; @ViewChild('smartSelectPerson') smartSelectPerson: SelectPersonComponent;
@Output() done = new EventEmitter<any>();
isVisible = false; isVisiable = false;
title; title;
eventId; eventId;
validateForm: FormGroup; validateForm: FormGroup;
fileList: UploadFile[] = []; fileList: UploadFile[] = [];
operatorsList = []; //处理人列表 operatorsList = []; //处理人列表
eventTypeList = []; //事件分类列表
constructor(private workSer: WorkService, private message: NzMessageService, constructor(private workSer: WorkService, private message: NzMessageService,
private fb: FormBuilder) { private fb: FormBuilder) {
} }
ngOnInit() {} ngOnInit() {
this.initForm();
}
initForm() { initForm() {
this.validateForm = this.fb.group( this.validateForm = this.fb.group(
...@@ -39,6 +42,19 @@ export class EventComponent implements OnInit { ...@@ -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 => { beforeUpload = (file: UploadFile): boolean => {
const isLt5M = file.size / 1024 < 5000; const isLt5M = file.size / 1024 < 5000;
if (!isLt5M) { if (!isLt5M) {
...@@ -50,14 +66,21 @@ export class EventComponent implements OnInit { ...@@ -50,14 +66,21 @@ export class EventComponent implements OnInit {
}; };
showAddModal(title) { showAddModal(title) {
this.isVisible = true; this.isVisiable = true;
this.title = title; this.title = title;
this.getPlanType();
} }
showEditModal(title, id) { showEditModal(title, id) {
this.isVisible = true; this.isVisiable = true;
this.title = title; this.title = title;
this.eventId = id; this.eventId = id;
this.getPlanType();
this.workSer.findByNo(this.eventId).subscribe(
(res)=>{
this.validateForm.patchValue(res.data);
}
)
} }
handEditleOk() { handEditleOk() {
...@@ -79,6 +102,9 @@ export class EventComponent implements OnInit { ...@@ -79,6 +102,9 @@ export class EventComponent implements OnInit {
this.workSer.create(formData).subscribe( this.workSer.create(formData).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.isVisiable = false;
this.initForm();
this.done.emit();
this.message.success('新增事件成功'); this.message.success('新增事件成功');
} else { } else {
this.message.error(res.errMsg); this.message.error(res.errMsg);
...@@ -98,6 +124,9 @@ export class EventComponent implements OnInit { ...@@ -98,6 +124,9 @@ export class EventComponent implements OnInit {
this.workSer.update(formData).subscribe( this.workSer.update(formData).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.isVisiable = false;
this.initForm();
this.done.emit();
this.message.success('修改事件成功'); this.message.success('修改事件成功');
} else { } else {
this.message.error(res.errMsg); this.message.error(res.errMsg);
...@@ -107,12 +136,13 @@ export class EventComponent implements OnInit { ...@@ -107,12 +136,13 @@ export class EventComponent implements OnInit {
} }
handleEditCancel() { handleEditCancel() {
this.isVisible = false; this.isVisiable = false;
this.initForm();
} }
//选择处理人 //选择处理人
selectPerson(){ selectPerson(){
// this.smartSelectPerson.showModal("选择处理人"); this.smartSelectPerson.showModal("选择处理人");
} }
deletePerson(i){ deletePerson(i){
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
</td> </td>
<td>时间分类</td> <td>时间分类</td>
<td> <td>
{{data.operators[0].username}} {{data.operators[0]?.username}}
</td> </td>
<td> <td>
<span *ngIf="data.status == 0">待处理</span> <span *ngIf="data.status == 0">待处理</span>
...@@ -90,14 +90,30 @@ ...@@ -90,14 +90,30 @@
<td class="handle text-center"> <td class="handle text-center">
<span (click)="lookEvent(data)">查看</span> <span (click)="lookEvent(data)">查看</span>
<span (click)="showEditModal(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> </td>
</tr> </tr>
</tbody> </tbody>
</nz-table> </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> </nz-modal>
<!--选择处理人-->
<smart-event #smartEvent></smart-event> <smart-select-person #smartSelectPerson (done)="getUser($event)"></smart-select-person>
\ No newline at end of file <!--新增事件-->
<smart-event #smartEvent (done)="getList()"></smart-event>
\ No newline at end of file
...@@ -4,14 +4,17 @@ import {WorkService} from '../work.service'; ...@@ -4,14 +4,17 @@ import {WorkService} from '../work.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {EventComponent} from './Event/event.component'; import {EventComponent} from './Event/event.component';
import {CommonService} from '../../shared/common/common.service';
import {SelectPersonComponent} from '../../modal/select-person/select-person.component';
@Component({ @Component({
selector: 'smart-work-handle', selector: 'smart-work-handle',
templateUrl: './work-handle.component.html', templateUrl: './work-handle.component.html',
styles: [] styles: []
}) })
export class WorkHandleComponent implements OnInit { export class WorkHandleComponent implements OnInit {
@ViewChild('smartEvent') smartEvent:EventComponent; @ViewChild('smartEvent') smartEvent: EventComponent;
@ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent;
timeFormat = 'yyyy-MM-dd'; timeFormat = 'yyyy-MM-dd';
eventList; eventList;
...@@ -22,62 +25,148 @@ export class WorkHandleComponent implements OnInit { ...@@ -22,62 +25,148 @@ export class WorkHandleComponent implements OnInit {
totalNum; totalNum;
obj = { obj = {
pageCount:null, pageCount: null,
pageNum:null, pageNum: null,
searchStr:'', searchStr: '',
type:null, type: null,
status:null, status: null,
source:null, source: null,
startTime:'', startTime: '',
endTime:'', 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(); this.getList();
} }
getList(){ getList() {
const obj = { const obj = {
pageCount:this.pageCount, pageCount: this.pageCount,
pageNum:this.pageNum, pageNum: this.pageNum,
searchStr:this.obj.searchStr, searchStr: this.obj.searchStr,
type:this.obj.type, type: this.obj.type,
status:this.obj.status, status: this.obj.status,
source:this.obj.source, source: this.obj.source,
startTime:this.obj.startTime, startTime: this.obj.startTime,
endTime:this.obj.endTime, endTime: this.obj.endTime,
}; };
this.workSer.find(obj).subscribe( this.workSer.find(obj).subscribe(
(res)=>{ (res) => {
if(res.errCode == 10000){ if (res.errCode == 10000) {
this.eventList = res.data.data; this.eventList = res.data.data;
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
}else{ } else {
}
} }
} );
) }
}
change(e){ change(e) {
this.pageNum = e; this.pageNum = e;
this.getList(); this.getList();
} }
//查看详情 //查看详情
lookEvent(item){ lookEvent(item) {
this.router.navigate(['app/main/handleDetail'],{ this.router.navigate(['app/main/handleDetail'], {
queryParams:{ queryParams: {
eventId:item.id eventId: item.id
} }
}) });
} }
//新增事件 //新增事件
showAddModal(){ showAddModal() {
this.smartEvent.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 { ...@@ -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); 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