diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html index 5fc7bb9..af65716 100644 --- a/src/app/pages/login/login.component.html +++ b/src/app/pages/login/login.component.html @@ -1,6 +1,6 @@
-

欢迎登陆

+

欢迎登录

中化石油智能安全管理系统

- + diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index a59692f..afdcf92 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -37,7 +37,7 @@ export class LoginComponent implements OnInit { }); this.remember = true //这一步是回显后让勾选框为选中状态 } - //自动登陆 + //自动登录 if (localStorage.getItem('isautologin') == 'true') { this.submitForm() this.autologin = true //这一步是回显后让勾选框为选中状态 @@ -63,7 +63,7 @@ export class LoginComponent implements OnInit { localStorage.setItem("password", Base64.encode(this.validateForm.value.password)) } } - //自动登陆 + //自动登录 autoLogin() { if (this.autologin) { localStorage.setItem("isautologin", 'true') @@ -114,21 +114,21 @@ export class LoginComponent implements OnInit { this.isLoading = false; //记住密码 this.rememberInfo() - //自动登陆 + //自动登录 this.autoLogin() if (data.result.user.userName == 'admin') { sessionStorage.setItem("isGasStation", 'false'); this.router.navigate(['/system/organization']) - this.message.create('success', `登陆成功`); + this.message.create('success', `登录成功`); } else { if (data.result.user.organization.isGasStation) { sessionStorage.setItem("isGasStation", 'true'); this.router.navigate(['/warning/petrolStation']) - this.message.create('success', `登陆成功`); + this.message.create('success', `登录成功`); } else { sessionStorage.setItem("isGasStation", 'false'); this.router.navigate(['/homepage']) - this.message.create('success', `登陆成功`); + this.message.create('success', `登录成功`); } } }, err => { diff --git a/src/app/pages/register/register.component.ts b/src/app/pages/register/register.component.ts index 3e53af2..169154d 100644 --- a/src/app/pages/register/register.component.ts +++ b/src/app/pages/register/register.component.ts @@ -30,7 +30,7 @@ export class RegisterComponent implements OnInit { }) } - //跳转登陆页面 + //跳转登录页面 toLogin() { this.router.navigate(['/login']) } diff --git a/src/app/system-management/navigation/navigation.component.html b/src/app/system-management/navigation/navigation.component.html index bdda0a2..35ad50d 100644 --- a/src/app/system-management/navigation/navigation.component.html +++ b/src/app/system-management/navigation/navigation.component.html @@ -23,7 +23,7 @@ - Hey,欢迎登陆加油站可视化智能安全管理系统 + Hey,欢迎登录加油站可视化智能安全管理系统 diff --git a/src/app/system-management/organization/organization.component.ts b/src/app/system-management/organization/organization.component.ts index c649463..864c721 100644 --- a/src/app/system-management/organization/organization.component.ts +++ b/src/app/system-management/organization/organization.component.ts @@ -38,6 +38,8 @@ export class OrganizationComponent implements OnInit { searchValue = ''; nzExpandAll = false; totalCount: string + + allOrList: any getAllOrganization() { let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let params = { @@ -53,6 +55,7 @@ export class OrganizationComponent implements OnInit { element.title = element.displayName element.selectable = false }); + this.allOrList = data.result.items this.nodes = [...this.toTree.toTree(data.result.items)] this.defaultExpandedKeys = [...this.defaultExpandedKeys] }) @@ -178,9 +181,130 @@ export class OrganizationComponent implements OnInit { nzEvent(event: NzFormatEmitEvent): void { + console.log('event', event) + if (this.isDrag) { + let parentId + if (this.pos == 0) {//目标节点内部 + parentId = event.node.key + } else { + if (event.node.level == 0) { + parentId = null + } else { + parentId = event.node.origin.parentId + } + } + + let body = { + id: event.dragNode.key, + parentId: parentId, + // code: instance.validateForm.value.code, + displayName: event.dragNode.origin.displayName, + isGasStation: event.dragNode.origin.isGasStation + } + this.http.put('/api/services/app/Organization/Update', body).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 = {} + // let originalData = JSON.parse(JSON.stringify(this.allOrList || [])) //tree原始数据 + // let targetNodeData = []//拖动移入节点的数据,用于遍历求出放在该数组的第几位 + //找到需要重新排序的数组 + // if (this.pos == 0) { + // originalData.forEach(item => { + // if (item.parentId == event.node.key) { + // targetNodeData.push(item) + // } + // }) + // } else { + // if (event.node.origin.parentId) {//如果拖动目标为非一级节点 + // originalData.forEach(item => { + // if (item.parentId == event.node.origin.parentId) { + // targetNodeData.push(item) + // } + // }) + // } else {//如果拖动目标为一级节点 + // originalData.forEach(item => { + // if (!item.parentId) { + // targetNodeData.push(item) + // } + // }) + // } + // } + + // let idArr = [] + // targetNodeData.forEach(i => { + // idArr.push(i.id) + // }) + // if (this.pos == 0 && event.node.origin.children.length == 1) { + // // console.log("移入,没有兄弟") + // let key = event.dragNode.key + // orders[key] = 0 + // parentId = event.node.key + // } else { + + // let array = [] + // targetNodeData.forEach(item => { + // if (item.id != event.dragNode.key) { //将拖动项先移除掉 + // array.push(item) + // } + // }) + // 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]) {//如果移入到第一个 + // // console.log("第一") + // array.unshift(event.dragNode.origin) + // } else {//如果移入中间位置 + // // console.log("中间") + // array.splice(event.node.origin.order, 0, event.dragNode.origin) + // } + // array.forEach((item, key) => { + // orders[item.id] = key + // }) + // console.log("移入,多个兄弟",orders) + // } + + // let obj = { + // id: event.dragNode.origin.id, + // parentId: parentId, + // orders: orders + // } + + // this.http.put("/api/DisposalNodes/Sort", obj).subscribe(data => { + // const config = new MatSnackBarConfig(); + // config.verticalPosition = 'top'; + // config.duration = 3000 + // this.snackBar.open('排序成功', '确定', config) + // this.refurbishTreeData() + // }) + + + + } } + isDrag //是否可以拖动 + pos//放置位置 beforeDrop = (arg: NzFormatBeforeDropEvent) => { - + 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) + } } }