fix bug
This commit is contained in:
		| @ -0,0 +1,310 @@ | ||||
| import { Component, OnInit, ViewChild } from '@angular/core'; | ||||
| import { Router } from '@angular/router'; | ||||
| import { STChange, STColumn, STComponent, STData } from '@delon/abc/st'; | ||||
| import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; | ||||
| import { NzModalService } from 'ng-zorro-antd/modal'; | ||||
| import { UsermanageService } from '../../../services/usercenter.service'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'app-Freight-components-enterprise-audit', | ||||
|   templateUrl: './enterprise-audit.component.html', | ||||
|   styleUrls: ['./enterprise-audit.component.less'], | ||||
| }) | ||||
| export class FreightComponentsEnterpriseAuditComponent implements OnInit { | ||||
|   _$expand = false; | ||||
|   ui!: SFUISchema; | ||||
|   schema!: SFSchema; | ||||
|   columns!: STColumn[]; | ||||
|   @ViewChild('st', { static: false }) st!: STComponent; | ||||
|   @ViewChild('sf', { static: false }) sf!: SFComponent; | ||||
|   tabType = 1; | ||||
|   tabs = [ | ||||
|     { | ||||
|       name: '企业审核', | ||||
|       type: 1, | ||||
|       isActived: false, | ||||
|     }, | ||||
|     { | ||||
|       name: '企业管理员审核', | ||||
|       type: 2, | ||||
|       isActived: false, | ||||
|     }, | ||||
|   ]; | ||||
|   datalist = [ | ||||
|     { | ||||
|       storeName: '企业名称', | ||||
|       contactsName: '152746565', | ||||
|       enterpriseName: '湖南', | ||||
|       unifiedSocialCreditCode: '45454', | ||||
|       contactsPhone: '*97889461561', | ||||
|       effectiveDateStr: '废弃eww', | ||||
|       enStatusStr2: '已驳回', | ||||
|       enStatusStr3: '正常', | ||||
|       unifiedSocialCreditCode3: '常用服务', | ||||
|       unifiedSocialCreditCode2: '正常', | ||||
|       tenantId: 1 | ||||
|     }, | ||||
|     { | ||||
|       storeName: '企业名称', | ||||
|       contactsName: '152746565', | ||||
|       enterpriseName: '湖南', | ||||
|       unifiedSocialCreditCode: '45454', | ||||
|       contactsPhone: '*97889461561', | ||||
|       effectiveDateStr: '废弃eww', | ||||
|       enStatusStr2: '待审核', | ||||
|       enStatusStr3: '正常', | ||||
|       unifiedSocialCreditCode3: '常用服务', | ||||
|       unifiedSocialCreditCode2: '正常', | ||||
|       tenantId: 2 | ||||
|     }, | ||||
|   ] | ||||
|   isVisible = false; | ||||
|   mdType!: any; | ||||
|   cateData = []; | ||||
|   // stApi = this.service.$api_get_labelList; | ||||
|   constructor(public service: UsermanageService, private router: Router, private modal: NzModalService) {} | ||||
|  | ||||
|   /** | ||||
|    * 查询字段个数 | ||||
|    */ | ||||
|   get queryFieldCount(): number { | ||||
|     return Object.keys(this.schema?.properties || {}).length; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 查询参数 | ||||
|    */ | ||||
|   get reqParams() { | ||||
|     const params = Object.assign({}, this.sf?.value || {}, { | ||||
|       flag: this.tabType, | ||||
|     }); | ||||
|     delete params._$expand; | ||||
|     return { ...params }; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 选中行 | ||||
|    */ | ||||
|   get selectedRows() { | ||||
|     return this.st?.list.filter((item) => item.checked) || []; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 伸缩查询条件 | ||||
|    */ | ||||
|   expandToggle() { | ||||
|     this._$expand = !this._$expand; | ||||
|     this.sf?.setValue('/expand', this._$expand); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 重置表单 | ||||
|    */ | ||||
|   resetSF() { | ||||
|     this.sf.reset(); | ||||
|     this._$expand = false; | ||||
|   } | ||||
|   /** | ||||
|    * 程序初始化入口 | ||||
|    */ | ||||
|   ngOnInit() { | ||||
|     this.initSF(); | ||||
|     this.initST(); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 初始化查询表单 | ||||
|    */ | ||||
|   initSF() { | ||||
|     this.schema = { | ||||
|       properties: { | ||||
|         expand: { type: 'boolean', ui: { hidden: true } }, | ||||
|         name: { title: '企业名称', type: 'string' }, | ||||
|         contactsName: { | ||||
|           title: '联系人', | ||||
|           type: 'string', | ||||
|           ui: { | ||||
|             showRequired: false, | ||||
|           }, | ||||
|         }, | ||||
|         phone: { | ||||
|           title: '手机号', | ||||
|           type: 'string', | ||||
|           format: 'mobile', | ||||
|           maxLength: 11, | ||||
|           ui: { | ||||
|             placeholder: '请输入手机号', | ||||
|           }, | ||||
|         }, | ||||
|         enStatus2: { | ||||
|           type: 'string', | ||||
|           title: '状态', | ||||
|           enum: [ | ||||
|             { label: '全部', value: '' }, | ||||
|             { label: '正常', value: 0 }, | ||||
|             { label: '冻结', value: 1 }, | ||||
|             { label: '废弃', value: 2 }, | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value, | ||||
|             }, | ||||
|           }, | ||||
|         }, | ||||
|  | ||||
|       }, | ||||
|     }; | ||||
|     this.ui = { '*': { spanLabelFixed: 100, grid: { span: 8, gutter: 4 } } }; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 初始化数据列表 | ||||
|    */ | ||||
|   initST() { | ||||
|     this.columns = [ | ||||
|       { title: '企业名称', className: 'text-center', index: 'storeName' }, | ||||
|       { title: '联系人', className: 'text-center', index: 'contactsName' }, | ||||
|       { title: '税源地', className: 'text-center', render: 'enterpriseName' }, | ||||
|       { title: '累计运单金额', className: 'text-center', index: 'unifiedSocialCreditCode' }, | ||||
|       { | ||||
|         title: '状态', | ||||
|         className: 'text-center', | ||||
|         index: 'enStatusStr2', | ||||
|         type: 'badge', | ||||
|         badge: { | ||||
|           待审核: { text: '待审核', color: 'success' }, | ||||
|           已驳回: { text: '已驳回', color: 'warning' }, | ||||
|         }, | ||||
|       }, | ||||
|      { title: '常用服务', className: 'text-center', index: 'unifiedSocialCreditCode3' }, | ||||
|      { title: '推广业务员', className: 'text-center', index: 'unifiedSocialCreditCode2' }, | ||||
|       { | ||||
|         title: '操作', | ||||
|         fixed: 'right', | ||||
|         width: '180px', | ||||
|         className: 'text-center', | ||||
|         buttons: [ | ||||
|           { text: '查看', click: (_record) => this.addOne('view', _record) }, | ||||
|         ], | ||||
|       }, | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 数据列表状态变化事件 | ||||
|    */ | ||||
|   change(e: STChange) { | ||||
|     // console.log(e.checkbox); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 新增实例 | ||||
|    */ | ||||
|   addOne(type: any, record: any) { | ||||
|     // this.router.navigate(['../add'], { relativeTo: this.ar }); | ||||
|     this.router.navigate(['/cmc/tags/add'], { | ||||
|       queryParams: { | ||||
|         id: record.id, | ||||
|         type, | ||||
|         flag: this.tabType, | ||||
|       }, | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 编辑单个实例 | ||||
|    * @param record 记录实例 | ||||
|    */ | ||||
|   editOne(record: STData) { | ||||
|     // this.router.navigate(['../edit', record.uuid], { relativeTo: this.ar }); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 删除单个实例 | ||||
|    * @param record 记录实例 | ||||
|    */ | ||||
|   delOne(record: STData) { | ||||
|     // let delApi = this.service.$api_label_deletebatch; | ||||
|     // if (this.tabType === 3) { | ||||
|     //   delApi = this.service.$api_business_label_delete; | ||||
|     // } else { | ||||
|     //   delApi = this.service.$api_label_deletebatch; | ||||
|     // } | ||||
|     this.modal.confirm({ | ||||
|       nzTitle: '<i>删除确认</i>', | ||||
|       nzContent: `<b>即将删除 当前行数据,请仔细核对,避免误操作!<br>是否删除?</br>`, | ||||
|       nzOnOk: () => | ||||
|       console.log('1') | ||||
|         // this.service.http.post(delApi, [record.id]).subscribe((res) => { | ||||
|         //   console.log(res, 'del'); | ||||
|  | ||||
|         //   if (res === true || res.data === true) { | ||||
|         //     this.service.msgSrv.success('删除成功!'); | ||||
|         //     setTimeout(() => { | ||||
|         //       this.st?.reload(); | ||||
|         //     }, 500); | ||||
|         //   } else { | ||||
|         //     this.service.msgSrv.error('删除失败!'); | ||||
|         //   } | ||||
|         // }), | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 删除多个实例 | ||||
|    */ | ||||
|   delMany(record: STData) { | ||||
|     this.modal.confirm({ | ||||
|       nzTitle: '<i>删除确认</i>', | ||||
|       nzContent: `<b>即将删除 当前行数据,请仔细核对,避免误操作!<br>是否删除?</br>`, | ||||
|       nzOnOk: () => | ||||
|       console.log('') | ||||
|         // this.service.http.post(this.service.$api_label_deletebatch, [record.id]).subscribe((res) => { | ||||
|         //   if (res === true) { | ||||
|         //     this.service.msgSrv.success('删除成功!'); | ||||
|         //     this.st?.reload(); | ||||
|         //   } | ||||
|         // }), | ||||
|     }); | ||||
|     /* | ||||
|     const delData = this.st.list.filter((item) => item.checked).map((item) => item.id); | ||||
|     if (delData.length > 0) { | ||||
|       this.modal.confirm({ | ||||
|         nzTitle: '<i>删除确认</i>', | ||||
|         nzContent: `<b>即将删除 <i>${delData.length}</i> 条数据,请仔细核对,避免误操作!<br>是否删除?</br>`, | ||||
|         nzOnOk: () => | ||||
|           this.service.delMany(delData).subscribe((res) => { | ||||
|             if (res === true) { | ||||
|               this.service.msgSrv.success('数据删除成功!'); | ||||
|               this.st?.reload(); | ||||
|             } | ||||
|           }), | ||||
|       }); | ||||
|     } | ||||
|     */ | ||||
|   } | ||||
|  | ||||
|   // 切换Tab | ||||
|   changeTab(item: any) { | ||||
|     this.tabType = item.type; | ||||
|     this.sf?.reset(); | ||||
|     // if (item.type === 3) { | ||||
|     //   this.stApi = this.service.$api_get_business_labelList; | ||||
|     // } else { | ||||
|     //   this.stApi = this.service.$api_get_labelList; | ||||
|     // } | ||||
|     // setTimeout(() => { | ||||
|     //   this.tabs.forEach((i) => (i.isActived = false)); | ||||
|     //   item.isActived = !item.isActived; | ||||
|     //   this.st.load(1); | ||||
|     //   this.st.resetColumns(); | ||||
|     // }, 500); | ||||
|   } | ||||
|  | ||||
|   // checkType(): boolean { | ||||
|   //   return this.mdType === 2 ? true : false; | ||||
|   // } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user