From a99a15e570d283b3e1da83b502abcd19691f0dd6 Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Wed, 29 Dec 2021 19:46:29 +0800 Subject: [PATCH] edit --- .../abnormal-gold/abnormal-gold.component.ts | 4 +- .../driver-account-detail.component.ts | 55 ++++---- .../driver-account.component.ts | 6 +- .../freight-account-detail.component.ts | 15 +- .../freight-account.component.ts | 6 +- .../payment-record.component.html | 14 +- .../payment-record.component.ts | 48 ++----- .../recharge-record.component.ts | 4 +- .../transaction-flow.component.ts | 25 +--- .../withdrawals-record.component.html | 2 +- .../withdrawals-record.component.ts | 31 ++-- .../components/index/index.component.html | 5 + .../components/index/index.component.less | 16 +++ .../components/index/index.component.spec.ts | 23 +++ .../components/index/index.component.ts | 120 ++++++++++++++++ .../menu-manager-routing.module.ts | 14 ++ .../menu-manager/menu-manager.module.ts | 12 ++ .../services/menu-manager.service.ts | 23 +++ .../menu-manager/services/user.service.ts | 132 ++++++++++++++++++ src/app/routes/routes-routing.module.ts | 1 + 20 files changed, 425 insertions(+), 131 deletions(-) create mode 100644 src/app/routes/menu-manager/components/index/index.component.html create mode 100644 src/app/routes/menu-manager/components/index/index.component.less create mode 100644 src/app/routes/menu-manager/components/index/index.component.spec.ts create mode 100644 src/app/routes/menu-manager/components/index/index.component.ts create mode 100644 src/app/routes/menu-manager/menu-manager-routing.module.ts create mode 100644 src/app/routes/menu-manager/menu-manager.module.ts create mode 100644 src/app/routes/menu-manager/services/menu-manager.service.ts create mode 100644 src/app/routes/menu-manager/services/user.service.ts diff --git a/src/app/routes/financial-management/components/abnormal-gold/abnormal-gold.component.ts b/src/app/routes/financial-management/components/abnormal-gold/abnormal-gold.component.ts index bffc7231..73497225 100644 --- a/src/app/routes/financial-management/components/abnormal-gold/abnormal-gold.component.ts +++ b/src/app/routes/financial-management/components/abnormal-gold/abnormal-gold.component.ts @@ -83,7 +83,7 @@ export class AbnormalGoldComponent implements OnInit { placeholder: '请输入' } }, - ltdid: { + ltdId: { type: 'string', title: '网络货运人', ui: { @@ -157,7 +157,7 @@ export class AbnormalGoldComponent implements OnInit { private initST(): STColumn[] { return [ { title: '银行流水号', index: 'paySerialNumber', width: 150 }, - { title: '网络货运人', index: 'ltdid', width: 120 }, + { title: '网络货运人', index: 'ltdId', width: 120 }, { title: '银行类型', index: 'callNo', width: 100, type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } }, { title: '资金总账号', index: 'callNo', width: 120 }, { title: '充值金额', index: 'rechargeAmount', width: 100 }, 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 a85e6f86..7378bcc2 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 @@ -32,24 +32,28 @@ export class DriverAccountDetailComponent implements OnInit { beforeReq = (requestOptions: STRequestOptions) => { Object.assign(requestOptions.body, { - ltdid: this.params.ltdid, + ltdId: this.params.ltdId, projectId: this.params.projectId, enterpriseId: this.params.enterpriseId, roleId: this.params.roleId }); if (this.sf) { - Object.assign(requestOptions.body, { ...this.sf.value }); + Object.assign(requestOptions.body, { + ...this.sf.value, + createTime: { + start: this.sf.value?.createTime?.[0] || null, + end: this.sf.value?.createTime?.[1] || null + } + }); } return requestOptions; }; loadInfo() { - console.log(1); - this.service .request(this.service.$api_get_driver_account_balance_detail, { ...this.sf?.value, - ltdid: this.params.ltdid, + ltdId: this.params.ltdId, projectId: this.params.projectId, enterpriseId: this.params.enterpriseId, roleId: this.params.roleId, @@ -114,33 +118,26 @@ export class DriverAccountDetailComponent implements OnInit { nzShowTime: true } 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: '资金回收' } - ], ui: { - widget: 'select', + widget: 'dict-select', + params: { dictKey: 'trade:type' }, placeholder: '请选择', visibleIf: { expand: (value: boolean) => value @@ -148,16 +145,12 @@ export class DriverAccountDetailComponent implements OnInit { }, default: '' }, - receiveName2: { + incomeType: { type: 'string', title: '收支类型', - enum: [ - { label: '全部', value: '' }, - { label: '收入', value: '收入' }, - { label: '支出', value: '支出' } - ], ui: { - widget: 'select', + widget: 'dict-select', + params: { dictKey: 'income:type' }, placeholder: '请选择', visibleIf: { expand: (value: boolean) => value @@ -171,13 +164,13 @@ export class DriverAccountDetailComponent 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: 'createTime', type: 'date' }, + { title: '流水号', index: 'channelPaySn' }, + { title: '交易类型', index: 'tradeTypeLabel' }, + { title: '关联单号', index: 'businessNumber' }, + { title: '收支类型', index: 'incomeTypeLabel' }, + { title: '交易金额', index: 'amount' }, + { title: '账户余额', index: 'accountBalance' } ]; } } diff --git a/src/app/routes/financial-management/components/driver-account/driver-account.component.ts b/src/app/routes/financial-management/components/driver-account/driver-account.component.ts index 45bc7f8f..b91fc0e3 100644 --- a/src/app/routes/financial-management/components/driver-account/driver-account.component.ts +++ b/src/app/routes/financial-management/components/driver-account/driver-account.component.ts @@ -78,7 +78,7 @@ export class DriverAccountComponent implements OnInit { placeholder: '请输入' } }, - ltdid: { + ltdId: { type: 'string', title: '网络货运人', ui: { @@ -144,7 +144,7 @@ export class DriverAccountComponent implements OnInit { { title: '证件号码', index: 'idNo' }, { title: '手机号', index: 'phone' }, { title: '网络货运人', index: 'ltdName' }, - { title: '银行类型', index: 'bankType', type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } }, + { title: '银行类型', index: 'bankTypeLabel' }, { title: '虚拟账户', index: 'virtualAccount' }, { title: '可用余额', index: 'availableBalance' }, { title: '冻结余额', index: 'freezeBalance' }, @@ -167,7 +167,7 @@ export class DriverAccountComponent implements OnInit { availableBalance: item.availableBalance, enterpriseId: item.enterpriseId, roleId: item.roleId, - ltdid: item.ltdid + ltdId: item.ltdId } }) } 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 297eb0f9..ad81cea6 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 @@ -32,7 +32,7 @@ export class FreightAccountDetailComponent implements OnInit { beforeReq = (requestOptions: STRequestOptions) => { Object.assign(requestOptions.body, { - ltdid: this.params.ltdid, + ltdId: this.params.ltdId, projectId: this.params.projectId, enterpriseId: this.params.enterpriseId, roleId: this.params.roleId @@ -53,7 +53,7 @@ export class FreightAccountDetailComponent implements OnInit { this.service .request(this.service.$api_get_shipper_account_balance_detail, { ...this.sf?.value, - ltdid: this.params.ltdid, + ltdId: this.params.ltdId, projectId: this.params.projectId, enterpriseId: this.params.enterpriseId, roleId: this.params.roleId, @@ -188,17 +188,12 @@ export class FreightAccountDetailComponent implements OnInit { private initST(): STColumn[] { return [ - { title: '交易时间', index: 'updatedAt', type: 'date' }, + { title: '交易时间', index: 'createTime', type: 'date' }, { title: '流水号', index: 'transactionNumber' }, - { - title: '交易类型', - index: 'tradeType', - type: 'enum', - enum: { 1: '整车订单退款', 2: '整车订单支付', 3: '提现失败退回', 4: '提现', 5: '充值', 6: '运货订单结算' } - }, + { title: '交易类型', index: 'tradeTypeLabel' }, { title: '关联单号', index: 'businessNumber' }, { title: '所属项目', index: 'projectId' }, - { title: '收支类型', index: 'incomeType', type: 'enum', enum: { 1: '收入', 2: '支出' } }, + { title: '收支类型', index: 'incomeTypeLabel' }, { title: '交易金额', index: 'amount' }, { title: '账户余额', index: 'accountBalance' } ]; diff --git a/src/app/routes/financial-management/components/freight-account/freight-account.component.ts b/src/app/routes/financial-management/components/freight-account/freight-account.component.ts index 0dd6edd7..cf0093f5 100644 --- a/src/app/routes/financial-management/components/freight-account/freight-account.component.ts +++ b/src/app/routes/financial-management/components/freight-account/freight-account.component.ts @@ -82,7 +82,7 @@ export class FreightAccountComponent implements OnInit { placeholder: '请输入' } }, - ltdid: { + ltdId: { type: 'string', title: '网络货运人', ui: { @@ -144,7 +144,7 @@ export class FreightAccountComponent implements OnInit { { title: '联系人', index: 'name' }, { title: '联系人电话', index: 'phone' }, { title: '网络货运人', index: 'ltdName' }, - { title: '银行类型', index: 'bankType', type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } }, + { title: '银行类型', index: 'bankTypeLabel' }, { title: '虚拟账户', index: 'virtualAccount' }, { title: '可用余额', index: 'availableBalance' }, { title: '冻结余额', index: 'freezeBalance' }, @@ -172,7 +172,7 @@ export class FreightAccountComponent implements OnInit { projectId: item.projectId, enterpriseId: item.enterpriseId, roleId: item.roleId, - ltdid: item.ltdid + ltdId: item.ltdId } }) } diff --git a/src/app/routes/financial-management/components/payment-record/payment-record.component.html b/src/app/routes/financial-management/components/payment-record/payment-record.component.html index 93435deb..6497f658 100644 --- a/src/app/routes/financial-management/components/payment-record/payment-record.component.html +++ b/src/app/routes/financial-management/components/payment-record/payment-record.component.html @@ -24,10 +24,10 @@ - - - - + + + + - {{ item.orderPaymentCode }}
{{ paymentStatusEm[item.paymentStatus] }} + {{ item.orderPaymentCode }}
{{ item.paymentStatusLabel }}
预付:¥{{ item.price }}
附加费:¥ {{ item.surcharge }}
- {{ item.billCode }}
{{billStatus[item.billStatus] }} + {{ item.billCode }}
{{item.billStatusLabel }}
- {{ item.wayBillCode }}
{{wayBillStatus[item.wayBillStatus ] }} + {{ item.wayBillCode }}
{{item.wayBillStatusLabel }}
{{ item.driverName }}
{{ item.driverTelephone }}
{{ item.driverLicensePlate }} diff --git a/src/app/routes/financial-management/components/payment-record/payment-record.component.ts b/src/app/routes/financial-management/components/payment-record/payment-record.component.ts index 52b88b56..203c5498 100644 --- a/src/app/routes/financial-management/components/payment-record/payment-record.component.ts +++ b/src/app/routes/financial-management/components/payment-record/payment-record.component.ts @@ -23,30 +23,6 @@ export class PaymentRecordComponent implements OnInit { paymentStatus: any = ''; - paymentStatusEm: any = { - 0: '待支付', - 1: '已支付', - 2: '已拒绝', - 3: '支付中', - 4: '支付失败' - }; - billStatus: any = { - 1: '待接单', - 2: '待发车', - 3: '运输中', - 4: '待签收', - 5: '已完成', - 6: '已取消' - }; - wayBillStatus: any = { - 1: '待接单', - 2: '待发车', - 3: '运输中', - 4: '待签收', - 5: '已完成', - 6: '已取消' - }; - constructor(public service: FreightAccountService, private nzModalService: NzModalService, private router: Router) {} ngOnInit(): void {} @@ -56,14 +32,14 @@ export class PaymentRecordComponent implements OnInit { Object.assign(requestOptions.body, { ...this.sf.value, applyDate: { - start: this.sf.value.applyDate?.[0] || null, - end: this.sf.value.applyDate?.[1] || null + start: this.sf.value.applyDate?.[0] || '', + end: this.sf.value.applyDate?.[1] || '' }, handlerDate: { - start: this.sf.value.handlerDate?.[0] || null, - end: this.sf.value.handlerDate?.[1] || null + start: this.sf.value.handlerDate?.[0] || '', + end: this.sf.value.handlerDate?.[1] || '' }, - paymentStatus: this.paymentStatus || '' + paymentStatus: this.paymentStatus || null }); } return requestOptions; @@ -243,7 +219,7 @@ export class PaymentRecordComponent implements OnInit { }, default: '' }, - ltdid: { + ltdId: { type: 'string', title: '网络货运人', ui: { @@ -280,10 +256,8 @@ export class PaymentRecordComponent implements OnInit { }, { title: '支付类型', - index: 'payType', - width: 130, - type: 'enum', - enum: { 1: '货主支付平台', 2: '平台支付司机', 3: '司机支付车队长' } + index: 'payTypeLabel', + width: 130 }, { title: '货主', index: 'enterpriseInfoName', width: 100 }, { title: '订单号', render: 'billCode', width: 120 }, @@ -291,10 +265,8 @@ export class PaymentRecordComponent implements OnInit { { title: '货源编号', index: 'resourceCode', width: 120 }, { title: '服务类型', - index: 'serviceType', - width: 150, - type: 'enum', - enum: { '1': '抢单', '2': '指派', '3': '二维码', '4': '手工单' } + index: 'serviceTypeLabel', + width: 150 }, { title: '承运司机', render: 'driverId', width: 120 }, { title: '收款人', render: 'captainName', width: 120 }, diff --git a/src/app/routes/financial-management/components/recharge-record/recharge-record.component.ts b/src/app/routes/financial-management/components/recharge-record/recharge-record.component.ts index 1c1c9d6f..2a0d80fe 100644 --- a/src/app/routes/financial-management/components/recharge-record/recharge-record.component.ts +++ b/src/app/routes/financial-management/components/recharge-record/recharge-record.component.ts @@ -121,7 +121,7 @@ export class RechargeRecordComponent implements OnInit { }, default: '' }, - ltdid: { + ltdId: { type: 'string', title: '网络货运人', ui: { @@ -159,7 +159,7 @@ export class RechargeRecordComponent implements OnInit { return [ { title: '充值时间', index: 'createTime', type: 'date' }, { title: '充值单号', index: 'rechargeNo' }, - { title: '网络货运人', index: 'ltdid' }, + { title: '网络货运人', index: 'ltdId' }, { title: '银行类型', index: 'bankType', type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } }, { title: '账户类型', index: 'accountType', type: 'enum', enum: { 1: '平安银行', 2: '浦发银行', 3: '运营商账户' } }, { title: '账户名称', index: 'rechargeName' }, diff --git a/src/app/routes/financial-management/components/transaction-flow/transaction-flow.component.ts b/src/app/routes/financial-management/components/transaction-flow/transaction-flow.component.ts index 90c6bfe7..538d5a80 100644 --- a/src/app/routes/financial-management/components/transaction-flow/transaction-flow.component.ts +++ b/src/app/routes/financial-management/components/transaction-flow/transaction-flow.component.ts @@ -186,7 +186,7 @@ export class TransactionFlowComponent implements OnInit { }, default: '' }, - ltdid: { + ltdId: { type: 'string', title: '网络货运人', ui: { @@ -208,33 +208,16 @@ export class TransactionFlowComponent implements OnInit { return [ { title: '交易时间', index: 'createTime', width: 150 }, { title: '流水号', index: 'transactionNumber', width: 150 }, - { - title: '交易类型', - index: 'tradeType', - width: 100, - type: 'enum', - enum: { - 1: '运费支付', - 2: '附加费支付', - 3: '运费退款', - 4: '附加费退款', - 5: '保费支付', - 6: '保费退款', - 7: '余额充值', - 8: '余额提现', - 9: '资金分配', - 10: '资金回收' - } - }, + { title: '交易类型', index: 'tradeTypeLabel', width: 100 }, { title: '关联单号', index: 'businessNumber', width: 150 }, { title: '账户类型', index: 'channelSource', width: 100, enum: { 1: '货主端', 2: '司机端', 3: '运营平台' } }, { title: '账户名称', index: 'driverName', width: 100 }, { title: '所属项目', index: 'projectName', width: 100 }, - { title: '收支类型', index: 'incomeType', width: 100, type: 'enum', enum: { 1: '收入', 2: '支出' } }, + { title: '收支类型', index: 'incomeTypeLabel', width: 100 }, { title: '交易金额', index: 'amount', width: 100 }, { title: '账户余额', index: 'accountBalance', width: 100 }, { title: '网络货运人', index: 'ltdName', width: 120 }, - { title: '银行类型', index: 'bankType', width: 100, type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } }, + { title: '银行类型', index: 'bankTypeLabel', width: 100 }, { title: '银行流水号', index: 'channelPaySn', width: 120 }, { title: '操作', diff --git a/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.html b/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.html index 4cd6d4ca..8a471bb4 100644 --- a/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.html +++ b/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.html @@ -67,7 +67,7 @@ diff --git a/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.ts b/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.ts index d82a0bd7..e039ff40 100644 --- a/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.ts +++ b/src/app/routes/financial-management/components/withdrawals-record/withdrawals-record.component.ts @@ -45,6 +45,11 @@ export class WithdrawalsRecordComponent implements OnInit { return requestOptions; }; + afterRes = (data: any[], rawData?: any) => { + data = data.map(node => ({ ...node, disabled: node.refundStatus !== '1' })); + return data; + }; + stChange(e: STChange): void { switch (e.type) { case 'checkbox': @@ -61,8 +66,11 @@ export class WithdrawalsRecordComponent implements OnInit { auditAction(item?: any) { this.msg = ''; - if(!item){ - + let params: Array = []; + if (item) { + params = [item.id]; + } else { + params = this.selectedRows.map(node => node.id); } const modal = this.nzModalService.create({ nzTitle: '审核', @@ -74,13 +82,14 @@ export class WithdrawalsRecordComponent implements OnInit { onClick: () => { this.service .request(this.service.$api_disagree_refund, { - refundApplicationId: item.id, + refundApplicationId: params, msg: this.msg }) .subscribe(res => { if (res) { this.service.msgSrv.success('审核拒绝成功'); modal.destroy(); + this.st.load(1); } }); } @@ -91,13 +100,14 @@ export class WithdrawalsRecordComponent implements OnInit { onClick: () => { this.service .request(this.service.$api_agree_refund, { - refundApplicationId: item.id, + refundApplicationId: params, msg: this.msg }) .subscribe(res => { if (res) { this.service.msgSrv.success('审核通过成功'); modal.destroy(); + this.st.load(1); } }); } @@ -198,7 +208,7 @@ export class WithdrawalsRecordComponent implements OnInit { } } }, - ltdid: { + ltdId: { type: 'string', title: '网络货运人', ui: { @@ -233,23 +243,18 @@ export class WithdrawalsRecordComponent implements OnInit { { title: '提现时间', index: 'createTime', width: 180 }, { title: '提现单号', index: 'refundApplyCode', width: 120 }, { title: '网络货运人', index: 'ltdname', width: 120 }, - { title: '银行类型', index: 'bankType', type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' }, width: 100 }, + { title: '银行类型', index: 'bankTypeLabel', width: 100 }, { title: '账户类型', index: 'callNo', width: 100 }, { title: '账户名称', index: 'callNo', width: 100 }, { title: '虚拟账户', index: 'virtualAccount', width: 100 }, { title: '提现金额', index: 'amount', width: 100 }, { title: '提现银行账户', render: 'bankCardNumber', width: 120 }, - { - title: '提现状态', - index: 'refundStatus', - type: 'enum', - enum: { '1': '待审核', '2': '提现中', '3': '提现成功', '4': '拒绝提现', '5': '提现失败' }, - width: 100 - }, + { title: '提现状态', index: 'refundStatusLabel', width: 100 }, { title: '银行流水号', index: 'bankSerialNumber', width: 120 }, { title: '失败原因', index: 'failCause', width: 150 }, { title: '操作', + width: 120, buttons: [ { text: '审核', diff --git a/src/app/routes/menu-manager/components/index/index.component.html b/src/app/routes/menu-manager/components/index/index.component.html new file mode 100644 index 00000000..0f8d5bc5 --- /dev/null +++ b/src/app/routes/menu-manager/components/index/index.component.html @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/src/app/routes/menu-manager/components/index/index.component.less b/src/app/routes/menu-manager/components/index/index.component.less new file mode 100644 index 00000000..c801e37d --- /dev/null +++ b/src/app/routes/menu-manager/components/index/index.component.less @@ -0,0 +1,16 @@ +:host { + ::ng-deep { + .pane-content-left { + padding-right: 12px; + + nz-select { + width: 100%; + margin-bottom: 1rem; + border-bottom: 2px solid #15408e; + } + } + .pane-content-right { + padding-left: 12px; + } + } +} diff --git a/src/app/routes/menu-manager/components/index/index.component.spec.ts b/src/app/routes/menu-manager/components/index/index.component.spec.ts new file mode 100644 index 00000000..b359c299 --- /dev/null +++ b/src/app/routes/menu-manager/components/index/index.component.spec.ts @@ -0,0 +1,23 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { MenuManagerComponentsIndexComponent } from './index.component'; + +describe('MenuManagerComponentsIndexComponent', () => { + let component: MenuManagerComponentsIndexComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [MenuManagerComponentsIndexComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MenuManagerComponentsIndexComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/menu-manager/components/index/index.component.ts b/src/app/routes/menu-manager/components/index/index.component.ts new file mode 100644 index 00000000..bd1c0f33 --- /dev/null +++ b/src/app/routes/menu-manager/components/index/index.component.ts @@ -0,0 +1,120 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { Menu } from '@delon/theme'; +import { NzModalService } from 'ng-zorro-antd/modal'; +import { MenuManagerService } from './../../services/menu-manager.service'; + +@Component({ + selector: 'app-menu-manager-components-index', + templateUrl: './index.component.html', + styleUrls: ['./index.component.less'], +}) +export class MenuManagerComponentsIndexComponent implements OnInit { + selectedPlatform!: { name: string; appId: string; enName: string }; + menus: Array = []; + platforms: Array = []; + currentSelectedNode: any; + transferData!: string; + dropType = { + dropPrev: true, + dropNext: true, + dropInner: true, + }; + constructor(public service: MenuManagerService, private modal: NzModalService) { } + + ngOnInit(): void { + this.initData(); + } + + initData(): void { + this.platforms = [ + { name: '运维平台', appId: 'D40B4EFC33FC4803864934872A11B0CE', enName: 'scm-soc-ui' }, + { name: '运营后台', appId: '2537B72DDA534361AE4931903F0BFEB3', enName: 'scm-ows-ui' }, + { name: '供应商平台', appId: '0CEE254099064665872B777CF9FCBB6B', enName: 'scm-cvc-ui' }, + // { name: '代理商平台', appId: '737BB699C8894B2D81F21FC667A21169', enName: 'scm-cac-ui' }, + // { name: '分销商平台', appId: '0D00C7CC306A4CACA5AF95BBD1251980', enName: 'scm-cdc-ui' }, + // { name: '开放平台', appId: '7B216DD933CB4922BD9094ED8F96B0B4', enName: 'scm-opc-ui' }, + ]; + } + + platformChange(e: { name: string; appId: string }) { + if (e) { + this.loadMenus(e.appId); + } else { + this.menus = []; + this.currentSelectedNode = null; + } + } + + loadMenus(appId: string) { + this.service.request(this.service.$api_get_all, { appId }, 'POST', true, 'FORM').subscribe((res) => { + this.menus = res; + }); + } + + + editValueChange(event: any) { + console.log('editChanged', event); + } + + + menuImport() { + if (!this.selectedPlatform) { + return; + } + + this.service.http.request('GET', `assets/tmp/_mock/platform/${this.selectedPlatform.enName}.json`).subscribe((res: any) => { + // console.log(res); + this.addMenu(res.menu); + }); + } + + addMenu(menus: Array, parentId: string = '') { + menus.forEach((r) => { + if (parentId !== '') { + r.parentId = parentId; + } + this.service.request(this.service.$api_get_one, { appId: this.selectedPlatform.appId, i18n: r.i18n }).subscribe((res) => { + // 如果res.data存在,则更新菜单 + if (res.data) { + r.id = res.data.id; + } + this.service + .addOne({ appId: this.selectedPlatform.appId, ...r, isLeaf: !(r.children && r.children.length > 0) }) + .subscribe((result) => { + if (result) { + if (r.children && r.children.length > 0) { + this.addMenu(r.children, result.id); + } + } + }); + }); + }); + + this.loadMenus(this.selectedPlatform.appId); + } + + addMenuRecursion() { + + } + + delMenu(appId: string, menus: Array) { + if (!menus || menus.length === 0) { + return; + } + let notice = `确认删除菜单[${menus[0].text}]?`; + if (menus.length > 1) { + notice = `确认删除勾选的${menus.length}行菜单记录?`; + } + const ids = menus.map((r) => r.id); + this.modal.confirm({ + nzTitle: '删除确认', + nzContent: `${notice}
是否删除?`, + nzOnOk: () => + this.service.delMany(ids).subscribe((res) => { + if (res === true) { + this.service.msgSrv.success('删除成功!'); + } + }), + }); + } +} diff --git a/src/app/routes/menu-manager/menu-manager-routing.module.ts b/src/app/routes/menu-manager/menu-manager-routing.module.ts new file mode 100644 index 00000000..d03e89c2 --- /dev/null +++ b/src/app/routes/menu-manager/menu-manager-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { MenuManagerComponentsIndexComponent } from './components/index/index.component'; + +const routes: Routes = [ + { path: '', redirectTo: 'index', pathMatch: 'full' }, + { path: 'index', component: MenuManagerComponentsIndexComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class MenuManagerRoutingModule {} diff --git a/src/app/routes/menu-manager/menu-manager.module.ts b/src/app/routes/menu-manager/menu-manager.module.ts new file mode 100644 index 00000000..8c73d083 --- /dev/null +++ b/src/app/routes/menu-manager/menu-manager.module.ts @@ -0,0 +1,12 @@ +import { NgModule, Type } from '@angular/core'; +import { SharedModule } from '@shared'; +import { MenuManagerComponentsIndexComponent } from './components/index/index.component'; +import { MenuManagerRoutingModule } from './menu-manager-routing.module'; + +const COMPONENTS: Type[] = [MenuManagerComponentsIndexComponent]; +const COMPONENTS_NOROUNT: Type[] = []; +@NgModule({ + imports: [SharedModule, MenuManagerRoutingModule], + declarations: [...COMPONENTS, ...COMPONENTS_NOROUNT] +}) +export class MenuManagerModule {} diff --git a/src/app/routes/menu-manager/services/menu-manager.service.ts b/src/app/routes/menu-manager/services/menu-manager.service.ts new file mode 100644 index 00000000..11898dd0 --- /dev/null +++ b/src/app/routes/menu-manager/services/menu-manager.service.ts @@ -0,0 +1,23 @@ +import { Injectable, Injector } from '@angular/core'; +import { BaseService } from '@shared'; + +@Injectable({ + providedIn: 'root', +}) +export class MenuManagerService extends BaseService { + // 新增/更新菜单 + $api_add_one = `/scm/cuc/cuc/functionInfo/saveFunctionInfo`; + + // 根据应用ID获取所有菜单 + $api_get_all = `/scm/cuc/cuc/functionInfo/getAllFunctionInfoByAppId`; + + // 根据i18n和应用ID获取菜单 + $api_get_one = `/scm/cuc/cuc/functionInfo/getFunctionsInfoByI18n?_allow_badcode=true`; + + // 删除多个菜单 + $api_del_many = `/scm/cuc/cuc/functionInfo/deletebatchFunctionInfo`; + + constructor(public injector: Injector) { + super(injector); + } +} diff --git a/src/app/routes/menu-manager/services/user.service.ts b/src/app/routes/menu-manager/services/user.service.ts new file mode 100644 index 00000000..2fc688ac --- /dev/null +++ b/src/app/routes/menu-manager/services/user.service.ts @@ -0,0 +1,132 @@ +import { Injectable, Injector } from '@angular/core'; +import { BaseService } from '@shared'; +@Injectable({ + providedIn: 'root', +}) +export class UserService extends BaseService { + // 保存单个实例接口地址 + $api_save_one = '/tms/cuc/oaUserHarvestAddress/save'; + // 保存多个实例接口地址 + $api_save_many = ''; + // 删除一个实例接口地址 + $api_del_one = ''; + // 删除多个实例接口地址 + $api_del_many = '/tms/cuc/oaUserHarvestAddress/deletebatch'; + // 获取单个实例接口地址 + $api_get_one = '/bcp/cuc/cuc/userInfo/getUserDetailByUserId'; + // 获取多个实例接口地址 + $api_get_many = ''; + // 获取实例分页数据接口地址 + $api_get_page = '/bcp/cuc/cuc/userInfo/getUserInfoListPage'; + // 导出接口地址 + $api_export = '/bcp/cuc/cuc/userInfo/exportUserList'; + // 导入接口地址 + $api_import = ''; + // 导入模板下载地址 + $api_import_download_tpl = ''; + // 获取项目列表 + $api_getProjectInfoList = '/scm/cuc/cuc/projectInfo/getProjectInfoList'; + // 根据项目获取应用列表 + $api_getAppInfoListByProjectId = '/scm/cuc/cuc/appInfo/getAppInfoListByProjectId'; + // 根据应用获取菜单列表 + $api_getAllFunctionInfoByAppId = '/scm/cuc/cuc/functionInfo/getAllFunctionInfoByAppId'; + // 获取菜单已拥有的按钮 + $api_getFunctionButtonInfo = '/scm/cuc/cuc/functionButton/getFunctionButtonInfo'; + // 获取菜单已拥有的数据字典 + $api_getFunctionDataInfo = '/scm/cuc/cuc/functionData/getFunctionDataInfo'; + // 获取所有按钮 + $api_getButtonInfoList = '/scm/cuc/cuc/buttonInfo/getButtonInfoList'; + // 获取按钮列表 + $api_getButtonInfoPage = '/scm/cuc/cuc/buttonInfo/getButtonInfoPage'; + // 新增编辑按钮信息 + $api_saveButtonInfo = '/scm/cuc/cuc/buttonInfo/saveButtonInfo'; + // 查看菜单信息 + $api_getFunctionInfo = '/scm/cuc/cuc/functionInfo/getFunctionInfo'; + + // 删除 + $api_deletebatchButton = '/scm/cuc/cuc/buttonInfo/deletebatchButton'; + // 新增 and 编辑 + $api_saveFunctionInfo = '/scm/cuc/cuc/functionInfo/saveFunctionInfo'; + // 删除菜单(含多个) + $api_deletebatchFunctionInfo = '/scm/cuc/cuc/functionInfo/deletebatchFunctionInfo'; + // 字典列表 + $api_getDictTree = '/scce/pbc/pbc/dict/getDictTree'; + // 删除字典 + $api_delete = '/scce/pbc/pbc/dict/delete'; + // 删除字典选项 + $api_deleteById = '/scce/pbc/pbc/dictItems/deleteById'; + // 字典详情 + $api_getDictItemsByDictId = '/scce/pbc/pbc/dictItems/getDictItemsByDictId'; + // 编辑字典 + $api_dictUpdate = '/scce/pbc/pbc/dict/update'; + // 新增字典 + $api_dictSave = '/scce/pbc/pbc/dict/save'; + // 编辑字典选项 + $api_dictItemsUpdate = '/scce/pbc/pbc/dictItems/update'; + // 新增字典选项 + $api_dictItemsSave = '/scce/pbc/pbc/dictItems/save'; + // 角色模板列表查询 + $api_getRoleTemplateInfoList = '/scm/cuc/cuc/roleTemplateInfo/getRoleTemplateInfoList'; + // 删除角色模板(含多个) + $api_removeRoleTemplateInfo = '/scm/cuc/cuc/roleTemplateInfo/removeRoleTemplateInfo'; + // 编辑角色模板信息 + $api_updateRoleTemplateInfo = '/scm/cuc/cuc/roleTemplateInfo/updateRoleTemplateInfo'; + // 获取角色详情 + $api_getRoleInfo = '/scm/cuc/cuc/roleInfo/getRoleInfo'; + // 角色列表 + $api_getAppRoleInfoList = '/scm/cuc/cuc/roleInfo/getAppRoleInfoList'; + // 删除角色 + $api_removeRoleInfo = '/scm/cuc/cuc/roleInfo/removeRoleInfo'; + // 编辑角色 + $api_updateRoleInfo = '/scm/cuc/cuc/roleInfo/updateRoleInfo'; + // 获取角色模板详情 + $api_getRoleTemplateInfo = '/scm/cuc/cuc/roleTemplateInfo/getRoleTemplateInfo'; + // 获取角色模板权限 + $api_getRoleTemplateAuthority = '/scm/cuc/cuc/roleTemplateInfo/getRoleTemplateAuthority'; + // 角色菜单下已拥有按钮权限 + $api_getRoleFunctionButtonAuthority = '/scm/cuc/cuc/roleAuthority/getRoleFunctionButtonAuthority'; + // 角色菜单下已拥有数据权限 + $api_getRoleFunctionDataAuthorit = '/scm/cuc/cuc/roleAuthority/getRoleFunctionDataAuthority'; + // 用户角色关系列表 + $api_getUserRoleList = '/scm/cuc/cuc/userAuthority/getUserRoleList'; + // 删除用户角色关系列表 + $api_deleteUserAuthority = '/scm/cuc/cuc/userAuthority/deleteUserAuthority'; + // 用户列表 + $api_getUserListPage = '/scm/cuc/cuc/userBasicInfo/getUserListPage'; + // 获取所有应用 + $api_getAppList = '/scm/cuc/cuc/appInfo/getAppList'; + // 用户详情 + $api_getUserInfo = '/scm/cuc/cuc/userBasicInfo/getUserInfo'; + // 获取用户下所有应用 + $api_getAppInfoByUserId = '/scm/cuc/cuc/userApp/getAppInfoByUserId'; + // 获取用户下所有企业 + $api_getUserEnterpriseList = '/scm/cuc/cuc/userEnterprise/getUserEnterpriseList'; + // 应用用户列表 + $api_getAppUserList = '/scm/cuc/cuc/userApp/getAppUserList'; + // 新增应用用户 + $api_saveAppUser = '/scm/cuc/cuc/userApp/saveAppUser'; + // 编辑应用用户信息 + $api_updateAppUser = '/scm/cuc/cuc/userApp/updateAppUser'; + // 删除应用用户 + $api_deleteAppUser = '/scm/cuc/cuc/userApp/deleteAppUser'; + // 获取应用列表 + $api_getAppListByLesseeId = '/scm/cuc/cuc/appInfo/getAppListByLesseeId'; + // 获取应用用户详情 + $api_getAppUser = '/scm/cuc/cuc/userApp/getAppUser'; + // 重置密码 + $api_resetPw = '/scm/cuc/cuc/userBasicInfo/resetPassword'; + // 冻结或恢复应用用户 + $api_userApp_freezeOrResume = '/scm/cuc/cuc/userApp/freezeOrResume'; + // 新增角色 + $api_roleInfo_saveRoleInfo = '/scm/cuc/cuc/roleInfo/saveRoleInfo'; + // 编辑角色 + $api_roleInfo_updateRoleInfo = '/scm/cuc/cuc/roleInfo/updateRoleInfo'; + // 冻结或恢复角色 + $api_roleInfo_freezeOrResume = '/scm/cuc/cuc/roleInfo/freezeOrResume'; + // 获取角色下用户列表 + $api_getRoleUserList = '/scm/cuc/cuc/userAuthority/getRoleUserList'; + + constructor(public injector: Injector) { + super(injector); + } +} diff --git a/src/app/routes/routes-routing.module.ts b/src/app/routes/routes-routing.module.ts index a9eb13b1..4482f6e1 100644 --- a/src/app/routes/routes-routing.module.ts +++ b/src/app/routes/routes-routing.module.ts @@ -43,6 +43,7 @@ const routes: Routes = [ { path: 'waybill-management', loadChildren: () => import('./waybill-management/waybill-management.module').then((m) => m.WaybillManagementModule) }, { path: 'financial-management', loadChildren: () => import('./financial-management/financial-management.module').then((m) => m.FinancialManagementModule) }, { path: 'contract-management', loadChildren: () => import('./contract-management/contract-management.module').then((m) => m.ContractManagementManagementModule) }, + { path: 'menu-management', loadChildren: () => import('./menu-manager/menu-manager.module').then((m) => m.MenuManagerModule) }, ] }, // passport