import { Options } from '@zxcvbn-ts/core';
import { valueEquals } from 'element-plus';
import { FormulaType } from 'exceljs';
import type { VxeGridProps, VxeColumnPropTypes } from 'vxe-table';
import XEUtils from 'xe-utils';


interface VxeColumn {
  type?: string;
  field?: string;
  title?: string;
  width?: number | string;
  minWidth?: number | string;
  maxWidth?: number | string;
  sortable?: boolean;
  formatter?: (value: any) => string;
  treeNode?: boolean;
  slots?: {};
  visible?: boolean;
  editRender?: {};
  align?: string;
  showOverflow?: boolean | string;
  fixed?: string;
  filters?: [] | {};
  filterMethod?: any;
  filterMethodTp?: string;
  filterRender?: any;
}

export const tableFormData = [
  {
    serialNumber: "1",
    project: "基础设施灾备模式",
    code: 'TB201',
    content: [

      { type: "text", value: "基础设施灾备模式" },
      { type: "br" },
      { 
        type: "radio-group-extraFields", 
        field: "COL1",
        format:"1",
        options: [
          {label:'一主一备：一个生产中心对应一个灾备中心',extraField:"",extraLabel:"" },
          {label:'一主多备：一个生产中心对应多个灾备中心',extraField:"",extraLabel:"" },
          {label:'多主一备：多个生产中心共用一个灾备中心', 
            extraField:"COL2",extraLabel:"其中，多个生产中心之间关系",extraFormType:"radio",extraOptions: [
              {label:"独立运行",value:"独立运行"},
              {label:"互为备份",value:"互为备份"},
              {label:"双活",value:"双活"},
              {label:"多活",value:"多活"},
            ]
          },
          {label:'多主多备：多个生产中心对应多个灾备中心',
            extraField:"COL3",extraLabel:"其中，多个生产中心之间关系",extraFormType:"radio",extraOptions: [
              {label:"独立运行",value:"独立运行"},
              {label:"互为备份",value:"互为备份"},
              {label:"双活",value:"双活"},
              {label:"多活",value:"多活"},
            ]
          },
          {label:'双活：两个生产中心同时运行相同重要信息系统并承担用户业务，互为实时备份',extraField:"",extraLabel:"" },
          {label:'多活：多个生产中心同时运行相同重要信息系统并承担用户业务，互为实时备份',extraField:"",extraLabel:"" },

          {label:'其他',extraField:"COL4",extraLable:"" },
          {label:'无'},
          
        ],
      },

      { type: "br" },
      { type: "br" },
      { type: "text", value: "基础设施灾备模式-备注" },
      { type: "textarea", field: "COL5",width:"500px"},

    ],
  },

  {
    serialNumber: "2",
    project: "生产中心",
    code:"TB202",
    type:"MultiColumnTable",
    content: [
      {
        name: "类型",formType:'radio-group-extraFields',field:"COL6",options:[
        {label:'数据中心'},
        {label:'中心机房'}  
       ],
       extraFields:{
        "数据中心": [
          {label:"数据中心类型",field:"COL7",formType:"checkbox",options:[
            {label:"生产中心",value:"生产中心"},
             {label:"同城灾备中心",value:"同城灾备中心"},
             {label:"异地灾备中心",value:"异地灾备中心"}
          ]},
        ],
        "中心机房": [
          {label:"中心机房类型",field:"COL8",formType:"checkbox",options:[
            {label:"生产机房",value:"生产机房"},
             {label:"同城灾备机房",value:"同城灾备机房"},
             {label:"异地灾备机房",value:"异地灾备机房"}
        ]},
          
        ],
      }
      },

      { name: "中心名称",formType:'input',field:"COL9"},
      { name: "负责部门",formType:'input',field:"COL10"},
      { name: "地点",formType:'combinaform',childs:
        [
          {label:'国家',formType:"input",field:"COL12",},
          {label:'省（自治区、直辖市）',formType:"input",field:"COL13",},
          {label:'市（县、州、盟）',formType:"input",field:"COL14",}, 
          {label:'街道',formType:"input",field:"COL15",}, 
          {label:'门牌号',formType:"input",field:"COL16",},   
        ] ,layout:"horizontal"  //'horizontal'|'vertical'|'inline'
      },
      { name: "启用日期",formType:'date',field:"COL18"},
      { name: "功能用途",formType:'textarea',field:"COL20"},
      { name: "产权形式",formType:'select',field:"COL22",
            options:[
                {label:'自有',value:"自有"},
                {label:'共有',value:"共有",extraFields:[
                  {label:'共有方名称',formType:"input",field:"COL23",},
                  {label:'性质',formType:"radio",field:"COL24",options:[
                    {label:'母行或母公司',value:"母行或母公司"},
                    {label:'同一母行或母公司下的其他子公司',value:"同一母行或母公司下的其他子公司"},
                    {label:'独立第三方公司',value:"独立第三方公司"},
                    {label:'其他',value:"其他"}
                  ],otherFiled:'COL25'
                },
                ]
              },
              {label:'他有',value:"他有",extraFields:[
                {label:'出租（出借）方名称',formType:"input",field:"COL26",},
                {label:'性质',formType:"radio",field:"C20A002",options:[
                    {label:'母行或母公司',value:"母行或母公司"},
                    {label:'同一母行或母公司下的其他子公司',value:"同一母行或母公司下的其他子公司"},
                    {label:'独立第三方公司',value:"独立第三方公司"},
                    {label:'其他',value:"其他"}
                  ],otherFiled:'COL28'
                },
              ]},  
        ],layout:"horizontal"  
      },
      { name: "使用模式",formType:'select',field:"COL30",
        options:[
            {label:'独立使用和管理'},
            {label:'托管',extraFields:[
              {label:'托管机构名称',formType:"input",field:"COL31",},
              {label:'性质',formType:"radio",field:"C20A003",options:[
                {label:'母行或母公司',value:"母行或母公司"},
                {label:'同一母行或母公司下的其他子公司',value:"同一母行或母公司下的其他子公司"},
                {label:'其他银行或保险业机构',value:"其他银行或保险业机构"},
                {label:'独立第三方公司',value:"独立第三方公司"},
                {label:'其他',value:"其他"}
              ],otherFiled:'COL33'},

              {label:'托管方式',formType:"checkbox",field:"C20A004",options:[
                {label:'主机托管',value:""},
                {label:'云主机或存储(IaaS)',value:"云主机或存储(IaaS)"},
                {label:'平台软件（PaaS）',value:"平台软件（PaaS"},
                {label:'用软件（SaaS）',value:"用软件（SaaS）"},
              ]},
            ]
          },
 
        ],layout:"horizontal"  
      },

      { name: "运维模式",
        formType:'select',
        field:"COL35",
        options:[
            {label:'自主运维',extraFields:[
              {label:'责任部门',formType:"input",field:"COL36",},
            ]},
            {label:'整体运维外包',extraFields:[
              {label:'托管机构名称',formType:"input",field:"COL37",},
              {label:'性质',formType:"radio",field:"COL38",options:[
                {label:'母行或母公司',value:"母行或母公司"},
                {label:'同一母行或母公司下的其他子公司',value:"同一母行或母公司下的其他子公司"},
                {label:'其他银行或保险业机构',value:"其他银行或保险业机构"},
                {label:'独立第三方公司',value:"独立第三方公司"},
                {label:'其他',value:"其他"}
              ],otherFiled:'COL39'},
              {label:'托管方式',formType:"checkbox",field:"COL40",options:[
                {label:'主机托管',value:"主机托管"},
                {label:'云主机或存储(IaaS)',value:"云主机或存储(IaaS)"},
                {label:'平台软件（PaaS）',value:"平台软件（PaaS）"},
                {label:'用软件（SaaS）',value:"用软件（SaaS）"},
              ]},
            ]
          },
          {label:'部分运维外包'},
        ],layout:"horizontal"  
      },

      // { name: "部署模式 ",formType:'checkbox-group',field:"C20A006",options:[
      //   "裸金属","虚拟化","集群","容器","私有云","专有云","公有云","混合云" 
      // ]},

      
      { name: "物理安全管控措施",formType:'checkbox-group',field:"C20A006",
        options:["物理围笼","视频监控","门禁措施","其他"],
        otherField:"C24A002"
      },


      { name: "网络授时服务 ",formType:'radio-group-extraFields',field:"C20A100",options:[
        {label:'有'},
        {label:'无'}
      ],
      extraFields:{
        "有": [
          {label:"时钟来源",formType:'checkbox',field:"C20A101",options:[
            {label:'北斗',value:"北斗"},
            {label:'GPS',value:"GPS"},
            {label:'NTP时钟服务器',value:"NTP时钟服务器"},
            {label:'其他',value:"其他"},
          ],
          otherOption:true,
          otherField:"C20A102"
        },
        ],
        "无": [],
      }
    
    },

      { name: "核心网络设备冗余情况（仅在中心类型为生产中心或生产机房时填写）",formType:'combinaform',childs:[

        { label: "核心路由器  ",formType:'checkbox',field:"COL43",options:[
            {label:'双机热备',value:"双机热备"},
            {label:'负载均衡',value:"负载均衡"},
            {label:'存在单点',value:"存在单点"},
            {label:'其他',value:"其他"},
        ]},
        { label: "核心交换机  ",formType:'checkbox',field:"COL46",options:[
            {label:'双机热备',value:"双机热备"},
            {label:'负载均衡',value:"负载均衡"},
            {label:'存在单点',value:"存在单点"},
            {label:'其他',value:"其他"},
        ]},
        { label: "核心网安设备  ",formType:'checkbox',field:"COL48",options:[
            {label:'双机热备',value:"双机热备"},
            {label:'负载均衡',value:"负载均衡"},
            {label:'存在单点',value:"存在单点"},
            {label:'其他',value:"其他"},
      ]},

      ]},
      { name: "生产网线路可用性（仅在中心类型为生产中心或生产机房时填写） ",formType:'AttachTable',field:"attach3",
        gridOptions:
        {
          border: true,
          showOverflow: true,
          editConfig: {
            trigger: 'click',
            mode: 'row'
          },
          showHeader:true,
          columns: [
            { type: 'seq', width: 70 },
            { field: 'col1', title: '线路名称'},
            { field: 'col2', title: '线路条数(条)', slots: { default: 'form_default' },},
            { field: 'col3', title: '不同运营商家数(家)',  slots: { default: 'form_default' },},
            { field: 'col4', title: '网络带宽(M)' ,slots: { default: 'form_default' },
            }
          ],
          datas: [
            { col1: '至一级分支机构', 
              col2: {field: "COL51",formType:"number"},
              col3: {field: "COL52",formType:"number"},
              col4: {field: "COL53",formType:"input"}},
            { col1: '至同城灾备中心（或灾备机房）',
               col2: {field: "COL54",formType:"number"},
               col3:{field: "COL55",formType:"number"},
               col4:{field: "COL56",formType:"input"}},
            { col1: '至异地灾备中心（或灾备机房）', 
              col2: { field: "COL57",formType:"number"},
              col3:{field: "COL58",formType:"number"},
              col4:{field: "COL59",formType:"input"}},
          ]

        }

      },

      { name: "基本情况",formType:'combinaform',childs:
        [
          {label:'设计等级',formType:"radio",field:"COL60",
            options:[
              {label:'A类',value:'A类'}, 
              {label:'B类',value:'B类'}, 
              {label:'C类',value:'C类'}, 
              {label:'其他',value:"其他"}, 
            ],
            otherOption:true,
            otherField:"COL61",
            
          },
          {label:'机房数量',formType:"number",field:"C20A008",unit:"个"}, 
          {label:'机房总面积',formType:"number",field:"C20A010",unit:"平方米"},   
          {label:'设计可安装机柜总数',formType:"input",field:"COL150",unit:"个"},  
          {label:'实际安装机柜总数',formType:"input",field:"COL152",unit:"个"},  
          {label:'上电机柜总数',formType:"input",field:"COL154",unit:"个"},  
          {label:'算力',formType:"input",field:"COL156",unit:"PFLOPS"},  
          
        ] ,layout:"horizontal"  //'horizontal'|'vertical'|'inline'
      },
      { name: "供电",formType:'AttachTable',field:"attach1",
        gridOptions:
        {
          border: true,
          showOverflow: true,
          editConfig: {
            trigger: 'click',
            mode: 'row'
          },
          showHeader:false,
          columns: [
            { type: 'seq', width: 70 },
            { field: 'col1', title: '分类1',width:"100"},
            { field: 'col2', title: '分类2',width:"200"},
            { field: 'col3', title: '填报', slots: { default: 'form_default' },},
          ],
          datas: [
            
            { col1: '供电线路', col2:"变配电室有双路市电接入",col3:{ formType:'yesno',field: "COL64"},},
            { col1: '供电线路', col2:"双路市电由不同变电所接入",col3:{ formType:'yesno',field: "COL66"},},
            { col1: 'UPS',col2:"UPS供电模式",
              col3:{ formType:'radio-group',field: "COL68",options:["N+1","N+2","2N","2(N+1)","存在单点","其他"]},
            },
            { col1: 'UPS',col2:"系统设计容量(KVA)",col3:{ formType:'input',field: "COL71"},},
            { col1: 'UPS',col2:"实际负载峰值(KVA)",col3:{ formType:'input',field: "COL73"},},
            { col1: 'UPS',col2:"满载电池可用时间 ",col3:{ formType:'input',field: "COL75"},},
            { col1: 'UPS',col2:"UPS主机已使用年份 ",col3:{ formType:'input',field: "COL77"},},
            { col1: 'UPS',col2:"UPS电池已使用年份",col3:{ formType:'input',field: "COL79"},},
            
            { col1: '发电机', col2:"是否配备",col3:{ formType:'input',field: "COL81"},},
            { col1: '发电机', col2:"额定功率",col3:{ formType:'input',field: "COL83"},},
            { col1: '发电机', col2:"是否满足机房应急供电需要",col3:{ formType:'input',field: "COL85"},},
            { col1: '发电机', col2:"自动启动",col3:{ formType:'input',field: "COL87"},},
            { col1: '发电机', col2:"启动时间",col3:{ formType:'input',field: "COL89"},},
            { col1: '发电机', col2:"本地油料储备可用时间",col3:{ formType:'input',field: "COL91"},},
            { col1: '发电机', col2:"运维单位",col3:{ formType:'input',field: "COL93"},},
            { col1: '发电机', col2:"运维单位名称",col3:{ formType:'input',field: "COL94"},},
            { col1: '发电机', col2:"是否租用",col3:{ formType:'input',field: "COL96"},},

            { col1: '能效', col2:"电能利用效率",col3:{ formType:'input',field: "C20A012"},},
            { col1: '能效', col2:"能效认证",col3:{ formType:'input',field: "C20A014"},},
          ],
          mergeCells: [
            { row: 0, col: 1, rowspan: 2, colspan: 1 },
            { row: 2, col: 1, rowspan: 6, colspan: 1 },
            { row: 8, col: 1, rowspan: 8, colspan: 1 },
            { row: 16, col: 1, rowspan: 2, colspan: 1 },
          ],
        }

      },

      { name: "门禁与监控",formType:'AttachTable',field:"attach2",
        gridOptions:
        {
          border: true,
          showOverflow: true,
          showHeader:false,
          editConfig: {
            trigger: 'click',
            mode: 'row'
          },
          columns: [
            { type: 'seq', width: 70 },
            { field: 'col1', title: '分类1',width:"100"},
            { field: 'col2', title: '分类2',width:"200"},
            { field: 'col3', title: '填报', slots: { default: 'form_default' },},
          ],
          datas: [
            { col1: '门禁', col2:"控制方式",col3:{
              field: "COL99",formType:"checkbox-group",options:[
                "IC卡","密码锁","指纹","虹膜","掌纹","面部特征识别","其他"
              ],
            }},
            { col1: '门禁', col2:"门禁记录保存时间",col3:{
              field: "COL102", formType:'radio-group', options:[
                "定期保存","永久保存"
              ],

            }},

            { col1: '环境监控', col2:"已建立并定期更新资产台账",col3:{
              field: "C24A005", formType:'yesno',
            }},
           
            { col1: '环境监控', col2:"覆盖范围",col3:{
              field: "COL105", formType:'checkbox-group', options:[
                 "温度","湿度","防水","防磁","防雷","防鼠","消防","安防","空调","UPS","发电机配电","机房门禁","逃生通道"
              ]
            }},
            
            { col1: '环境监控', col2:"视频监控记录保存时间",col3:{
              formType:'number',field: "COL108",
            }},
            { col1: '环境监控', col2:"报警方式",col3:{
              field: "COL110", formType:'checkbox-group', options:[
                "语音","短信","声光","其他"
             ]
            }},
          ],
          mergeCells: [
            { row: 0, col: 1, rowspan: 2, colspan: 1 },
            { row: 2, col: 1, rowspan: 6, colspan: 1 },
            { row: 8, col: 1, rowspan: 8, colspan: 1 },
            { row: 16, col: 1, rowspan: 2, colspan: 1 },
          ],
        }

      },

      { name: "电磁屏蔽  ",formType:'combinaform',childs:[
        {label:'是否全屏蔽 ',formType:"radio",field:"COL113",options:[
          {label:'是',value:"是"},  
          {label:'否',value:"否"},
        ]}
      ]},

      { name: "防雷设施  ",formType:'combinaform',childs:[
        {label:'是否具备 ',formType:"radio",field:"COL115",options:[
          {label:'是',value:"是"},  
          {label:'否',value:"否"},
        ]}
      ]},


      { name: "防水  ",formType:'combinaform',childs:[
        {label:'是否具备 ',formType:"radio",field:"COL117",options:[
          {label:'是',value:"是"},  
          {label:'否',value:"否"},
        ]}
      ]},

      { name: "防鼠  ",formType:'combinaform',childs:[
        {label:'是否具备 ',formType:"radio",field:"COL119",options:[
           {label:'是',value:"是"},  
           {label:'否',value:"否"},
        ]}
      ]},

      { name: "空调",formType:'combinaform',childs:
        [
          {label:'冗余情况',formType:"radio",field:"COL121",
            options:[
              {label:'A类',value:'A类'}, 
              {label:'B类',value:'B类'}, 
              {label:'C类',value:'C类'}, 
              {label:'其他',value:'其他'}, 
            ],
            otherOption:true,
            otherField:"COL122",
            otherLabel:""
          },
          {label:'设计单位面积制冷量',formType:"number",field:"COL124",unit:"瓦/平方米"}, 
          {label:'冷却方式',formType:"checkbox",field:"COL126",options:[
            {label:'风冷',value:'风冷'}, 
            {label:'水冷',value:'水冷'},
          ]},   
          {label:'空调已使用年份',formType:"number",field:"C20A016",unit:"年"},  
          
          
        ] ,layout:"horizontal"  //'horizontal'|'vertical'|'inline'
      },
      { name: "消防",formType:'combinaform',childs:
        [
          {label:'灭火方式',formType:"input",field:"COL128",},
          {label:'灭火剂类型',formType:"input",field:"COL130",unit:"个"}, 
          {label:'本年度是否由专业机构或部门对消防设备进行检测 ',formType:"radio",field:"COL132",options:
            [
              {label:'是',value:"是"},
              {label:'否',value:"否"},
            ],
          },  
          {label:'检测时间',formType:"date",field:"COL133",},
        ] ,layout:"horizontal"  //'horizontal'|'vertical'|'inline'
      },

  
      { name: "巡检",formType:'combinaform',childs:[
        {label:'巡检频度',formType:"number",field:"COL135",unit:"次/每天"},
        {label:'巡检频度备注',formType:"input",field:"COL136",unit:"次/每天"}
      ]},

     
      { name: "所承担的灾备职能（仅在中心类型为灾备中心或灾备机房时填写）",formType:'table',field:"TB20201",
        gridOptions:
        {
          border: true,
          showOverflow: true,
          editConfig: {
            trigger: 'click',
            mode: 'row'
          },
          toolbarConfig: {
            buttons: [
              { name: '新增', code: 'add', mode:'text',status: 'primary',size:"mini",field:"TB20201"},
              { name: '删除', code: 'delete', mode:'text',status: 'primary',size:"mini",field:"TB20201"},
  
            ]
          },
          columns: [
            { type: 'checkbox', width: 70 },
            { field: 'COL138', title: '所备份的生产中心名称',editRender: {
              name: 'input',
            }
            },
            { field: 'COL139', title: '区域', editRender: { 
              name: 'VxeSelect',
              options:[
                {label:'同城',value:"同城"},
                {label:'异地',value:"异地"},
              ]
            } },
            { field: 'COL140', title: '与生产中心距离（公里）', editRender: { 
                name: 'input',
                attrs: {
                  type: 'number', 
                  min: 0, 
                  step: 10,
                  placeholder: '请输入整数'
                }
            } }
          ],
          data: [
            { },
          ]
        },
      },

    ],

    datas:[{}],
  },
 
];