pull/1/head
parent
0c87526fe8
commit
596ff57f2d
@ -0,0 +1,48 @@ |
||||
<!-- start 面包屑 --> |
||||
<app-breadcrumb></app-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
|
||||
<div class="inner-content"> |
||||
<span>共计 {{total}} 条数据</span> |
||||
<div class="operating-button"> |
||||
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/system/sinopec-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button> |
||||
</div> |
||||
<nz-table |
||||
class="table" |
||||
#ajaxTable |
||||
nzShowSizeChanger |
||||
[nzFrontPagination]="false" |
||||
[nzData]="requestData" |
||||
[nzLoading]="loading" |
||||
[nzTotal]="total" |
||||
[(nzPageIndex)]="pageNum" |
||||
[(nzPageSize)]="pageSize" |
||||
[nzScroll]="{ x: '1200px' }" |
||||
(nzPageIndexChange)="getRequest(false , searchForm.value)" |
||||
(nzPageSizeChange)="getRequest(false , searchForm.value)"> |
||||
<thead nzSingleSort> |
||||
<tr> |
||||
<th nzWidth="50px">编号</th> |
||||
<th nzWidth="80px">客户AppId</th> |
||||
<th nzWidth="80px">客户密码</th> |
||||
<th nzWidth="100px">客户编码</th> |
||||
<!-- <th nzWidth="100px">创建时间</th>--> |
||||
<th nzWidth="80px" nzRight="0px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of ajaxTable.data; let i = index"> |
||||
<td>{{i+1}}</td> |
||||
<td>{{data.appId}}</td> |
||||
<td>{{data.appSecret}}</td> |
||||
<td>{{data.code}}</td> |
||||
<!-- <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>--> |
||||
<td nzRight="0px" class="table-td-operation"> |
||||
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a> |
||||
</td> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
|
||||
|
||||
|
@ -0,0 +1,90 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import {environment} from '../../../../environments/environment'; |
||||
import {FormBuilder, FormGroup} from '@angular/forms'; |
||||
import {MerchantService} from '../../../services/merchant.service'; |
||||
import {IconService} from '../../../services/icon.service'; |
||||
import {NzMessageService} from 'ng-zorro-antd'; |
||||
import {Router} from '@angular/router'; |
||||
import {SystemService} from '../../../services/system.service'; |
||||
|
||||
@Component({ |
||||
selector: 'app-sinopec-config', |
||||
templateUrl: './sinopec-config.component.html', |
||||
styleUrls: ['./sinopec-config.component.scss'] |
||||
}) |
||||
export class SinopecConfigComponent implements OnInit { |
||||
|
||||
WEB_SERVE_URL = environment.imageUrl; |
||||
searchForm: FormGroup; // 搜索框
|
||||
requestData = []; // 列表数据
|
||||
total: number; // 页码
|
||||
pageNum = 1; // 页码
|
||||
pageSize = 10; // 条码
|
||||
loading = true; |
||||
|
||||
constructor( |
||||
private form: FormBuilder, |
||||
private system: SystemService, |
||||
private iconService: IconService, |
||||
private message: NzMessageService, |
||||
private router: Router, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.init(); |
||||
} |
||||
|
||||
public init(): void { |
||||
this.searchForm = this.form.group({ |
||||
merchantKey: [null], |
||||
merchantName: [null], |
||||
telephone: [null], |
||||
status: [null], |
||||
}); |
||||
this.getRequest(true, this.searchForm.value); |
||||
} |
||||
|
||||
// 查询列表
|
||||
public getRequest(reset: boolean = false, whereObject: object) { |
||||
|
||||
this.loading = false; |
||||
if (reset) { |
||||
this.pageNum = 1; |
||||
} |
||||
whereObject['pageNum'] = this.pageNum; |
||||
whereObject['pageSize'] = this.pageSize; |
||||
this.system.getListSinopecConfig(whereObject, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.requestData = data['return_data'].list; |
||||
this.total = data['return_data'].total; |
||||
} else { |
||||
this.message.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 重置
|
||||
public resetForm(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
// 修改
|
||||
public getEdit(id: number): void { |
||||
this.router.navigate(['/admin/system/sinopec-edit'], { |
||||
queryParams: { |
||||
merchantId: id |
||||
} |
||||
}).then(r => console.log(r)); |
||||
} |
||||
|
||||
// 查看详情
|
||||
public getDetail(id: number): void { |
||||
this.router.navigate(['/admin/system/sinopec-detail'], { |
||||
queryParams: { |
||||
merchantId: id |
||||
} |
||||
}).then(r => console.log(r)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,48 @@ |
||||
<!-- start 面包屑 --> |
||||
<nz-breadcrumb> |
||||
<nz-breadcrumb-item> |
||||
<a (click)="getBack()">系统管理</a> |
||||
</nz-breadcrumb-item> |
||||
<nz-breadcrumb-item> |
||||
编辑配置 |
||||
</nz-breadcrumb-item> |
||||
</nz-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
|
||||
<nz-content class="inner-content"> |
||||
<form nz-form [formGroup]="validateForm" class="ant-advanced-search-form"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzFor]="'appId'" nzRequired>客户AppId</nz-form-label> |
||||
<nz-form-control nzErrorTip="请输入客户AppId!"> |
||||
<input nz-input placeholder="请输入客户AppId..." [formControlName]="'appId'" id="'appId'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzFor]="'appSecret'" nzRequired>客户密码</nz-form-label> |
||||
<nz-form-control nzErrorTip="请输入客户密码!"> |
||||
<input nz-input placeholder="请输入客户密码..." [formControlName]="'appSecret'" id="'appSecret'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzFor]="'code'" nzRequired>客户编码</nz-form-label> |
||||
<nz-form-control nzErrorTip="请输入客户编码!"> |
||||
<input nz-input placeholder="请输入客户编码..." [formControlName]="'code'" id="'code'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
<div nz-row> |
||||
<div nz-col [nzSpan]="24" class="search-area"> |
||||
<button nz-button (click)="resetForm()">重置</button> |
||||
<button nz-button [nzType]="'primary'" (click)="getSave()">提交</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
</nz-content> |
@ -0,0 +1,6 @@ |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
:host ::ng-deep .ant-upload { |
||||
background-color: #ffffff; |
||||
} |
@ -0,0 +1,99 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
||||
import {environment} from '../../../../environments/environment'; |
||||
import {MerchantService} from '../../../services/merchant.service'; |
||||
import {NzMessageService} from 'ng-zorro-antd'; |
||||
import {ActivatedRoute} from '@angular/router'; |
||||
import {SystemService} from '../../../services/system.service'; |
||||
|
||||
@Component({ |
||||
selector: 'app-sinopec-edit', |
||||
templateUrl: './sinopec-edit.component.html', |
||||
styleUrls: ['./sinopec-edit.component.scss'] |
||||
}) |
||||
export class SinopecEditComponent implements OnInit { |
||||
|
||||
validateForm!: FormGroup; |
||||
data: any; |
||||
editFlag = false; |
||||
id: number; |
||||
WEB_SERVE_URL = environment.baseUrl; |
||||
|
||||
constructor( |
||||
private fb: FormBuilder, |
||||
private system: SystemService, |
||||
private message: NzMessageService, // 信息提示
|
||||
private activatedRoute: ActivatedRoute, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.activatedRoute.queryParams.subscribe(queryParams => { |
||||
if (queryParams.sinopecId != null) { |
||||
this.editFlag = true; |
||||
this.id = queryParams.sinopecId; |
||||
this.getDetails(queryParams.sinopecId); |
||||
} |
||||
}); |
||||
this.validateForm = this.fb.group({ |
||||
appId: [null, [Validators.required]], |
||||
appSecret: [null, [Validators.required]], |
||||
code: [null, [Validators.required]], |
||||
}); |
||||
} |
||||
|
||||
// 返回
|
||||
getBack() { |
||||
history.back(); |
||||
} |
||||
|
||||
// 重置
|
||||
public resetForm(): void { |
||||
this.validateForm.reset(); |
||||
} |
||||
|
||||
// 保存
|
||||
public getSave(): void { |
||||
// tslint:disable-next-line:forin
|
||||
for (const i in this.validateForm.controls) { |
||||
this.validateForm.controls[i].markAsDirty(); |
||||
this.validateForm.controls[i].updateValueAndValidity(); |
||||
if (this.validateForm.controls[i].errors != null) { |
||||
this.message.error('必填项不能为空'); |
||||
return; |
||||
} |
||||
} |
||||
if (this.editFlag) { |
||||
this.validateForm.value.id = this.id; |
||||
this.system.updateMerchant(this.validateForm.value, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.getBack(); |
||||
this.message.success('修改成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
this.system.insertMerchant(this.validateForm.value, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.getBack(); |
||||
this.message.success('添加成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
public getDetails(id) { |
||||
this.system.findById(id, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.validateForm.patchValue(data['return_data']); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
} |
Loading…
Reference in new issue