diff --git a/src/app/core/startup/startup.service.ts b/src/app/core/startup/startup.service.ts index 78763f48..392f5e31 100644 --- a/src/app/core/startup/startup.service.ts +++ b/src/app/core/startup/startup.service.ts @@ -45,9 +45,9 @@ export class StartupService { let data; if (this.coreSrv.loginStatus) { // 本地菜单 - data = this.loadMockData(); + // data = this.loadMockData(); // 远程菜单 - // data = this.loadRemoteData(); + data = this.loadRemoteData(); } else { data = this.loadMockData(); } @@ -103,7 +103,7 @@ export class StartupService { const appData = this.httpClient.get(`assets/mocks/app-data.json`).pipe(map((res: any) => res.app)); // 用户数据 - const userData = this.httpClient.post(this.userSrv.$api_get_user_by_token, {}).pipe(map((res: any) => res.data)); + const userData = this.httpClient.get('assets/mocks/user-data.json').pipe(map((res: any) => res.user)); // 菜单数据 const menuData = this.httpClient.get('assets/mocks/menu-data.json').pipe(map((res: any) => res.data.menu)); @@ -122,16 +122,15 @@ export class StartupService { const appData = this.httpClient.get(`assets/mocks/app-data.json`).pipe(map((res: any) => res.app)); // 用户数据 - const userData = this.coreSrv.loginStatus - ? this.httpClient.post(this.coreSrv.$api_get_current_user_info, {}).pipe(map((res: any) => res.data)) - : this.httpClient.get('assets/mocks/user-data.json').pipe(map((res: any) => res.user)); + const userData = this.httpClient.post(this.userSrv.$api_get_user_by_token, {}).pipe(map((res: any) => res.data)); // 菜单数据 - const menuData = this.httpClient - .post(this.coreSrv.$api_get_current_user_menus, { - appId: this.coreSrv.envSrv.getEnvironment().appId - }) - .pipe(map((res: any) => res.data)); + // const menuData = this.httpClient + // .post(this.coreSrv.$api_get_current_user_menus, { + // appId: this.coreSrv.envSrv.getEnvironment().appId + // }) + // .pipe(map((res: any) => res.data)); + const menuData = this.httpClient.get('assets/mocks/menu-data.json').pipe(map((res: any) => res.data.menu)); return zip(appData, userData, menuData); } diff --git a/src/app/layout/passport/passport.component.ts b/src/app/layout/passport/passport.component.ts index 5c6e216c..8a4ef9da 100644 --- a/src/app/layout/passport/passport.component.ts +++ b/src/app/layout/passport/passport.component.ts @@ -7,9 +7,9 @@ import { DA_SERVICE_TOKEN, ITokenService } from '@delon/auth'; styleUrls: ['./passport.component.less'] }) export class LayoutPassportComponent implements OnInit { - constructor(@Inject(DA_SERVICE_TOKEN) private tokenService: ITokenService) {} + constructor() {} ngOnInit(): void { - this.tokenService.clear(); + // this.tokenService.clear(); } } diff --git a/src/app/routes/financial-management/components/driver-account/driver-account-detail/driver-account-detail.component.ts b/src/app/routes/financial-management/components/driver-account/driver-account-detail/driver-account-detail.component.ts index bb7e3ee3..7b005830 100644 --- a/src/app/routes/financial-management/components/driver-account/driver-account-detail/driver-account-detail.component.ts +++ b/src/app/routes/financial-management/components/driver-account/driver-account-detail/driver-account-detail.component.ts @@ -11,7 +11,6 @@ import { FreightAccountService } from '../../../services/freight-account.service styleUrls: ['./driver-account-detail.component.less'] }) export class DriverAccountDetailComponent implements OnInit { - url = `/rule?_allow_anonymous=true`; @ViewChild('st', { static: true }) st!: STComponent; @ViewChild('sf', { static: false }) @@ -101,10 +100,6 @@ export class DriverAccountDetailComponent implements OnInit { ui: { widget: 'select', placeholder: '请选择', - change: (i: any) => { - this.sf.value.receiveName = i; - this.sf?.setValue('/receiveName', i); - }, visibleIf: { expand: (value: boolean) => value } @@ -122,10 +117,6 @@ export class DriverAccountDetailComponent implements OnInit { ui: { widget: 'select', placeholder: '请选择', - change: (i: any) => { - this.sf.value.receiveName2 = i; - this.sf?.setValue('/receiveName2', i); - }, visibleIf: { expand: (value: boolean) => value } diff --git a/src/app/routes/financial-management/components/driver-account/driver-account.component.html b/src/app/routes/financial-management/components/driver-account/driver-account.component.html index 8f38e950..ea3f5792 100644 --- a/src/app/routes/financial-management/components/driver-account/driver-account.component.html +++ b/src/app/routes/financial-management/components/driver-account/driver-account.component.html @@ -22,7 +22,7 @@ - { + Object.assign(requestOptions.body, { accountType: 2 }); if (this.sf) { Object.assign(requestOptions.body, { ...this.sf.value }); } @@ -59,7 +61,7 @@ export class DriverAccountComponent implements OnInit { hidden: true } }, - receiveName: { + tenantName: { type: 'string', title: '司机姓名', ui: { placeholder: '请输入' } @@ -76,31 +78,41 @@ export class DriverAccountComponent implements OnInit { placeholder: '请输入' } }, - page2: { + ltdid: { type: 'string', title: '网络货运人', - enum: [{ label: '全部', value: '全部' }], ui: { widget: 'select', placeholder: '请选择', visibleIf: { expand: (value: boolean) => value - } + }, + allowClear: true, + asyncData: () => this.service.getNetworkFreightForwarder() } }, - page22: { + bankType: { type: 'string', title: '银行类型', - enum: [{ label: '全部', value: '全部' }], + enum: [ + { label: '全部', value: null }, + { label: '平安银行', value: '1' }, + { label: '浦发银行', value: '2' } + ], ui: { widget: 'select', placeholder: '请选择', + change: (i: any) => { + this.sf.value.receiveName2 = i; + this.sf?.setValue('/receiveName2', i); + }, visibleIf: { expand: (value: boolean) => value } - } + }, + default: null }, - page3: { + virtualAccount: { type: 'string', title: '虚拟账户', ui: { @@ -128,17 +140,17 @@ export class DriverAccountComponent implements OnInit { private initST(): STColumn[] { return [ - { title: '司机姓名', index: 'description' }, + { title: '司机姓名', index: 'tenantName' }, { title: '证件号码', index: 'description' }, { title: '手机号', index: 'description' }, - { title: '网络货运人', index: 'description' }, - { title: '银行类型', index: 'description' }, - { title: '虚拟账户', index: 'description' }, - { title: '可用余额', index: 'description' }, - { title: '冻结余额', index: 'description' }, + { title: '网络货运人', index: 'ltdid' }, + { title: '银行类型', index: 'description', type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } }, + { title: '虚拟账户', index: 'virtualAccount' }, + { title: '可用余额', index: 'availableBalance' }, + { title: '冻结余额', index: 'freezeBalance' }, { title: '本月累计提现金额', index: 'description', width: 150 }, - { title: '账户总余额', index: 'description' }, - { title: '创建时间', index: 'updatedAt', type: 'date', width: 150 }, + { title: '账户总余额', index: 'availableBalance' }, + { title: '创建时间', index: 'createTime', type: 'date', width: 150 }, { title: '操作', buttons: [ diff --git a/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.html b/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.html index 40790f8f..46979a1e 100644 --- a/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.html +++ b/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.html @@ -19,11 +19,12 @@ - + - + @@ -49,9 +50,9 @@ - \ No newline at end of file diff --git a/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.ts b/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.ts index ee41839e..f1e9661e 100644 --- a/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.ts +++ b/src/app/routes/financial-management/components/freight-account/freight-account-detail/freight-account-detail.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st'; -import { SFComponent, SFDateWidgetSchema, SFSchema } from '@delon/form'; +import { SFComponent, SFDateWidgetSchema, SFSchema, SFSelectWidgetSchema } from '@delon/form'; import { NzModalService } from 'ng-zorro-antd/modal'; import { FreightAccountService } from '../../../services/freight-account.service'; @@ -18,18 +18,32 @@ export class FreightAccountDetailComponent implements OnInit { columns: STColumn[] = this.initST(); searchSchema: SFSchema = this.initSF(); + info: any = {}; + _$expand = false; - constructor(public service: FreightAccountService, private nzModalService: NzModalService, private router: Router) {} + constructor(public service: FreightAccountService, private nzModalService: NzModalService, private route: ActivatedRoute) {} ngOnInit(): void {} beforeReq = (requestOptions: STRequestOptions) => { + Object.assign(requestOptions.body, { transactionNumber: this.route.snapshot.params.id }); if (this.sf) { Object.assign(requestOptions.body, { ...this.sf.value }); } return requestOptions; }; + afterReq = (data: any[], rawData?: any) => { + console.log(data, rawData); + if (rawData?.success) { + this.info = { + incomeAmount: rawData.data.rawData, + payAmount: rawData.data.payAmount + }; + } + return data; + }; + exportList() { this.service.downloadFile(this.service.$mock_url, { ...this.sf.value, pageIndex: this.st.pi, pageSize: this.st.ps }); } @@ -72,81 +86,69 @@ export class FreightAccountDetailComponent implements OnInit { format: 'yyyy-MM-dd' } as SFDateWidgetSchema }, - orderSn2: { + transactionNumber: { type: 'string', title: '流水号', ui: { placeholder: '请输入' } }, - orderSn3: { + businessNumber: { type: 'string', title: '关联单号', ui: { placeholder: '请输入' } }, - receiveName: { + tradeType: { type: 'string', title: '交易类型', enum: [ { label: '全部', value: '' }, - { label: '订单支付', value: '订单支付' }, - { label: '余额充值', value: '余额充值' }, - { label: '余额提现', value: '余额提现' }, - { label: '资金分配', value: '资金分配' }, - { label: '资金回收', value: '资金回收' } + { label: '整车订单退款', value: '1' }, + { label: '整车订单支付', value: '2' }, + { label: '提现失败退回', value: '3' }, + { label: '提现', value: '4' }, + { label: '充值', value: '5' }, + { label: '运货订单结算F', value: '5' } ], ui: { widget: 'select', placeholder: '请选择', - change: (i: any) => { - this.sf.value.receiveName = i; - this.sf?.setValue('/receiveName', i); - }, visibleIf: { expand: (value: boolean) => value } }, default: '' }, - receiveName2: { + incomeType: { type: 'string', title: '收支类型', enum: [ { label: '全部', value: '' }, - { label: '收入', value: '收入' }, - { label: '支出', value: '支出' } + { label: '收入', value: '1' }, + { label: '支出', value: '2' } ], ui: { widget: 'select', placeholder: '请选择', - change: (i: any) => { - this.sf.value.receiveName2 = i; - this.sf?.setValue('/receiveName2', i); - }, visibleIf: { expand: (value: boolean) => value } }, default: '' }, - receiveName3: { + projectId: { + title: '项目', type: 'string', - title: '所属项目', - enum: [{ label: '全部', value: '' }], + default: '', ui: { widget: 'select', - placeholder: '请选择', - change: (i: any) => { - this.sf.value.receiveName3 = i; - this.sf?.setValue('/receiveName3', i); - }, visibleIf: { expand: (value: boolean) => value - } - }, - default: '' + }, + asyncData: () => this.service.getEnterpriseProject() + } as SFSelectWidgetSchema } } }; @@ -155,13 +157,18 @@ export class FreightAccountDetailComponent implements OnInit { private initST(): STColumn[] { return [ { title: '交易时间', index: 'updatedAt', type: 'date' }, - { title: '流水号', index: 'callNo' }, - { title: '交易类型', index: 'callNo' }, - { title: '关联单号', index: 'callNo' }, - { title: '所属项目', index: 'callNo' }, - { title: '收支类型', index: 'callNo' }, - { title: '交易金额', index: 'callNo' }, - { title: '账户余额', index: 'callNo' } + { title: '流水号', index: 'transactionNumber' }, + { + title: '交易类型', + index: 'tradeType', + type: 'enum', + enum: { 1: '整车订单退款', 2: '整车订单支付', 3: '提现失败退回', 4: '提现', 5: '充值', 6: '运货订单结算' } + }, + { title: '关联单号', index: 'businessNumber' }, + { title: '所属项目', index: 'projectId' }, + { title: '收支类型', index: 'incomeType', type: 'enum', enum: { 1: '收入', 2: '支出' } }, + { title: '交易金额', index: 'amount' }, + { title: '账户余额', index: 'accountBalance' } ]; } } diff --git a/src/app/routes/financial-management/components/freight-account/freight-account.component.html b/src/app/routes/financial-management/components/freight-account/freight-account.component.html index f1dcf5ed..12b1bcd6 100644 --- a/src/app/routes/financial-management/components/freight-account/freight-account.component.html +++ b/src/app/routes/financial-management/components/freight-account/freight-account.component.html @@ -22,7 +22,7 @@ - { + Object.assign(requestOptions.body, { accountType: 1 }); if (this.sf) { Object.assign(requestOptions.body, { ...this.sf.value }); } @@ -63,7 +65,7 @@ export class FreightAccountComponent implements OnInit { hidden: true } }, - receiveName: { + tenantName: { type: 'string', title: '企业名称', ui: { placeholder: '请输入' } @@ -80,35 +82,37 @@ export class FreightAccountComponent implements OnInit { placeholder: '请输入' } }, - page2: { + ltdid: { type: 'string', title: '网络货运人', - enum: [{ label: '全部', value: '全部' }], ui: { widget: 'select', placeholder: '请选择', visibleIf: { expand: (value: boolean) => value - } + }, + allowClear: true, + asyncData: () => this.service.getNetworkFreightForwarder() } }, - receiveName2: { + bankType: { type: 'string', title: '银行类型', - enum: [{ label: '全部', value: '全部' }], + enum: [ + { label: '全部', value: null }, + { label: '平安银行', value: '1' }, + { label: '浦发银行', value: '2' } + ], ui: { widget: 'select', placeholder: '请选择', - change: (i: any) => { - this.sf.value.receiveName2 = i; - this.sf?.setValue('/receiveName2', i); - }, visibleIf: { expand: (value: boolean) => value } - } + }, + default: null }, - page3: { + virtualAccount: { type: 'string', title: '虚拟账户', ui: { @@ -136,24 +140,29 @@ export class FreightAccountComponent implements OnInit { private initST(): STColumn[] { return [ - { title: '企业名称', index: 'description' }, + { title: '企业名称', index: 'tenantName' }, { title: '联系人', index: 'description' }, { title: '联系人电话', index: 'description' }, - { title: '网络货运人', index: 'description' }, - { title: '银行类型', index: 'description' }, - { title: '虚拟账户', index: 'description' }, - { title: '可用余额', index: 'description' }, - { title: '冻结余额', index: 'description' }, + { title: '网络货运人', index: 'ltdid' }, + { title: '银行类型', index: 'bankType', type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } }, + { title: '虚拟账户', index: 'virtualAccount' }, + { title: '可用余额', index: 'availableBalance' }, + { title: '冻结余额', index: 'freezeBalance' }, { title: '累计消费金额', index: 'description' }, - { title: '账户总余额', render: 'description1' }, - { title: '创建时间', index: 'updatedAt', type: 'date', width: 150 }, - { title: '状态', render: 'description1' }, + { title: '账户总余额', render: 'availableBalance' }, + { title: '创建时间', index: 'createTime', type: 'date', width: 150 }, + { + title: '状态', + render: 'stateLocked', + type: 'badge', + badge: { 0: { text: '正常', color: 'success' }, 1: { text: '锁定', color: 'warning' } } + }, { title: '操作', buttons: [ { text: '查看明细', - click: item => this.router.navigate(['/financial-management/freight-account/detail/1']) + click: item => this.router.navigate(['/financial-management/freight-account/detail/' + item.id]) } ] } diff --git a/src/app/routes/financial-management/services/freight-account.service.ts b/src/app/routes/financial-management/services/freight-account.service.ts index 6f376729..c9d7f5f6 100644 --- a/src/app/routes/financial-management/services/freight-account.service.ts +++ b/src/app/routes/financial-management/services/freight-account.service.ts @@ -1,12 +1,18 @@ import { Injectable, Injector } from '@angular/core'; -import { BaseService } from '@shared'; +import { BaseService, ShipperBaseService } from '@shared'; @Injectable({ providedIn: 'root' }) -export class FreightAccountService extends BaseService { +export class FreightAccountService extends ShipperBaseService { $mock_url = '/rule?_allow_anonymous=true'; + // 获取账户余额信息 + $api_get_account_balance = '/api/fcc/accountBalance/getAccountBalance'; + + // 货主端获取账户余额交易明细 + $api_get_balance_by_shipper = '/api/fcc/accountBalanceDetail/getAccountBalanceByShipperPage'; + constructor(public injector: Injector) { super(injector); } diff --git a/src/app/routes/passport/components/order-agreement/order-agreement.component.html b/src/app/routes/passport/components/order-agreement/order-agreement.component.html index 6aefe172..c56608d8 100644 --- a/src/app/routes/passport/components/order-agreement/order-agreement.component.html +++ b/src/app/routes/passport/components/order-agreement/order-agreement.component.html @@ -1,9 +1,9 @@

- {{ agreementContent?.typeName }} + {{ agreementContent?.agreementName }}

最新版本生效日期:{{ agreementContent?.modifyTime }}

-
+
-
+ \ No newline at end of file diff --git a/src/app/routes/passport/components/order-agreement/order-agreement.component.spec.ts b/src/app/routes/passport/components/order-agreement/order-agreement.component.spec.ts deleted file mode 100644 index 9ad146da..00000000 --- a/src/app/routes/passport/components/order-agreement/order-agreement.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { OrderAgreementComponent } from './order-agreement.component'; - -describe('OrderAgreementComponent', () => { - let component: OrderAgreementComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [OrderAgreementComponent], - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(OrderAgreementComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/routes/passport/components/order-agreement/order-agreement.component.ts b/src/app/routes/passport/components/order-agreement/order-agreement.component.ts index f4fd249e..36b97187 100644 --- a/src/app/routes/passport/components/order-agreement/order-agreement.component.ts +++ b/src/app/routes/passport/components/order-agreement/order-agreement.component.ts @@ -16,9 +16,10 @@ export class OrderAgreementComponent implements OnInit { }); } ngOnInit() { - this.service.request(this.service.$api_get_agreement, { type: this.type }).subscribe(res => { + console.log({ type: this.type }); + + this.service.request(this.service.$api_get_agreement, { type: this.type }, 'POST', true, 'FORM').subscribe(res => { if (res) { - console.log(res); this.agreementContent = res; } }); diff --git a/src/app/routes/passport/passport.module.ts b/src/app/routes/passport/passport.module.ts index e4ab74be..ad3a9f31 100644 --- a/src/app/routes/passport/passport.module.ts +++ b/src/app/routes/passport/passport.module.ts @@ -6,6 +6,7 @@ import { SEModule } from '@delon/abc/se'; import { DelonACLModule } from '@delon/acl'; import { DelonFormModule } from '@delon/form'; import { AlainThemeModule } from '@delon/theme'; +import { PipeModule } from '@shared'; import { NzAlertModule } from 'ng-zorro-antd/alert'; import { NzAvatarModule } from 'ng-zorro-antd/avatar'; import { NzButtonModule } from 'ng-zorro-antd/button'; @@ -60,6 +61,7 @@ const COMPONENTS = [ DelonFormModule, NzStepsModule, ProPageModule, + PipeModule ], declarations: COMPONENTS }) diff --git a/src/app/routes/passport/services/passport.service.ts b/src/app/routes/passport/services/passport.service.ts index 08798739..d3f38a0a 100644 --- a/src/app/routes/passport/services/passport.service.ts +++ b/src/app/routes/passport/services/passport.service.ts @@ -9,7 +9,7 @@ import { EAFileUtil } from 'src/app/shared/utils/file.util'; }) export class PassportService extends BaseService { // 登录协议,服务订购协议 - public $api_get_agreement = `/scm/cms/cms/agreement/getAgreement?_allow_anonymous=true`; + public $api_get_agreement = `/api/mdc/pbc/agreementInfo/getAgreementInfoByType?_allow_anonymous=true`; constructor(public injector: Injector) { super(injector); diff --git a/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.html b/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.html index 9f03cefa..17d718f0 100644 --- a/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.html +++ b/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.html @@ -4,29 +4,31 @@
    -
  • - {{ item.name }} +
  • + {{ item.agreementName }}
- {{ tabItem.typeName }} + {{ tabItem.agreementName }}
更新时间: {{ tabItem.modifyTime }} - 预览 + 预览
-
+
- +
diff --git a/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.ts b/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.ts index 55272c75..90799802 100644 --- a/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.ts +++ b/src/app/routes/sys-setting/components/agreement-config/agreement-config.component.ts @@ -13,39 +13,11 @@ import { EnvironmentService } from '@env/environment.service'; templateUrl: './agreement-config.component.html' }) export class AgreementConfigComponentsBaseComponent implements OnInit { - @ViewChild('sf1', { static: false }) sf1!: SFComponent; - - i: any; - formDate: any = {}; + @ViewChild('sf', { static: false }) sf!: SFComponent; schema1!: SFSchema; - ui1: SFUISchema = {}; - idx: any = 0; isUpdate = false; - type = 0; - tabItem = { - content: '', - id: 0, - modifyTime: '', - type: '', - typeName: '' - }; - tabs = [ - { - name: '《货主端用户注册协议》' - }, - { - name: '《司机端用户注册协议》' - }, - { - name: '《服务协议》' - }, - { - name: '《隐私政策》' - }, - { - name: '《人脸识别协议》' - } - ]; + tabItem: any = {}; + tabs: any[] = []; constructor(private service: SystemService) {} @@ -53,7 +25,8 @@ export class AgreementConfigComponentsBaseComponent implements OnInit { this.loadAgreement(); this.initSF(); } - initSF() { + + initSF(data?: any) { this.schema1 = { properties: { content: { @@ -65,58 +38,51 @@ export class AgreementConfigComponentsBaseComponent implements OnInit { config: { height: 650 } - } + }, + default: data?.agreementContent || '' } } }; - this.ui1 = { - '*': { - spanLabelFixed: 10, - grid: { span: 24 } + } + + changeType(item: any): void { + this.isUpdate = false; + this.tabItem = item; + } + + loadAgreement(type?: number) { + this.service.request(`${this.service.$api_get_agreement_page}`).subscribe(res => { + if (res) { + res.records = res.records.map((item: any) => ({ ...item, agreementContent: decodeURIComponent(item.agreementContent) })); + this.tabs = res.records; + if (type) { + this.tabItem = res.records.find((i: any) => i.type === type); + } else { + this.tabItem = res.records?.[0]; + } } - }; - } - - changeType(type: number): void { - this.idx = type; - if (type > 0) { - this.isUpdate = false; - this.type = +type; - - this.loadAgreement(); - } - } - - loadAgreement() { - // this.service.request(`${this.service.$api_general_getAgreement}`, { type: this.type }).subscribe((res) => { - // console.log('🚀 ~ this.service.request ~ res', res); - // if (res) { - // this.tabItem = res; - // } - // }); + }); } update() { this.isUpdate = true; - console.log('🚀 ~ update ~ isUpdate', this.tabItem); - - this.formDate.content = this.tabItem.content; - this.initSF(); + this.initSF(this.tabItem); } save() { const params = { id: this.tabItem.id, - content: encodeURIComponent(this.sf1?.value.content), - type: this.type + agreementContent: encodeURIComponent(this.sf?.value.content), + type: this.tabItem.type, + agreementName: this.tabItem.agreementName }; this.isUpdate = false; - // this.service.request(`${this.service.$api_general_updateAgreement}`, params).subscribe((res) => { - // if (res) { - // this.service.msgSrv.success('保存成功'); - // this.changeType(this.type); - // this.isUpdate = false; - // } - // }); + this.service.request(`${this.service.$api_update_agreement}`, params).subscribe(res => { + if (res) { + this.service.msgSrv.success('保存成功'); + this.isUpdate = false; + this.loadAgreement(this.tabItem.type); + } + }); } cancel() { diff --git a/src/app/routes/sys-setting/components/system-logs/system-logs.component.html b/src/app/routes/sys-setting/components/system-logs/system-logs.component.html index 6cd3aed6..9d2b0a3a 100644 --- a/src/app/routes/sys-setting/components/system-logs/system-logs.component.html +++ b/src/app/routes/sys-setting/components/system-logs/system-logs.component.html @@ -1,4 +1,4 @@ - + @@ -19,9 +19,9 @@ - + [loading]="service.http.loading" [scroll]="{ y: '370px' }"> \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/system-logs/system-logs.component.less b/src/app/routes/sys-setting/components/system-logs/system-logs.component.less index 80d9010f..7512dfec 100644 --- a/src/app/routes/sys-setting/components/system-logs/system-logs.component.less +++ b/src/app/routes/sys-setting/components/system-logs/system-logs.component.less @@ -17,5 +17,16 @@ } .expend-options { - margin-top: -40px; + margin-top: 0px; +} + + +@media (min-width: 1200px) { + .expend-options { + max-width: 400px; + position : absolute; + right : 0; + bottom : 25px; + } + } \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/system-logs/system-logs.component.ts b/src/app/routes/sys-setting/components/system-logs/system-logs.component.ts index 6839951f..818d024c 100644 --- a/src/app/routes/sys-setting/components/system-logs/system-logs.component.ts +++ b/src/app/routes/sys-setting/components/system-logs/system-logs.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { STComponent, STColumn, STChange } from '@delon/abc/st'; +import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form'; +import { dateTimePickerUtil } from '@delon/util'; import { NzModalService } from 'ng-zorro-antd/modal'; import { SystemService } from '../../services/system.service'; @@ -15,8 +16,6 @@ export class SystemLogsComponent implements OnInit { @ViewChild('sf', { static: false }) sf!: SFComponent; - url = `/rule?_allow_anonymous=true`; - searchSchema: SFSchema = { properties: { expand: { @@ -25,24 +24,24 @@ export class SystemLogsComponent implements OnInit { hidden: true } }, - receiveName: { + operator: { type: 'string', title: '操作人', ui: { placeholder: '请输入' } }, - phone: { + telephone: { type: 'string', title: '手机号码', ui: { placeholder: '请输入' } }, - page: { + operatePage: { type: 'string', title: '操作页面', ui: { placeholder: '请输入' } }, - content: { + operationContent: { type: 'string', title: '操作内容', ui: { @@ -52,13 +51,14 @@ export class SystemLogsComponent implements OnInit { } } }, - createTime: { - title: '操作时间', + time: { + title: '登录时间', type: 'string', ui: { - widget: 'date', - mode: 'range', - format: 'yyyy-MM-dd', + widget: 'item-date', + format: 'yyyy-MM-dd HH:mm:ss', + placeholder: '请选择', + nzShowTime: true, visibleIf: { expand: (value: boolean) => value } @@ -68,28 +68,29 @@ export class SystemLogsComponent implements OnInit { }; columns: STColumn[] = [ - { title: '操作时间', index: 'updatedAt', type: 'date' }, - { title: '操作人', index: 'description' }, - { title: '操作人手机号码', index: 'description' }, - { title: '操作页面', index: 'description' }, - { title: '操作内容', index: 'description' }, - { - title: '创建时间', - index: 'updatedAt', - type: 'date' - } + { title: '操作时间', index: 'operatorTimestamp', type: 'date' }, + { title: '操作人', index: 'operator' }, + { title: '操作人手机号码', index: 'telephone' }, + { title: '操作页面', index: 'operatePage' }, + { title: '操作内容', index: 'operationContent' } ]; - selectedRows: any[] = []; - - reqParams = { pageIndex: 1, pageSize: 10 }; _$expand = false; constructor(public service: SystemService, private nzModalService: NzModalService) {} ngOnInit(): void {} - stChange(e: STChange): void {} + beforeReq = (requestOptions: STRequestOptions) => { + if (this.sf) { + Object.assign(requestOptions.body, { + ...this.sf.value, + endTime: this.sf.value.time?.end ? dateTimePickerUtil.format(this.sf.value.time?.end, 'yyyy-MM-dd HH:mm:ss') : null, + startTime: this.sf.value.time?.start ? dateTimePickerUtil.format(this.sf.value.time?.start, 'yyyy-MM-dd HH:mm:ss') : null + }); + } + return requestOptions; + }; /** * 重置表单 diff --git a/src/app/routes/sys-setting/components/user-logs/user-logs.component.html b/src/app/routes/sys-setting/components/user-logs/user-logs.component.html index fb7cfab8..ea2bb8f2 100644 --- a/src/app/routes/sys-setting/components/user-logs/user-logs.component.html +++ b/src/app/routes/sys-setting/components/user-logs/user-logs.component.html @@ -19,9 +19,9 @@ - + [loading]="service.http.loading" [scroll]="{ y: '370px' }"> \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/user-logs/user-logs.component.less b/src/app/routes/sys-setting/components/user-logs/user-logs.component.less index 80d9010f..7512dfec 100644 --- a/src/app/routes/sys-setting/components/user-logs/user-logs.component.less +++ b/src/app/routes/sys-setting/components/user-logs/user-logs.component.less @@ -17,5 +17,16 @@ } .expend-options { - margin-top: -40px; + margin-top: 0px; +} + + +@media (min-width: 1200px) { + .expend-options { + max-width: 400px; + position : absolute; + right : 0; + bottom : 25px; + } + } \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/user-logs/user-logs.component.ts b/src/app/routes/sys-setting/components/user-logs/user-logs.component.ts index d7707c88..17327a1c 100644 --- a/src/app/routes/sys-setting/components/user-logs/user-logs.component.ts +++ b/src/app/routes/sys-setting/components/user-logs/user-logs.component.ts @@ -1,7 +1,9 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { STComponent, STColumn, STChange } from '@delon/abc/st'; +import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFDateWidgetSchema, SFSchema } from '@delon/form'; +import { dateTimePickerUtil } from '@delon/util'; import { NzModalService } from 'ng-zorro-antd/modal'; +import { SFItemDateWidget } from 'src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget'; import { SystemService } from '../../services/system.service'; @Component({ @@ -25,24 +27,34 @@ export class UserLogsComponent implements OnInit { hidden: true } }, - receiveName: { + roleName: { type: 'string', title: '登录端口', ui: { placeholder: '请输入' } }, - phone: { + loginType: { type: 'string', title: '登录方式', - ui: { placeholder: '请输入' } + enum: [ + { label: '全部', value: null }, + { label: 'PC', value: '1' }, + { label: 'APP', value: '2' }, + { label: '小程序', value: '3' } + ], + ui: { + widget: 'select', + placeholder: '请选择' + }, + default: null }, - page: { + address: { type: 'string', title: '位置', ui: { placeholder: '请输入' } }, - content: { + terminalIp: { type: 'string', title: 'ip', ui: { @@ -52,13 +64,14 @@ export class UserLogsComponent implements OnInit { } } }, - createTime: { + time: { title: '登录时间', type: 'string', ui: { - widget: 'date', - mode: 'range', - format: 'yyyy-MM-dd', + widget: 'item-date', + format: 'yyyy-MM-dd HH:mm:ss', + placeholder: '请选择', + nzShowTime: true, visibleIf: { expand: (value: boolean) => value } @@ -68,36 +81,36 @@ export class UserLogsComponent implements OnInit { }; columns: STColumn[] = [ - { title: '登录时间', index: 'updatedAt', type: 'date' }, - { title: '登录端口', index: 'description' }, - { title: '姓名', index: 'description' }, - { title: '登录方式', index: 'description' }, - { title: '位置', index: 'description' }, - { title: 'ip', index: 'description' } + { title: '登录时间', index: 'createTime', type: 'date' }, + { title: '登录端口', index: 'roleName' }, + { title: '姓名', index: 'userName' }, + { title: '登录方式', index: 'loginType', enum: { '1': 'PC', '2': 'APP', '3': '小程序' }, type: 'enum' }, + { title: '位置', index: 'address' }, + { title: 'ip', index: 'terminalIp' } ]; - selectedRows: any[] = []; - reqParams = { pageIndex: 1, pageSize: 10 }; _$expand = false; - constructor(public service: SystemService, private nzModalService: NzModalService) {} + constructor(public service: SystemService) {} ngOnInit(): void {} - stChange(e: STChange): void { - switch (e.type) { - case 'checkbox': - this.selectedRows = e.checkbox!; - break; - case 'filter': - this.st.load(); - break; + beforeReq = (requestOptions: STRequestOptions) => { + if (this.sf) { + Object.assign(requestOptions.body, { + ...this.sf.value, + time: { + start: this.sf.value.time?.start ? dateTimePickerUtil.format(this.sf.value.time?.start, 'yyyy-MM-dd HH:mm:ss') : null, + end: this.sf.value.time?.end ? dateTimePickerUtil.format(this.sf.value.time?.end, 'yyyy-MM-dd HH:mm:ss') : null + } + }); } - } + return requestOptions; + }; roleAction(item?: any) {} - /** + /** * 重置表单 */ resetSF() { diff --git a/src/app/routes/sys-setting/components/version-logs/version-logs.component.html b/src/app/routes/sys-setting/components/version-logs/version-logs.component.html index 6f566f41..fec8020f 100644 --- a/src/app/routes/sys-setting/components/version-logs/version-logs.component.html +++ b/src/app/routes/sys-setting/components/version-logs/version-logs.component.html @@ -19,9 +19,9 @@ - + [loading]="service.http.loading" [scroll]="{ y: '370px' }"> \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/version-logs/version-logs.component.less b/src/app/routes/sys-setting/components/version-logs/version-logs.component.less index 80d9010f..7512dfec 100644 --- a/src/app/routes/sys-setting/components/version-logs/version-logs.component.less +++ b/src/app/routes/sys-setting/components/version-logs/version-logs.component.less @@ -17,5 +17,16 @@ } .expend-options { - margin-top: -40px; + margin-top: 0px; +} + + +@media (min-width: 1200px) { + .expend-options { + max-width: 400px; + position : absolute; + right : 0; + bottom : 25px; + } + } \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/version-logs/version-logs.component.ts b/src/app/routes/sys-setting/components/version-logs/version-logs.component.ts index 1d68a7ab..6ab9b2f5 100644 --- a/src/app/routes/sys-setting/components/version-logs/version-logs.component.ts +++ b/src/app/routes/sys-setting/components/version-logs/version-logs.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { STComponent, STColumn, STChange } from '@delon/abc/st'; +import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFDateWidgetSchema, SFSchema } from '@delon/form'; +import { dateTimePickerUtil } from '@delon/util'; import { NzModalService } from 'ng-zorro-antd/modal'; import { SystemService } from '../../services/system.service'; @@ -15,8 +16,6 @@ export class VersionLogsComponent implements OnInit { @ViewChild('sf', { static: false }) sf!: SFComponent; - url = `/rule?_allow_anonymous=true`; - searchSchema: SFSchema = { properties: { expand: { @@ -25,17 +24,37 @@ export class VersionLogsComponent implements OnInit { hidden: true } }, - receiveName: { + publishPort: { type: 'string', title: '端口', - ui: { placeholder: '请输入' } + enum: [ + { label: '全部', value: null }, + { label: '司机', value: '1' }, + { label: '货主', value: '2' }, + { label: '运营平台', value: '3' } + ], + ui: { + widget: 'select', + placeholder: '请选择' + }, + default: null }, - phone: { + publishType: { type: 'string', title: '端口方式', - ui: { placeholder: '请输入' } + enum: [ + { label: '全部', value: null }, + { label: 'PC ', value: '1' }, + { label: 'APP', value: '2' }, + { label: '小程序', value: '3' } + ], + ui: { + widget: 'select', + placeholder: '请选择' + }, + default: null }, - page: { + publishVersion: { type: 'string', title: '版本号', ui: { @@ -58,38 +77,35 @@ export class VersionLogsComponent implements OnInit { }; columns: STColumn[] = [ - { title: '端口', index: 'no' }, - { title: '端口方式', index: 'description' }, - { title: '版本号', index: 'description' }, + { title: '端口', index: 'publishPort', type: 'enum', enum: { 1: '司机', 2: '货主', 3: '运营平台' } }, + { title: '端口方式', index: 'publishType', type: 'enum', enum: { 1: 'PC', 2: 'APP', 3: '小程序' } }, + { title: '版本号', index: 'publishVersion' }, { title: '发布时间', - index: 'updatedAt', + index: 'createTime', type: 'date' }, - { title: '更新内容', index: 'description' } + { title: '更新内容', index: 'publicshContext' } ]; - selectedRows: any[] = []; - - reqParams = { pageIndex: 1, pageSize: 10 }; _$expand = false; constructor(public service: SystemService, private nzModalService: NzModalService) {} - ngOnInit(): void {} - - stChange(e: STChange): void { - switch (e.type) { - case 'checkbox': - this.selectedRows = e.checkbox!; - break; - case 'filter': - this.st.load(); - break; + beforeReq = (requestOptions: STRequestOptions) => { + if (this.sf) { + Object.assign(requestOptions.body, { + ...this.sf.value, + publishTime: { + start: this.sf.value.time?.start ? dateTimePickerUtil.format(this.sf.value.time?.start, 'yyyy-MM-dd HH:mm:ss') : null, + end: this.sf.value.time?.end ? dateTimePickerUtil.format(this.sf.value.time?.end, 'yyyy-MM-dd HH:mm:ss') : null + } + }); } - } + return requestOptions; + }; - roleAction(item?: any) {} + ngOnInit(): void {} /** * 重置表单 diff --git a/src/app/routes/sys-setting/services/system.service.ts b/src/app/routes/sys-setting/services/system.service.ts index 10f1fd65..0a12e736 100644 --- a/src/app/routes/sys-setting/services/system.service.ts +++ b/src/app/routes/sys-setting/services/system.service.ts @@ -80,6 +80,18 @@ export class SystemService extends BaseService { // 获取货主企业列表 public $api_enterpriceList = '/api/mdc/cuc/enterpriseInfo/operate/enterpriceList'; + // 查询用户登录记录表 + public $api_user_login_logs = '/api/mdc/userLoginLog/list/page'; + // 获取操作日志列表 + public $api_get_systemt_logs = '/api/mdc/pbc/operationLogRecords/getOperationLogRecordsList'; + // 查询版本发布表 + public $api_get_version_logs = '/api/mdc/versionPublish/list/page'; + + // 查询协议列表 + public $api_get_agreement_page = '/api/mdc/pbc/agreementInfo/list/page'; + // 编辑协议 + public $api_update_agreement = '/api/mdc/pbc/agreementInfo/modifyAgreementInfo'; + $api_getRoleTemplateInfo: string = ''; $api_getFunctionButtonInfo: string = ''; $api_getFunctionDataInfo: string = ''; diff --git a/src/app/shared/index.ts b/src/app/shared/index.ts index 9d2d0dc2..1ade0aef 100644 --- a/src/app/shared/index.ts +++ b/src/app/shared/index.ts @@ -22,6 +22,7 @@ export * from './components/dict-select/index'; // Utils export * from './utils'; export * from './services'; +export * from './pipes'; // Module export * from './shared.module'; diff --git a/src/app/shared/pipes/index.ts b/src/app/shared/pipes/index.ts new file mode 100644 index 00000000..08d84320 --- /dev/null +++ b/src/app/shared/pipes/index.ts @@ -0,0 +1,2 @@ +export * from './pipe.module'; +export * from './trushtml.pipe'; \ No newline at end of file diff --git a/src/app/shared/pipes/pipe.module.ts b/src/app/shared/pipes/pipe.module.ts new file mode 100644 index 00000000..d808239c --- /dev/null +++ b/src/app/shared/pipes/pipe.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { TrushtmlPipe } from './trushtml.pipe'; + +@NgModule({ + declarations: [TrushtmlPipe], + imports: [CommonModule], + exports: [TrushtmlPipe] +}) +export class PipeModule {} diff --git a/src/app/shared/pipes/trushtml.pipe.ts b/src/app/shared/pipes/trushtml.pipe.ts new file mode 100644 index 00000000..73b48359 --- /dev/null +++ b/src/app/shared/pipes/trushtml.pipe.ts @@ -0,0 +1,28 @@ +/* + * @Description: + * @Author: wsm + * @Date: 2021-06-23 17:02:20 + * @LastEditTime: 2021-06-23 17:04:57 + * @LastEditors: wsm + * @Reference: + */ +import { Pipe, PipeTransform } from '@angular/core'; +import { DomSanitizer } from '@angular/platform-browser'; + +@Pipe({ + name: 'safehtml', +}) +export class TrushtmlPipe implements PipeTransform { + constructor(private sanitizer: DomSanitizer) {} + + transform(value: any, args?: any): any { + try { + if (!value || value === '') { + return ''; + } + return this.sanitizer.bypassSecurityTrustHtml(value); + } catch (e) { + return ''; + } + } +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index e77a54ec..1bfce680 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -30,6 +30,7 @@ import { LogisticsTimeLineComponent } from './components/logistics-time-line/log import { AmapModule } from './components/amap/amap.module'; import { ImageListModule } from './components/imagelist'; import { DictSelectComponent } from './components/dict-select'; +import { PipeModule } from './pipes'; const MODULES = [ AddressModule, @@ -43,6 +44,7 @@ const MODULES = [ SharedThirdModule, AmapModule, ImageListModule, + PipeModule, ...PRO_SHARED_MODULES ]; // #endregion diff --git a/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.html b/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.html new file mode 100644 index 00000000..12b29e22 --- /dev/null +++ b/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.html @@ -0,0 +1,11 @@ + +
+ + + - + + +
+
\ No newline at end of file diff --git a/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.less b/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.less new file mode 100644 index 00000000..e69de29b diff --git a/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.ts b/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.ts new file mode 100644 index 00000000..d98058d5 --- /dev/null +++ b/src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget.ts @@ -0,0 +1,46 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { FormGroup, Validators } from '@angular/forms'; +import { ControlWidget } from '@delon/form'; +import { _HttpClient } from '@delon/theme'; +import differenceInCalendarDays from 'date-fns/differenceInCalendarDays'; +import setHours from 'date-fns/setHours'; +import { DisabledTimeFn, DisabledTimePartial } from 'ng-zorro-antd/date-picker'; +@Component({ + selector: 'sf-item-date', + templateUrl: './sl-form-item-date.widget.html', + styleUrls: ['./sl-form-item-date.widget.less'] +}) +export class SFItemDateWidget extends ControlWidget implements OnInit { + /* 用于注册小部件 KEY 值 */ + static readonly KEY = 'item-date'; + + // 组件所需要的参数,建议使用 `ngOnInit` 获取 + format: any; + placeholder: string = ''; + nzShowTime = false; + + data: any = { + start: null, + end: null + }; + + ngOnInit(): void { + this.format = this.ui.format || 'yyyy-mm-dd'; + this.placeholder = this.ui.placeholder || ''; + this.nzShowTime = this.ui.nzShowTime || false; + this.data = this.value; + } + + // reset 可以更好的解决表单重置过程中所需要的新数据问题 + reset(value: string) {} + + change(value: Date, key: string) { + if (this.data) { + this.data[key] = value; + } else { + this.data = { [key]: value }; + } + if (this.ui.change) this.ui.change(this.data); + this.setValue(this.data); + } +} diff --git a/src/app/shared/widget/st-widget.module.ts b/src/app/shared/widget/st-widget.module.ts index 634efc46..e619ab77 100644 --- a/src/app/shared/widget/st-widget.module.ts +++ b/src/app/shared/widget/st-widget.module.ts @@ -30,6 +30,7 @@ import { EAFromToWidget } from './from-to/from-to.widget'; import { ImgWidget } from './img/img.widget'; import { NounWidget } from './noun/noun.widget'; import { PropertyValuesWidget } from './property-values/property-values.widget'; +import { SFItemDateWidget } from './sl-form-item-date/sl-form-item-date.widget'; import { SpecValuesWidget } from './spec-values/spec-values.widget'; import { TinymceWidget } from './tinymce/tinymce.widget'; @@ -43,7 +44,8 @@ export const STWIDGET_COMPONENTS = [ SpecValuesWidget, PropertyValuesWidget, SLFromToSearchWidget, - DictSelectWidget + DictSelectWidget, + SFItemDateWidget ]; @NgModule({ @@ -78,6 +80,7 @@ export class STWidgetModule { widgetRegistry.register(SpecValuesWidget.KEY, SpecValuesWidget); widgetRegistry.register(PropertyValuesWidget.KEY, PropertyValuesWidget); widgetRegistry.register(SLFromToSearchWidget.KEY, SLFromToSearchWidget); - widgetRegistry.register(DictSelectWidget.KEY, DictSelectWidget) + widgetRegistry.register(DictSelectWidget.KEY, DictSelectWidget); + widgetRegistry.register(SFItemDateWidget.KEY, SFItemDateWidget); } } diff --git a/src/assets/mocks/menu-data.json b/src/assets/mocks/menu-data.json index f48b0a8c..fd9f7dbe 100644 --- a/src/assets/mocks/menu-data.json +++ b/src/assets/mocks/menu-data.json @@ -430,7 +430,7 @@ "link": "/system/basic-config" }, { - "text": "系统日志", + "text": "系统操作日志", "link": "/system/system-logs" }, {