parent
b396a61fc3
commit
38babbd3d9
@ -0,0 +1,138 @@ |
||||
<!-- start 面包屑 --> |
||||
<app-breadcrumb></app-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
<!--条件搜索--> |
||||
|
||||
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||
<div class="inner-content"> |
||||
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||
<div nz-row> |
||||
<!-- <div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">所属部门</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<nz-select nzAllowClear formControlName="orgId"> |
||||
<nz-option *ngFor="let item of orgArray" nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div>--> |
||||
|
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">油站名称</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<input nz-input formControlName="gasName" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">预存类型</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<nz-select formControlName="prestoreType"> |
||||
<nz-option nzValue="0" nzLabel="非预存"></nz-option> |
||||
<nz-option nzValue="1" nzLabel="预存"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">预警状态</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<nz-select formControlName="amountsEarlyWarningStatus"> |
||||
<nz-option nzValue="0" nzLabel="正常"></nz-option> |
||||
<nz-option nzValue="1" nzLabel="余额预警"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
</div> |
||||
|
||||
<div nz-row> |
||||
<div nz-col nzSpan="24" class="search-button"> |
||||
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
|
||||
<div class="inner-content"> |
||||
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||
<div class="operating-button"> |
||||
</div> |
||||
|
||||
<!--数组表格 --> |
||||
<nz-table #basicTable |
||||
[nzData]="dataObject.list" |
||||
[nzTotal]="dataObject.total" |
||||
[nzFrontPagination]="false" |
||||
[nzLoading]="tableLoading" |
||||
[nzPageIndex]="whereObject.pageNum" |
||||
(nzPageIndexChange)="requestData($event)" |
||||
[nzScroll]="{ x: '1100px'}"> |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="60px">序号</th> |
||||
<th nzWidth="150px">所在公司</th> |
||||
<th nzWidth="140px">所在商户</th> |
||||
<th nzWidth="200px">油站名称</th> |
||||
<th nzWidth="90px">预存类型</th> |
||||
<th nzWidth="90px">账户余额</th> |
||||
<th nzWidth="90px">预警余额</th> |
||||
<th nzWidth="90px">预警状态</th> |
||||
<th nzWidth="100px">油站编号</th> |
||||
<th nzWidth="150px">油站地址</th> |
||||
<th nzWidth="110px">创建时间</th> |
||||
<th nzWidth="110px" nzRight="0px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data;let i = index" style="{{data.amountsEarlyWarningStatus?'color: #aa1111;':''}}"> |
||||
<td>{{i+1}}</td> |
||||
<td>{{data.companyName}}</td> |
||||
<td>{{data.storeMerName}}</td> |
||||
<td>{{data.storeName}}</td> |
||||
<td>{{data.storePrestoreType? '预存' : '非预存'}}</td> |
||||
<td>{{data.amounts?'¥'+data.amounts:'无'}}</td> |
||||
<td>{{data.amountsEarlyWarning?'¥'+data.amountsEarlyWarning:'无'}}</td> |
||||
<td> |
||||
<span *ngIf="data.amountsEarlyWarningStatus == null">无</span> |
||||
<span *ngIf="data.amountsEarlyWarningStatus == 0">正常</span> |
||||
<span *ngIf="data.amountsEarlyWarningStatus == 1">余额预警</span> |
||||
</td> |
||||
<td>{{data.storeKey}}</td> |
||||
<td>{{data.storeAddress}}</td> |
||||
<td>{{data.storeCreateTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzRight="0px" class="table-td-operation"> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item (click)="showEarlyWarningModal(data)">余额预警</li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
</nz-spin> |
||||
|
||||
<nz-modal [(nzVisible)]="amountsEarlyWarningModal" nzTitle="设置账户余额预警" (nzOnCancel)="closeEarlyWarningModal()" [nzFooter]="null"> |
||||
<form nz-form [formGroup]="amountsEarlyWarningFrom"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">预警余额</nz-form-label> |
||||
<nz-form-control [nzSpan]="14" nzExtra="预警余额设置为0,代表不需要预警"> |
||||
<nz-input-number nz-input formControlName="earlyWarning" [nzMin]="0" [nzMax]="99999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</form> |
||||
<div style="text-align: center;"> |
||||
<button nz-button nzType="primary" style="width: 150px;" (click)="submitEarlyWarning()">确定</button> |
||||
</div> |
||||
</nz-modal> |
@ -0,0 +1,3 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
@ -0,0 +1,25 @@ |
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { GasStationListComponent } from './gas-station-list.component'; |
||||
|
||||
describe('GasStationListComponent', () => { |
||||
let component: GasStationListComponent; |
||||
let fixture: ComponentFixture<GasStationListComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ GasStationListComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(GasStationListComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -0,0 +1,134 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import {environment} from '../../../../environments/environment'; |
||||
import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; |
||||
import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||
import {LocalStorageService} from '../../../services/local-storage.service'; |
||||
import {CompanyAccountService} from '../../../services/company-account.service'; |
||||
import {Router} from '_@angular_router@9.0.7@@angular/router'; |
||||
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; |
||||
import {IndexService} from '../../../services/index.service'; |
||||
import {Validators} from '@angular/forms'; |
||||
import {MerchantStoreService} from "../../../services/merchant-store.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-gas-station-list', |
||||
templateUrl: './gas-station-list.component.html', |
||||
styleUrls: ['./gas-station-list.component.scss'] |
||||
}) |
||||
export class GasStationListComponent implements OnInit { |
||||
FILE_URL = environment.imageUrl; |
||||
roleType; |
||||
adminFlag; |
||||
loadingObject = { |
||||
spinning: false, |
||||
msg: '加载中' |
||||
}; |
||||
|
||||
dataObject: any = {}; |
||||
tableLoading = true; |
||||
searchForm: FormGroup; |
||||
pageNum: number; |
||||
whereObject: any = {}; |
||||
|
||||
amountsEarlyWarningFrom: FormGroup; |
||||
amountsEarlyWarningModal = false; |
||||
|
||||
constructor(private modal: NzModalService, |
||||
private message: NzMessageService, |
||||
private store: LocalStorageService, |
||||
private indexService: IndexService, |
||||
private router: Router, |
||||
private form: FormBuilder) { |
||||
this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType); |
||||
this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag); |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.searchForm = this.form.group({ |
||||
companyId: [null], |
||||
merId: [null], |
||||
gasName: [null], |
||||
prestoreType: [null], |
||||
amountsEarlyWarningStatus: [null], |
||||
}); |
||||
|
||||
this.amountsEarlyWarningFrom = this.form.group({ |
||||
storeId: [null, [Validators.required]], |
||||
earlyWarning: [null, [Validators.required]], |
||||
}); |
||||
|
||||
this.requestData(1); |
||||
} |
||||
|
||||
/** |
||||
* 请求数据 |
||||
*/ |
||||
requestData(pageNum) { |
||||
this.tableLoading = true; |
||||
this.whereObject['pageNum'] = pageNum; |
||||
this.whereObject['pageSize'] = 10; |
||||
this.indexService.getGasSelfBuiltStationList(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(); |
||||
} |
||||
|
||||
showEarlyWarningModal(gasObject: object) { |
||||
this.amountsEarlyWarningModal = true; |
||||
this.amountsEarlyWarningFrom.patchValue({ storeId: gasObject['storeId'], earlyWarning: gasObject['amountsEarlyWarning']}); |
||||
} |
||||
|
||||
submitEarlyWarning() { |
||||
for (const i in this.amountsEarlyWarningFrom.controls) { |
||||
this.amountsEarlyWarningFrom.controls[i].markAsDirty(); |
||||
this.amountsEarlyWarningFrom.controls[i].updateValueAndValidity(); |
||||
} |
||||
if (this.amountsEarlyWarningFrom.status == null || this.amountsEarlyWarningFrom.status !== 'VALID') { |
||||
this.modal.warning({ |
||||
nzTitle: '提示', |
||||
nzContent: '请填写所有必填项', |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
this.indexService.setAmountsEarlyWarning(this.amountsEarlyWarningFrom.value, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.modal.success({ |
||||
nzTitle: '提示', |
||||
nzContent: '设置成功', |
||||
}); |
||||
this.requestData(this.whereObject['pageNum']); |
||||
this.closeEarlyWarningModal(); |
||||
} else { |
||||
this.modal.error({ |
||||
nzTitle: '提示', |
||||
nzContent: data['return_msg'], |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
closeEarlyWarningModal() { |
||||
this.amountsEarlyWarningModal = false; |
||||
} |
||||
} |
Loading…
Reference in new issue