刘向辉 3 years ago
parent
commit
1702579c30
  1. 11
      src/app/pages/login/login.component.ts
  2. 38
      src/app/pages/plan-admin/plan-admin.component.html
  3. 3
      src/app/system-management/role/editrole/editrole.component.ts
  4. 3
      src/app/system-management/role/role.component.ts
  5. 2
      src/app/system-management/user/adduser/adduser.component.html
  6. 2
      src/app/system-management/user/edituser/edituser.component.html
  7. 22
      src/app/system-management/user/edituser/edituser.component.ts
  8. 8
      src/app/system-management/user/user.component.ts
  9. 4
      src/shared/helpers/SignalRAspNetCoreHelper.ts

11
src/app/pages/login/login.component.ts

@ -106,7 +106,7 @@ export class LoginComponent implements OnInit {
sessionStorage.setItem("token", data.result.accessToken); sessionStorage.setItem("token", data.result.accessToken);
this.cookieService.set("token", data.result.accessToken, null, '/'); this.cookieService.set("token", data.result.accessToken, null, '/');
this.cookieService.set("refreshToken", data.result.encryptedAccessToken, null, '/'); this.cookieService.set("refreshToken", data.result.encryptedAccessToken, null, '/');
sessionStorage.setItem("encryptedAccessToken",data.result.encryptedAccessToken); sessionStorage.setItem("encryptedAccessToken", data.result.encryptedAccessToken);
console.log('token', data) console.log('token', data)
this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data: any) => { this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data: any) => {
sessionStorage.setItem('userdata', JSON.stringify(data.result.user)) sessionStorage.setItem('userdata', JSON.stringify(data.result.user))
@ -119,21 +119,18 @@ export class LoginComponent implements OnInit {
if (data.result.user.userName == 'admin') { if (data.result.user.userName == 'admin') {
sessionStorage.setItem("isGasStation", 'false'); sessionStorage.setItem("isGasStation", 'false');
this.router.navigate(['/system/organization']) this.router.navigate(['/system/organization'])
this.message.create('success', `登陆成功`);
} else { } else {
if (data.result.user.organization.isGasStation) { if (data.result.user.organization.isGasStation) {
sessionStorage.setItem("isGasStation", 'true'); sessionStorage.setItem("isGasStation", 'true');
this.router.navigate(['/warning/petrolStation']) this.router.navigate(['/warning/petrolStation'])
this.message.create('success', `登陆成功`);
} else { } else {
sessionStorage.setItem("isGasStation", 'false'); sessionStorage.setItem("isGasStation", 'false');
this.router.navigate(['/homepage']) this.router.navigate(['/homepage'])
this.message.create('success', `登陆成功`);
} }
} }
this.message.create('success', `登陆成功`);
let _this = this;
}, err => { }, err => {
this.isLoading = false; this.isLoading = false;
}) })

38
src/app/pages/plan-admin/plan-admin.component.html

@ -53,34 +53,40 @@
<div class="tablebox" id="tablebox"> <div class="tablebox" id="tablebox">
<nz-table [nzPageSize]='999' #headerTable [nzData]="list" [nzShowPagination]="false" <nz-table [nzPageSize]='999' #headerTable [nzData]="list" [nzShowPagination]="false"
[nzScroll]="{ y:tableheight() }" [nzNoResult]='null'> [nzScroll]="{ y:tableheight() }" [nzNoResult]='null' nzTableLayout="fixed">
<thead> <thead>
<tr> <tr>
<th></th> <th [nzWidth]="'20%'">
<th>加油站名称</th> <div style="width: 20px;height: 20px;display: inline-block;margin-left: 20px;margin-right: 6px;">
</div>加油站名称
</th>
<th>区域</th> <th>区域</th>
<th>所属公司</th> <th>所属公司</th>
<th>联系人</th> <th>联系人</th>
<th>联系电话</th> <th>联系电话</th>
<th>油站等级</th> <th>油站等级</th>
<th>经营品类</th> <th>经营品类</th>
<th>油机数量</th> <th [nzWidth]="'6%'">油机数量</th>
<th>车道数量</th> <th [nzWidth]="'6%'">车道数量</th>
<th>油罐容积</th> <th [nzWidth]="'6%'">油罐容积</th>
<th>操作</th> <th [nzWidth]="'5%'">操作</th>
</tr> </tr>
</thead> </thead>
<tbody id="table"> <tbody id="table">
<tr *ngFor="let item of headerTable.data;let key = index"> <tr *ngFor="let item of headerTable.data;let key = index">
<th style="text-align: right;box-sizing: border-box;padding-right: 8px;"><img <th nzEllipsis [title]="item.stationName">
src="../../../assets/images/3d.png" alt="" *ngIf="item.hasBuildingInfo"></th> <div style="width: 20px;height: 20px;display: inline-block;margin-left: 20px;margin-right: 6px;">
<th>{{item.stationName}}</th> <img src="../../../assets/images/3d.png" alt="" *ngIf="item.hasBuildingInfo">
<th>{{item.locationName}}</th> </div>
<th>{{item.companyName}}</th> {{item.stationName}}
<th>{{item.leaderName}}</th> </th>
<th>{{item.leaderContact}}</th> <th nzEllipsis [title]="item.locationName">{{item.locationName}}</th>
<th>{{item.stationLevel}}</th> <th nzEllipsis [title]="item.companyName">{{item.companyName}}</th>
<th>{{item.sellVariety}}</th> <th nzEllipsis [title]="item.leaderName">{{item.leaderName}}</th>
<th nzEllipsis [title]="item.leaderContact">{{item.leaderContact}}</th>
<th nzEllipsis [title]="item.stationLevel">{{item.stationLevel}}</th>
<th nzEllipsis [title]="item.sellVariety">{{item.sellVariety}}</th>
<th>{{item.gasStationCount}}</th> <th>{{item.gasStationCount}}</th>
<th>{{item.laneCount}}</th> <th>{{item.laneCount}}</th>
<th>{{item.tankVolume}}</th> <th>{{item.tankVolume}}</th>

3
src/app/system-management/role/editrole/editrole.component.ts

@ -31,7 +31,8 @@ export class EditroleComponent implements OnInit {
loadMore() { loadMore() {
this.http.get('/api/services/app/Role/GetAllPermissions').subscribe((data:any) => { this.http.get('/api/services/app/Role/GetAllPermissions').subscribe((data:any) => {
this.optionList = data.result.items this.optionList = data.result.items
console.log('所有权限',data) this.modal.containerInstance.config.nzOkLoading = false
// console.log('所有权限',data)
}) })
} }

3
src/app/system-management/role/role.component.ts

@ -75,7 +75,8 @@ export class RoleComponent implements OnInit {
nzTitle: '编辑角色', nzTitle: '编辑角色',
nzContent: EditroleComponent, nzContent: EditroleComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 288, nzWidth: 325,
nzOkLoading: true,
nzComponentParams: { nzComponentParams: {
data: item data: item
}, },

2
src/app/system-management/user/adduser/adduser.component.html

@ -24,7 +24,7 @@
<nz-form-item> <nz-form-item>
<nz-form-control> <nz-form-control>
<nz-select formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple"> <nz-select formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.name" [nzLabel]="item.displayName"></nz-option> <nz-option *ngFor="let item of listOfData" [nzValue]="item.normalizedName" [nzLabel]="item.displayName"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

2
src/app/system-management/user/edituser/edituser.component.html

@ -24,7 +24,7 @@
<nz-form-item> <nz-form-item>
<nz-form-control> <nz-form-control>
<nz-select [(ngModel)]="data.roleNames" formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple"> <nz-select [(ngModel)]="data.roleNames" formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.name" [nzLabel]="item.displayName"></nz-option> <nz-option *ngFor="let item of listOfData" [nzValue]="item.normalizedName" [nzLabel]="item.displayName"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

22
src/app/system-management/user/edituser/edituser.component.ts

@ -23,11 +23,9 @@ export class EdituserComponent implements OnInit {
role: [null, [Validators.required]], role: [null, [Validators.required]],
phonenum: [null, [Validators.required]] phonenum: [null, [Validators.required]]
}); });
Promise.all([this.getAllRoles(), this.getAllOrganization()]).then(()=>{
this.modal.containerInstance.config.nzOkLoading = false
console.log(this.data) })
this.getAllRoles()
this.getAllOrganization()
} }
destroyModal(): void { destroyModal(): void {
this.modal.destroy({ data: 'this the result data' }); this.modal.destroy({ data: 'this the result data' });
@ -36,20 +34,23 @@ export class EdituserComponent implements OnInit {
listOfData: any[] = []; listOfData: any[] = [];
//获取角色列表 //获取角色列表
getAllRoles() { async getAllRoles() {
await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Role/GetAll').subscribe((data: any) => { this.http.get('/api/services/app/Role/GetAll').subscribe((data: any) => {
console.log('角色列表', data.result.items) resolve(data)
this.listOfData = data.result.items this.listOfData = data.result.items
}) })
})
} }
//获取所有组织机构 //获取所有组织机构
nodes:any = [] nodes: any = []
getAllOrganization() { async getAllOrganization() {
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
let params = { let params = {
OrganizationUnitId: OrganizationUnitId, OrganizationUnitId: OrganizationUnitId,
IsContainsChildren: "true" IsContainsChildren: "true"
} }
await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Organization/GetAll', { this.http.get('/api/services/app/Organization/GetAll', {
params: params params: params
}).subscribe((data: any) => { }).subscribe((data: any) => {
@ -58,7 +59,8 @@ export class EdituserComponent implements OnInit {
element.title = element.displayName element.title = element.displayName
}); });
this.nodes = [...this.toTree.toTree(data.result.items)] this.nodes = [...this.toTree.toTree(data.result.items)]
resolve(data)
})
}) })
} }
} }

8
src/app/system-management/user/user.component.ts

@ -71,6 +71,7 @@ export class UserComponent implements OnInit {
subtitle: '' subtitle: ''
}, },
nzOnOk: async () => { nzOnOk: async () => {
// console.log(instance.validateForm.value)
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise(resolve => { await new Promise(resolve => {
let body = { let body = {
@ -114,6 +115,7 @@ export class UserComponent implements OnInit {
nzContent: EdituserComponent, nzContent: EdituserComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 288, nzWidth: 288,
nzOkLoading: true,
nzComponentParams: { nzComponentParams: {
data: data, data: data,
}, },
@ -122,7 +124,7 @@ export class UserComponent implements OnInit {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise(resolve => { await new Promise(resolve => {
let body = { let body = {
id:data.id, id: data.id,
userName: instance.validateForm.value.account, userName: instance.validateForm.value.account,
name: instance.validateForm.value.name, name: instance.validateForm.value.name,
organizationUnitId: instance.validateForm.value.organization, organizationUnitId: instance.validateForm.value.organization,
@ -132,12 +134,12 @@ export class UserComponent implements OnInit {
} }
this.http.put('/api/services/app/User/Update', body).subscribe(data => { this.http.put('/api/services/app/User/Update', body).subscribe(data => {
resolve(data) resolve(data)
this.message.create('success', '创建成功!'); this.message.create('success', '编辑成功!');
this.getAllUsers() this.getAllUsers()
return true return true
}, err => { }, err => {
resolve(err) resolve(err)
this.message.create('warning', '创建失败'); this.message.create('warning', '编辑失败');
return false return false
}) })
}) })

4
src/shared/helpers/SignalRAspNetCoreHelper.ts

@ -2,7 +2,9 @@ declare var abp: any
export class SignalRAspNetCoreHelper { export class SignalRAspNetCoreHelper {
static initSignalR(callback?: () => void): void { static initSignalR(callback?: () => void): void {
const encryptedAuthToken = sessionStorage.getItem("encryptedAccessToken"); const encryptedAuthToken = sessionStorage.getItem("encryptedAccessToken");
let url = "http://39.106.78.171:8906"; console.log('window.location.origin',window.location.origin)
// let url = "http://39.106.78.171:8906";
let url = window.location.origin
abp.signalr = { abp.signalr = {
autoConnect: true, autoConnect: true,
connect: undefined, connect: undefined,

Loading…
Cancel
Save