import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { DescItem } from '#/components/description';
import { DictEnum } from '@vben/constants';

import { Tag } from 'ant-design-vue';

import { getDictOptions } from '#/utils/dict';

export const querySchema: FormSchemaGetter = () => [
  // {
  //   component: 'Select',
  //   componentProps: {
  //   },
  //   fieldName: 'salaryType',
  //   label: '工资类型',
  // },
  {
    component: 'Input',
    fieldName: 'deptName',
    label: '部门名称',
  },
  {
    component: 'Input',
    fieldName: 'policeName',
    label: '人员姓名',
  },
  {
    fieldName: 'salaryYearMonth',
    label: '工资月份',
    component: 'DatePicker',
    componentProps : {
      picker: 'month',
      valueFormat: 'YYYY-MM',
    }
  }
];

export const searchSchema: FormSchemaGetter = () => [

  {
    fieldName: 'salaryYearMonth',
    label: '工资月份',
    component: 'DatePicker',
    componentProps : {
      picker: 'month',
      valueFormat: 'YYYY-MM',
    }
  }
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },

  {
    title: '工资类型',
    field: 'salaryType',
    width: 80
  },
  {
    title: '人员姓名',
    field: 'policeName',
    width: 80
  },
  {
    title: '身份证号',
    field: 'idcard',
    width: 180
  },
  {
    title: '银行卡号',
    field: 'bankCard',
    width: 200
  },
  // {
  //   title: '部门ID',
  //   field: 'deptId',
  // },
  {
    title: '部门名称',
    field: 'deptName',
    width: 140
  },
  {
    title: '工资月份',
    field: 'salaryYearMonth',
    width: 80
  },
  // {
  //   title: '年份',
  //   field: 'salaryYear',
  // },
  // {
  //   title: '月份',
  //   field: 'salaryMonth',
  // },
  {
    title: '职务（技术等级）工资',
    field: 'postSalary',
    width: 120,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '级别（比例）工资',
    field: 'gradeSalary',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '生活性补贴',
    field: 'livingSubsidy',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '工作性津贴',
    field: 'workAllowance',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '基础绩效奖',
    field: 'basicPerformance',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '警衔津贴',
    field: 'policeRankAllowance',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '执勤津贴',
    field: 'dutyAllowance',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '加班补贴',
    field: 'overtimePay',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '乡镇工作津贴',
    field: 'townshipWorkAllowance',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '扣个人所得税',
    field: 'individualIncomeTax',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '扣医疗保险金',
    field: 'medicalInsuranceFund',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '扣住房公积金',
    field: 'housingFund',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '扣基本养老金',
    field: 'basicPension',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '扣职业年金',
    field: 'occupationalPension',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '其他代扣',
    field: 'otherDeduction',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '扣款小计',
    field: 'totalDeduction',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '增发',
    field: 'increasePay',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '减发',
    field: 'reducePay',
    width: 80,
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '应发',
    field: 'totalPay',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '实发',
    field: 'actualSalary',
    width: 80,
    cellRender: { name: 'CellAmount' }
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];
export const searchColumns: VxeGridProps['columns'] = [

  {
    title: '工资类型',
    field: 'salaryType',
  },
  // {
  //   title: '人员姓名',
  //   field: 'policeName',
  //   width: 80
  // },
  // {
  //   title: '身份证号',
  //   field: 'idcard',
  //   width: 160
  // },
  // {
  //   title: '银行卡号',
  //   field: 'bankCard',
  //   width: 180
  // },
  // {
  //   title: '部门ID',
  //   field: 'deptId',
  // },
  // {
  //   title: '部门名称',
  //   field: 'deptName',
  // },
  {
    title: '工资月份',
    field: 'salaryYearMonth',
  },
  // {
  //   title: '年份',
  //   field: 'salaryYear',
  // },
  // {
  //   title: '月份',
  //   field: 'salaryMonth',
  // },
  // {
  //   title: '职务（技术等级）工资',
  //   field: 'postSalary',
  //   width: 120,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '级别（比例）工资',
  //   field: 'gradeSalary',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '生活性补贴',
  //   field: 'livingSubsidy',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '工作性津贴',
  //   field: 'workAllowance',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '基础绩效奖',
  //   field: 'basicPerformance',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '警衔津贴',
  //   field: 'policeRankAllowance',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '执勤津贴',
  //   field: 'dutyAllowance',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '加班补贴',
  //   field: 'overtimePay',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '乡镇工作津贴',
  //   field: 'townshipWorkAllowance',
  //   width: 80,
  //   cellRender: { name: 'CellAmount' }
  // },
  // {
  //   title: '扣个人所得税',
  //   field: 'individualIncomeTax',
  //   width: 80,
  //   cellRender: { name: 'CellMinusAmount' }
  // },
  // {
  //   title: '扣医疗保险金',
  //   field: 'medicalInsuranceFund',
  //   width: 80,
  //   cellRender: { name: 'CellMinusAmount' }
  // },
  // {
  //   title: '扣住房公积金',
  //   field: 'housingFund',
  //   width: 80,
  //   cellRender: { name: 'CellMinusAmount' }
  // },
  // {
  //   title: '扣基本养老金',
  //   field: 'basicPension',
  //   width: 80,
  //   cellRender: { name: 'CellMinusAmount' }
  // },
  // {
  //   title: '扣职业年金',
  //   field: 'occupationalPension',
  //   width: 80,
  //   cellRender: { name: 'CellMinusAmount' }
  // },
  // {
  //   title: '其他代扣',
  //   field: 'otherDeduction',
  //   width: 80,
  //   cellRender: { name: 'CellMinusAmount' }
  // },
  // {
  //   title: '扣款小计',
  //   field: 'totalDeduction',
  //   width: 80,
  //   cellRender: { name: 'CellMinusAmount' }
  // },
  {
    title: '增发',
    field: 'increasePay',
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '减发',
    field: 'reducePay',
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '应发',
    field: 'totalPay',
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '实发',
    field: 'actualSalary',
    cellRender: { name: 'CellAmount' }
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 80,
  },
];

export const drawerSchema: FormSchemaGetter = () => [
  {
    label: 'ID',
    fieldName: 'id',
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    label: '部门名称',
    fieldName: 'deptName',
    component: 'Input',
    componentProps:{
      readonly: true,
	  bordered: false
    }
  },
  {
    label: '人员姓名',
    fieldName: 'policeName',
    component: 'Input',
    componentProps:{
      readonly: true,
	  bordered: false
    }
  },
  {
    label: '工资类型',
    fieldName: 'salaryType',
    component: 'Input',
    componentProps: {
    },
  },
  {
    label: '工资月份',
    fieldName: 'salaryYearMonth',
    component: 'DatePicker',
    componentProps : {
      picker: 'month',
      valueFormat: 'YYYY-MM',
    }
  },
  {
    label: '身份证号',
    fieldName: 'idcard',
    component: 'Input',
    componentProps:{
      readonly: true,
	  bordered: false
    }
  },
  {
    label: '银行卡号',
    fieldName: 'bankCard',
    component: 'Input',
  },
  // {
  //   label: '部门ID',
  //   fieldName: 'deptId',
  //   component: 'Input',
  // },
  // {
  //   label: '年份',
  //   fieldName: 'salaryYear',
  //   component: 'Input',
  // },
  // {
  //   label: '月份',
  //   fieldName: 'salaryMonth',
  //   component: 'Input',
  // },
  {
    label: '职务工资',
    fieldName: 'postSalary',
    component: 'Input',
  },
  {
    label: '级别工资',
    fieldName: 'gradeSalary',
    component: 'Input',
  },
  {
    label: '生活性补贴',
    fieldName: 'livingSubsidy',
    component: 'Input',
  },
  {
    label: '工作性津贴',
    fieldName: 'workAllowance',
    component: 'Input',
  },
  {
    label: '基础绩效奖',
    fieldName: 'basicPerformance',
    component: 'Input',
  },
  {
    label: '警衔津贴',
    fieldName: 'policeRankAllowance',
    component: 'Input',
  },
  {
    label: '执勤津贴',
    fieldName: 'dutyAllowance',
    component: 'Input',
  },
  {
    label: '加班补贴',
    fieldName: 'overtimePay',
    component: 'Input',
  },
  {
    label: '乡镇工作津贴',
    fieldName: 'townshipWorkAllowance',
    component: 'Input',
  },
  {
    label: '扣个人所得税',
    fieldName: 'individualIncomeTax',
    component: 'Input',
  },
  {
    label: '扣医疗保险金',
    fieldName: 'medicalInsuranceFund',
    component: 'Input',
  },
  {
    label: '扣住房公积金',
    fieldName: 'housingFund',
    component: 'Input',
  },
  {
    label: '扣基本养老金',
    fieldName: 'basicPension',
    component: 'Input',
  },
  {
    label: '扣职业年金',
    fieldName: 'occupationalPension',
    component: 'Input',
  },
  {
    label: '其他代扣',
    fieldName: 'otherDeduction',
    component: 'Input',
  },
  {
    label: '扣款小计',
    fieldName: 'totalDeduction',
    component: 'Input',
  },
  {
    label: '增发',
    fieldName: 'increasePay',
    component: 'Input',
  },
  {
    label: '减发',
    fieldName: 'reducePay',
    component: 'Input',
  },
  {
    label: '应发',
    fieldName: 'totalPay',
    component: 'Input',
  },
  {
    label: '实发',
    fieldName: 'actualSalary',
    component: 'Input',
  },
  {
    label: '备注',
    fieldName: 'remark',
    component: 'Textarea',
  },
  // {
  //   label: '创建用户ID',
  //   fieldName: 'createUserId',
  //   component: 'Input',
  // },
];


export const descSchema: DescItem[] = [
  {
    label: '部门名称',
    field: 'deptName',
  },
  {
    label: '人员姓名',
    field: 'policeName',
  },
  {
    label: '工资类型',
    field: 'salaryType',
  },
  {
    label: '工资月份',
    field: 'salaryYearMonth',
  },
  {
    label: '身份证号',
    field: 'idcard',
  },
  {
    label: '银行卡号',
    field: 'bankCard',
  },
  // {
  //   label: '部门ID',
  //   field: 'deptId',
  // },
  // {
  //   label: '年份',
  //   field: 'salaryYear',
  // },
  // {
  //   label: '月份',
  //   field: 'salaryMonth',
  // },
  {
    label: '职务工资',
    field: 'postSalary',
  },
  {
    label: '级别工资',
    field: 'gradeSalary',
  },
  {
    label: '生活性补贴',
    field: 'livingSubsidy',
  },
  {
    label: '工作性津贴',
    field: 'workAllowance',
  },
  {
    label: '基础绩效奖',
    field: 'basicPerformance',
  },
  {
    label: '警衔津贴',
    field: 'policeRankAllowance',
  },
  {
    label: '执勤津贴',
    field: 'dutyAllowance',
  },
  {
    label: '加班补贴',
    field: 'overtimePay',
  },
  {
    label: '乡镇工作津贴',
    field: 'townshipWorkAllowance',
  },
  {
    label: '扣个人所得税',
    field: 'individualIncomeTax',
  },
  {
    label: '扣医疗保险金',
    field: 'medicalInsuranceFund',
  },
  {
    label: '扣住房公积金',
    field: 'housingFund',
  },
  {
    label: '扣基本养老金',
    field: 'basicPension',
  },
  {
    label: '扣职业年金',
    field: 'occupationalPension',
  },
  {
    label: '其他代扣',
    field: 'otherDeduction',
  },
  {
    label: '扣款小计',
    field: 'totalDeduction',
  },
  {
    label: '增发',
    field: 'increasePay',
  },
  {
    label: '减发',
    field: 'reducePay',
  },
  {
    label: '应发',
    field: 'totalPay',
  },
  {
    label: '实发',
    field: 'actualSalary',
  },
  {
    label: '备注',
    field: 'remark',
  },
];
