提交代码

master
胡锐 1 year ago
parent 6195edd2ba
commit 5137406d0f
  1. 2
      src/app/admin/system/system-routing.module.ts
  2. 3
      src/app/admin/system/system.module.ts
  3. 166
      src/app/admin/system/version/version.component.html
  4. 3
      src/app/admin/system/version/version.component.scss
  5. 25
      src/app/admin/system/version/version.component.spec.ts
  6. 257
      src/app/admin/system/version/version.component.ts
  7. 2
      src/app/admin/trade-order/trade-order-list/trade-order-list.component.html
  8. 60
      src/app/services/system-version.service.ts

@ -6,6 +6,7 @@ import {SystemRoleShowComponent} from './system-role-show/system-role-show.compo
import {SystemUserComponent} from './system-user/system-user.component'; import {SystemUserComponent} from './system-user/system-user.component';
import {PermissionComponent} from './permission/permission.component'; import {PermissionComponent} from './permission/permission.component';
import {MenuComponent} from './menu/menu.component'; import {MenuComponent} from './menu/menu.component';
import {VersionComponent} from './version/version.component';
const routes: Routes = [ const routes: Routes = [
{ path: 'systemorganization', component: SystemOrganizationComponent}, { path: 'systemorganization', component: SystemOrganizationComponent},
@ -14,6 +15,7 @@ const routes: Routes = [
{ path: 'systemuser', component: SystemUserComponent }, { path: 'systemuser', component: SystemUserComponent },
{ path: 'menu', component: MenuComponent }, { path: 'menu', component: MenuComponent },
{ path: 'permission', component: PermissionComponent }, { path: 'permission', component: PermissionComponent },
{ path: 'version', component: VersionComponent },
]; ];
@NgModule({ @NgModule({

@ -14,9 +14,10 @@ import {NgxNeditorModule} from '@notadd/ngx-neditor';
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {AppCommonModule} from '../../app-common.module'; import {AppCommonModule} from '../../app-common.module';
import { VersionComponent } from './version/version.component';
@NgModule({ @NgModule({
declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent], declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent, VersionComponent],
imports: [ imports: [
CommonModule, CommonModule,
SystemRoutingModule, SystemRoutingModule,

@ -0,0 +1,166 @@
<!-- 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">
<nz-form-item>
<nz-form-label [nzSpan]="8">终端类型</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select nzAllowClear formControlName="termType">
<nz-option *ngFor="let item of termTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></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 nzAllowClear formControlName="versionType">
<nz-option *ngFor="let item of versionTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></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 nzAllowClear formControlName="status">
<nz-option nzLabel="已发布" nzValue="1"></nz-option>
<nz-option nzLabel="未发布" nzValue="2"></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">
<button nz-button nzType="primary" class="right-btn" (click)="showEditModal(null)">新增版本</button>
</div>
<!--数组表格 -->
<nz-table #basicTable
[nzData]="dataObject.list"
[nzTotal]="dataObject.total"
[nzFrontPagination]="false"
[nzLoading]="tableLoading"
[nzPageIndex]="whereObject.pageNum"
(nzPageIndexChange)="requestData($event)"
[nzScroll]="{ x: '1150px'}">
<thead>
<tr>
<th nzWidth="80px">终端类型</th>
<th nzWidth="80px">版本类型</th>
<th nzWidth="80px">版本号</th>
<th nzWidth="80px">状态</th>
<th nzWidth="150px">版本内容</th>
<th nzWidth="140px">创建时间</th>
<th nzWidth="140px">发布时间</th>
<th nzWidth="150px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td>{{data.termType}}</td>
<td>{{data.versionType == 1?'小版本':'大版本'}}</td>
<td>{{data.version}}</td>
<td>{{data.status == 1?'已发布':'未发布'}}</td>
<td nzEllipsis>{{data.content}}</td>
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td>{{data.releaseTime | 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)="showOpenDetail(data)"><a >查看详情</a></li>
<li nz-menu-item *ngIf="data.status == 2" (click)="showReleaseConfirm(data.id)"><a >发布版本</a></li>
<li nz-menu-item *ngIf="data.status == 2" (click)="showDelConfirm(data.id)"><a >删除版本</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tr>
</tbody>
</nz-table>
</div>
</nz-spin>
<nz-modal [(nzVisible)]="editVersionModal" nzTitle="新增版本" (nzOnCancel)="closeEditModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="editVersionModalForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>终端类型</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select formControlName="termType">
<nz-option *ngFor="let data of termTypeArray" nzLabel="{{data.codeName}}" nzValue="{{data.codeValue}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>版本类型</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select formControlName="versionType">
<nz-option *ngFor="let data of versionTypeArray" nzLabel="{{data.codeName}}" nzValue="{{data.codeValue}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>新版本号</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="version" placeholder="请输入新版本号" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>版本内容</nz-form-label>
<nz-form-control [nzSpan]="14">
<textarea rows="4" nz-input placeholder="版本更新内容" formControlName="content"></textarea>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>更新文件</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-upload
nzAction="http://122.9.135.148:9902/v1/fileUpload/uploadfile"
(nzChange)="fileHandleChange($event)"
>
<button nz-button><i nz-icon nzType="upload"></i>文件上传</button>
</nz-upload>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitEdit()">确定</button>
</div>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="versionDetailModal" nzTitle="版本详情" (nzOnCancel)="closeVersionDetail()" nzWidth="500px" [nzFooter]="null">
<nz-descriptions nzBordered nzLayout="vertical">
<nz-descriptions-item nzTitle="终端类型" [nzSpan]="1">{{versionDetailObject.termType}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="版本类型" [nzSpan]="1">{{versionDetailObject.versionType == 1?'小版本':'大版本'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="版本编号" [nzSpan]="1">{{versionDetailObject.version}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="文件路径" [nzSpan]="3"><a target="_blank" href="{{versionDetailObject.fileUrl}}">{{versionDetailObject.fileUrl}}</a></nz-descriptions-item>
<nz-descriptions-item nzTitle="版本内容" [nzSpan]="3">
<pre>{{versionDetailObject.content}}</pre>
</nz-descriptions-item>
</nz-descriptions>
</nz-modal>

@ -0,0 +1,3 @@
.table-td-operation a {
padding: 0px 5px;
}

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { VersionComponent } from './version.component';
describe('VersionComponent', () => {
let component: VersionComponent;
let fixture: ComponentFixture<VersionComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ VersionComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(VersionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,257 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {LocalStorageService} from '../../../services/local-storage.service';
import {NzMessageService, NzModalService, NzUploadFile} from 'ng-zorro-antd';
import {StoreService} from '../../../services/store.service';
import {SystemVersionService} from '../../../services/system-version.service';
@Component({
selector: 'app-version',
templateUrl: './version.component.html',
styleUrls: ['./version.component.scss']
})
export class VersionComponent implements OnInit {
WEB_SERVE_URL = environment.baseUrl;
FILE_URL = environment.imageUrl;
loading = false;
dataObject: any = {};
tableLoading = true;
searchForm: FormGroup;
pageNum: number;
whereObject: any = {};
loadingObject = {
spinning: false,
msg: '加载中'
};
termTypeArray = [
{
codeValue: 'APP',
codeName: 'APP'
}
];
versionTypeArray = [
{
codeValue: '1',
codeName: '小版本'
},
{
codeValue: '2',
codeName: '大版本'
}
];
versionDetailModal = false;
versionDetailObject: any = {};
editVersionModal = false;
editVersionModalForm: FormGroup;
versionFileUrl;
constructor(private store: LocalStorageService, // 数据请求
private modal: NzModalService,
private message: NzMessageService,
private systemVersionService: SystemVersionService,
private storeService: StoreService,
private form: FormBuilder) { }
ngOnInit(): void {
this.searchForm = this.form.group({
termType: [null],
versionType: [null],
status: [null],
});
this.editVersionModalForm = this.form.group({
id: [null],
termType: ['APP', [Validators.required]],
versionType: ['1', [Validators.required]],
version: [null, [Validators.required]],
content: [null, [Validators.required]],
fileUrl: [null],
});
this.requestData(1);
}
/**
*
*/
requestData(pageNum) {
this.tableLoading = true;
this.whereObject['pageNum'] = pageNum;
this.whereObject['pageSize'] = 10;
this.systemVersionService.getVersionList(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();
}
/**
*
*/
showEditModal(id: number) {
this.editVersionModal = true;
}
/**
*
*/
submitEdit() {
for (const i in this.editVersionModalForm.controls) {
this.editVersionModalForm.controls[i].markAsDirty();
this.editVersionModalForm.controls[i].updateValueAndValidity();
}
console.log(this.editVersionModalForm.value);
console.log(this.editVersionModalForm.status);
if (this.editVersionModalForm.status == null || this.editVersionModalForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请规范填写所有的必填项信息',
});
return;
}
if (this.versionFileUrl == null || this.versionFileUrl.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '未上传更新文件',
});
return;
}
this.editVersionModalForm.value.fileUrl = 'https://hsg.dctpay.com/filesystem/' + this.versionFileUrl;
this.systemVersionService.editVersion(this.editVersionModalForm.value, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '新增成功',
nzOnOk: () => this.requestData(1)
});
this.closeEditModal();
} else {
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
/**
*
*/
closeEditModal() {
this.editVersionModal = false;
}
/**
*
*/
showReleaseConfirm(id: number): void {
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定发布版本吗?',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.requestRelease(id)
});
}
/**
*
*
*/
requestRelease(id: number) {
this.loading = true;
this.systemVersionService.releaseVersion(id, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '操作成功',
nzOnOk: () => this.requestData(this.whereObject['pageNum'])
});
} else {
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
this.loading = false;
});
}
/**
* 退
*/
showDelConfirm(id: number): void {
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定删除吗?',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.requestDel(id)
});
}
/**
*
*
*/
requestDel(id: number) {
this.loading = true;
this.systemVersionService.delVersion(id, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '操作成功',
nzOnOk: () => this.requestData(this.whereObject['pageNum'])
});
} else {
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
this.loading = false;
});
}
fileHandleChange(info: { file: NzUploadFile }): void {
switch (info.file.status) {
case 'uploading':
break;
case 'done':
this.versionFileUrl = info.file.response.return_data[0];
break;
case 'error':
this.message.error('上传失败');
break;
}
}
showOpenDetail(data: object) {
this.versionDetailObject = data;
this.versionDetailModal = true;
}
closeVersionDetail() {
this.versionDetailModal = false;
}
}

@ -128,7 +128,7 @@
<tr *ngFor="let data of basicTable.data;let i = index"> <tr *ngFor="let data of basicTable.data;let i = index">
<td>{{i + 1}}</td> <td>{{i + 1}}</td>
<td>{{data.merName}}</td> <td>{{data.merName}}</td>
<td>{{data.storeName}}</td> <td>{{data.storeName?data.storeName:'无'}}</td>
<td>{{data.outTradeNo}}</td> <td>{{data.outTradeNo}}</td>
<td>{{data.payMode | payMode}}</td> <td>{{data.payMode | payMode}}</td>
<td>¥{{data.tradeAmount}}</td> <td>¥{{data.tradeAmount}}</td>

@ -0,0 +1,60 @@
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 SystemVersionService {
constructor(
private http: HttpClient,
private commonsService: CommonsService
) { }
/**
*
* @param object
* @param callBack
*/
editVersion(object: object, callBack) {
this.http.post(environment.baseUrl + 'sysVersion/editVersion', object).subscribe(data => {
callBack(data);
});
}
/**
*
* @param id
* @param callBack
*/
releaseVersion(id: number, callBack) {
this.http.get(environment.baseUrl + 'sysVersion/releaseVersion?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
*
* @param id
* @param callBack
*/
delVersion(id: number, callBack) {
this.http.get(environment.baseUrl + 'sysVersion/delVersion?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
getVersionList(paramObject: object, callBack) {
this.http.get(environment.baseUrl + 'sysVersion/getVersionList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
callBack(data);
});
}
}
Loading…
Cancel
Save