Browse Source

[完善]组织机构管理,推送管理优化

beijing
邵佳豪 2 years ago
parent
commit
85b7c07c31
  1. 23
      src/app/pages/home-page/home-page.component.ts
  2. 2
      src/app/system-management/organization/organization.component.html
  3. 390
      src/app/system-management/organization/organization.component.ts
  4. 7
      src/app/system-management/push/push.component.html
  5. 236
      src/app/system-management/push/push.component.ts

23
src/app/pages/home-page/home-page.component.ts

@ -494,9 +494,6 @@ export class HomePageComponent implements OnInit {
this.getHomeAggregation()
this.getUnreadNotification()
// this.getAggregations()
setTimeout(() => {
this.getHomeAggregation()
}, 10 * 6000);
@ -576,6 +573,8 @@ export class HomePageComponent implements OnInit {
})
}
//预警图表
equipmentechartdata
tools1
@ -698,23 +697,7 @@ export class HomePageComponent implements OnInit {
}
this.oilchartbar.setOption(this.oilchartbarOption);
}
//获取统计信息
getAggregations() {
let organizationUnitId
if (this.router.url.indexOf('petrolStation') != -1) {
organizationUnitId = JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id
} else {
organizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id
}
let params: any = {
OrganizationUnitId: organizationUnitId,
IsContainsChildren: 'true'
}
this.http.get('/api/services/app/OilUnloadingProcess/GetAllCountByDays', { params: params }).subscribe((data: any) => {
console.log('统计信息', data)
this.refreshEchartsData1(data.result)
})
}
timer
rollStart() {
var ROLL_SPEED = 100

2
src/app/system-management/organization/organization.component.html

@ -31,7 +31,7 @@
<span *ngIf="!node.origin.isGasStation">({{node.origin.products? node.origin.products.stationsCount :
0}})</span>
</span>
<span class="operation">
<span class="operation" *ngIf="level === 1">
<span (click)="addOr(node)" *ngIf="!node.origin.isGasStation">新增</span>
<span (click)="waring(node)" *ngIf="node.origin.isGasStation">配置预警事件</span>
<span (click)="editOr(node)">编辑</span>

390
src/app/system-management/organization/organization.component.ts

@ -1,31 +1,52 @@
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core';
import { TreeService } from 'src/app/service/tree.service';
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ModalButtonOptions, NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message';
import { AddorComponent } from './addor/addor.component';
import { EditorComponent } from './editor/editor.component';
import { HttpClient } from "@angular/common/http";
import {
Component,
OnInit,
AfterViewInit,
ViewChild,
ViewContainerRef,
} from "@angular/core";
import { TreeService } from "src/app/service/tree.service";
import {
NzFormatEmitEvent,
NzTreeComponent,
NzTreeNodeOptions,
} from "ng-zorro-antd/tree";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { ModalButtonOptions, NzModalService } from "ng-zorro-antd/modal";
import { NzMessageService } from "ng-zorro-antd/message";
import { AddorComponent } from "./addor/addor.component";
import { EditorComponent } from "./editor/editor.component";
import { NzFormatBeforeDropEvent } from 'ng-zorro-antd/tree';
import { Observable, of } from 'rxjs';
import { delay } from 'rxjs/operators';
import { WarningEventsComponent } from './warning-events/warning-events.component';
import { NzFormatBeforeDropEvent } from "ng-zorro-antd/tree";
import { Observable, of } from "rxjs";
import { delay } from "rxjs/operators";
import { WarningEventsComponent } from "./warning-events/warning-events.component";
@Component({
selector: 'app-organization',
templateUrl: './organization.component.html',
styleUrls: ['./organization.component.scss']
selector: "app-organization",
templateUrl: "./organization.component.html",
styleUrls: ["./organization.component.scss"],
})
export class OrganizationComponent implements OnInit {
validateForm!: FormGroup;
constructor(private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { }
constructor(
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService,
private modal: NzModalService,
private message: NzMessageService,
private viewContainerRef: ViewContainerRef
) {}
level: number; //当前登录账号的组织机构等级
ngOnInit(): void {
this.level = JSON.parse(
sessionStorage.getItem("userdata")
).organization.level;
this.validateForm = this.fb.group({
search: [null]
search: [null],
});
this.getAllOrganization()
this.getAllOrganization();
}
//搜索框提交
submitForm(): void {
@ -36,69 +57,85 @@ export class OrganizationComponent implements OnInit {
}
//获取所有组织机构
searchValue = '';
searchValue = "";
nzExpandAll = false;
totalCount: string
totalCount: string;
allOrList: any
organization: any
isLoading = false
allOrList: any;
organization: any;
isLoading = false;
getAllOrganization() {
this.isLoading = true
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
this.isLoading = true;
let OrganizationUnitId =
sessionStorage.getItem("isGasStation") == "true"
? JSON.parse(sessionStorage.getItem("userdataOfgasstation"))
.organization.id
: JSON.parse(sessionStorage.getItem("userdata")).organization.id;
let params = {
OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true"
}
this.http.get('/api/services/app/Organization/GetAll', {
params: params
}).subscribe((data: any) => {
this.organization = data.result.items
this.getStationsNum(data.result.items)
this.totalCount = data.result.totalCount
})
IsContainsChildren: "true",
};
this.http
.get("/api/services/app/Organization/GetAll", {
params: params,
})
.subscribe((data: any) => {
this.organization = data.result.items;
this.getStationsNum(data.result.items);
this.totalCount = data.result.totalCount;
});
}
//获得组织机构下有多少油站
stationsList
stationsList;
getStationsNum(e) {
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
this.http.get('/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true').subscribe((data: any) => {
this.stationsList = data.result
const arrs = e.map(item => {
const data = this.stationsList.find(i => item.id == i.organizationId)
return {
...item,
products: data ? data : false
}
})
for (let index = 0; index < arrs.length; index++) {
if (arrs[index].id == OrganizationUnitId) {
arrs[index].parentId = null
let OrganizationUnitId =
sessionStorage.getItem("isGasStation") == "true"
? JSON.parse(sessionStorage.getItem("userdataOfgasstation"))
.organization.id
: JSON.parse(sessionStorage.getItem("userdata")).organization.id;
this.http
.get(
"/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true"
)
.subscribe((data: any) => {
this.stationsList = data.result;
const arrs = e.map((item) => {
const data = this.stationsList.find(
(i) => item.id == i.organizationId
);
return {
...item,
products: data ? data : false,
};
});
for (let index = 0; index < arrs.length; index++) {
if (arrs[index].id == OrganizationUnitId) {
arrs[index].parentId = null;
}
arrs[index].title = arrs[index].displayName;
arrs[index].key = arrs[index].id;
arrs[index].selectable = false;
}
arrs[index].title = arrs[index].displayName
arrs[index].key = arrs[index].id
arrs[index].selectable = false
}
this.nodes = [...this.toTree.toTree(arrs)]
this.defaultExpandedKeys.length == 0 ? this.defaultExpandedKeys = [this.nodes[0].id] : this.defaultExpandedKeys = [...this.defaultExpandedKeys]
this.isLoading = false
})
this.nodes = [...this.toTree.toTree(arrs)];
this.defaultExpandedKeys.length == 0
? (this.defaultExpandedKeys = [this.nodes[0].id])
: (this.defaultExpandedKeys = [...this.defaultExpandedKeys]);
this.isLoading = false;
});
}
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
@ViewChild("nzTreeComponent", { static: false })
nzTreeComponent!: NzTreeComponent;
defaultExpandedKeys = [];
nodes: any[] = []
nodes: any[] = [];
addOr(node?: any) {
// console.log(node)
const modal = this.modal.create({
nzTitle: node ? '新增组织机构' : '新增一级组织机构',
nzTitle: node ? "新增组织机构" : "新增一级组织机构",
nzContent: AddorComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
@ -106,42 +143,48 @@ export class OrganizationComponent implements OnInit {
nzOnOk: async () => {
// console.log('hhhhhhh', instance.validateForm)
if (instance.validateForm.valid) {
await new Promise(resolve => {
let isGasStation
instance.validateForm.value.OrgnizationLevel == 4 ? isGasStation = true : isGasStation = false
await new Promise((resolve) => {
let isGasStation;
instance.validateForm.value.OrgnizationLevel == 4
? (isGasStation = true)
: (isGasStation = false);
let body = {
parentId: node ? Number(node.key) : null,
displayName: instance.validateForm.value.name,
isGasStation: isGasStation,
isSkipAudit: !instance.validateForm.value.isParticipationAudit,
level: instance.validateForm.value.OrgnizationLevel,
}
this.http.post('/api/services/app/Organization/Create', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key)
})
this.getAllOrganization()
return true
}, err => {
resolve(err)
this.message.create('warning', '创建失败');
return false
})
})
};
this.http
.post("/api/services/app/Organization/Create", body)
.subscribe(
(data) => {
resolve(data);
this.message.create("success", "创建成功!");
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key);
});
this.getAllOrganization();
return true;
},
(err) => {
resolve(err);
this.message.create("warning", "创建失败");
return false;
}
);
});
} else {
this.message.create('warning', '请填写完整!');
return false
this.message.create("warning", "请填写完整!");
return false;
}
}
},
});
const instance = modal.getContentComponent();
}
editOr(node) {
const modal = this.modal.create({
nzTitle: '编辑组织机构',
nzTitle: "编辑组织机构",
nzContent: EditorComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
@ -151,102 +194,106 @@ export class OrganizationComponent implements OnInit {
nzOnOk: async () => {
// console.log('hhhhhhh', instance.validateForm)
if (instance.validateForm.valid) {
await new Promise(resolve => {
let isGasStation
instance.validateForm.value.OrgnizationLevel == 4 ? isGasStation = true : isGasStation = false
await new Promise((resolve) => {
let isGasStation;
instance.validateForm.value.OrgnizationLevel == 4
? (isGasStation = true)
: (isGasStation = false);
let body = {
id: node.origin.id,
parentId: node.origin.parentId,
displayName: instance.validateForm.value.name,
isGasStation: isGasStation,
isSkipAudit: !instance.validateForm.value.isParticipationAudit,
level: instance.validateForm.value.OrgnizationLevel
}
this.http.put('/api/services/app/Organization/Update', body).subscribe(data => {
resolve(data)
this.message.create('success', '编辑成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key)
})
this.getAllOrganization()
return true
}, err => {
resolve(err)
this.message.create('warning', '编辑失败');
return false
})
})
level: instance.validateForm.value.OrgnizationLevel,
};
this.http
.put("/api/services/app/Organization/Update", body)
.subscribe(
(data) => {
resolve(data);
this.message.create("success", "编辑成功!");
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key);
});
this.getAllOrganization();
return true;
},
(err) => {
resolve(err);
this.message.create("warning", "编辑失败");
return false;
}
);
});
} else {
this.message.create('warning', '请填写完整!');
return false
this.message.create("warning", "请填写完整!");
return false;
}
}
},
});
const instance = modal.getContentComponent();
}
waring(node) {
const modal = this.modal.create({
nzTitle: '油站预警事件接收情况',
nzTitle: "油站预警事件接收情况",
nzContent: WarningEventsComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 388,
nzClassName: 'WarningEvents',
nzClassName: "WarningEvents",
nzFooter: null,
nzMaskClosable: false,
nzComponentParams: {
data: node.origin,
},
nzOnOk: () => {
}
nzOnOk: () => {},
});
const instance = modal.getContentComponent();
}
deleteOr(item) {
console.log(item)
console.log(item);
if (item.origin.children && item.origin.children.length != 0) {
this.message.create('warning', '请先删除所有子节点');
this.message.create("warning", "请先删除所有子节点");
} else {
this.modal.confirm({
nzTitle: `确定要删除${item.title}这个机构吗?`,
nzOkText: '确定',
nzOkType: 'primary',
nzOkText: "确定",
nzOkType: "primary",
nzOnOk: () => {
this.http.delete('/api/services/app/Organization/Delete', {
params: {
Id: item.origin.id
}
}).subscribe(data => {
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key)
this.http
.delete("/api/services/app/Organization/Delete", {
params: {
Id: item.origin.id,
},
})
this.getAllOrganization()
this.message.create('success', '删除成功!');
})
.subscribe((data) => {
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key);
});
this.getAllOrganization();
this.message.create("success", "删除成功!");
});
},
nzCancelText: '取消',
nzOnCancel: () => {
}
nzCancelText: "取消",
nzOnCancel: () => {},
});
}
}
nzEvent(event: NzFormatEmitEvent): void {
console.log('event', event)
console.log("event", event);
if (this.isDrag) {
let parentId
if (this.pos == 0) {//目标节点内部
parentId = event.node.key
let parentId;
if (this.pos == 0) {
//目标节点内部
parentId = event.node.key;
} else {
if (event.node.level == 0) {
parentId = null
parentId = null;
} else {
parentId = event.node.origin.parentId
parentId = event.node.origin.parentId;
}
}
@ -256,24 +303,28 @@ export class OrganizationComponent implements OnInit {
// code: instance.validateForm.value.code,
// displayName: event.dragNode.origin.displayName,
// isGasStation: event.dragNode.origin.isGasStation
}
this.http.post('/api/services/app/Organization/Move', null, {
params: {
id: event.dragNode.key,
parentId: parentId,
}
}).subscribe(data => {
this.message.create('success', '拖拽成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key)
};
this.http
.post("/api/services/app/Organization/Move", null, {
params: {
id: event.dragNode.key,
parentId: parentId,
},
})
this.getAllOrganization()
return true
}, err => {
this.message.create('warning', '拖拽失败');
return false
})
.subscribe(
(data) => {
this.message.create("success", "拖拽成功!");
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key);
});
this.getAllOrganization();
return true;
},
(err) => {
this.message.create("warning", "拖拽失败");
return false;
}
);
// console.log('this.allOrList', this.allOrList)
// let orders = {}
@ -302,7 +353,6 @@ export class OrganizationComponent implements OnInit {
// }
// }
// let idArr = []
// targetNodeData.forEach(i => {
// idArr.push(i.id)
@ -323,7 +373,7 @@ export class OrganizationComponent implements OnInit {
// if (event.dragNode.isEnd[event.dragNode.isEnd.length - 1]) { //如果移入到最后一个
// // console.log("最后")
// array.push(event.dragNode.origin)
// } else if (event.dragNode.isStart[event.dragNode.isStart.length - 1]) {//如果移入到第一个
// } else if (event.dragNode.isStart[event.dragNode.isStart.length - 1]) {//如果移入到第一个
// // console.log("第一")
// array.unshift(event.dragNode.origin)
// } else {//如果移入中间位置
@ -349,23 +399,21 @@ export class OrganizationComponent implements OnInit {
// this.snackBar.open('排序成功', '确定', config)
// this.refurbishTreeData()
// })
}
}
isDrag //是否可以拖动
pos//放置位置
isDrag; //是否可以拖动
pos; //放置位置
beforeDrop = (arg: NzFormatBeforeDropEvent) => {
console.log('arg', arg)
if (arg.node.level === 0) {//如果为数据节点则不允许拖到一级节点
this.message.create('warning', '不允许拖拽到一级节点');
this.isDrag = false
console.log("arg", arg);
if (arg.node.level === 0) {
//如果为数据节点则不允许拖到一级节点
this.message.create("warning", "不允许拖拽到一级节点");
this.isDrag = false;
return of(false);
} else {
this.isDrag = true
this.pos = arg.pos
return of(true)
this.isDrag = true;
this.pos = arg.pos;
return of(true);
}
}
};
}

7
src/app/system-management/push/push.component.html

@ -2,7 +2,8 @@
<div class="topbox">
<div class="lefttop">
<span>通知推送权限配置</span>
<label nz-checkbox [(ngModel)]="checked" (ngModelChange)='changeNotePush($event)'>是否开启短信推送</label>
<label *ngIf="level === 1" nz-checkbox [(ngModel)]="checked"
(ngModelChange)='changeNotePush($event)'>是否开启短信推送</label>
</div>
<div class="righttop">
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
@ -26,7 +27,7 @@
<th style="width: 25%;">预警推送范围</th>
<!-- <th style="width: 25%;">预警处置范围</th> -->
<th style="width: 25%;">短信推送范围</th>
<th style="width: 10%;">操作</th>
<th style="width: 10%;" *ngIf="level === 1">操作</th>
</tr>
<tr *ngFor="let item of list">
<td>{{item.eventSystemName}}</td>
@ -40,7 +41,7 @@
<td>
<span class="name" *ngFor="let i of item.noteRoleNames">{{i}}</span>
</td>
<td>
<td *ngIf="level === 1">
<span style="color: #2399FF;cursor: pointer;" (click)="edititem(item)">编辑</span>
</td>
</tr>

236
src/app/system-management/push/push.component.ts

@ -1,107 +1,123 @@
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, ViewContainerRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message';
import { EditPushItemComponent } from './edit-push-item/edit-push-item.component';
import { HttpClient } from "@angular/common/http";
import { Component, OnInit, ViewContainerRef } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { NzModalService } from "ng-zorro-antd/modal";
import { NzMessageService } from "ng-zorro-antd/message";
import { EditPushItemComponent } from "./edit-push-item/edit-push-item.component";
@Component({
selector: 'app-push',
templateUrl: './push.component.html',
styleUrls: ['./push.component.scss']
selector: "app-push",
templateUrl: "./push.component.html",
styleUrls: ["./push.component.scss"],
})
export class PushComponent implements OnInit {
validateForm!: FormGroup;
constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private http: HttpClient, private message: NzMessageService) { }
checked
constructor(
private modal: NzModalService,
private viewContainerRef: ViewContainerRef,
private fb: FormBuilder,
private http: HttpClient,
private message: NzMessageService
) {}
checked;
level: number; //当前登录账号的组织机构等级
async ngOnInit(): Promise<void> {
this.level = JSON.parse(
sessionStorage.getItem("userdata")
).organization.level;
this.validateForm = this.fb.group({
search: [null]
search: [null],
});
await this.getPutRoles()
await this.getPutRoles();
// await this.getHandleRoles()
await this.getNoteRoles()
this.getViolation()
this.getSetting()
await this.getNoteRoles();
this.getViolation();
this.getSetting();
}
//获取短信推送状态
getSetting() {
let params = {
settingName: 'ViolationSmsSwitch',
}
this.http.get('/api/services/app/Configuration/GetSetting', { params: params }).subscribe((data: any) => {
// console.log('获取短信推送状态', data)
data.result == 'true' ? this.checked = true : this.checked = false
})
settingName: "ViolationSmsSwitch",
};
this.http
.get("/api/services/app/Configuration/GetSetting", { params: params })
.subscribe((data: any) => {
// console.log('获取短信推送状态', data)
data.result == "true" ? (this.checked = true) : (this.checked = false);
});
}
changeNotePush(e) {
console.log(e)
console.log(e);
let params = {
settingName: 'ViolationSmsSwitch',
value: e
}
this.http.post('/api/services/app/Configuration/SetSetting', '', { params: params }).subscribe((data: any) => {
// console.log('设置短信推送状态成功', data)
if (e) {
this.message.create('success', '开启成功!');
} else {
this.message.create('success', '关闭成功!');
}
})
settingName: "ViolationSmsSwitch",
value: e,
};
this.http
.post("/api/services/app/Configuration/SetSetting", "", {
params: params,
})
.subscribe((data: any) => {
// console.log('设置短信推送状态成功', data)
if (e) {
this.message.create("success", "开启成功!");
} else {
this.message.create("success", "关闭成功!");
}
});
}
//获取预警类型
list: any
list: any;
getViolation() {
this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => {
data.result.forEach(element => {
element.pushRoleNames = []
element.pushRoleIds.forEach(item => {
this.pushRoleIds.forEach(i => {
if (i.id == item) {
element.pushRoleNames.push(i.displayName)
}
this.http
.get("/api/services/app/Violation/GetAllList")
.subscribe((data: any) => {
data.result.forEach((element) => {
element.pushRoleNames = [];
element.pushRoleIds.forEach((item) => {
this.pushRoleIds.forEach((i) => {
if (i.id == item) {
element.pushRoleNames.push(i.displayName);
}
});
});
});
// element.handleRoleNames = []
// element.handleRoleIds.forEach(item => {
// this.handleRoleIds.forEach(i => {
// if (i.id == item) {
// element.handleRoleNames.push(i.displayName)
// }
// });
// });
element.noteRoleNames = []
element.smsPushRoleIds.forEach(item => {
this.noteRoleIds.forEach(i => {
if (i.id == item) {
element.noteRoleNames.push(i.displayName)
}
// element.handleRoleNames = []
// element.handleRoleIds.forEach(item => {
// this.handleRoleIds.forEach(i => {
// if (i.id == item) {
// element.handleRoleNames.push(i.displayName)
// }
// });
// });
element.noteRoleNames = [];
element.smsPushRoleIds.forEach((item) => {
this.noteRoleIds.forEach((i) => {
if (i.id == item) {
element.noteRoleNames.push(i.displayName);
}
});
});
});
this.list = data.result;
console.log("预警类型", this.list);
});
this.list = data.result
console.log('预警类型', this.list)
})
}
//获取推送的角色列表
pushRoleIds
pushRoleIds;
async getPutRoles() {
await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Violation/GetPutRoles').subscribe((data: any) => {
this.pushRoleIds = data.result
resolve(data)
console.log('推送角色', data)
})
})
this.http
.get("/api/services/app/Violation/GetPutRoles")
.subscribe((data: any) => {
this.pushRoleIds = data.result;
resolve(data);
console.log("推送角色", data);
});
});
}
// handleRoleIds
// //获取处置的角色列表
@ -114,25 +130,24 @@ export class PushComponent implements OnInit {
// })
// })
// }
noteRoleIds
noteRoleIds;
//获取处置的角色列表
async getNoteRoles() {
await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Violation/GetSmsPutRoles').subscribe((data: any) => {
this.noteRoleIds = data.result
resolve(data)
console.log('短信角色', data)
})
})
this.http
.get("/api/services/app/Violation/GetSmsPutRoles")
.subscribe((data: any) => {
this.noteRoleIds = data.result;
resolve(data);
console.log("短信角色", data);
});
});
}
edititem(item) {
console.log(item)
console.log(item);
const modal = this.modal.create({
nzTitle: '编辑推送设置',
nzTitle: "编辑推送设置",
nzContent: EditPushItemComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 400,
@ -145,37 +160,37 @@ export class PushComponent implements OnInit {
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise((resolve, reject) => {
console.log('表单信息', instance.validateForm)
console.log("表单信息", instance.validateForm);
let body = {
id: item.id,
pushRoleIds: instance.validateForm.value.push,
// handleRoleIds: instance.validateForm.value.handle,
smsPushRoleIds: instance.validateForm.value.note
}
this.http.put('/api/services/app/Violation/UpdateRoles', body).subscribe({
next: data => {
resolve(data)
this.message.create('success', '修改成功!');
this.getViolation()
return true
},
error: err => {
this.message.create('success', '修改失败!');
reject(err)
}
})
})
smsPushRoleIds: instance.validateForm.value.note,
};
this.http
.put("/api/services/app/Violation/UpdateRoles", body)
.subscribe({
next: (data) => {
resolve(data);
this.message.create("success", "修改成功!");
this.getViolation();
return true;
},
error: (err) => {
this.message.create("success", "修改失败!");
reject(err);
},
});
});
} else {
this.message.create('warning', '请填写完整!');
return false
this.message.create("warning", "请填写完整!");
return false;
}
}
},
});
const instance = modal.getContentComponent();
}
//搜索框提交
submitForm(): void {
for (const i in this.validateForm.controls) {
@ -185,11 +200,10 @@ export class PushComponent implements OnInit {
if (this.validateForm.value.search) {
this.list = this.list.filter((item) => {
return item.violationType.indexOf(this.validateForm.value.search) != -1
})
return item.violationType.indexOf(this.validateForm.value.search) != -1;
});
} else {
this.getViolation()
this.getViolation();
}
}
}

Loading…
Cancel
Save