/*
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-03-09 14:05:33
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-03-09 15:18:38
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\sys-setting\\components\\note-management\\note-management.component.ts
 * Copyright (C) 2022 huzhenhong. All rights reserved.
 */
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from '../../services/system.service';

@Component({
  selector: 'app-note-management',
  templateUrl: './note-management.component.html',
  styleUrls: ['../../../commom/less/box.less']
})
export class NoTeManagementComponent implements OnInit {
  @ViewChild('st', { static: true })
  st!: STComponent;
  @ViewChild('sf', { static: false })
  sf!: SFComponent;

  searchSchema: SFSchema = {
    properties: {
      cellphone: {
        type: 'string',
        title: '手机号',
        maxLength: 11,
        ui: { placeholder: '请输入' }
      }
    }
  };

  columns: STColumn[] = [
    { title: '手机号', className: 'text-center', index: 'cellphone' },
    {
      title: '发送时间',
      index: 'createTime',
      type: 'date',
      className: 'text-center'
    },
    { title: '短信内容', className: 'text-center', index: 'content',
    // format: (value) => {
    //   return JSON.parse(value?.templateParam)?.code
    // }
  },
  ];

  constructor(public service: SystemService, private nzModalService: NzModalService, private route: ActivatedRoute) {
  }

  ngOnInit(): void {}

  beforeReq = (requestOptions: STRequestOptions) => {
    if (this.sf) {
      Object.assign(requestOptions.body, { ...this.sf.value });
    }
    return requestOptions;
  };



  /**
   * 重置表单
   */
  resetSF() {
    this.sf.reset();
  }
}
