/*
 *    Copyright (c) 2018-2025, cyweb All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 */

import {getDetailsByName} from "@/api/asset/assetdept/assetdept";
import global from "@/components/tools/commondict";

const STATUS=[
  {label:'待审核',value:'0'},
  {label:'通过',value:'100'},
  {label:'驳回',value:'-100'}
]

const ERROR_STATUS=[
  {label:"是",value:"1"},
  {label:"否",value:"0"}
]

var validaterChinese = (rule, value, callback) => {
  var reg = new RegExp("[\\u4E00-\\u9FFF]+$","g");
  if(!reg.test(value)){
    callback(new Error('开户行信息必须全为中文字符'));
  } else {
    callback();
  }
};

var validatePhone=(rule,value,callback)=>{
  var reg = new RegExp("^\\d{11}$", "g");
  if(!reg.test(value)){
    callback(new Error('请填写11位的手机号码'));
  } else {
    callback();
  }
}

export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  editBtn: false,
  delBtn: false,
  addBtn: false,
  dialogHeight:600,
  column: [
	  {
      label: '姓名',
      prop: 'realName',
      addDisabled: true,
      search:true,
      rules: [{
        required: true,
        message: '请填写姓名',
        trigger: 'blur'
      }]
    },
	  {
      label: '性别',
      prop: 'sex',
      props:{
        label:'label',
        value:'value'
      },
      type:"radio",
      dicUrl:'/admin/dict/item/type/sexy',
      addDisabled: true,
      editDisabled: true,
      rules: [{
        required: true,
        message: '请选择性别',
        trigger: 'blur'
      }]
    },
	  {
      label: '出生年月',
      prop: 'birthDate',
      type:'date',
      format:'yyyy-MM-dd',
      valueFormat:'yyyy-MM-dd HH:mm:ss',
      addDisabled: true,
      editDisabled: true,
      rules: [{
        required: true,
        message: '请填写出生年月',
        trigger: 'blur'
      }]
    },
	  {
      label: '住址',
      prop: 'nativePlace',
      addDisabled: true,
      editDisabled: true,
    },
    {
      label: '民族',
      prop: 'nation',
      addDisabled: true,
      editDisabled: true,
    },
    {
      label: '电话',
      prop: 'phone',
      search:true,
      rules: [{
        required: true,
        message: '请填写电话',
        trigger: 'blur'
      },
      {validator: validatePhone, trigger: 'blur'}
      ]
    },
	  // {
    //   label: '银行卡类别',
    //   prop: 'bankCardType'
    // },
	  {
      label: '银行卡号',
      prop: 'bankCardNo',
      rules: [{
        required: true,
        message: '请填写银行卡号',
        trigger: 'blur'
      }]
    },
    {
      label: '开户行',
      prop: 'bankCardOpen',
      placeholder:'请输入全中文开户行信息',
      rules: [{
        required: true,
        message: '请输入全中文开户行信息',
        trigger: 'blur'
      },
      {validator: validaterChinese, trigger: 'blur'}
      ]
    },
	  {
      label: '身份证',
      prop: 'idCard',
      search:true,
      disabled:true,
       rules: [{
         required: true,
         message: '请填写身份证号',
         trigger: 'blur'
       }]
    },
    {
      label: '职称',
      prop: 'qualifications'
    },
    {
      label: '职称证明',
      prop: 'qualificationsPic',
      formslot:true,
      slot:true
    },
    {
      label: '银行卡(正)',
      prop: 'bankCardPic',
      formslot:true,
      slot:true,
      hide:true,
      rules: [{
        required: true,
        message: '请上传银行卡正面',
        trigger: 'blur'
      }]
    },
	  {
      label: '身份证(人像)',
      prop: 'cardPicFront',
      formslot:true,
      slot:true,
      editDisplay:false,
      rules: [{
        required: true,
        message: '请上传正面身份证',
        trigger: 'blur'
      }]

    },
	  {
      label: '身份证(国徽)',
      prop: 'cardPicBack',
      formslot:true,
      editDisplay:false,
      slot:true,
      rules: [{
        required: true,
        message: '请上传反面身份证',
        trigger: 'blur'
      }]
    },
	  // {
    //   label: '创建时间',
    //   prop: 'createTime',
    //   addDisplay:false,
    //   editDisabled:true
    // },
    {
      label: '创建人',
      prop: 'createName',
    },
    {
      label: '备注',
      prop: 'remark',
      type:'textarea'
    },
    {
      label: '是否异常',
      prop: 'errorStatus',
      slot:true,
      search:true,
      type:'select',
      dicData:ERROR_STATUS,
      props:{
        label:'label',
        value:'value'
      }
    },
    // {
    //   label: '状态',
    //   prop: 'status',
    //   type:'select',
    //   search:true,
    //   dicData:STATUS,
    //   props:{
    //     label:'label',
    //     value:'value'
    //   },
    //   display:false
    // },
  ]
}


export const financeAdminTalbeOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  editBtn: false,
  delBtn: false,
  addBtn: false,
  dialogHeight:600,
  column: [
    {
      label: '姓名',
      prop: 'realName',
      search:true,
      rules: [{
        required: true,
        message: '请填写姓名',
        trigger: 'blur'
      }]
    },
    {
      label: '性别',
      prop: 'sex',
      props:{
        label:'label',
        value:'value'
      },
      type:"radio",
      dicUrl:'/admin/dict/item/type/sexy',
      display:false,
    },
    {
      label: '出生年月',
      prop: 'birthDate',
      type:'date',
      format:'yyyy-MM-dd',
      valueFormat:'yyyy-MM-dd HH:mm:ss',
      display:false,
    },
    {
      label: '住址',
      prop: 'nativePlace',
    },
    {
      label: '民族',
      prop: 'nation'
    },
    {
      label: '电话',
      prop: 'phone',
      search:true,
      rules: [{
        required: true,
        message: '请填写电话',
        trigger: 'blur'
      },
        {validator: validatePhone, trigger: 'blur'}
      ]
    },
    // {
    //   label: '银行卡类别',
    //   prop: 'bankCardType'
    // },
    {
      label: '银行卡号',
      prop: 'bankCardNo',
      rules: [{
        required: true,
        message: '请填写银行卡号',
        trigger: 'blur'
      }]
    },
    {
      label: '开户行',
      prop: 'bankCardOpen',
      placeholder:'请输入全中文开户行信息',
      rules: [{
        required: true,
        message: '请输入全中文开户行信息',
        trigger: 'blur'
      },
        {validator: validaterChinese, trigger: 'blur'}
      ]
    },
    {
      label: '身份证',
      prop: 'idCard',
      search:true,
      rules: [{
        required: true,
        message: '请填写身份证号',
        trigger: 'blur'
      }]
    },
    {
      label: '职称',
      prop: 'qualifications'
    },
    {
      label: '职称证明',
      prop: 'qualificationsPic',
      formslot:true,
      slot:true
    },
    {
      label: '银行卡(正)',
      prop: 'bankCardPic',
      formslot:true,
      slot:true,
      hide:true
    },
    {
      label: '身份证(人像)',
      prop: 'cardPicFront',
      formslot:true,
      slot:true

    },
    {
      label: '身份证(国徽)',
      prop: 'cardPicBack',
      formslot:true,
      slot:true,
    },
    {
      label: '创建时间',
      prop: 'createTime',
      addDisplay:false,
      editDisabled:true
    },
    {
      label: '备注',
      prop: 'remark',
      type:'textarea'
    },
    {
      label: '创建人',
      prop: 'createName',
    },
    {
      label: '是否异常',
      prop: 'errorStatus',
      slot:true,
      search:true,
      type:'select',
      dicData:ERROR_STATUS,
      props:{
        label:'label',
        value:'value'
      }
    },
    // {
    //   label: '状态',
    //   prop: 'status',
    //   type:'select',
    //   search:true,
    //   dicData:STATUS,
    //   props:{
    //     label:'label',
    //     value:'value'
    //   },
    //   display:false
    // },
  ]
}

