From 79ff8ddbd752b8b91b94c584cf77383e4d753d95 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Wed, 19 Jan 2022 11:13:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E6=8E=A5=E5=8F=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../btn-management.component.html | 80 +++++++ .../btn-management.component.less | 13 ++ .../btn-management.component.ts | 199 ++++++++++++++++++ .../sys-setting/services/system.service.ts | 16 +- .../sys-setting/sys-setting-routing.module.ts | 8 +- .../routes/sys-setting/sys-setting.module.ts | 10 +- src/assets/mocks/menu-data.json | 4 + 7 files changed, 320 insertions(+), 10 deletions(-) create mode 100644 src/app/routes/sys-setting/components/close-account copy/btn-management.component.html create mode 100644 src/app/routes/sys-setting/components/close-account copy/btn-management.component.less create mode 100644 src/app/routes/sys-setting/components/close-account copy/btn-management.component.ts diff --git a/src/app/routes/sys-setting/components/close-account copy/btn-management.component.html b/src/app/routes/sys-setting/components/close-account copy/btn-management.component.html new file mode 100644 index 00000000..6bf41320 --- /dev/null +++ b/src/app/routes/sys-setting/components/close-account copy/btn-management.component.html @@ -0,0 +1,80 @@ + + + + + +
+ +
+ +
+ + + +
+ +
+
+ + + + +
+
+
+
+ + +
+
+ +
+
+ + +
+ 客户 + 供应商 +
+
+
+
+ + + + + + + + + + diff --git a/src/app/routes/sys-setting/components/close-account copy/btn-management.component.less b/src/app/routes/sys-setting/components/close-account copy/btn-management.component.less new file mode 100644 index 00000000..04fd4ba3 --- /dev/null +++ b/src/app/routes/sys-setting/components/close-account copy/btn-management.component.less @@ -0,0 +1,13 @@ +:host::ng-deep{ + .search-box{ + .ant-card-body{ + padding-bottom: 18px; + } + } + + .content-box{ + .ant-card-body{ + padding-top: 14px; + } + } +} \ No newline at end of file diff --git a/src/app/routes/sys-setting/components/close-account copy/btn-management.component.ts b/src/app/routes/sys-setting/components/close-account copy/btn-management.component.ts new file mode 100644 index 00000000..170758f9 --- /dev/null +++ b/src/app/routes/sys-setting/components/close-account copy/btn-management.component.ts @@ -0,0 +1,199 @@ +import { Component, OnInit, ViewChild, Type } from '@angular/core'; +import { STComponent, STColumn, STChange } from '@delon/abc/st'; +import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; +import { ShipperBaseService } from '@shared'; +import { NzModalService } from 'ng-zorro-antd/modal'; +import { of } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { SystemService } from '../../services/system.service'; + +@Component({ + selector: 'app-sys-setting-components-btn-management', + templateUrl: './btn-management.component.html', + styleUrls: ['./btn-management.component.less'] +}) +export class BtnManagementComponent implements OnInit { + @ViewChild('st', { static: true }) + st!: STComponent; + @ViewChild('sf', { static: false }) sf!: SFComponent; + @ViewChild('sfFre', { static: false }) sfFre!: SFComponent; + ui: SFUISchema = {}; + ui2: SFUISchema = {}; + schema: SFSchema = {}; + addSchema: SFSchema = {}; + _$expand = false; + editText = ''; + formData :any; + isVisible = false; + edit = false; + editId = false; + + columns: STColumn[] = [ + { title: '按钮名称', index: 'name' }, + { title: 'i18n', index: 'i18n' }, + { title: '创建时间', index: 'createTime' }, + { title: '按钮说明', index: 'text' }, + { + title: '操作', + buttons: [ + { + text: '编辑', + click: item => this.roleAction(item, 2) + }, + { + text: '删除', + click: item => this.deleteAction(item) + }, + ] + } + ]; + + selectedRows: any[] = []; + + get reqParams (){ + return { + ...this.sf?.value, + }}; + + constructor( + public service: SystemService, + private nzModalService: NzModalService, + public shipperservice: ShipperBaseService, + ) {} + + ngOnInit(): void { + this.initSF() + this.initSFFre() + } + + stChange(e: STChange): void { + switch (e.type) { + case 'checkbox': + this.selectedRows = e.checkbox!; + break; + case 'filter': + this.st.load(); + break; + } + } + /** + * 伸缩查询条件 + */ + expandToggle(): void { + this._$expand = !this._$expand; + this.sf?.setValue('/_$expand', this._$expand); + } + /** + * 查询字段个数 + */ + get queryFieldCount(): number { + return Object.keys(this.schema?.properties || {}).length; + } + initSF(){ + this.schema = { + properties: { + _$expand: { type: 'boolean', ui: { hidden: true } }, + name: { + type: 'string', + title: '按钮名称', + ui: { placeholder: '请输入' } + }, + } + + }; + this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } }; + } + initSFFre() { + this.addSchema = { + properties: { + name: { + type: 'string', + title: '按钮名称', + ui: { placeholder: '请输入' } + }, + i18n: { + type: 'string', + title: 'i18n', + ui: { placeholder: '请输入' } + }, + text: { + title: '按钮说明', + type: 'string', + ui: { + placeholder: '请输入', + } + }, + }, + required: ['name', 'i18n', 'text'] + }; +this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } }; +} + roleAction(value: any,item?: any) { + if(item === 1) { + this.edit = false; + this.editText = '新增'; + this.formData = {}; + } else { + this.service.request(this.service.$api_getButtonInfo_one, {id: value.id}).subscribe((res: any) => { + console.log(res) + if(res) { + this.formData = res; + } + }) + this.edit = true; + this.editId = value.id; + this.editText = '编辑'; + } + this.isVisible = true; + } + + deleteAction(item?: any) { + this.nzModalService.error({ + nzTitle: '确认删除?', + nzClosable: false, + nzCancelText: '取消', + nzOnOk: () => { + this.service.request(this.service.$api_deletebatchButton, [item.id]).subscribe(res => { + if (res) { + this.service.msgSrv.success('删除成功!'); + this.st.reload(1) + } + }) + } + }); + } + + /** + * 重置表单 + */ + resetSF() { + this.sf.reset(); + } + handleCancel() { + this.isVisible = false + } + + handleOK() { + console.log(this.sfFre.value) + if(!this.sfFre.valid) { + this.service.msgSrv.warning('请正确填写完整!') + return + } + const params ={ + ...this.sfFre.value + } + if(this.editId) { + params.id = this.editId + } + this.service.request(this.service.$api_saveButtonInfo, params).subscribe((res:any) => { + if(res) { + this.service.msgSrv.success('保存成功!') + this.isVisible = false + this.st.reload(); + } else { + this.service.msgSrv.warning(res?.msg) + + } + }) + } +} diff --git a/src/app/routes/sys-setting/services/system.service.ts b/src/app/routes/sys-setting/services/system.service.ts index 8676b2b8..e9755da6 100644 --- a/src/app/routes/sys-setting/services/system.service.ts +++ b/src/app/routes/sys-setting/services/system.service.ts @@ -1,10 +1,10 @@ /* * @Author: your name * @Date: 2021-12-20 17:18:43 - * @LastEditTime: 2022-01-14 10:57:58 - * @LastEditors: Please set LastEditors + * @LastEditTime : 2022-01-19 11:09:26 + * @LastEditors : Shiming * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - * @FilePath: \tms-obc-web\src\app\routes\sys-setting\services\system.service.ts + * @FilePath : \\tms-obc-web\\src\\app\\routes\\sys-setting\\services\\system.service.ts */ import { Injectable, Injector } from '@angular/core'; import { BaseService } from 'src/app/shared/services'; @@ -133,6 +133,16 @@ export class SystemService extends BaseService { $api_get_region_by_code = '/api/mdc/pbc/region/getRegionByCode'; // 根据地区code查询地区详情 $api_getRegionDetailByCode = '/api/mdc/pbc/region/getRegionDetailByCode'; + + + // 分页查询按钮列表 + $api_getButtonInfoPage = '/api/mdc/cuc/buttonInfo/getButtonInfoPage'; + // 新增编辑按钮信息 + $api_saveButtonInfo = '/api/mdc/cuc/buttonInfo/saveButtonInfo'; + // 获取按钮信息表(id) + $api_getButtonInfo_one = '/api/mdc/cuc/buttonInfo/getButtonInfo'; + // 删除按钮信息(id) + $api_deletebatchButton = '/api/mdc/cuc/buttonInfo/deletebatchButton'; $api_getRoleTemplateInfo: string = ''; $api_getFunctionButtonInfo: string = ''; diff --git a/src/app/routes/sys-setting/sys-setting-routing.module.ts b/src/app/routes/sys-setting/sys-setting-routing.module.ts index c3763507..13e878bb 100644 --- a/src/app/routes/sys-setting/sys-setting-routing.module.ts +++ b/src/app/routes/sys-setting/sys-setting-routing.module.ts @@ -1,10 +1,10 @@ /* * @Author: your name * @Date: 2021-12-03 15:23:05 - * @LastEditTime: 2021-12-27 11:11:12 - * @LastEditors: Please set LastEditors + * @LastEditTime : 2022-01-19 10:53:58 + * @LastEditors : Shiming * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - * @FilePath: \tms-obc-web\src\app\routes\sys-setting\sys-setting-routing.module.ts + * @FilePath : \\tms-obc-web\\src\\app\\routes\\sys-setting\\sys-setting-routing.module.ts */ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; @@ -13,6 +13,7 @@ import { AuditReasonConfigComponent } from './components/audit-reason-config/aud import { BasicConfigComponent } from './components/basic-config/basic-config.component'; import { BasicSettingComponent } from './components/basic-setting/basic-setting.component'; import { CartConfigComponent } from './components/cart-config/cart-config.component'; +import { BtnManagementComponent } from './components/close-account copy/btn-management.component'; import { CloseAccountComponent } from './components/close-account/close-account.component'; import { CrmManagementComponent } from './components/crm-management/crm-management.component'; import { GoodsNameConfigComponent } from './components/goods-name-config/goods-name-config.component'; @@ -44,6 +45,7 @@ const routes: Routes = [ { path: 'close-account', component: CloseAccountComponent }, { path: 'system-supply-logs', component: SystemSupplyLogsComponent }, { path: 'system-waybill-logs', component: SystemWaybillLogsComponent }, + { path: 'btn-management', component: BtnManagementComponent }, ]; @NgModule({ diff --git a/src/app/routes/sys-setting/sys-setting.module.ts b/src/app/routes/sys-setting/sys-setting.module.ts index 816faebb..b543a5e6 100644 --- a/src/app/routes/sys-setting/sys-setting.module.ts +++ b/src/app/routes/sys-setting/sys-setting.module.ts @@ -1,10 +1,10 @@ /* * @Author: your name * @Date: 2021-12-03 15:23:05 - * @LastEditTime: 2022-01-04 14:46:23 - * @LastEditors: Please set LastEditors + * @LastEditTime : 2022-01-19 10:53:26 + * @LastEditors : Shiming * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - * @FilePath: \tms-obc-web\src\app\routes\sys-setting\sys-setting.module.ts + * @FilePath : \\tms-obc-web\\src\\app\\routes\\sys-setting\\sys-setting.module.ts */ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; @@ -34,6 +34,7 @@ import { NetworkFreightComponent } from './components/network-freight/network-fr import { CloseAccountComponent } from './components/close-account/close-account.component'; import { SystemSupplyLogsComponent } from './components/system-supply-logs/system-supply-logs.component'; import { SystemWaybillLogsComponent } from './components/system-waybill-logs/system-waybill-logs.component'; +import { BtnManagementComponent } from './components/close-account copy/btn-management.component'; const COMPONENTS = [ StaffManagementComponent, @@ -52,7 +53,8 @@ const COMPONENTS = [ NetworkFreightComponent, CloseAccountComponent, SystemSupplyLogsComponent, - SystemWaybillLogsComponent + SystemWaybillLogsComponent, + BtnManagementComponent ]; const NOTROUTECOMPONENTS = [ BuyerTranspowerComponent, diff --git a/src/assets/mocks/menu-data.json b/src/assets/mocks/menu-data.json index 5f13e866..c10f1bc1 100644 --- a/src/assets/mocks/menu-data.json +++ b/src/assets/mocks/menu-data.json @@ -475,6 +475,10 @@ "text": "基础设置", "link": "/system/basic-setting" }, + { + "text": "按钮管理设置", + "link": "/system/btn-management" + }, { "text": "车型车长配置", "link": "/system/cart-config"