diff --git a/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html new file mode 100644 index 0000000..a52ee53 --- /dev/null +++ b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html @@ -0,0 +1,116 @@ + diff --git a/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.scss b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts new file mode 100644 index 0000000..174516f --- /dev/null +++ b/src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts @@ -0,0 +1,97 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {GasClassGroupService} from '../../../services/gas-class-group.service'; + +@Component({ + selector: 'app-gas-class-group-list', + templateUrl: './gas-class-group-list.component.html', + styleUrls: ['./gas-class-group-list.component.scss'] +}) +export class GasClassGroupListComponent implements OnInit { + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private gasClassGroupService: GasClassGroupService, + private form: FormBuilder) { } + + ngOnInit(): void { + this.searchForm = this.form.group({ + name: [null], + principalName: [null], + principalPhone: [null], + }); + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.gasClassGroupService.getClassGroupList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 弹出删除对话框 + */ + showDeleteConfirm(groupId: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除该代理商', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.deleteData(groupId) + }); + } + + /** + * 删除数据 + * + */ + deleteData(groupId: number) { + this.gasClassGroupService.delClassGroup(groupId, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + +} diff --git a/src/app/admin/gas-class-group/gas-class-group-routing.module.ts b/src/app/admin/gas-class-group/gas-class-group-routing.module.ts new file mode 100644 index 0000000..53cb55c --- /dev/null +++ b/src/app/admin/gas-class-group/gas-class-group-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {GasClassGroupListComponent} from './gas-class-group-list/gas-class-group-list.component'; +import {GasClassGroupTaskComponent} from './gas-class-group-task/gas-class-group-task.component'; + + +const routes: Routes = [ + { path: 'list', component: GasClassGroupListComponent}, + { path: 'task-list', component: GasClassGroupTaskComponent}, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class GasClassGroupRoutingModule { } diff --git a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html new file mode 100644 index 0000000..28fb20f --- /dev/null +++ b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html @@ -0,0 +1 @@ +

gas-class-group-task works!

diff --git a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.scss b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts new file mode 100644 index 0000000..eca8cb6 --- /dev/null +++ b/src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-gas-class-group-task', + templateUrl: './gas-class-group-task.component.html', + styleUrls: ['./gas-class-group-task.component.scss'] +}) +export class GasClassGroupTaskComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/gas-class-group/gas-class-group.module.ts b/src/app/admin/gas-class-group/gas-class-group.module.ts new file mode 100644 index 0000000..96dd463 --- /dev/null +++ b/src/app/admin/gas-class-group/gas-class-group.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { GasClassGroupRoutingModule } from './gas-class-group-routing.module'; +import { GasClassGroupListComponent } from './gas-class-group-list/gas-class-group-list.component'; +import { GasClassGroupTaskComponent } from './gas-class-group-task/gas-class-group-task.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {AppCommonModule} from '../../app-common.module'; + + +@NgModule({ + declarations: [GasClassGroupListComponent, GasClassGroupTaskComponent], + imports: [ + CommonModule, + GasClassGroupRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + ] +}) +export class GasClassGroupModule { } diff --git a/src/app/admin/login/login/login.component.ts b/src/app/admin/login/login/login.component.ts index 333777c..576bd3f 100644 --- a/src/app/admin/login/login/login.component.ts +++ b/src/app/admin/login/login/login.component.ts @@ -51,6 +51,7 @@ export class LoginComponent implements OnInit { } this.loginService.userLogin(this.loginForm.value, data => { if (data['return_code'] === '000000') { + data['return_data']['object']['menuList'] = data['return_data']['object']['menuList'].filter(o => o.showOnMobile == 0); this.store.set(ADMIN_INFO_OBJECT, data['return_data']['object']); this.store.set(TOKEN, data['return_data']['uniqueCode']); this.store.set(INIT_FLAG, true); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1e9d55f..4b44e07 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -132,6 +132,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/device/device.module').then(m => m.DeviceModule), canActivate: [InitGuardService] }, + { + path: 'gas-class-group', + loadChildren: () => import('./admin/gas-class-group/gas-class-group.module').then(m => m.GasClassGroupModule), + canActivate: [InitGuardService] + }, { path: 'api-product', loadChildren: () => import('./admin/api-product/api-product.module').then(m => m.ApiProductModule), diff --git a/src/app/services/gas-class-group-task.service.ts b/src/app/services/gas-class-group-task.service.ts new file mode 100644 index 0000000..92ee582 --- /dev/null +++ b/src/app/services/gas-class-group-task.service.ts @@ -0,0 +1,76 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class GasClassGroupTaskService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 开启班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public startGroupTask(param: object, callBack) { + this.http.post(environment.baseUrl + 'gasClassGroupTask/startGroupTask', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 结束班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public endGroupTask(param: object, callBack) { + this.http.post(environment.baseUrl + 'gasClassGroupTask/endGroupTask', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public swapGroupTask(param: object, callBack) { + this.http.post(environment.baseUrl + 'gasClassGroupTask/swapGroupTask', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getClassGroupTaskById(id: number, callBack) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskById?gasClassGroupTaskId=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getClassGroupTaskList(param: object, callBack) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskList' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/gas-class-group.service.ts b/src/app/services/gas-class-group.service.ts new file mode 100644 index 0000000..923e734 --- /dev/null +++ b/src/app/services/gas-class-group.service.ts @@ -0,0 +1,63 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class GasClassGroupService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 编辑班组 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public editClassGroup(param: object, callBack) { + this.http.post(environment.baseUrl + 'gasClassGroup/editClassGroup', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除班组 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public delClassGroup(groupId: number, callBack) { + this.http.post(environment.baseUrl + 'gasClassGroup/delClassGroup', { id: groupId}).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id查询详情 + * + * @param groupId 班组id + * @param callBack 回调 + */ + public getClassGroupById(groupId: number, callBack) { + this.http.get(environment.baseUrl + 'gasClassGroup/getClassGroupById?groupId=' + groupId).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询班组列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getClassGroupList(param: Object, callBack) { + this.http.get(environment.baseUrl + 'gasClassGroup/getClassGroupList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } +}