系统管理角色,用户,部门内部分字段长度控制
This commit is contained in:
@@ -36,7 +36,6 @@ export class LoginComponent implements OnInit {
|
|||||||
if (data.is_success) {
|
if (data.is_success) {
|
||||||
this.httpClient.get('/sysapi/setting/user/currentUser/detail').subscribe(
|
this.httpClient.get('/sysapi/setting/user/currentUser/detail').subscribe(
|
||||||
xhr => {
|
xhr => {
|
||||||
console.log(xhr);
|
|
||||||
if (xhr.is_success) {
|
if (xhr.is_success) {
|
||||||
sessionStorage.setItem('userInfo', JSON.stringify(xhr.body));
|
sessionStorage.setItem('userInfo', JSON.stringify(xhr.body));
|
||||||
this.message.success('登录成功!');
|
this.message.success('登录成功!');
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ export class MainComponent implements OnInit {
|
|||||||
private websocketService: WebsocketService
|
private websocketService: WebsocketService
|
||||||
) {
|
) {
|
||||||
this.toastService.getToasts().forEach((config: ToastConfig) => {
|
this.toastService.getToasts().forEach((config: ToastConfig) => {
|
||||||
console.log(config);
|
|
||||||
this.toastConfigs.unshift(config);
|
this.toastConfigs.unshift(config);
|
||||||
});
|
});
|
||||||
this.toastService.removeToastMainSubject.subscribe((config?: ToastConfig) => {
|
this.toastService.removeToastMainSubject.subscribe((config?: ToastConfig) => {
|
||||||
@@ -53,6 +52,9 @@ export class MainComponent implements OnInit {
|
|||||||
if (event.urlAfterRedirects != '/app/main') {
|
if (event.urlAfterRedirects != '/app/main') {
|
||||||
if (this.websocketService.websocket.readyState === 1) {
|
if (this.websocketService.websocket.readyState === 1) {
|
||||||
this.websocketService.websocket.close();
|
this.websocketService.websocket.close();
|
||||||
|
if(this.websocketService.websocketHeartBeat){
|
||||||
|
this.websocketService.clearIntervalHandle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,14 +131,9 @@ export class MainComponent implements OnInit {
|
|||||||
// 订阅航班更新
|
// 订阅航班更新
|
||||||
this.websocketService.dynamicsMessage().subscribe(
|
this.websocketService.dynamicsMessage().subscribe(
|
||||||
event => {
|
event => {
|
||||||
setInterval(() => {
|
|
||||||
let msg = { "topic": "heart-beat", "message": "" };
|
|
||||||
this.websocketService.websocket.send(JSON.stringify(msg));
|
|
||||||
}, 30000);
|
|
||||||
let data = JSON.parse(event as string);
|
let data = JSON.parse(event as string);
|
||||||
if (data.topic === 'schd') {
|
if (data.topic === 'schd') {
|
||||||
let message = JSON.parse(data.message);
|
let message = JSON.parse(data.message);
|
||||||
// console.log(message);
|
|
||||||
//是否可以开始处理动态消息
|
//是否可以开始处理动态消息
|
||||||
if (this.canHandleDynamicMessage) {
|
if (this.canHandleDynamicMessage) {
|
||||||
this.dynamicMessageHandle(message);
|
this.dynamicMessageHandle(message);
|
||||||
@@ -145,7 +142,6 @@ export class MainComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
} else if (data.topic === 'msg') {
|
} else if (data.topic === 'msg') {
|
||||||
let message = JSON.parse(data.message);
|
let message = JSON.parse(data.message);
|
||||||
// console.log(message);
|
|
||||||
if (this.canHandleDynamicAlert) {
|
if (this.canHandleDynamicAlert) {
|
||||||
this.dynamicAlertHandle(message);
|
this.dynamicAlertHandle(message);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export class PagesComponent implements OnInit {
|
|||||||
menuList.forEach(menu => {
|
menuList.forEach(menu => {
|
||||||
this.menuDataHandle(menu);
|
this.menuDataHandle(menu);
|
||||||
})
|
})
|
||||||
// console.log(menuList);
|
|
||||||
this.menuData = menuList;
|
this.menuData = menuList;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ export class DataSynchronizeComponent implements OnInit {
|
|||||||
onEndChange(date: Date): void {
|
onEndChange(date: Date): void {
|
||||||
this.endValue = date;
|
this.endValue = date;
|
||||||
this.search.endDate = this.changeDate(date)
|
this.search.endDate = this.changeDate(date)
|
||||||
console.log(this.search.endDate)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleStartOpenChange(open: boolean): void {
|
handleStartOpenChange(open: boolean): void {
|
||||||
|
|||||||
+8
-7
@@ -97,7 +97,8 @@
|
|||||||
<nz-form-label nzSpan="7" nzFor="organization" nzRequired>机构名称</nz-form-label>
|
<nz-form-label nzSpan="7" nzFor="organization" nzRequired>机构名称</nz-form-label>
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input id="organization" formControlName="organization" placeholder="请输入姓名">
|
<input nz-input id="organization" formControlName="organization" placeholder="请输入姓名">
|
||||||
<nz-form-explain *ngIf="validateForm.get('organization').dirty && validateForm.get('organization').errors">请输入机构名称</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('organization').dirty && validateForm.get('organization').errors?.required">请输入机构名称</nz-form-explain>
|
||||||
|
<nz-form-explain *ngIf="validateForm.get('organization').dirty && validateForm.get('organization').errors?.maxlength">机构名称最长20个字符</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</div>
|
</div>
|
||||||
@@ -106,17 +107,17 @@
|
|||||||
<nz-form-label nzSpan="7" nzFor="shortName">机构简称</nz-form-label>
|
<nz-form-label nzSpan="7" nzFor="shortName">机构简称</nz-form-label>
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input id="shortName" formControlName="shortName" placeholder="请输入姓名">
|
<input nz-input id="shortName" formControlName="shortName" placeholder="请输入姓名">
|
||||||
<nz-form-explain *ngIf="validateForm.get('shortName').dirty && validateForm.get('shortName').errors">请输入机构简称</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('shortName').dirty && validateForm.get('shortName').errors">机构简称最长10个字符</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div nz-col [nzXs]="24" [nzSm]="24" [nzMd]="24" [nzLg]="24" [nzXl]="12" [nzXXl]="12">
|
<div nz-col [nzXs]="24" [nzSm]="24" [nzMd]="24" [nzLg]="24" [nzXl]="12" [nzXXl]="12">
|
||||||
<nz-form-item>
|
<nz-form-item>
|
||||||
<nz-form-label nzSpan="7" nzFor="code" nzRequired>机构编码</nz-form-label>
|
<nz-form-label nzSpan="7" nzFor="code" nzRequired>机构编码</nz-form-label>
|
||||||
<nz-form-control nzSpan="12" [nzValidateStatus]="checkNameStatus" nzHasFeedback>
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input id="code" formControlName="code" placeholder="请输入机构编码" (blur)='checkName()'
|
<input nz-input id="code" formControlName="code" placeholder="请输入机构编码" (keyup)='checkName()' name="validating">
|
||||||
(keydown)="checkNameStatus='';nameOnly=true" name="validating">
|
<nz-form-explain *ngIf="validateForm.get('code').dirty && validateForm.get('code').errors?.required">请输入机构编码</nz-form-explain>
|
||||||
<nz-form-explain *ngIf="validateForm.get('code').dirty && validateForm.get('code').errors">请输入机构编码</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('code').dirty && validateForm.get('code').errors?.maxlength">机构编码最长10个字符</nz-form-explain>
|
||||||
<nz-form-explain *ngIf="!nameOnly" class="danger">该编码已存在</nz-form-explain>
|
<nz-form-explain *ngIf="!nameOnly" class="danger">该编码已存在</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
@@ -126,7 +127,7 @@
|
|||||||
<nz-form-label nzSpan="7" nzFor="contact_person">联系人</nz-form-label>
|
<nz-form-label nzSpan="7" nzFor="contact_person">联系人</nz-form-label>
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input id="contact_person" formControlName="contact_person" placeholder="请输入姓名">
|
<input nz-input id="contact_person" formControlName="contact_person" placeholder="请输入姓名">
|
||||||
<nz-form-explain *ngIf="validateForm.get('contact_person').dirty && validateForm.get('contact_person').errors">请输入联系人</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('contact_person').dirty && validateForm.get('contact_person').errors?.maxlength">联系人名称最长10个字符</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+400
-404
@@ -1,427 +1,423 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormBuilder,FormControl,FormGroup,Validators} from '@angular/forms';
|
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
import { HttpClientService } from '../../../services/http-client.service';
|
import { HttpClientService } from '../../../services/http-client.service';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { NzMessageService,NzModalRef, NzModalService } from 'ng-zorro-antd';
|
import { NzMessageService, NzModalRef, NzModalService } from 'ng-zorro-antd';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import 'ztree';
|
import 'ztree';
|
||||||
declare var $: any;
|
declare var $: any;
|
||||||
declare var jQuery: any
|
declare var jQuery: any
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-department-management',
|
selector: 'app-department-management',
|
||||||
templateUrl: './department-management.component.html',
|
templateUrl: './department-management.component.html',
|
||||||
styleUrls: ['./department-management.component.scss']
|
styleUrls: ['./department-management.component.scss']
|
||||||
})
|
})
|
||||||
export class DepartmentManagementComponent implements OnInit {
|
export class DepartmentManagementComponent implements OnInit {
|
||||||
collectionSize:any ;
|
collectionSize: any;
|
||||||
treeSelected:any; //树模型-当前选中项
|
treeSelected: any; //树模型-当前选中项
|
||||||
treeSelectedChild:any; //上级机构选择树
|
treeSelectedChild: any; //上级机构选择树
|
||||||
statusParamsTree:any={ //获取机构接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
statusParamsTree: any = { //获取机构接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
||||||
status:1,
|
status: 1,
|
||||||
}
|
}
|
||||||
statusParamsUsers:any={ //接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
statusParamsUsers: any = { //接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
||||||
status:1,
|
status: 1,
|
||||||
}
|
}
|
||||||
public TreeData:any;
|
public TreeData: any;
|
||||||
public canDel:any=false;
|
public canDel: any = false;
|
||||||
public canEdit:any=false;
|
public canEdit: any = false;
|
||||||
public search:any={
|
public search: any = {
|
||||||
page_index:'1',
|
page_index: '1',
|
||||||
page_size:'10',
|
page_size: '10',
|
||||||
real_name:'',
|
real_name: '',
|
||||||
}
|
}
|
||||||
public orgDetail:any=''; //左侧机构目录当前选中项机构的详情信息
|
public orgDetail: any = ''; //左侧机构目录当前选中项机构的详情信息
|
||||||
public orgSeleted:any=''; //新增或者修改时,当前选中的所属机构的机构详情信息
|
public orgSeleted: any = ''; //新增或者修改时,当前选中的所属机构的机构详情信息
|
||||||
public modifyType:any='3'; //操作状态 1新增 2修改 3详情
|
public modifyType: any = '3'; //操作状态 1新增 2修改 3详情
|
||||||
public parentName:any='';
|
public parentName: any = '';
|
||||||
public parentNode:any=''; //当前选中机构的父级节点
|
public parentNode: any = ''; //当前选中机构的父级节点
|
||||||
public userList:any=''; //机构负责人列表-详情时展示用户列表
|
public userList: any = ''; //机构负责人列表-详情时展示用户列表
|
||||||
public userSelecteds:any=[]; //机构负责人已选用户-新增、修改时
|
public userSelecteds: any = []; //机构负责人已选用户-新增、修改时
|
||||||
public userData:any=[]; //用户列表数据
|
public userData: any = []; //用户列表数据
|
||||||
saveCheck:any=false; //保存检查,保存验证表单 false 还未验证 true 触发了验证
|
saveCheck: any = false; //保存检查,保存验证表单 false 还未验证 true 触发了验证
|
||||||
public visible:any=false;
|
public visible: any = false;
|
||||||
public orgSeletedBtn:any=true; //控制机构选择按钮
|
public orgSeletedBtn: any = true; //控制机构选择按钮
|
||||||
validateForm: FormGroup;
|
validateForm: FormGroup;
|
||||||
visibleUsers:any=false;
|
visibleUsers: any = false;
|
||||||
isLoadingSave:any=false;
|
isLoadingSave: any = false;
|
||||||
nameOnly:any=true; //系统账号是否唯一 true唯一 false重复
|
nameOnly: any = true; //系统账号是否唯一 true唯一 false重复
|
||||||
oldLoginName:any=''; //修改时,保存原本的系统账号,用于检测唯一性
|
oldLoginName: any = ''; //修改时,保存原本的系统账号,用于检测唯一性
|
||||||
checkNameStatus:any=''; //检测账号唯一性的图标状态
|
checkNameStatus: any = ''; //检测账号唯一性的图标状态
|
||||||
orgList:any=[];
|
orgList: any = [];
|
||||||
confirmModal:NzModalRef;
|
confirmModal: NzModalRef;
|
||||||
constructor(
|
constructor(
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private http:HttpClientService,
|
private http: HttpClientService,
|
||||||
private router:Router,
|
private router: Router,
|
||||||
private message: NzMessageService,
|
private message: NzMessageService,
|
||||||
private modal: NzModalService,
|
private modal: NzModalService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
$('.tree-box').css('height',(document.documentElement.clientHeight-106+'px'));
|
$('.tree-box').css('height', (document.documentElement.clientHeight - 106 + 'px'));
|
||||||
$('.main-content').css('height',(document.documentElement.clientHeight-106+'px'));
|
$('.main-content').css('height', (document.documentElement.clientHeight - 106 + 'px'));
|
||||||
$(window).resize(function(){
|
$(window).resize(function () {
|
||||||
$('.tree-box').css('height',(document.documentElement.clientHeight-106+'px'));
|
$('.tree-box').css('height', (document.documentElement.clientHeight - 106 + 'px'));
|
||||||
$('.main-content').css('height',(document.documentElement.clientHeight-106+'px'));
|
$('.main-content').css('height', (document.documentElement.clientHeight - 106 + 'px'));
|
||||||
})
|
})
|
||||||
//表单实例化
|
//表单实例化
|
||||||
this.validateForm = this.fb.group({
|
this.validateForm = this.fb.group({
|
||||||
organization:[ '', [ Validators.required ] ],
|
organization: ['', [Validators.required, Validators.maxLength(20)]],
|
||||||
shortName:[ '' ],
|
shortName: ['',[Validators.maxLength(10)]],
|
||||||
code:[ '', [ Validators.required ] ],
|
code: ['', [Validators.required,Validators.maxLength(10)]],
|
||||||
contact_person:[ '' ],
|
contact_person: ['',[Validators.maxLength(10)]],
|
||||||
contact_method:[ '' ],
|
contact_method: [''],
|
||||||
organization_type:[ '' ],
|
organization_type: [''],
|
||||||
address:[ '' ],
|
address: [''],
|
||||||
|
|
||||||
});
|
});
|
||||||
this.initTree();
|
this.initTree();
|
||||||
this.queryTable();
|
this.queryTable();
|
||||||
}
|
}
|
||||||
//新增、修改 type 1新增 2修改
|
//新增、修改 type 1新增 2修改
|
||||||
addModify(type){
|
addModify(type) {
|
||||||
//数据清空重置
|
//数据清空重置
|
||||||
this.modifyType=type;
|
this.modifyType = type;
|
||||||
this.validateForm.reset();
|
this.validateForm.reset();
|
||||||
this.userSelecteds=[];
|
this.userSelecteds = [];
|
||||||
this.orgSeleted='';
|
this.orgSeleted = '';
|
||||||
this.checkNameStatus='';
|
this.checkNameStatus = '';
|
||||||
this.nameOnly=true;
|
this.nameOnly = true;
|
||||||
this.validateForm.patchValue({organization_type:1,});
|
this.validateForm.patchValue({ organization_type: 1, });
|
||||||
if(type==1){
|
if (type == 1) {
|
||||||
|
|
||||||
}else if(type==2){
|
} else if (type == 2) {
|
||||||
let item=this.orgDetail;
|
let item = this.orgDetail;
|
||||||
// console.log(item);
|
this.zNodesChild = this.zNodes.concat();
|
||||||
this.zNodesChild=this.zNodes.concat();
|
for (let i = 0; i < this.zNodesChild.length; i++) {
|
||||||
for(let i = 0;i<this.zNodesChild.length;i++){
|
if (this.zNodesChild[i].id === item.id) {
|
||||||
if(this.zNodesChild[i].id===item.id){
|
this.zNodesChild.splice(i, 1);
|
||||||
this.zNodesChild.splice(i,1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.fn.zTree.init($("#treeDemoChild"), this.settingChild, this.zNodesChild);
|
$.fn.zTree.init($("#treeDemoChild"), this.settingChild, this.zNodesChild);
|
||||||
this.validateForm.patchValue({
|
this.validateForm.patchValue({
|
||||||
organization:item.organization,
|
organization: item.organization,
|
||||||
shortName:item.shortName,
|
shortName: item.shortName,
|
||||||
code:item.code,
|
code: item.code,
|
||||||
contact_person:item.contact_person,
|
contact_person: item.contact_person,
|
||||||
contact_method:item.contact_method,
|
contact_method: item.contact_method,
|
||||||
organization_type:item.organization_type,
|
organization_type: item.organization_type,
|
||||||
address:item.address,
|
address: item.address,
|
||||||
});
|
});
|
||||||
this.orgSeleted=this.parentNode;
|
this.orgSeleted = this.parentNode;
|
||||||
this.userList.forEach(option=>{
|
this.userList.forEach(option => {
|
||||||
option.checked=true;
|
option.checked = true;
|
||||||
option.disabled=false;
|
option.disabled = false;
|
||||||
this.userSelecteds.push(option)
|
this.userSelecteds.push(option)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//删除
|
//删除
|
||||||
delete(){
|
delete() {
|
||||||
this.confirmModal = this.modal.confirm({
|
this.confirmModal = this.modal.confirm({
|
||||||
nzTitle: '删除',
|
nzTitle: '删除',
|
||||||
nzContent: '确定删除【'+this.orgDetail.organization+'】?',
|
nzContent: '确定删除【' + this.orgDetail.organization + '】?',
|
||||||
nzOnOk: () => new Promise((resolve, reject) => {
|
nzOnOk: () => new Promise((resolve, reject) => {
|
||||||
this.http.delete('/sysapi/setting/organization/delOrgByid/'+this.orgDetail.id).subscribe((json)=>{
|
this.http.delete('/sysapi/setting/organization/delOrgByid/' + this.orgDetail.id).subscribe((json) => {
|
||||||
if(json.is_success){
|
if (json.is_success) {
|
||||||
resolve();
|
resolve();
|
||||||
this.message.success(`删除成功!`);
|
this.message.success(`删除成功!`);
|
||||||
this.initTree();
|
this.initTree();
|
||||||
}else{
|
} else {
|
||||||
reject();
|
reject();
|
||||||
this.message.error(`删除失败!`);
|
this.message.error(`删除失败!`);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}).catch(() => console.log('Oops errors!'))
|
}).catch(() => console.log('Oops errors!'))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//保存
|
//保存
|
||||||
submitForm(){
|
submitForm() {
|
||||||
let pid='';
|
let pid = '';
|
||||||
let userList=[];
|
let userList = [];
|
||||||
this.orgSeleted?pid=this.orgSeleted.id:pid='';
|
this.orgSeleted ? pid = this.orgSeleted.id : pid = '';
|
||||||
if(this.userSelecteds&&this.userSelecteds.length>0){
|
if (this.userSelecteds && this.userSelecteds.length > 0) {
|
||||||
this.userSelecteds.forEach(item=>{
|
this.userSelecteds.forEach(item => {
|
||||||
userList.push({uid:item.uid})
|
userList.push({ uid: item.uid })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let params=Object.assign({},this.validateForm.value,{pid:pid},{userList:userList})
|
let params = Object.assign({}, this.validateForm.value, { pid: pid }, { userList: userList })
|
||||||
if(this.modifyType==1){
|
if (this.modifyType == 1) {
|
||||||
this.http.post('/sysapi/setting/organization/add/',params).subscribe((json)=>{
|
this.http.post('/sysapi/setting/organization/add/', params).subscribe((json) => {
|
||||||
if(json.is_success){
|
if (json.is_success) {
|
||||||
this.message.success(`新增成功!`);
|
this.message.success(`新增成功!`);
|
||||||
this.initTree();
|
this.initTree();
|
||||||
}else{
|
} else {
|
||||||
this.message.error(`新增失败!`);
|
this.message.error(`新增失败!`);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else if(this.modifyType==2){
|
} else if (this.modifyType == 2) {
|
||||||
this.http.put('/sysapi/setting/organization/updateById/'+this.orgDetail.id,params).subscribe((json)=>{
|
this.http.put('/sysapi/setting/organization/updateById/' + this.orgDetail.id, params).subscribe((json) => {
|
||||||
if(json.is_success){
|
if (json.is_success) {
|
||||||
this.message.success(`修改成功!`);
|
this.message.success(`修改成功!`);
|
||||||
this.initTree();
|
this.initTree();
|
||||||
}else{
|
} else {
|
||||||
this.message.error(`修改失败!`);
|
this.message.error(`修改失败!`);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//取消
|
//取消
|
||||||
cancel(){
|
cancel() {
|
||||||
this.modifyType=3;
|
this.modifyType = 3;
|
||||||
}
|
}
|
||||||
//保存机构负责人
|
//保存机构负责人
|
||||||
userSave(){
|
userSave() {
|
||||||
this.userData.forEach(item=>{
|
this.userData.forEach(item => {
|
||||||
if(item.checked&&!item.disabled){
|
if (item.checked && !item.disabled) {
|
||||||
// 增加数据
|
// 增加数据
|
||||||
this.userSelecteds = [ ...this.userSelecteds, item];
|
this.userSelecteds = [...this.userSelecteds, item];
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.visibleUsers = false;
|
this.visibleUsers = false;
|
||||||
}
|
}
|
||||||
//保存选择机构
|
//保存选择机构
|
||||||
treeSave(){
|
treeSave() {
|
||||||
if(this.treeSelectedChild){
|
if (this.treeSelectedChild) {
|
||||||
this.orgSeleted=this.treeSelectedChild;
|
this.orgSeleted = this.treeSelectedChild;
|
||||||
this.close();
|
this.close();
|
||||||
// this.visible = false;
|
// this.visible = false;
|
||||||
// this.orgSeletedBtn=false;
|
// this.orgSeletedBtn=false;
|
||||||
}else{
|
} else {
|
||||||
//如果没有选择机构,提示请选择机构
|
//如果没有选择机构,提示请选择机构
|
||||||
this.message.create('warning', `请选择所属机构!`,{ nzDuration: 2000 });
|
this.message.create('warning', `请选择所属机构!`, { nzDuration: 2000 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//打开机构负责人抽屉
|
//打开机构负责人抽屉
|
||||||
openUsers(){
|
openUsers() {
|
||||||
this.visibleUsers = true;
|
this.visibleUsers = true;
|
||||||
this.queryTable();
|
this.queryTable();
|
||||||
}
|
}
|
||||||
//处理机构负责人选择和数据回填
|
//处理机构负责人选择和数据回填
|
||||||
userSelect(){
|
userSelect() {
|
||||||
if(this.userData){
|
if (this.userData) {
|
||||||
this.userData.forEach(item=>{
|
this.userData.forEach(item => {
|
||||||
this.userSelecteds.forEach(option=>{
|
this.userSelecteds.forEach(option => {
|
||||||
if(item.uid==option.uid){
|
if (item.uid == option.uid) {
|
||||||
item.checked=true;
|
item.checked = true;
|
||||||
item.disabled=true;
|
item.disabled = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//关闭用户选择抽屉
|
//关闭用户选择抽屉
|
||||||
closeUser(){
|
closeUser() {
|
||||||
this.visibleUsers = false;
|
this.visibleUsers = false;
|
||||||
}
|
}
|
||||||
//打开机构树抽屉
|
//打开机构树抽屉
|
||||||
open(): void {
|
open(): void {
|
||||||
this.treeSelectedChild='';
|
this.treeSelectedChild = '';
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
}
|
}
|
||||||
//关闭机构选择页面
|
//关闭机构选择页面
|
||||||
close(): void {
|
close(): void {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
}
|
||||||
//删除机构标签
|
//删除机构标签
|
||||||
tagClose(event){
|
tagClose(event) {
|
||||||
// this.orgSeletedBtn=true;
|
// this.orgSeletedBtn=true;
|
||||||
this.orgSeleted='';
|
this.orgSeleted = '';
|
||||||
}
|
}
|
||||||
//删除机构负责人
|
//删除机构负责人
|
||||||
delectConfirm(item){
|
delectConfirm(item) {
|
||||||
this.userSelecteds=this.userSelecteds.filter(function(option){
|
this.userSelecteds = this.userSelecteds.filter(function (option) {
|
||||||
return item.uid!==option.uid
|
return item.uid !== option.uid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//取消删除
|
//取消删除
|
||||||
delectCancel(){
|
delectCancel() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取用户列表
|
|
||||||
queryTable():void{
|
|
||||||
this.statusParamsUsers.status=1;
|
|
||||||
this.http.get('/sysapi/setting/user/list',this.search).subscribe((json)=>{
|
|
||||||
if(json.is_success){
|
|
||||||
this.userData=json.body.list;
|
|
||||||
this.collectionSize=json.body.total;
|
|
||||||
if(json.body.list&&json.body.list.length>0){
|
|
||||||
this.statusParamsUsers.status=3;
|
|
||||||
this.userData.forEach(item=>{
|
|
||||||
if(this.userSelecteds.length>0){
|
|
||||||
this.userSelecteds.forEach(option=>{
|
|
||||||
if(item.uid==option.uid){
|
|
||||||
item.checked=true;
|
|
||||||
item.disabled=true;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
item.checked=false;
|
|
||||||
item.disabled=false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
this.statusParamsUsers.status=4;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.statusParamsUsers.status=0;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//翻页
|
|
||||||
pageChange(event){
|
|
||||||
this.search.page_index=event;
|
|
||||||
this.queryTable();
|
|
||||||
}
|
|
||||||
//修改时查询该系统下的所有用户
|
|
||||||
queryUserById():void{
|
|
||||||
this.http.get('/sysapi/setting/organization/queryUserById/'+this.orgDetail.id).subscribe((json)=>{
|
|
||||||
if(json.is_success){
|
|
||||||
this.userList=json.body
|
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
//获取用户列表
|
||||||
})
|
queryTable(): void {
|
||||||
}
|
this.statusParamsUsers.status = 1;
|
||||||
//检验编码的唯一性
|
this.http.get('/sysapi/setting/user/list', this.search).subscribe((json) => {
|
||||||
checkName(){
|
if (json.is_success) {
|
||||||
//处理修改的时候,修改的值为原来的值,这时候直接显示验证成功
|
this.userData = json.body.list;
|
||||||
if(this.modifyType==2&&this.validateForm.value.code.trim()==this.oldLoginName){
|
this.collectionSize = json.body.total;
|
||||||
this.nameOnly = true;
|
if (json.body.list && json.body.list.length > 0) {
|
||||||
this.checkNameStatus='success';
|
this.statusParamsUsers.status = 3;
|
||||||
return false;
|
this.userData.forEach(item => {
|
||||||
}
|
if (this.userSelecteds.length > 0) {
|
||||||
//拿用户输入的机构编码跟机构列表的编码对比,判断编码是否已经存在
|
this.userSelecteds.forEach(option => {
|
||||||
let status='true';
|
if (item.uid == option.uid) {
|
||||||
this.orgList.forEach(item=>{
|
item.checked = true;
|
||||||
if(this.validateForm.value.code.trim()==item.code){
|
item.disabled = true;
|
||||||
this.checkNameStatus='error';
|
}
|
||||||
this.nameOnly = false;
|
})
|
||||||
status='false';
|
} else {
|
||||||
return false;
|
item.checked = false;
|
||||||
}
|
item.disabled = false;
|
||||||
});
|
}
|
||||||
if(status=='true'&&this.validateForm.value.code.trim()){
|
})
|
||||||
this.checkNameStatus='success';
|
} else {
|
||||||
this.nameOnly = true;
|
this.statusParamsUsers.status = 4;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
//获取机构列表,树模型数据处理
|
this.statusParamsUsers.status = 0;
|
||||||
initTree(){
|
}
|
||||||
//获取目录列表
|
})
|
||||||
this.statusParamsTree.status=1;
|
}
|
||||||
this.http.get("/sysapi/setting/organization/list",).subscribe(json=>{
|
//翻页
|
||||||
if(json.is_success){
|
pageChange(event) {
|
||||||
if(json.body.length>0){
|
this.search.page_index = event;
|
||||||
this.statusParamsTree.status=3;
|
this.queryTable();
|
||||||
this.orgList=json.body;
|
}
|
||||||
let children=[];
|
//修改时查询该系统下的所有用户
|
||||||
json.body.forEach(option=>{
|
queryUserById(): void {
|
||||||
option.name=option.organization;
|
this.http.get('/sysapi/setting/organization/queryUserById/' + this.orgDetail.id).subscribe((json) => {
|
||||||
if(option.pid){
|
if (json.is_success) {
|
||||||
option.pId=option.pid;
|
this.userList = json.body
|
||||||
}else{
|
} else {
|
||||||
option.pId='hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc';
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
json.body.push({
|
}
|
||||||
name:"全部机构",
|
//检验编码的唯一性
|
||||||
isParent:true,
|
checkName() {
|
||||||
open:true,
|
//处理修改的时候,修改的值为原来的值,这时候直接显示验证成功
|
||||||
id:'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc',
|
if (this.modifyType == 2 && this.validateForm.value.code.trim() == this.oldLoginName) {
|
||||||
})
|
this.nameOnly = true;
|
||||||
}else{
|
this.checkNameStatus = 'success';
|
||||||
//数据为空
|
return false;
|
||||||
this.statusParamsTree.status=4;
|
}
|
||||||
}
|
//拿用户输入的机构编码跟机构列表的编码对比,判断编码是否已经存在
|
||||||
}else{
|
let status = 'true';
|
||||||
//请求失败
|
this.orgList.forEach(item => {
|
||||||
this.statusParamsTree.status=0;
|
if (this.validateForm.value.code.trim() == item.code) {
|
||||||
}
|
this.checkNameStatus = 'error';
|
||||||
this.zNodes=json.body;
|
this.nameOnly = false;
|
||||||
|
status = 'false';
|
||||||
// console.log(this.zNodes);
|
return false;
|
||||||
$.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
|
}
|
||||||
|
});
|
||||||
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
if (status == 'true' && this.validateForm.value.code.trim()) {
|
||||||
let node = zTree.getNodes();
|
this.checkNameStatus = 'success';
|
||||||
if(json.body.length>0){
|
this.nameOnly = true;
|
||||||
zTree.selectNode(node[0].children[0])
|
}
|
||||||
zTree.setting.callback.onClick(null,zTree.setting.treeId,node[0].children[0])
|
}
|
||||||
}
|
//获取机构列表,树模型数据处理
|
||||||
})
|
initTree() {
|
||||||
}
|
//获取目录列表
|
||||||
//树模型参数设置-左侧机构树
|
this.statusParamsTree.status = 1;
|
||||||
public zNodes: any[];
|
this.http.get("/sysapi/setting/organization/list").subscribe(json => {
|
||||||
setting = {
|
if (json.is_success) {
|
||||||
data: {
|
if (json.body.length > 0) {
|
||||||
simpleData: {
|
this.statusParamsTree.status = 3;
|
||||||
enable: true
|
this.orgList = json.body;
|
||||||
}
|
let children = [];
|
||||||
},
|
json.body.forEach(option => {
|
||||||
view: {
|
option.name = option.organization;
|
||||||
showLine: true,
|
if (option.pid) {
|
||||||
dblClickExpand: false,
|
option.pId = option.pid;
|
||||||
showIcon:true
|
} else {
|
||||||
},
|
option.pId = 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc';
|
||||||
callback: {
|
}
|
||||||
//节点点击事件
|
});
|
||||||
onClick: (event, treeId, treeNode, clickFlag) => {
|
json.body.push({
|
||||||
this.modifyType=3;
|
name: "全部机构",
|
||||||
this.parentName='';
|
isParent: true,
|
||||||
this.parentNode='';
|
open: true,
|
||||||
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
id: 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc',
|
||||||
this.treeSelected=treeNode;
|
})
|
||||||
let isTopNode=this.treeSelected.getParentNode(); //是否为顶级节点 true不是顶级节点 false 为顶级节点
|
} else {
|
||||||
if(isTopNode){ //子节点
|
//数据为空
|
||||||
this.orgDetail=treeNode;
|
this.statusParamsTree.status = 4;
|
||||||
this.oldLoginName=this.orgDetail.code;
|
}
|
||||||
this.queryUserById();
|
} else {
|
||||||
this.canDel=true;
|
//请求失败
|
||||||
this.canEdit=true;
|
this.statusParamsTree.status = 0;
|
||||||
if(isTopNode.id=='hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc'){
|
}
|
||||||
//除去全部机构这层的第一层 也就是实际意义的顶层
|
this.zNodes = json.body;
|
||||||
}else{
|
$.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
|
||||||
this.parentName=isTopNode.name;
|
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
||||||
this.parentNode=isTopNode;
|
let node = zTree.getNodes();
|
||||||
}
|
if (json.body.length > 0) {
|
||||||
}else{ //顶级节点
|
zTree.selectNode(node[0].children[0])
|
||||||
this.orgDetail='';
|
zTree.setting.callback.onClick(null, zTree.setting.treeId, node[0].children[0])
|
||||||
this.canDel=false;
|
}
|
||||||
this.canEdit=false;
|
})
|
||||||
}
|
}
|
||||||
},
|
//树模型参数设置-左侧机构树
|
||||||
},
|
public zNodes: any[];
|
||||||
};
|
setting = {
|
||||||
//树模型参数设置-右侧机构树
|
data: {
|
||||||
public zNodesChild: any[];
|
simpleData: {
|
||||||
settingChild = {
|
enable: true
|
||||||
data: {
|
}
|
||||||
simpleData: {
|
},
|
||||||
enable: true
|
view: {
|
||||||
}
|
showLine: true,
|
||||||
},
|
dblClickExpand: false,
|
||||||
view: {
|
showIcon: true
|
||||||
showLine: true,
|
},
|
||||||
dblClickExpand: false,
|
callback: {
|
||||||
showIcon:true
|
//节点点击事件
|
||||||
},
|
onClick: (event, treeId, treeNode, clickFlag) => {
|
||||||
callback: {
|
this.modifyType = 3;
|
||||||
//节点点击事件
|
this.parentName = '';
|
||||||
onClick: (event, treeId, treeNode, clickFlag) => {
|
this.parentNode = '';
|
||||||
var zTree = $.fn.zTree.getZTreeObj("treeDemoChild");
|
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
||||||
this.treeSelectedChild=treeNode;
|
this.treeSelected = treeNode;
|
||||||
},
|
let isTopNode = this.treeSelected.getParentNode(); //是否为顶级节点 true不是顶级节点 false 为顶级节点
|
||||||
},
|
if (isTopNode) { //子节点
|
||||||
};
|
this.orgDetail = treeNode;
|
||||||
|
this.oldLoginName = this.orgDetail.code;
|
||||||
|
this.queryUserById();
|
||||||
|
this.canDel = true;
|
||||||
|
this.canEdit = true;
|
||||||
|
if (isTopNode.id == 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc') {
|
||||||
|
//除去全部机构这层的第一层 也就是实际意义的顶层
|
||||||
|
} else {
|
||||||
|
this.parentName = isTopNode.name;
|
||||||
|
this.parentNode = isTopNode;
|
||||||
|
}
|
||||||
|
} else { //顶级节点
|
||||||
|
this.orgDetail = '';
|
||||||
|
this.canDel = false;
|
||||||
|
this.canEdit = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
//树模型参数设置-右侧机构树
|
||||||
|
public zNodesChild: any[];
|
||||||
|
settingChild = {
|
||||||
|
data: {
|
||||||
|
simpleData: {
|
||||||
|
enable: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
view: {
|
||||||
|
showLine: true,
|
||||||
|
dblClickExpand: false,
|
||||||
|
showIcon: true
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
//节点点击事件
|
||||||
|
onClick: (event, treeId, treeNode, clickFlag) => {
|
||||||
|
var zTree = $.fn.zTree.getZTreeObj("treeDemoChild");
|
||||||
|
this.treeSelectedChild = treeNode;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@
|
|||||||
<nz-form-label class="mr-2" nzFor="role_name" nzRequired style="vertical-align:top">角色名称</nz-form-label>
|
<nz-form-label class="mr-2" nzFor="role_name" nzRequired style="vertical-align:top">角色名称</nz-form-label>
|
||||||
<nz-form-control style="display:inline-block">
|
<nz-form-control style="display:inline-block">
|
||||||
<input nz-input id="role_name" formControlName="role_name" placeholder="请输入角色名称">
|
<input nz-input id="role_name" formControlName="role_name" placeholder="请输入角色名称">
|
||||||
<nz-form-explain *ngIf="validateForm.get('role_name').dirty && validateForm.get('role_name').errors">请输入角色名称</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('role_name').dirty && validateForm.get('role_name').errors?.required">请输入角色名称</nz-form-explain>
|
||||||
|
<nz-form-explain *ngIf="validateForm.get('role_name').dirty && validateForm.get('role_name').errors?.maxlength">角色名称最长20个字符</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
<nz-form-item>
|
<nz-form-item>
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ export class RoleManagementModifyComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.validateForm = this.fb.group({
|
this.validateForm = this.fb.group({
|
||||||
role_name: ['', [Validators.required]],
|
role_name: ['', [Validators.required,Validators.maxLength(20)]],
|
||||||
role_type: ['1', [Validators.required]], //0=系统内置(不可删除) ,1=用户定义
|
role_type: ['1', [Validators.required]], //0=系统内置(不可删除) ,1=用户定义
|
||||||
description: [''],
|
description: [''],
|
||||||
role_code: [''],
|
role_code: [''],
|
||||||
|
|||||||
+8
-5
@@ -8,7 +8,8 @@
|
|||||||
<nz-form-label nzSpan="7" nzFor="real_name" nzRequired>姓名</nz-form-label>
|
<nz-form-label nzSpan="7" nzFor="real_name" nzRequired>姓名</nz-form-label>
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input id="real_name" formControlName="real_name" placeholder="请输入姓名">
|
<input nz-input id="real_name" formControlName="real_name" placeholder="请输入姓名">
|
||||||
<nz-form-explain *ngIf="validateForm.get('real_name').dirty && validateForm.get('real_name').errors">请输入姓名</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('real_name').dirty && validateForm.get('real_name').errors?.required">请输入姓名</nz-form-explain>
|
||||||
|
<nz-form-explain *ngIf="validateForm.get('real_name').dirty && validateForm.get('real_name').errors?.maxlength">姓名最长20个字符</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</div>
|
</div>
|
||||||
@@ -30,10 +31,11 @@
|
|||||||
<div nz-col [nzXs]="24" [nzSm]="24" [nzMd]="24" [nzLg]="24" [nzXl]="12" [nzXXl]="12">
|
<div nz-col [nzXs]="24" [nzSm]="24" [nzMd]="24" [nzLg]="24" [nzXl]="12" [nzXXl]="12">
|
||||||
<nz-form-item>
|
<nz-form-item>
|
||||||
<nz-form-label nzSpan="7" nzFor="login_name" nzRequired>系统账号</nz-form-label>
|
<nz-form-label nzSpan="7" nzFor="login_name" nzRequired>系统账号</nz-form-label>
|
||||||
<nz-form-control nzSpan="12" [nzValidateStatus]="checkNameStatus" nzHasFeedback>
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input (blur)='checkName()' (keydown)="checkNameStatus='';nameOnly=true" name="validating"
|
<input nz-input (keyup)="checkName()" name="validating"
|
||||||
id="login_name" formControlName="login_name" placeholder="请输入统一身份认证账号">
|
id="login_name" formControlName="login_name" placeholder="请输入统一身份认证账号">
|
||||||
<nz-form-explain *ngIf="validateForm.get('login_name').dirty && validateForm.get('login_name').errors">请输入系统账号</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('login_name').dirty && validateForm.get('login_name').errors?.required">请输入系统账号</nz-form-explain>
|
||||||
|
<nz-form-explain *ngIf="validateForm.get('login_name').dirty && validateForm.get('login_name').errors?.maxlength">系统账号最长20个字符</nz-form-explain>
|
||||||
<nz-form-explain *ngIf="!nameOnly" class="red">本账号已存在</nz-form-explain>
|
<nz-form-explain *ngIf="!nameOnly" class="red">本账号已存在</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
@@ -43,7 +45,8 @@
|
|||||||
<nz-form-label nzSpan="7" nzFor="password" nzRequired>系统密码</nz-form-label>
|
<nz-form-label nzSpan="7" nzFor="password" nzRequired>系统密码</nz-form-label>
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<input nz-input id="password" formControlName="password" placeholder="请输入密码">
|
<input nz-input id="password" formControlName="password" placeholder="请输入密码">
|
||||||
<nz-form-explain *ngIf="validateForm.get('password').dirty && validateForm.get('password').errors">请输入密码</nz-form-explain>
|
<nz-form-explain *ngIf="validateForm.get('password').dirty && validateForm.get('password').errors?.required">请输入密码</nz-form-explain>
|
||||||
|
<nz-form-explain *ngIf="validateForm.get('password').dirty && validateForm.get('password').errors?.maxlength">密码最长20个字符</nz-form-explain>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-3
@@ -54,9 +54,9 @@ export class UserManagementModifyComponent implements OnInit {
|
|||||||
// $('#main-container').height('height',(document.documentElement.clientHeight-106+'px'));
|
// $('#main-container').height('height',(document.documentElement.clientHeight-106+'px'));
|
||||||
this.queryRole();
|
this.queryRole();
|
||||||
this.validateForm = this.fb.group({
|
this.validateForm = this.fb.group({
|
||||||
real_name: ['', [Validators.required]],
|
real_name: ['', [Validators.required,Validators.maxLength(20)]],
|
||||||
login_name: ['', [Validators.required]],
|
login_name: ['', [Validators.required,Validators.maxLength(20)]],
|
||||||
password: ['', [Validators.required]],
|
password: ['', [Validators.required,Validators.maxLength(20)]],
|
||||||
identify_num: [''],
|
identify_num: [''],
|
||||||
email: [''],
|
email: [''],
|
||||||
mobile: [''],
|
mobile: [''],
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ var SECURE = 'wss://';
|
|||||||
|
|
||||||
export class WebsocketService {
|
export class WebsocketService {
|
||||||
public websocket: WebSocket;
|
public websocket: WebSocket;
|
||||||
|
public websocketHeartBeat;
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
dynamicsMessage() {
|
dynamicsMessage() {
|
||||||
@@ -19,7 +20,11 @@ export class WebsocketService {
|
|||||||
this.websocket = new WebSocket(url);
|
this.websocket = new WebSocket(url);
|
||||||
return new Observable(ob => {
|
return new Observable(ob => {
|
||||||
this.websocket.onopen = () => {
|
this.websocket.onopen = () => {
|
||||||
console.log('websocket was connected...')
|
console.log('websocket was connected...');
|
||||||
|
this.websocketHeartBeat = setInterval(() => {
|
||||||
|
let msg = { "topic": "heart-beat", "message": "" };
|
||||||
|
this.websocket.send(JSON.stringify(msg));
|
||||||
|
}, 30000);
|
||||||
}
|
}
|
||||||
this.websocket.onmessage = (event) => {
|
this.websocket.onmessage = (event) => {
|
||||||
ob.next(event.data)
|
ob.next(event.data)
|
||||||
@@ -33,4 +38,8 @@ export class WebsocketService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearIntervalHandle() {
|
||||||
|
clearInterval(this.websocketHeartBeat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user