From 5137406d0fac428bfef990f9971cc827bd86dcbf Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 26 Jun 2023 16:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/system/system-routing.module.ts | 2 + src/app/admin/system/system.module.ts | 3 +- .../system/version/version.component.html | 166 +++++++++++ .../system/version/version.component.scss | 3 + .../system/version/version.component.spec.ts | 25 ++ .../admin/system/version/version.component.ts | 257 ++++++++++++++++++ .../trade-order-list.component.html | 2 +- src/app/services/system-version.service.ts | 60 ++++ 8 files changed, 516 insertions(+), 2 deletions(-) create mode 100644 src/app/admin/system/version/version.component.html create mode 100644 src/app/admin/system/version/version.component.scss create mode 100644 src/app/admin/system/version/version.component.spec.ts create mode 100644 src/app/admin/system/version/version.component.ts create mode 100644 src/app/services/system-version.service.ts diff --git a/src/app/admin/system/system-routing.module.ts b/src/app/admin/system/system-routing.module.ts index 0857e91..d1bd4aa 100644 --- a/src/app/admin/system/system-routing.module.ts +++ b/src/app/admin/system/system-routing.module.ts @@ -6,6 +6,7 @@ import {SystemRoleShowComponent} from './system-role-show/system-role-show.compo import {SystemUserComponent} from './system-user/system-user.component'; import {PermissionComponent} from './permission/permission.component'; import {MenuComponent} from './menu/menu.component'; +import {VersionComponent} from './version/version.component'; const routes: Routes = [ { path: 'systemorganization', component: SystemOrganizationComponent}, @@ -14,6 +15,7 @@ const routes: Routes = [ { path: 'systemuser', component: SystemUserComponent }, { path: 'menu', component: MenuComponent }, { path: 'permission', component: PermissionComponent }, + { path: 'version', component: VersionComponent }, ]; @NgModule({ diff --git a/src/app/admin/system/system.module.ts b/src/app/admin/system/system.module.ts index 9f7733b..af4eeb4 100644 --- a/src/app/admin/system/system.module.ts +++ b/src/app/admin/system/system.module.ts @@ -14,9 +14,10 @@ import {NgxNeditorModule} from '@notadd/ngx-neditor'; import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {AppCommonModule} from '../../app-common.module'; +import { VersionComponent } from './version/version.component'; @NgModule({ - declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent], + declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent, VersionComponent], imports: [ CommonModule, SystemRoutingModule, diff --git a/src/app/admin/system/version/version.component.html b/src/app/admin/system/version/version.component.html new file mode 100644 index 0000000..6d83666 --- /dev/null +++ b/src/app/admin/system/version/version.component.html @@ -0,0 +1,166 @@ + + + + + +
+
+
+
+ + 终端类型 + + + + + + +
+
+ + 版本类型 + + + + + + +
+
+ + 状态 + + + + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + 终端类型 + 版本类型 + 版本号 + 状态 + 版本内容 + 创建时间 + 发布时间 + 操作 + + + + + {{data.termType}} + {{data.versionType == 1?'小版本':'大版本'}} + {{data.version}} + {{data.status == 1?'已发布':'未发布'}} + {{data.content}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.releaseTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 其他操作 + + + + + + + +
+
+ + + +
+ + 终端类型 + + + + + + + + + 版本类型 + + + + + + + + + 新版本号 + + + + + + + 版本内容 + + + + + + + 更新文件 + + + + + + + +
+ +
+
+
+ + + + + {{versionDetailObject.termType}} + {{versionDetailObject.versionType == 1?'小版本':'大版本'}} + {{versionDetailObject.version}} + {{versionDetailObject.fileUrl}} + +
{{versionDetailObject.content}}
+
+
+
diff --git a/src/app/admin/system/version/version.component.scss b/src/app/admin/system/version/version.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/system/version/version.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/system/version/version.component.spec.ts b/src/app/admin/system/version/version.component.spec.ts new file mode 100644 index 0000000..fcd0475 --- /dev/null +++ b/src/app/admin/system/version/version.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ VersionComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(VersionComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/system/version/version.component.ts b/src/app/admin/system/version/version.component.ts new file mode 100644 index 0000000..1a2afe5 --- /dev/null +++ b/src/app/admin/system/version/version.component.ts @@ -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; + } +} diff --git a/src/app/admin/trade-order/trade-order-list/trade-order-list.component.html b/src/app/admin/trade-order/trade-order-list/trade-order-list.component.html index b7329c1..a1adcce 100644 --- a/src/app/admin/trade-order/trade-order-list/trade-order-list.component.html +++ b/src/app/admin/trade-order/trade-order-list/trade-order-list.component.html @@ -128,7 +128,7 @@ {{i + 1}} {{data.merName}} - {{data.storeName}} + {{data.storeName?data.storeName:'无'}} {{data.outTradeNo}} {{data.payMode | payMode}} ¥{{data.tradeAmount}} diff --git a/src/app/services/system-version.service.ts b/src/app/services/system-version.service.ts new file mode 100644 index 0000000..752a016 --- /dev/null +++ b/src/app/services/system-version.service.ts @@ -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); + }); + } + +}