edit
This commit is contained in:
		| @ -17,39 +17,22 @@ | ||||
|   <a *ngIf="!i.externalLink" [routerLink]="i.link" [target]="i.target">{{ i.text }} </a> | ||||
|   <a *ngIf="i.externalLink" [attr.href]="i.externalLink" [attr.target]="i.target">{{ i.text }} </a> | ||||
| </ng-template> | ||||
| <ul *ngIf="menus" nz-menu [nzMode]="mode" [nzTheme]="pro.theme" [nzInlineCollapsed]="pro.isMobile ? false : pro.collapsed"> | ||||
| <ul *ngIf="menus" nz-menu [nzMode]="mode" [nzTheme]="pro.theme" | ||||
|   [nzInlineCollapsed]="pro.isMobile ? false : pro.collapsed"> | ||||
|   <ng-container *ngFor="let l1 of menus"> | ||||
|     <li | ||||
|       *ngIf="l1.children!.length === 0" | ||||
|       nz-menu-item | ||||
|       class="alain-pro__menu-item" | ||||
|       [class.alain-pro__menu-item--disabled]="l1.disabled" | ||||
|       [nzSelected]="l1._selected" | ||||
|       [nzDisabled]="l1.disabled" | ||||
|     > | ||||
|     <li *ngIf="l1.children!.length === 0" nz-menu-item class="alain-pro__menu-item" | ||||
|       [class.alain-pro__menu-item--disabled]="l1.disabled" [nzSelected]="l1._selected" [nzDisabled]="l1.disabled"> | ||||
|       <a *ngIf="!l1.externalLink" [routerLink]="l1.link" (click)="closeCollapsed()" class="alain-pro__menu-title"> | ||||
|         <ng-template [ngTemplateOutlet]="mainLink" [ngTemplateOutletContext]="{ $implicit: l1 }"></ng-template> | ||||
|       </a> | ||||
|       <a | ||||
|         *ngIf="l1.externalLink" | ||||
|         [attr.href]="l1.externalLink" | ||||
|         [attr.target]="l1.target" | ||||
|         (click)="closeCollapsed()" | ||||
|         class="alain-pro__menu-title" | ||||
|       > | ||||
|       <a *ngIf="l1.externalLink" [attr.href]="l1.externalLink" [attr.target]="l1.target" (click)="closeCollapsed()" | ||||
|         class="alain-pro__menu-title"> | ||||
|         <ng-template [ngTemplateOutlet]="mainLink" [ngTemplateOutletContext]="{ $implicit: l1 }"></ng-template> | ||||
|       </a> | ||||
|     </li> | ||||
|     <li | ||||
|       *ngIf="l1.children!.length > 0" | ||||
|       nz-submenu | ||||
|       [nzTitle]="l1TitleTpl" | ||||
|       class="alain-pro__menu-item" | ||||
|       [class.text-white]="pro.theme === 'dark' && l1._selected" | ||||
|       [nzOpen]="l1._open" | ||||
|       [nzDisabled]="l1.disabled" | ||||
|       (nzOpenChange)="openChange(l1, $event)" | ||||
|     > | ||||
|     <li *ngIf="l1.children!.length > 0" nz-submenu [nzTitle]="l1TitleTpl" class="alain-pro__menu-item" | ||||
|       [class.text-white]="pro.theme === 'dark' && l1._selected" [nzOpen]="l1._open" [nzDisabled]="l1.disabled" | ||||
|       (nzOpenChange)="openChange(l1, $event)"> | ||||
|       <ng-template #l1TitleTpl> | ||||
|         <span title class="alain-pro__menu-title"> | ||||
|           <ng-template [ngTemplateOutlet]="icon" [ngTemplateOutletContext]="{ $implicit: l1.icon }"></ng-template> | ||||
| @ -61,34 +44,17 @@ | ||||
|       </ng-template> | ||||
|       <ul> | ||||
|         <ng-container *ngFor="let l2 of l1.children"> | ||||
|           <li | ||||
|             *ngIf="!l2._hidden && l2.children!.length === 0" | ||||
|             nz-menu-item | ||||
|             [class.alain-pro__menu-item--disabled]="l2.disabled" | ||||
|             [nzSelected]="l2._selected" | ||||
|             [nzDisabled]="l2.disabled" | ||||
|             (click)="closeCollapsed()" | ||||
|           > | ||||
|           <li *ngIf="!l2._hidden && l2.children!.length === 0" nz-menu-item | ||||
|             [class.alain-pro__menu-item--disabled]="l2.disabled" [nzSelected]="l2._selected" [nzDisabled]="l2.disabled" | ||||
|             (click)="closeCollapsed()"> | ||||
|             <ng-template [ngTemplateOutlet]="subLink" [ngTemplateOutletContext]="{ $implicit: l2 }"></ng-template> | ||||
|           </li> | ||||
|           <li | ||||
|             *ngIf="!l2._hidden && l2.children!.length > 0" | ||||
|             nz-submenu | ||||
|             [nzTitle]="l2.text!" | ||||
|             [nzOpen]="l2._open" | ||||
|             [nzDisabled]="l2.disabled" | ||||
|             (nzOpenChange)="openChange(l2, $event)" | ||||
|           > | ||||
|           <li *ngIf="!l2._hidden && l2.children!.length > 0" nz-submenu [nzTitle]="l2.text!" [nzOpen]="l2._open" | ||||
|             [nzDisabled]="l2.disabled" (nzOpenChange)="openChange(l2, $event)"> | ||||
|             <ul> | ||||
|               <ng-container *ngFor="let l3 of l2.children"> | ||||
|                 <li | ||||
|                   *ngIf="!l3._hidden" | ||||
|                   nz-menu-item | ||||
|                   [class.alain-pro__menu-item--disabled]="l3.disabled" | ||||
|                   [nzSelected]="l3._selected" | ||||
|                   [nzDisabled]="l3.disabled" | ||||
|                   (click)="closeCollapsed()" | ||||
|                 > | ||||
|                 <li *ngIf="!l3._hidden" nz-menu-item [class.alain-pro__menu-item--disabled]="l3.disabled" | ||||
|                   [nzSelected]="l3._selected" [nzDisabled]="l3.disabled" (click)="closeCollapsed()"> | ||||
|                   <ng-template [ngTemplateOutlet]="subLink" [ngTemplateOutletContext]="{ $implicit: l3 }"></ng-template> | ||||
|                 </li> | ||||
|               </ng-container> | ||||
|  | ||||
| @ -28,8 +28,8 @@ | ||||
| <nz-card class="content-box"> | ||||
|  | ||||
|   <nz-tabset [nzTabBarExtraContent]="extraTemplate"> | ||||
|     <nz-tab nzTitle="货主菜单" (nzClick)="changeMemu('1')"></nz-tab> | ||||
|     <nz-tab nzTitle="运营后台菜单" (nzClick)="changeMemu('2')"></nz-tab> | ||||
|     <nz-tab nzTitle="货主菜单" (nzClick)="changeMemu(0)"></nz-tab> | ||||
|     <nz-tab nzTitle="运营后台菜单" (nzClick)="changeMemu(1)"></nz-tab> | ||||
|   </nz-tabset> | ||||
|   <ng-template #extraTemplate> | ||||
|     <div class="d-flex align-items-center"> | ||||
| @ -39,12 +39,52 @@ | ||||
|     </div> | ||||
|   </ng-template> | ||||
|  | ||||
|   <st #st [data]="service.$api_get_all" [columns]="columns" [expand]="expand" expandRowByClick | ||||
|   <!-- <st #st [data]="service.$api_get_all" [columns]="columns" [expand]="expand" expandRowByClick | ||||
|     [req]="{ method: 'POST',  reName: { pi: 'pageIndex', ps: 'pageSize' },params:{appId:selectedPlatform?.appId} }" | ||||
|     [res]="{ reName: { list: 'data' } }" [page]="{ show: false }" [loading]="service.http.loading" | ||||
|     [scroll]="{ y: '370px' }" (change)="stChange($event)"> | ||||
|     <ng-template #expand let-item let-index="index" let-column="column"> | ||||
|       {{ item.description }} | ||||
|     </ng-template> | ||||
|   </st> | ||||
|   </st> --> | ||||
|   <nz-table #expandTable [nzData]="listOfMapData" nzTableLayout="fixed" nzBordered> | ||||
|     <thead> | ||||
|       <tr> | ||||
|         <th>菜单名称</th> | ||||
|         <th>路由地址</th> | ||||
|         <th>菜单图标</th> | ||||
|         <th>菜单排序</th> | ||||
|         <th class="text-center">操作</th> | ||||
|       </tr> | ||||
|     </thead> | ||||
|     <tbody> | ||||
|       <ng-container *ngFor="let data of expandTable.data"> | ||||
|         <ng-container *ngFor="let item of mapOfExpandedData[data.key]"> | ||||
|           <tr *ngIf="(item.parent && item.parent.expand) || !item.parent"> | ||||
|             <td [nzIndentSize]="item.level! * 20" [nzShowExpand]="!!item.children" [(nzExpand)]="item.expand" | ||||
|               (nzExpandChange)="collapse(mapOfExpandedData[data.key], item, $event)"> | ||||
|               {{ item.text }} | ||||
|             </td> | ||||
|             <td>{{ item.link }}</td> | ||||
|             <td> | ||||
|               <i nz-icon [nzType]="item.iconType"></i> | ||||
|             </td> | ||||
|             <td>{{ item.sorted }}</td> | ||||
|             <td class="text-center"> | ||||
|               <a>查看</a> | ||||
|               <nz-divider nzType="vertical"></nz-divider> | ||||
|               <a>编辑</a> | ||||
|               <nz-divider nzType="vertical"></nz-divider> | ||||
|               <a>删除</a> | ||||
|               <ng-container *ngIf="item.level!==3"> | ||||
|                 <nz-divider nzType="vertical"></nz-divider> | ||||
|                 <a>新增子项</a> | ||||
|               </ng-container> | ||||
|  | ||||
|             </td> | ||||
|           </tr> | ||||
|         </ng-container> | ||||
|       </ng-container> | ||||
|     </tbody> | ||||
|   </nz-table> | ||||
| </nz-card> | ||||
| @ -3,6 +3,7 @@ import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st | ||||
| import { SFComponent, SFSchema } from '@delon/form'; | ||||
| import { Menu } from '@delon/theme'; | ||||
| import { EAEnvironmentService } from '@shared'; | ||||
| import { NzSafeAny } from 'ng-zorro-antd/core/types'; | ||||
| import { NzModalService } from 'ng-zorro-antd/modal'; | ||||
| import { SettingRoleEditComponent } from 'src/app/routes/sys-setting/components/role-management/edit/edit.component'; | ||||
| import { MenuManagerService } from './../../services/menu-manager.service'; | ||||
| @ -39,32 +40,10 @@ export class MenuManagerComponentsIndexComponent implements OnInit { | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   columns: STColumn[] = [ | ||||
|     { title: '角色名称', index: 'roleName' }, | ||||
|     { title: '角色描述', index: 'roleDescription' }, | ||||
|     { title: '创建人手机号', index: 'telephone' }, | ||||
|     { | ||||
|       title: '创建时间', | ||||
|       index: 'createTime', | ||||
|       className: 'text-left', | ||||
|       type: 'date' | ||||
|     }, | ||||
|     { | ||||
|       title: '操作', | ||||
|       buttons: [ | ||||
|         { | ||||
|           text: '编辑', | ||||
|           click: item => this.roleAction(item) | ||||
|         }, | ||||
|         { | ||||
|           text: '删除', | ||||
|           click: item => this.deleteAction(item) | ||||
|         } | ||||
|       ] | ||||
|     } | ||||
|   ]; | ||||
|  | ||||
|   selectedRows: any[] = []; | ||||
|  | ||||
|   mapOfExpandedData: { [key: string]: any[] } = {}; | ||||
|   listOfMapData: any[] = []; | ||||
|   constructor(private envSrv: EAEnvironmentService, public service: MenuManagerService, private modal: NzModalService) { | ||||
|     this.initData(); | ||||
|   } | ||||
| @ -77,6 +56,19 @@ export class MenuManagerComponentsIndexComponent implements OnInit { | ||||
|       { name: '运营后台', appId: this.envSrv.env.appId, enName: 'tms-obc-web' } | ||||
|     ]; | ||||
|     this.selectedPlatform = this.platforms[0]; | ||||
|     this.loadMemu(this.selectedPlatform.appId); | ||||
|   } | ||||
|  | ||||
|   loadMemu(appId: string) { | ||||
|     this.service.request(this.service.$api_get_all, { appId }, 'POST', false).subscribe(res => { | ||||
|       if (res) { | ||||
|         this.listOfMapData = res; | ||||
|         this.listOfMapData.forEach(item => { | ||||
|           this.mapOfExpandedData[item.key] = this.convertTreeToList(item); | ||||
|         }); | ||||
|         console.log(this.listOfMapData, this.mapOfExpandedData); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   platformChange(e: { name: string; appId: string }) { | ||||
| @ -167,23 +159,10 @@ export class MenuManagerComponentsIndexComponent implements OnInit { | ||||
|     this.service.request(this.service.$api_del_many, ids).subscribe(res => {}); | ||||
|   } | ||||
|  | ||||
|   beforeReq = (requestOptions: STRequestOptions) => { | ||||
|     if (this.sf) { | ||||
|       Object.assign(requestOptions.body, { ...this.sf.value }); | ||||
|   changeMemu(key: number) { | ||||
|     this.selectedPlatform = this.platforms[key]; | ||||
|     this.loadMemu(this.selectedPlatform.appId); | ||||
|   } | ||||
|     Object.assign(requestOptions.body, { appId: this.selectedPlatform.appId }); | ||||
|     return requestOptions; | ||||
|   }; | ||||
|  | ||||
|   stChange(e: STChange): void { | ||||
|     switch (e.type) { | ||||
|       case 'sort': | ||||
|         this.selectedRows = e.checkbox!; | ||||
|         break; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   changeMemu(key: string) {} | ||||
|  | ||||
|   roleAction(item?: any) { | ||||
|     const modal = this.modal.create({ | ||||
| @ -219,4 +198,64 @@ export class MenuManagerComponentsIndexComponent implements OnInit { | ||||
|   resetSF() { | ||||
|     this.sf.reset(); | ||||
|   } | ||||
|  | ||||
|   collapse(array: TreeNodeInterface[], data: TreeNodeInterface, $event: boolean): void { | ||||
|     if (!$event) { | ||||
|       if (data.children) { | ||||
|         data.children.forEach(d => { | ||||
|           const target = array.find(a => a.key === d.key)!; | ||||
|           target.expand = false; | ||||
|           this.collapse(array, target, false); | ||||
|         }); | ||||
|       } else { | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   convertTreeToList(root: TreeNodeInterface): TreeNodeInterface[] { | ||||
|     const stack: TreeNodeInterface[] = []; | ||||
|     const array: TreeNodeInterface[] = []; | ||||
|     const hashMap = {}; | ||||
|     stack.push({ ...root, level: 0, expand: true }); | ||||
|  | ||||
|     while (stack.length !== 0) { | ||||
|       const node = stack.pop()!; | ||||
|       this.visitNode(node, hashMap, array); | ||||
|       if (node.children) { | ||||
|         for (let i = node.children.length - 1; i >= 0; i--) { | ||||
|           stack.push({ ...node.children[i], level: node.level! + 1, expand: false, parent: node, iconType: this.formatIcon(node.children[i].icon) }); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     return array; | ||||
|   } | ||||
|  | ||||
|   visitNode(node: TreeNodeInterface, hashMap: { [key: string]: boolean }, array: TreeNodeInterface[]): void { | ||||
|     if (!hashMap[node.key]) { | ||||
|       hashMap[node.key] = true; | ||||
|       array.push(node); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   private formatIcon(icon: any) { | ||||
|     let value = icon; | ||||
|     // compatible `anticon anticon-user` | ||||
|     if (~icon.indexOf(`anticon-`)) { | ||||
|       value = value.split('-').slice(1).join('-'); | ||||
|     } | ||||
|     return value; | ||||
|   } | ||||
| } | ||||
| export interface TreeNodeInterface { | ||||
|   key: string; | ||||
|   name: string; | ||||
|   age?: number; | ||||
|   level?: number; | ||||
|   expand?: boolean; | ||||
|   address?: string; | ||||
|   children?: TreeNodeInterface[]; | ||||
|   parent?: TreeNodeInterface; | ||||
|   [key: string]: any; | ||||
| } | ||||
|  | ||||
| @ -52,8 +52,8 @@ | ||||
|  | ||||
|  | ||||
|     <st #st [scroll]="{ x: '2000px',y:'400px' }" [data]="service.$api_ficoVatinvHList" [columns]="columns" | ||||
|         [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" | ||||
|         [res]="{ reName: { list: 'data.records', total: 'data.total' } }" | ||||
|         [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' },process: beforeReq }" | ||||
|         [res]="{ reName: { list: 'data.records', total: 'data.total' },process:afterRes }" | ||||
|         [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" | ||||
|         [loading]="service.http.loading"> | ||||
|  | ||||
|  | ||||
| @ -34,26 +34,28 @@ export class CancellationInvoiceComponent implements OnInit { | ||||
|  | ||||
|   ngOnInit(): void {} | ||||
|  | ||||
|   get reqParams() { | ||||
|     // if (this.sf) { | ||||
|     //   Object.assign(requestOptions.body, { | ||||
|     //     ...this.sf.value, | ||||
|     //     sts: this?.resourceStatus, | ||||
|     //     createTime: { | ||||
|     //       start: this.sf.value.createTime?.[0] || null, | ||||
|     //       end: this.sf.value.createTime?.[1] || null | ||||
|     //     } | ||||
|     //   }); | ||||
|     // } | ||||
|     const a: any = {}; | ||||
|   beforeReq = (requestOptions: STRequestOptions) => { | ||||
|     if (this.sf) { | ||||
|       Object.assign(requestOptions.body, { | ||||
|         ...this.sf.value, | ||||
|         createTime: { | ||||
|           start: this.sf.value.createTime?.[0] || '', | ||||
|           end: this.sf.value.createTime?.[1] || '' | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|     if (this.resourceStatus) { | ||||
|       a.sts = this.resourceStatus; | ||||
|       Object.assign(requestOptions.body, { | ||||
|         sts: this.resourceStatus | ||||
|       }); | ||||
|     } | ||||
|     return { | ||||
|       ...a, | ||||
|       ...this.sf?.value | ||||
|     return requestOptions; | ||||
|   }; | ||||
|   } | ||||
|  | ||||
|   afterRes = (data: any[], rawData?: any) => { | ||||
|     return data.map(node => ({ ...node, disabled: node.sts === '3' })); | ||||
|   }; | ||||
|  | ||||
|   selectChange(e: any) { | ||||
|     this.resourceStatus = e; | ||||
|     this.initST(); | ||||
| @ -90,7 +92,7 @@ export class CancellationInvoiceComponent implements OnInit { | ||||
|             if (res) { | ||||
|               this.service.msgSrv.success('开票成功'); | ||||
|               this.st.load(1); | ||||
|               modal.destroy; | ||||
|               modal.destroy(); | ||||
|             } | ||||
|           }); | ||||
|  | ||||
| @ -322,10 +324,12 @@ export class CancellationInvoiceComponent implements OnInit { | ||||
|           }, | ||||
|           { | ||||
|             text: '手工开票', | ||||
|             iif: item => item.sts != '3', | ||||
|             click: item => this.requestedAction(item) | ||||
|           }, | ||||
|           { | ||||
|             text: '推送开票', | ||||
|             iif: item => item.sts != '3', | ||||
|             click: item => this.pushInvoiceAction(item) | ||||
|           }, | ||||
|           { | ||||
|  | ||||
| @ -30,9 +30,6 @@ | ||||
|             <se label="税额"> | ||||
|                 {{headerInfo?.vattax}} | ||||
|             </se> | ||||
|             <se label="票面备注"> | ||||
|                 {{headerInfo?.remarks}} | ||||
|             </se> | ||||
|         </div> | ||||
|         <div nz-col [nzXl]="8" [nzLg]="8" [nzSm]="8" [nzXs]="8" se-container [labelWidth]="100" col="1"> | ||||
|             <se label="购买方"> | ||||
| @ -53,9 +50,12 @@ | ||||
|             <se label="银行账户"> | ||||
|                 {{headerInfo?.artoacc}} | ||||
|             </se> | ||||
|             <se label="其他要求"> | ||||
|                 {{headerInfo?.otherremarks}} | ||||
|             <se label="票面备注"> | ||||
|                 {{headerInfo?.remarks}} | ||||
|             </se> | ||||
|             <!-- <se label="其他要求"> | ||||
|                 {{headerInfo?.otherremarks}} | ||||
|             </se> --> | ||||
|         </div> | ||||
|         <div *ngIf="isCanEdit" nz-col [nzXl]="8" [nzLg]="8" [nzSm]="8" [nzXs]="8" class="text-right"> | ||||
|             <ng-container *ngIf="isEdit; else elseTemplate"> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user